Skip to content

Commit 97870df

Browse files
authored
Merge pull request #29 from hzy-hits/main
- samples/syscount: add syscount tool - rex/tracepoint: add RawSyscallEnter/ExitCtx struct - rex-macros/tracepoint: add RawSyscallEnter/Exit Ctx events Signed-off-by: Jinghao Jia <jinghao7@illinois.edu>
2 parents 94d522e + 95fa700 commit 97870df

11 files changed

Lines changed: 827 additions & 0 deletions

File tree

rex-macros/src/tracepoint.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ impl TracePoint {
6464
"SyscallsExitOpenCtx" => "syscalls/sys_exit_open",
6565
"SyscallsExitOpenatCtx" => "syscalls/sys_exit_openat",
6666
"SyscallsEnterDupCtx" => "syscalls/sys_enter_dup",
67+
"RawSyscallsEnterCtx" => "raw_syscalls/sys_enter",
68+
"RawSyscallsExitCtx" => "raw_syscalls/sys_exit",
6769
_ => abort_call_site!("Please provide a valid context type. If your needed context isn't supported consider opening a PR!"),
6870
};
6971
let attached_name = format!("rex/tracepoint/{}", hook_point_name);

rex/src/tracepoint/binding.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,19 @@ pub struct SyscallsEnterDupCtx {
4242
pub syscall_nr: i64,
4343
pub fildes: u64,
4444
}
45+
46+
#[repr(C)]
47+
#[derive(Debug, Copy, Clone)]
48+
pub struct RawSyscallsEnterCtx {
49+
unused: u64,
50+
pub id: i64,
51+
pub args: [u64; 6],
52+
}
53+
54+
#[repr(C)]
55+
#[derive(Debug, Copy, Clone)]
56+
pub struct RawSyscallsExitCtx {
57+
unused: u64,
58+
pub id: i64,
59+
pub ret: i64,
60+
}

samples/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ subdir('syscall_tp')
1414
subdir('trace_event')
1515
subdir('tracex5')
1616
subdir('xdp_test')
17+
subdir('syscount')
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[build]
2+
target = "x86_64-unknown-none"
3+
4+
[target.x86_64-unknown-none]
5+
linker = "ld.mold"
6+
rustflags = [
7+
"-Zthreads=8",
8+
"-Cforce-frame-pointers=y",
9+
"-Csymbol-mangling-version=v0",
10+
"-Ccodegen-units=1",
11+
"-Crelocation-model=pie",
12+
"-Crelro-level=full",
13+
]
14+
15+
[unstable]
16+
build-std = ["core"]

samples/syscount/Cargo.lock

Lines changed: 98 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/syscount/Cargo.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[package]
2+
name = "syscount"
3+
version = "0.1.0"
4+
edition = "2024"
5+
6+
[dependencies]
7+
8+
[dependencies.rex]
9+
path = "../../rex"
10+
11+
[lints.clippy]
12+
disallowed_methods = "forbid"
13+
disallowed_types = "forbid"
14+
15+
[lints.rust]
16+
incomplete_features = "forbid"
17+
internal_features = "forbid"
18+
unsafe_code = "forbid"
19+
unstable_features = "forbid"
20+
21+
[profile.dev]
22+
panic = "abort"
23+
debug = false
24+
25+
[profile.release]
26+
panic = "abort"
27+
debug = false
28+
lto = true

samples/syscount/clippy.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
disallowed-methods = [
2+
"core::mem::forget",
3+
]
4+
5+
disallowed-types = [
6+
"core::mem::ManuallyDrop",
7+
]

0 commit comments

Comments
 (0)