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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3873,6 +3873,7 @@ fn test_linux(target: &str) {
"linux/sched.h",
"linux/sctp.h",
"linux/seccomp.h",
"linux/securebits.h",
"linux/sock_diag.h",
"linux/sockios.h",
"linux/tls.h",
Expand Down
11 changes: 11 additions & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2776,6 +2776,14 @@ SCTP_STATUS
SCTP_STREAM_RESET_INCOMING
SCTP_STREAM_RESET_OUTGOING
SCTP_UNORDERED
SECBIT_KEEP_CAPS
SECBIT_KEEP_CAPS_LOCKED
SECBIT_NOROOT
SECBIT_NOROOT_LOCKED
SECBIT_NO_CAP_AMBIENT_RAISE
SECBIT_NO_CAP_AMBIENT_RAISE_LOCKED
SECBIT_NO_SETUID_FIXUP
SECBIT_NO_SETUID_FIXUP_LOCKED
SECCOMP_ADDFD_FLAG_SEND
SECCOMP_ADDFD_FLAG_SETFD
SECCOMP_FILTER_FLAG_LOG
Expand Down Expand Up @@ -2804,6 +2812,9 @@ SECCOMP_RET_USER_NOTIF
SECCOMP_SET_MODE_FILTER
SECCOMP_SET_MODE_STRICT
SECCOMP_USER_NOTIF_FLAG_CONTINUE
SECUREBITS_DEFAULT
SECURE_ALL_BITS
SECURE_ALL_LOCKS
SEEK_DATA
SEEK_HOLE
SELFMAG
Expand Down
20 changes: 20 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4815,6 +4815,26 @@ pub const IN_ONLYDIR: u32 = 0x0100_0000;
pub const IN_DONT_FOLLOW: u32 = 0x0200_0000;
pub const IN_EXCL_UNLINK: u32 = 0x0400_0000;

// uapi/linux/securebits.h
pub const SECBIT_NOROOT: c_int = 1 << 0;
pub const SECBIT_NOROOT_LOCKED: c_int = 1 << 1;

pub const SECBIT_NO_SETUID_FIXUP: c_int = 1 << 2;
pub const SECBIT_NO_SETUID_FIXUP_LOCKED: c_int = 1 << 3;

pub const SECBIT_KEEP_CAPS: c_int = 1 << 4;
pub const SECBIT_KEEP_CAPS_LOCKED: c_int = 1 << 5;

pub const SECBIT_NO_CAP_AMBIENT_RAISE: c_int = 1 << 6;
pub const SECBIT_NO_CAP_AMBIENT_RAISE_LOCKED: c_int = 1 << 7;

pub const SECUREBITS_DEFAULT: c_int = 0x00000000;
pub const SECURE_ALL_BITS: c_int = SECBIT_NOROOT
| SECBIT_NO_SETUID_FIXUP
| SECBIT_KEEP_CAPS
| SECBIT_NO_CAP_AMBIENT_RAISE;
pub const SECURE_ALL_LOCKS: c_int = SECURE_ALL_BITS << 1;

// linux/keyctl.h
pub const KEY_SPEC_THREAD_KEYRING: i32 = -1;
pub const KEY_SPEC_PROCESS_KEYRING: i32 = -2;
Expand Down
Loading