Skip to content

Commit 759ef16

Browse files
committed
Add AUDIT_ARCH_* constants from linux/audit.h
Architecture identification constants for seccomp BPF filters. https://github.com/torvalds/linux/blob/master/include/uapi/linux/audit.h#L389-L451
1 parent 4837954 commit 759ef16

7 files changed

Lines changed: 173 additions & 0 deletions

File tree

evalbox

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 2d2145381328ef5180284cc8685ec53c8e7e0468

flake.nix

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
description = "Development environment for rust-lang/libc";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
rust-overlay.url = "github:oxalica/rust-overlay";
7+
flake-utils.url = "github:numtide/flake-utils";
8+
};
9+
10+
outputs = { self, nixpkgs, rust-overlay, flake-utils }:
11+
flake-utils.lib.eachDefaultSystem (system:
12+
let
13+
overlays = [ (import rust-overlay) ];
14+
pkgs = import nixpkgs {
15+
inherit system overlays;
16+
};
17+
18+
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
19+
extensions = [ "rust-src" "rustfmt" "clippy" ];
20+
};
21+
in
22+
{
23+
devShells.default = pkgs.mkShell {
24+
buildInputs = with pkgs; [
25+
rustToolchain
26+
python3
27+
cargo
28+
29+
# Build tools
30+
gcc
31+
pkg-config
32+
];
33+
34+
shellHook = ''
35+
echo "🦀 Rust libc development environment"
36+
echo "Rust version: $(rustc --version)"
37+
echo "Cargo version: $(cargo --version)"
38+
echo "Rustfmt version: $(rustfmt --version)"
39+
echo "Clippy version: $(cargo clippy --version)"
40+
echo ""
41+
echo "Available commands:"
42+
echo " cargo clippy --workspace --exclude libc-test --exclude ctest-test --all-targets -- -D warnings"
43+
echo " ./ci/style.py"
44+
echo " cargo test"
45+
'';
46+
};
47+
}
48+
);
49+
}

libc-test/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4127,6 +4127,7 @@ fn test_linux(target: &str) {
41274127
headers!(
41284128
cfg,
41294129
(gnu, "linux/aio_abi.h"),
4130+
"linux/audit.h",
41304131
"linux/can.h",
41314132
"linux/can/bcm.h",
41324133
"linux/can/error.h",

libc-test/semver/linux.txt

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,59 @@ AT_SYMLINK_FOLLOW
192192
AT_SYMLINK_NOFOLLOW
193193
AT_SYSINFO_EHDR
194194
AT_UID
195+
AUDIT_ARCH_AARCH64
196+
AUDIT_ARCH_ALPHA
197+
AUDIT_ARCH_ARCOMPACT
198+
AUDIT_ARCH_ARCOMPACTBE
199+
AUDIT_ARCH_ARCV2
200+
AUDIT_ARCH_ARCV2BE
201+
AUDIT_ARCH_ARM
202+
AUDIT_ARCH_ARMEB
203+
AUDIT_ARCH_C6X
204+
AUDIT_ARCH_C6XBE
205+
AUDIT_ARCH_CRIS
206+
AUDIT_ARCH_CSKY
207+
AUDIT_ARCH_FRV
208+
AUDIT_ARCH_H8300
209+
AUDIT_ARCH_HEXAGON
210+
AUDIT_ARCH_I386
211+
AUDIT_ARCH_IA64
212+
AUDIT_ARCH_LOONGARCH32
213+
AUDIT_ARCH_LOONGARCH64
214+
AUDIT_ARCH_M32R
215+
AUDIT_ARCH_M68K
216+
AUDIT_ARCH_MICROBLAZE
217+
AUDIT_ARCH_MIPS
218+
AUDIT_ARCH_MIPS64
219+
AUDIT_ARCH_MIPS64N32
220+
AUDIT_ARCH_MIPSEL
221+
AUDIT_ARCH_MIPSEL64
222+
AUDIT_ARCH_MIPSEL64N32
223+
AUDIT_ARCH_NDS32
224+
AUDIT_ARCH_NDS32BE
225+
AUDIT_ARCH_NIOS2
226+
AUDIT_ARCH_OPENRISC
227+
AUDIT_ARCH_PARISC
228+
AUDIT_ARCH_PARISC64
229+
AUDIT_ARCH_PPC
230+
AUDIT_ARCH_PPC64
231+
AUDIT_ARCH_PPC64LE
232+
AUDIT_ARCH_RISCV32
233+
AUDIT_ARCH_RISCV64
234+
AUDIT_ARCH_S390
235+
AUDIT_ARCH_S390X
236+
AUDIT_ARCH_SH
237+
AUDIT_ARCH_SH64
238+
AUDIT_ARCH_SHEL
239+
AUDIT_ARCH_SHEL64
240+
AUDIT_ARCH_SPARC
241+
AUDIT_ARCH_SPARC64
242+
AUDIT_ARCH_TILEGX
243+
AUDIT_ARCH_TILEGX32
244+
AUDIT_ARCH_TILEPRO
245+
AUDIT_ARCH_UNICORE
246+
AUDIT_ARCH_X86_64
247+
AUDIT_ARCH_XTENSA
195248
B1000000
196249
B1152000
197250
B1500000
@@ -3996,6 +4049,10 @@ _SC_XOPEN_XCU_VERSION
39964049
_SC_XOPEN_XPG2
39974050
_SC_XOPEN_XPG3
39984051
_SC_XOPEN_XPG4
4052+
__AUDIT_ARCH_64BIT
4053+
__AUDIT_ARCH_CONVENTION_MASK
4054+
__AUDIT_ARCH_CONVENTION_MIPS64_N32
4055+
__AUDIT_ARCH_LE
39994056
__SIZEOF_PTHREAD_BARRIERATTR_T
40004057
__SIZEOF_PTHREAD_BARRIER_T
40014058
__SIZEOF_PTHREAD_CONDATTR_T

src/new/linux_uapi/linux/audit.rs

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
//! Header: `uapi/linux/audit.h`
2+
//!
3+
//! <https://github.com/torvalds/linux/blob/master/include/uapi/linux/audit.h>
4+
5+
pub const __AUDIT_ARCH_64BIT: u32 = 1 << 31;
6+
pub const __AUDIT_ARCH_LE: u32 = 1 << 30;
7+
pub const __AUDIT_ARCH_CONVENTION_MASK: u32 = 0x30000000;
8+
pub const __AUDIT_ARCH_CONVENTION_MIPS64_N32: u32 = 1 << 29;
9+
10+
pub const AUDIT_ARCH_AARCH64: u32 = 183 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE;
11+
pub const AUDIT_ARCH_ALPHA: u32 = 0x9026 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE;
12+
pub const AUDIT_ARCH_ARCOMPACT: u32 = 93 | __AUDIT_ARCH_LE;
13+
pub const AUDIT_ARCH_ARCOMPACTBE: u32 = 93;
14+
pub const AUDIT_ARCH_ARCV2: u32 = 195 | __AUDIT_ARCH_LE;
15+
pub const AUDIT_ARCH_ARCV2BE: u32 = 195;
16+
pub const AUDIT_ARCH_ARM: u32 = 40 | __AUDIT_ARCH_LE;
17+
pub const AUDIT_ARCH_ARMEB: u32 = 40;
18+
pub const AUDIT_ARCH_C6X: u32 = 140 | __AUDIT_ARCH_LE;
19+
pub const AUDIT_ARCH_C6XBE: u32 = 140;
20+
pub const AUDIT_ARCH_CRIS: u32 = 76 | __AUDIT_ARCH_LE;
21+
pub const AUDIT_ARCH_CSKY: u32 = 252 | __AUDIT_ARCH_LE;
22+
pub const AUDIT_ARCH_FRV: u32 = 0x5441;
23+
pub const AUDIT_ARCH_H8300: u32 = 46;
24+
pub const AUDIT_ARCH_HEXAGON: u32 = 164;
25+
pub const AUDIT_ARCH_I386: u32 = 3 | __AUDIT_ARCH_LE;
26+
pub const AUDIT_ARCH_IA64: u32 = 50 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE;
27+
pub const AUDIT_ARCH_M32R: u32 = 88;
28+
pub const AUDIT_ARCH_M68K: u32 = 4;
29+
pub const AUDIT_ARCH_MICROBLAZE: u32 = 189;
30+
pub const AUDIT_ARCH_MIPS: u32 = 8;
31+
pub const AUDIT_ARCH_MIPSEL: u32 = 8 | __AUDIT_ARCH_LE;
32+
pub const AUDIT_ARCH_MIPS64: u32 = 8 | __AUDIT_ARCH_64BIT;
33+
pub const AUDIT_ARCH_MIPS64N32: u32 = 8 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_CONVENTION_MIPS64_N32;
34+
pub const AUDIT_ARCH_MIPSEL64: u32 = 8 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE;
35+
pub const AUDIT_ARCH_MIPSEL64N32: u32 =
36+
8 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE | __AUDIT_ARCH_CONVENTION_MIPS64_N32;
37+
pub const AUDIT_ARCH_NDS32: u32 = 167 | __AUDIT_ARCH_LE;
38+
pub const AUDIT_ARCH_NDS32BE: u32 = 167;
39+
pub const AUDIT_ARCH_NIOS2: u32 = 113 | __AUDIT_ARCH_LE;
40+
pub const AUDIT_ARCH_OPENRISC: u32 = 92;
41+
pub const AUDIT_ARCH_PARISC: u32 = 15;
42+
pub const AUDIT_ARCH_PARISC64: u32 = 15 | __AUDIT_ARCH_64BIT;
43+
pub const AUDIT_ARCH_PPC: u32 = 20;
44+
pub const AUDIT_ARCH_PPC64: u32 = 21 | __AUDIT_ARCH_64BIT;
45+
pub const AUDIT_ARCH_PPC64LE: u32 = 21 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE;
46+
pub const AUDIT_ARCH_RISCV32: u32 = 243 | __AUDIT_ARCH_LE;
47+
pub const AUDIT_ARCH_RISCV64: u32 = 243 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE;
48+
pub const AUDIT_ARCH_S390: u32 = 22;
49+
pub const AUDIT_ARCH_S390X: u32 = 22 | __AUDIT_ARCH_64BIT;
50+
pub const AUDIT_ARCH_SH: u32 = 42;
51+
pub const AUDIT_ARCH_SHEL: u32 = 42 | __AUDIT_ARCH_LE;
52+
pub const AUDIT_ARCH_SH64: u32 = 42 | __AUDIT_ARCH_64BIT;
53+
pub const AUDIT_ARCH_SHEL64: u32 = 42 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE;
54+
pub const AUDIT_ARCH_SPARC: u32 = 2;
55+
pub const AUDIT_ARCH_SPARC64: u32 = 43 | __AUDIT_ARCH_64BIT;
56+
pub const AUDIT_ARCH_TILEGX: u32 = 191 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE;
57+
pub const AUDIT_ARCH_TILEGX32: u32 = 191 | __AUDIT_ARCH_LE;
58+
pub const AUDIT_ARCH_TILEPRO: u32 = 188 | __AUDIT_ARCH_LE;
59+
pub const AUDIT_ARCH_UNICORE: u32 = 110 | __AUDIT_ARCH_LE;
60+
pub const AUDIT_ARCH_X86_64: u32 = 62 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE;
61+
pub const AUDIT_ARCH_XTENSA: u32 = 94;
62+
pub const AUDIT_ARCH_LOONGARCH32: u32 = 258 | __AUDIT_ARCH_LE;
63+
pub const AUDIT_ARCH_LOONGARCH64: u32 = 258 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE;

src/new/linux_uapi/linux/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//!
33
//! <https://github.com/torvalds/linux/tree/master/include/uapi/linux>
44
5+
pub(crate) mod audit;
56
pub(crate) mod can;
67
pub(crate) mod futex;
78
pub(crate) mod if_link;

src/new/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ cfg_if! {
177177
pub use linux::types::*;
178178
pub use sys::socket::*;
179179
} else if #[cfg(target_os = "linux")] {
180+
pub use linux::audit::*;
180181
pub use linux::can::bcm::*;
181182
pub use linux::can::error::*;
182183
pub use linux::can::j1939::*;

0 commit comments

Comments
 (0)