From 552d13168671333e3a93604ead10c79014af73f7 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 8 Apr 2022 23:55:31 +0200 Subject: [PATCH] linux: add GRND_INSECURE constant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is available on kernels ≥5.6 and was added to glibc in 2.32. --- libc-test/build.rs | 6 ++++++ libc-test/semver/android.txt | 1 + libc-test/semver/linux.txt | 1 + src/unix/linux_like/android/mod.rs | 1 + src/unix/linux_like/linux/mod.rs | 1 + 5 files changed, 10 insertions(+) diff --git a/libc-test/build.rs b/libc-test/build.rs index 27497fa718957..7e98df2dbc098 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -1728,6 +1728,9 @@ fn test_android(target: &str) { // linux 5.12 min "MPOL_F_NUMA_BALANCING" => true, + // GRND_INSECURE was added in platform-tools-30.0.0 + "GRND_INSECURE" => true, + _ => false, } }); @@ -3317,6 +3320,9 @@ fn test_linux(target: &str) { // linux 5.17 min "PR_SET_VMA" | "PR_SET_VMA_ANON_NAME" => true, + // GRND_INSECURE was added in glibc-2.32 + "GRND_INSECURE" => true, + _ => false, } }); diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index a68ff86d7e38a..b439e09ddaac3 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -661,6 +661,7 @@ GENL_NAMSIZ GENL_UNS_ADMIN_PERM GRND_NONBLOCK GRND_RANDOM +GRND_INSECURE GRPQUOTA HPFS_SUPER_MAGIC HUGETLBFS_MAGIC diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index 9eb096efe89aa..62537122da82f 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -649,6 +649,7 @@ GLOB_NOSORT GLOB_NOSPACE GRND_NONBLOCK GRND_RANDOM +GRND_INSECURE IBSHIFT IFA_ADDRESS IFA_ANYCAST diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 13d85b3f44540..5aaf48deaac6d 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -1792,6 +1792,7 @@ pub const NETLINK_GET_STRICT_CHK: ::c_int = 12; pub const GRND_NONBLOCK: ::c_uint = 0x0001; pub const GRND_RANDOM: ::c_uint = 0x0002; +pub const GRND_INSECURE: ::c_uint = 0x0004; pub const SECCOMP_MODE_DISABLED: ::c_uint = 0; pub const SECCOMP_MODE_STRICT: ::c_uint = 1; diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 64d293e2c8567..aa30bb2bc5b13 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -1781,6 +1781,7 @@ pub const PR_SET_VMA_ANON_NAME: ::c_int = 0; pub const GRND_NONBLOCK: ::c_uint = 0x0001; pub const GRND_RANDOM: ::c_uint = 0x0002; +pub const GRND_INSECURE: ::c_uint = 0x0004; pub const SECCOMP_MODE_DISABLED: ::c_uint = 0; pub const SECCOMP_MODE_STRICT: ::c_uint = 1;