Skip to content

Add SECBIT_ constants from securebits.h #4480

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chriswailes
Copy link

Description

This PR adds the SECBIT_ constants for use with the PR_GET_SECUREBITS and PR_SET_SECUREBITS prctl operations.

Sources

linux/securebits.h

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot label +stable-nominated

@rustbot rustbot added O-linux O-unix S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Jun 9, 2025
@chriswailes
Copy link
Author

I don't believe that the FreeBSD failures are due to the changes in this pull request.

Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

The values look good to me, but in the interest of matching the source code would you mind adding a const fn issecure_mask to do the shifts? Something like

const SECURE_NOROOT: c_int = 0;
pub const SECBIT_NOROOT: c_int = issecure_mask(SECURE_NOROOT);

// ...

const fn issecure_mask(x: c_int) -> c_int {
    1 << x
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-linux O-unix S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants