Skip to content

Remove new field from ucontext_t for compatibility with earlier glibc versions #1411

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

Merged
merged 5 commits into from
Jun 27, 2019

Conversation

acfoltzer
Copy link
Contributor

Per discussion in #1410 with @gnzlbg, this is necessary to avoid struct size mismatches between Rust and C on systems with glibc < 2.28.

Per discussion in rust-lang#1410, this is necessary to avoid struct size mismatches between Rust and C on
systems with glibc < 2.28.
@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @gnzlbg (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

Copy link
Contributor

@gnzlbg gnzlbg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

// ucontext_t added a new field as of glibc 2.28; our struct definition is
// conservative and omits the field, but that means the size doesn't match for newer
// glibcs (see https://github.com/rust-lang/libc/issues/1410)
"ucontext_t" if gnu => true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add the following FIXME here?

FIXME: remove once Ubuntu 20.04 LTS is released, somewhere in 2020.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, though I'm a little concerned about the timeline given that 18.04 LTS is supported until 2023. Is there a stated policy for how long this crate supports a given glibc version?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really. We tend to support a "sufficiently" old version, adding features of newer glibc versions on top. The glibc version supported differs per target, it's all a huge mess.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah, fair enough. It would be nice if we could trigger a load-time failure for too-old versions of glibc, as the original bug that triggered my report was pretty difficult to track down. I've seen programs fail to dynamically load before, asking for a particular glibc version, but I don't know how we could introduce that behavior. Either way, something for another PR probably.

@@ -285,7 +285,6 @@ s_no_extra_traits! {
pub uc_mcontext: mcontext_t,
pub uc_sigmask: ::sigset_t,
__private: [u8; 512],
__ssp: [::c_ulonglong; 4],
Copy link
Contributor

@gnzlbg gnzlbg Jun 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of removing the field, can you comment it out, and add a comment about why it is commented out ? For example:

// FIXME: the shadow stack field requires glibc >= 2.28.
// Re-add once we drop compatibility with glibc versions older than 2.28.
// __ssp: [::c_ulonglong; 4],

@gnzlbg
Copy link
Contributor

gnzlbg commented Jun 27, 2019

@bors: r+

@bors
Copy link
Contributor

bors commented Jun 27, 2019

📌 Commit 339fe22 has been approved by gnzlbg

@bors
Copy link
Contributor

bors commented Jun 27, 2019

⌛ Testing commit 339fe22 with merge 4bd13af...

bors added a commit that referenced this pull request Jun 27, 2019
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.
@bors
Copy link
Contributor

bors commented Jun 27, 2019

💔 Test failed - checks-travis

@gnzlbg
Copy link
Contributor

gnzlbg commented Jun 27, 2019

@bors: r+

@bors
Copy link
Contributor

bors commented Jun 27, 2019

📌 Commit e94fffc has been approved by gnzlbg

@bors
Copy link
Contributor

bors commented Jun 27, 2019

⌛ Testing commit e94fffc with merge 6c8e200...

bors added a commit that referenced this pull request Jun 27, 2019
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.
@bors
Copy link
Contributor

bors commented Jun 27, 2019

💔 Test failed - checks-travis

@gnzlbg
Copy link
Contributor

gnzlbg commented Jun 27, 2019

@bors: r+

@bors
Copy link
Contributor

bors commented Jun 27, 2019

📌 Commit f6e48fc has been approved by gnzlbg

bors added a commit that referenced this pull request Jun 27, 2019
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.
@bors
Copy link
Contributor

bors commented Jun 27, 2019

⌛ Testing commit f6e48fc with merge 8773f33...

@bors
Copy link
Contributor

bors commented Jun 27, 2019

☀️ Test successful - checks-cirrus-freebsd-11, checks-cirrus-freebsd-12, checks-travis, status-appveyor
Approved by: gnzlbg
Pushing 8773f33 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants