-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SIGSEGV with beta/nightly compiler with i686-unknown-freebsd target #130677
Comments
I can try to bisect it to a specific nightly next week. If it's useful, you all are welcome to use our CI to debug this - you can open a PR to Tokio to run our CI setup. |
it calls various tokio macros, doesn't it?? also, it doesn't seem to call anything in std besides |
@Darksonn Is this our compiler or is it the one from FreeBSD ports? They modded the target. |
I have bisected the issue. It succeeds on nightly-2024-08-20 and fails on nightly-2024-08-21. @lolbinarycat The @workingjubilee I got the compiler from rustup, so I assume it's your compiler. Our ci script runs the following commands:
with |
Yep, that's our sigsegv, comrade! |
Minimized: fn main() {
std::fs::File::open("Cargo.toml").unwrap().metadata();
} (any file that exists will do) |
Bisection points to #129226 In particular: rust-lang/libc#3723 (comment)
So... is it wrong to use a FreeBSD 12 ABI on a FreeBSD 14 system? Because that's what we're apparently trying to do here. |
Hello @asomers there seems to be a bit of confusion afoot! |
I've reproduced the problem locally, and I'll take a look. |
I'm pretty sure that this is a bug in libc. While I work on a patch, could one of you toolchain experts please suggest to me how I might compile an arbitrary crate using a patched version of libc for std? |
It should be sufficient to use |
Sorry @workingjubilee but I need more help than that. I also need to know how to build, for example, Tokio using the patched std. |
uhh honestly I would just build the entire stage 1 compiler with the patched std and then build tokio with that. I can look up the incantation for using the stage 0 std with an existing nightly if that would take forever, though. |
Ah here we go, you want to do this:
then |
@workingjubilee that almost works. But I can't cross-compile from x86_64 to x86. Could you please tell what I must do to enable that? When I try, I get this:
|
@asomers you should be able to use |
@lolbinarycat I tried that, but the compiler thinks it's beta, not nightly, so it won't allow it. Is there a config.toml setting I can use to build it as a nightly compiler instead? |
you can |
The original definitions were never correct. But nobody noticed because we don't do CI on 32-bit FreeBSD. The problem is apparent now due to rust-lang#3723 , which caused the nightly toolchain to switch to a FreeBSD 12 ABI. Fixes rust-lang/rust#130677
It's a standard library bug. Work around it by using an older toolchain. rust-lang/rust#130677
Commit 7437d0a erroneously defined it as "ulong" instead of u64. Nobody noticed the mistake, probably because it was only tested on 64-bit architectures, where those are equivalent. But it's a problem now, after rust-lang#3723 , which switched the standard library to a FreeBSD 12 ABI. Issue rust-lang/rust#130677
The original definitions were never correct. But nobody noticed because we don't do CI on 32-bit FreeBSD. The problem is apparent now due to rust-lang#3723 , which caused the nightly toolchain to switch to a FreeBSD 12 ABI. Fixes rust-lang/rust#130677
The relevant fixes have been merged into libc. So this bug will be fixed if libc makes a new release and rustc incorporates it. |
libc has released. So if you update rust to use libc 0.2.160 or later this bug should be fixed. |
As this bug has landed in a stable release, it is now causing CI failures in Tokio's CI setup. Please advise on what we should do. Will this get backported to 1.82, or should we freeze our FreeBSD CI to use 1.81.0? |
@rust-lang/libs, relevant facts:
Footnotes
|
The PR is what needs the backport nomination label -- I've added beta there, but you can add stable too if you want to argue for that. I expect the stable disposition will probably be something like "accepted but does not warrant a point release on its own." |
In the libs meeting we discussed #131823 (comment) we accepted the beta backport but rejected the stable backport due to the large potential impact of a libc bump on other targets. |
Add i686-unknown-freebsd to CI. Run it using 32-bit emulation in a 64-bit environment, with the nightly compiler only. So as to avoid a repeat of rust-lang/rust#130677
Add i686-unknown-freebsd to CI. Run it using 32-bit emulation in a 64-bit environment, with the nightly compiler only. So as to avoid a repeat of rust-lang/rust#130677
Add i686-unknown-freebsd to CI. Run it using 32-bit emulation in a 64-bit environment, with the nightly compiler only. So as to avoid a repeat of rust-lang/rust#130677 (backport <rust-lang#3997>) (cherry picked from commit ce0a306)
When running the Tokio test suite through CI using the beta/nightly compiler, the FreeBSD 32-bit build encounters a segmentation fault. After running CI with a few different configurations, I've found two different cases of the failure. The first segfault is in the
compile_fail_full
test. Thepath_read_write
test also encounters a segfault.Please see tokio-rs/tokio#6856 for more output from the CI runs. Both failures happen in tests that interact with the file system. There are other tests that pass and don't touch the file system (e.g. all unit tests in
tokio/src/
pass). As Tokio has no special logic for using the file system and just calls std, and as thecompile_fail_full
test is not calling into any Tokio code at all, this looks an awful lot like a bug somewhere in std's filesystem handling code. But that is just a guess. I don't have access to a FreeBSD machine, so it is difficult for me to investigate further.The 64-bit FreeBSD build does not encounter these failures. There also are no problems when using the latest stable compiler. Note that the 32-bit binaries in question are cross-compiled from and executed on a 64-bit FreeBSD host machine.
Failing toolchains:
Passing toolchains:
The text was updated successfully, but these errors were encountered: