Skip to content

Commit 4bd13af

Browse files
committed
Auto merge of #1411 - acfoltzer:ucontext-compat, r=gnzlbg
Remove new field from ucontext_t for compatibility with earlier glibc versions Per discussion in #1410 with @gnzlbg, this is necessary to avoid struct size mismatches between Rust and C on systems with glibc < 2.28.
2 parents 4f4e81a + 339fe22 commit 4bd13af

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

libc-test/build.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,6 +2098,12 @@ fn test_linux(target: &str) {
20982098
// FIXME: musl version using by mips build jobs 1.0.15 is ancient:
20992099
"ifmap" | "ifreq" | "ifconf" if mips32_musl => true,
21002100

2101+
// FIXME: remove once Ubuntu 20.04 LTS is released, somewhere in 2020.
2102+
// ucontext_t added a new field as of glibc 2.28; our struct definition is
2103+
// conservative and omits the field, but that means the size doesn't match for newer
2104+
// glibcs (see https://github.com/rust-lang/libc/issues/1410)
2105+
"ucontext_t" if gnu => true,
2106+
21012107
_ => false,
21022108
}
21032109
});

src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,9 @@ s_no_extra_traits! {
285285
pub uc_mcontext: mcontext_t,
286286
pub uc_sigmask: ::sigset_t,
287287
__private: [u8; 512],
288-
__ssp: [::c_ulonglong; 4],
288+
// FIXME: the shadow stack field requires glibc >= 2.28.
289+
// Re-add once we drop compatibility with glibc versions older than 2.28.
290+
// __ssp: [::c_ulonglong; 4],
289291
}
290292
}
291293

0 commit comments

Comments
 (0)