Skip to content

Commit 1ad8f4b

Browse files
authored
Fix file names being empty (iovisor#4293)
Use bpf_probe_read_user_str() instead of bpf_probe_read_user() in opensnoop.py to avoid empty file names. Co-authored-by: Nurdan <[email protected]>
1 parent b96a6db commit 1ad8f4b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/opensnoop.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
}
154154
155155
bpf_probe_read_kernel(&data.comm, sizeof(data.comm), valp->comm);
156-
bpf_probe_read_user(&data.name, sizeof(data.name), (void *)valp->fname);
156+
bpf_probe_read_user_str(&data.name, sizeof(data.name), (void *)valp->fname);
157157
data.id = valp->id;
158158
data.ts = tsp / 1000;
159159
data.uid = bpf_get_current_uid_gid();
@@ -273,7 +273,7 @@
273273
274274
u64 tsp = bpf_ktime_get_ns();
275275
276-
bpf_probe_read_user(&data.name, sizeof(data.name), (void *)filename);
276+
bpf_probe_read_user_str(&data.name, sizeof(data.name), (void *)filename);
277277
data.id = id;
278278
data.ts = tsp / 1000;
279279
data.uid = bpf_get_current_uid_gid();

0 commit comments

Comments
 (0)