Skip to content

Commit

Permalink
fix(ebpf): fix prefix check in capture write (#3600)
Browse files Browse the repository at this point in the history
Fix prefix check, so it will use the right path address.
This should prevent verifier error in new kernels.
Also fixed the check logic to do what it was supposed to do.
  • Loading branch information
AlonZivony authored Oct 24, 2023
1 parent 1ecedcc commit 02dad67
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/ebpf/c/tracee.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -3002,7 +3002,7 @@ statfunc int capture_file_write(struct pt_regs *ctx, u32 event_id, bool is_buf)
// otherwise the capture will overwrite itself.
int pid = 0;
void *path_buf = get_path_str_cached(file);
if (path_buf != NULL && !has_prefix("/dev/null", (char *) &path_buf, 10)) {
if (path_buf != NULL && has_prefix("/dev/null", (char *) path_buf, 10)) {
pid = p.event->context.task.pid;
}

Expand Down

0 comments on commit 02dad67

Please sign in to comment.