Skip to content

Commit 7e0d2fe

Browse files
committed
revisions
1 parent 7557bb8 commit 7e0d2fe

File tree

1 file changed

+40
-29
lines changed

1 file changed

+40
-29
lines changed

_posts/2018-03-01-Rust-1.24.1.md

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,28 @@ appropriate page on our website, and check out the [detailed release notes for
2323

2424
## What's in 1.24.1 stable
2525

26-
As you know, we tend not to release point releases. In this case, we had a few regressions in 1.24.0.
27-
Each of them individually was not a "hair on fire" moment, but there's two reasons we decided to
28-
produce a point release. First, collectively, they were big enough to consider as a whole. Second, we
29-
want our attitude towards regressions to be "if we're not sure, default to reverting." Given that
30-
it was not clear that we *shouldn't* release a point release, we decided to err on the side of
31-
caution.
26+
As you know, we tend not to release point releases. In this case, Several minor
27+
regressions were found in 1.24.0 which collectively merited a release.
3228

3329
A quick summary of the changes: there are four.
3430

35-
* Do not abort when unwinding through FFI
31+
* Do not abort when unwinding through FFI (this reverts behavior from 1.24.0)
3632
* Emit UTF-16 files for linker arguments on Windows
3733
* Make the error index generator work again
3834
* Cargo will warn on Windows 7 if an update is needed.
3935

40-
In general, if you haven't run into any build issues, the "do not abort when unwinding through FFI"
41-
change is the only one you should care about. The others are also important, but if 1.24.0 has been
42-
working well for you, this is the only change that affects you. We plan on bringing this behavior back
43-
in 1.25 or 1.26, depending on how smoothly the new strategy goes.
36+
If your code is continuing to build, then the only issue that may affect you is
37+
the unwinding issue. We plan on bringing this behavior back in 1.25 or 1.26,
38+
depending on how smoothly the new strategy goes.
4439

4540
With that, let's dig into the details!
4641

4742
### Do not abort when unwinding through FFI
4843

44+
TL;DR: the behavior in 1.24.0 broke the `rlua` crate, and is being reverted. If
45+
you have since changed your code to take advantage of the behavior in 1.24.0,
46+
you'll need to revert it for now.
47+
4948
Quoting [the 1.24 annoucement](https://blog.rust-lang.org/2018/02/15/Rust-1.24.html):
5049

5150
> There’s one other change we’d like to talk about here: undefined behavior.
@@ -65,9 +64,11 @@ extern "C" fn panic_in_ffi() {
6564
>
6665
> In Rust 1.24, this code will now abort instead of producing undefined behavior.
6766
68-
We have reverted this behavior, and 1.24.1 will reintroduce the undefined behavior.
69-
Fundamentally, this is a soundness fix, and we still plan on reintroducing the
70-
abort, but are going to be rolling it out a bit more slowly, and with a different
67+
As implemented, this functionality broke some users, notably, integration with
68+
the Lua language. We have reverted this behavior, and 1.24.1 will reintroduce
69+
the undefined behavior. Fundamentally, the aborting behavior we originally
70+
rolled out is a soundness fix, and we still plan on reintroducing it, but are
71+
going to be rolling it out a bit more slowly, and with a different
7172
implementation.
7273

7374
It started with [a bug filed against the `rlua`
@@ -81,9 +82,9 @@ language](https://www.lua.org/).
8182
> production Rust users, and so handling this was a very high priority for the
8283
> Rust team.
8384
84-
In short, `rlua` error handling just... broke. On Windows, and only on Windows,
85-
any attempt to handle errors from Lua would simply abort. This makes `rlua`
86-
unusable, as any error of any kind within Lua causes your program to die.
85+
On Windows, and only on Windows, any attempt to handle errors from Lua would
86+
simply abort. This makes `rlua` unusable, as any error of any kind within Lua
87+
causes your program to die.
8788

8889
After digging in, the culpurit was found: `setjmp`/`longjmp`. These functions
8990
are provided by the C standard library as a means of handling errors. You
@@ -121,7 +122,7 @@ When we talked about `setjmp`/`longjmp` inititally, a key phrase here wasn't
121122
highlighted. Here it is:
122123

123124
> After digging in, the culpurit was found: `setjmp`/`longjmp`. These functions
124-
> are *provided by the C standard library* as a means of handling errors. You
125+
> are *provided by the C standard library* as a means of handling errors.
125126
126127
These functions aren't part of the C language, but part of the standard
127128
library. That means that platform authors implement these functions, and
@@ -156,9 +157,10 @@ Consider the code above, and imagine that `lua_newtable` here could call
156157
3. The initial `lua_pcall` catches the `longjmp` with the `setjmp` it called earlier.
157158
4. Everyone is happy.
158159

159-
However, `lua_newtable` is an `extern fn` to Rust. So, with the chances in
160-
1.24.1, it sets up a panic handler that will cause an abort. In other words,
161-
the code sorta looks something like this psuedo code now:
160+
However, the implementation of `protect_lua_call` converts our closure to an
161+
`extern fn`, since that's what Lua needs. So, with the changes in 1.24.0, it
162+
sets up a panic handler that will cause an abort. In other words, the code
163+
sorta looks something like this pseudo code now:
162164

163165
```rust
164166
protect_lua_call(self.state, 0, 1, |state| {
@@ -179,14 +181,15 @@ everything works. However, on Windows, since both `setjmp`/`longjmp` and Rust
179181
panics use SEH, the `longjmp` gets "caught", and runs the new abort code!
180182

181183
The [solution here](https://github.com/rust-lang/rust/pull/48572) is to
182-
generate the abort handler, but in a way that `longjmp` won't trigger. Eventually,
183-
it's likely we'll have to register our own personality functions and such, but
184-
this is good enough for now. It's not 100% clear if this will make it into Rust 1.25;
185-
if the landing is smooth, we may backport, otherwise, this functionality will
186-
be back in 1.26.
184+
generate the abort handler, but in a way that `longjmp` won't trigger it. It's
185+
not 100% clear if this will make it into Rust 1.25; if the landing is smooth,
186+
we may backport, otherwise, this functionality will be back in 1.26.
187187

188188
### Emit UTF-16 files for linker arguments on Windows
189189

190+
TL;DR: `rustc` stopped working for some Windows users. If it's been working for you,
191+
you were not affected by this bug.
192+
190193
In constrast with the previous bug, which is very complex and tough to understand,
191194
this bug's impact is simple: if you have non-ASCII paths in the directory where
192195
you invoke `rustc`, in 1.24, it would incorrectly error with a message like
@@ -214,13 +217,20 @@ straightforward: produce a UTF-16 file with a BOM.
214217

215218
### Make the error index generator work again
216219

220+
TL;DR: building Rust 1.24.0 with Rust 1.24.0 broke in some circumstances.
221+
If you weren't building Rust yourself, you were not affected by this bug.
222+
217223
When packaging Rust for various Linux distros, it was found that [building
218224
1.24 with 1.24 fails](https://github.com/rust-lang/rust/issues/48308).
219225
This was caused by an incorrect path, causing certain metadata to not
220226
be generated properly.
221227

222228
### Cargo will warn on Windows 7 if an update is needed.
223229

230+
TL;DR: Cargo couldn't fetch the index from crates.io if you were using an older
231+
Windows without having applied security fixes. If you are using a newer
232+
Windows, or a patched Windows, you are not affected by this bug.
233+
224234
In February of 2017, [GitHub announced that they were dropping support for
225235
weak cryptographic
226236
standards](https://githubengineering.com/crypto-deprecation-notice/). One
@@ -248,9 +258,10 @@ that accessing GitHub would start to fail.
248258
`libgit2` [created a fix](https://github.com/libgit2/libgit2/pull/4550), using the `WinHTTP` API
249259
to request TLS 1.2. On master, we've [updated to fix this](https://github.com/rust-lang/cargo/pull/5091),
250260
but for 1.24.1 stable, we're [issuing a warning](https://github.com/rust-lang/cargo/pull/5069),
251-
suggesting that they upgrade their Windows version. There's a balance here: we could have backported
252-
the `libgit2` fixes, but that'd require updating a lot of code, which feels incorrect for a point
253-
release, especially since the issue does not affect patched systems.
261+
suggesting that they upgrade their Windows version. Although the `libgit2` fix
262+
could have been backported, we felt that the code change footprint was too
263+
large for the point release, especially since the issue does not affect patched
264+
systems.
254265

255266
## Contributors to 1.24.1
256267

0 commit comments

Comments
 (0)