Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up'solaris' runtime stack guard conflicts with OS stack-clash mitigation #52577
Comments
This comment has been minimized.
This comment has been minimized.
|
Please submit a PR with the patch. |
nagisa
added
the
O-solaris
label
Jul 21, 2018
This comment has been minimized.
This comment has been minimized.
|
The most important question here probably concerns the backwards compatibility. "Just" disabling the code path for Seems to me that "fixing" this in illumos would be better if we care about back-compat. |
This comment has been minimized.
This comment has been minimized.
I planned to wait until consensus was reached about the right path forward before submitting a PR with anything.
The same can be said about older deployments of Linux which lack the enhanced stack-clash protections. Is it inappropriate to rely on its simpler OS-provided guard page on systems without stack-clash protection? The mapping of
Considering that there are over 9 months of illumos platforms in the wild on which rust's latest bits will abort, "fixing" illumos does not seem so attractive. How would it differ from Linux's change to its own stack handling? |
This comment has been minimized.
This comment has been minimized.
|
Is it true that this bug has only begun with 1.27 (I’ve only noticed this point now)? Given that the only changes present in 1.27 in that file are from #48575 perhaps reverting that PR would fix the issue altogether? The only other approach I’m comfortable with is ignoring the errors from syscalls on solaris, which will hide the actual bugs if they ever happen, but at least both new and old solarises will be properly supported. |
nagisa
added
regression-from-stable-to-stable
T-libs
labels
Jul 25, 2018
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@nagisa I think stack guard is always enabled so it has nothing to do with my PR? |
This comment has been minimized.
This comment has been minimized.
seems to imply that 1.24 was working but 1.27 is not, everything else being the same? @pfmooney is that right? Is the "2018Q2 update" something resembling an update between, say, Ubuntu releases? If so, can you please check versions 1.26 to 1.24 with other parts of your system being the same? |
This comment has been minimized.
This comment has been minimized.
My argument for #43072 was that this is fine. Rust was only adding a simple single-page guard, so if the OS already has this, we're not protecting it any better. Then with the additional protections for Stack Clash, Rust's guard page made things actually worse. Do the older illumos systems still have some basic protection for overflow? If so, then I think you can use the same logic I did. Trust that the older OS guard is at least as good as our own, and that the newer OS will do even better with Stack Clash. So perhaps
If you look at the backtrace, this error is happening from the |
This comment has been minimized.
This comment has been minimized.
Correct. The rustc 1.24.1 shipped in 2018Q1 works fine on a system bearing the stack-clash protections. In pre-release testing of 1.27.0 for 2018Q2, it was found to abort due to the added guard. (In order to make it useful, 2018Q2 bears the included patch)
SmartOS ships images based on branches/snapshots of pkgsrc. The OS platform image, consisting of the kernel and system libraries, is independent of these images and can vary from machine to machine. My test environment, for example, happens to be running a
I only have the 1.24.0 binaries presently at hand, but I can look into building a few of the intermediary versions.
On older platforms, the deterministic layout of the address space results in an unoccupied page between the upper limit of the stack and the last mapping of
Yep, that sounds ideal to me. |
nagisa
referenced this issue
Jul 28, 2018
Closed
rustc fails to raise rlimits for stacksize on mac for doctest runs through make #52801
This comment has been minimized.
This comment has been minimized.
|
Binaries from 1.26.2 appear to work fine on a system with the stack-clash protection. |
This comment has been minimized.
This comment has been minimized.
|
discussed at T-compiler meeting. Assigning to self to take point on this. Not 100% sure whether we will treat this as P-medium (which is my current inclination) or P-high, so I'm leaving the P- label unset for now until I can investigate further |
pnkfelix
self-assigned this
Nov 29, 2018
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
By the way @pfmooney are there any instances of illumos getting their own target triplet? |
This comment has been minimized.
This comment has been minimized.
|
I've heard nothing besides what you wrote up in #55553. |
This comment has been minimized.
This comment has been minimized.
jasonbking
commented
Feb 7, 2019
|
Just to follow up on this, we're in the process of creating and testing a new illumos OS target for rust. The current proposed plan is that the illumos target will disable rust stack probes in its spec file. Newer versions of the rust toolchain in pkgsrc will be updated to use this new target as the default (instead of x86_64-sun-solaris). This should I believe fix the problem, while allowing anyone using rust on actual Solaris platforms to benefit from the rust stack guards while allowing illumos platforms to use the built-in stack-clash mitigation. Once ready, we would also like to contribute back the code for the new target (essentially the spec files + a small amount of updates other crates to make them aware of the illumos target as necessary, plus a few bits fo code to fill in a few gaps). |
pfmooney commentedJul 20, 2018
•
edited
We have found the stack guard logic present in rust 1.27 conflicts with the OS-provided mitigation present in illumos distributions. This became clear on SmartOS when the 2018Q2 pkgsrc update moved from rust 1.24 to 1.27. Those binaries, compiled on an old platform without the mitigation, bail immediately on machines that do possess it
The details of how the two guards are conflicting can be found written up in OS-7059. The stack-clash mitigation was added to SmartOS and OmniOS back in October 2017. It was merged into illumos-gate this past week, marking its availability for any remaining downstream distributions.
Our temporary mitigation has been to float a patch in pkgsrc to treat the 'solaris' platform like 'linux', disabling the stack-guard mapping:
Considering the rest of the illumos ecosystem is (or soon will be) effected by this issue, it would be nice to get that stack-guard exclusion moved into upstream rust.