-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
CI segfaults on FreeBSD #1489
Comments
I'm mostly unavailable until Monday/Tuesday. |
I have a # Cargo.toml
[package]
name = "test_failure"
version = "0.1.0"
authors = ["The Rust Project Developers"]
license = "MIT OR Apache-2.0"
[build-dependencies]
autocfg = "0.1" and extern crate autocfg;
fn main() {
println!("cargo:rerun-if-changed=build.rs");
let ac = autocfg::new();
ac.emit_rustc_version(1, 26);
} This fails on FreeBSD12, but not on FreeBSD11. A backtrace of the segfault would be nice. |
I'll take a look. |
Something is calling fstatat, and it's calling the FreeBSD 12 version but probably expecting the FreeBSD 11 structure definitions. It screws up the stack so the core file's stack trace is useless, but I think this is the culprit:
Why isn't libc using the right link_name? |
Can you submit a PR fixing that ? |
I'm still trying to figure out what's going on. I verified that the 8-22 nightly compiler works and the 8-23 nightly doesn't, but I don't see any obviously relevant changes in that date range. rust-lang/rust's liblibc does use the correct link_name. The problem is something more subtle. I'll keep investigating . |
The only thing in rust-lang/rust@7602267...9eae1fc that looks relevant is the libc upgrade, The new |
Since Lines 632 to 638 in 9af04ce
So forcing I think the reason this hit |
Isn't the C library dynamically linked here ? As in, shouldn't it pick the FreeBSD12 C library and try to find there the
So this is the bug. We should add a freebsd10 cfg macro until Rust CI is upgraded to FreeBSD 11, and only enable that when building as part of libstd. Cirrus-CI has a freebsd-10-4-release-amd64 image, we should add that to CI to reproduce this and test that no regressions are introduced. |
No, I don't think that's it. Very few symbols changed between FreeBSD 10 and 11, and fstatat was not among them. Could LIBC_CI be getting set somehow? |
I don't know how - searching rust-lang/rust for LIBC_CI doesn't reveal anything. I set up a freebsd10 build job here (#1491) and tried to use the different link names, but that doesn't appear to make a difference. |
I can reproduce the problem without using autocfg or build.rs. But I still don't know why Rust is using the wrong symbol version. Could it be building libc without using the build.rs at all? That would do it. use std::path::PathBuf;
#[test]
fn t() {
let pb = PathBuf::from(".");
println!("{:?}", std::fs::metadata(&pb).unwrap());
} |
First, what's the wrong symbol ? I suppose that the bug is that instead of picking the symbol that we use for If so, then #1491 should fix that. It detects FreeBSD10, and uses the same symbols as FreeBSD11. It's not a great fix, but might do. |
You can use |
A better fix would be to either migrate rust-lang/rust to FreeBSD11, or to downgrade libc to target FreeBSD10 by default. |
I don't think #1491 will fix the problem. IIUC, build.rs should be emitting |
@pietroalbini @cuviper is there a way to find the build logs for that particular nightly version ? There we should be able to see if |
If I didn't mess myself, libstd on nightly is currently build using libc 0.2.51. And this version of libc doesn't provide |
https://github.com/rust-lang/rust/blob/4c58535d09d1261d21569df0036b974811544256/Cargo.lock#L1585 |
Oh, but I did mistake the versions earlier... that nightly change here was really 0.2.60...0.2.61 -- sorry for that confusion! |
@gnzlbg there are no specific jobs for nightly builds. AFAIK most recent merge that completes before 00:00 UTC is promoted as nightly. |
@cuviper if libstd is using 0.2.61 then that might explain this. IIRC, the build.rs being used there had a bug for freebsd and wasn't passing |
E.g. see here: 0.2.60...0.2.61#diff-a7b0a2dee0126cddf994326e705a91eaR18 If the freebsd version is 10, like for Rust CI, then no |
Updating |
I tried to build rust from scratch. 5000 seconds later it crashed with the same bug. Updating libc to 0.2.62 didn't help. Now I'm trying to build using a local checkout of libc. But it's not working. When I try to patch libc to use a local path, I get errors like this. Can anybody more experienced with building rust help me:
Simply commenting out the offending lines produces other, different build errors. It's as if libc were getting built with the wrong options. But removing the |
Actually, updating to 0.2.62 does fix the problem. Earlier when I said that it didn't, it's because I didn't do a full build; I took a shortcut. |
Update libc to 0.2.62 Hopefully this will mitigate rust-lang/libc#1489 and rust-lang#64006
Test FreeBSD 12 on latest nightly ~~Let's see if [libc update](rust-lang/rust#63806) for Rust fixed it.~~ Fixes #1489
CI has started to segfault on FreeBSD since the latest nightly.
This build passed with nightly-x86_64-unknown-freebsd 1.39.0 (760226733 2019-08-22)
This build failed with nightly-x86_64-unknown-freebsd 1.39.0 (9eae1fc0e 2019-08-23)
The segfault is triggered by the build.rs of
rand_pcg v0.1.2
andrand_chacha v0.1.1
(cc @dhardy), which AFAICT only callautocfg
(cc @cuviper ). There was an update ofautocfg
recently so initially I thought that might be it, but it seems that the builds were working correctly with that update, so AFAICT neitherautocfg
norrand
are at fault here (cc @mati865 @asomers ). Looking at the recently merged PRs in rust-lang/rust, I don't see any suspicious one.The text was updated successfully, but these errors were encountered: