Skip to content

Commit 8773f33

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 + f6e48fc commit 8773f33

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

ci/style.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) {
117117
} else {
118118
prev_blank = false;
119119
}
120-
if line != line.trim_right() {
120+
if line != line.trim_end() {
121121
err.error(path, i, "trailing whitespace");
122122
}
123123
if line.contains("\t") {
@@ -139,7 +139,7 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) {
139139
}
140140
}
141141

142-
let line = line.trim_left();
142+
let line = line.trim_start();
143143
let is_pub = line.starts_with("pub ");
144144
let line = if is_pub {&line[4..]} else {line};
145145

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: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,11 @@ 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
290+
// 2.28.
291+
//
292+
// __ssp: [::c_ulonglong; 4],
289293
}
290294
}
291295

0 commit comments

Comments
 (0)