Skip to content

Commit

Permalink
update: made changes as per review request
Browse files Browse the repository at this point in the history
Signed-off-by: RohithRaju <[email protected]>
  • Loading branch information
Rohith-Raju committed Jan 10, 2024
1 parent 0f70c71 commit 298be7d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 18 deletions.
4 changes: 2 additions & 2 deletions driver/bpf/fillers.h
Original file line number Diff line number Diff line change
Expand Up @@ -5795,8 +5795,8 @@ FILLER(sys_bpf_x, true)
bpf_push_s64_to_ring(data, fd);

/* Parameter 2: cmd (type: PT_INT32) */
unsigned long cmd = bpf_syscall_get_argument(data, 0);
return bpf_push_s32_to_ring(data, (int32_t)bpf_cmd_to_scap(cmd));
int32_t cmd = (int32_t)bpf_syscall_get_argument(data, 0);
return bpf_push_s32_to_ring(data, cmd);
}

FILLER(sys_unlinkat_x, true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ int BPF_PROG(bpf_x,
ringbuf__store_s64(&ringbuf, ret);

/* Parameter 2: cmd (type: PT_INT32) */
unsigned long cmd = extract__syscall_argument(regs, 0);
ringbuf__store_s32(&ringbuf,(int32_t)bpf_cmd_to_scap(cmd));
int32_t cmd = (int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s32(&ringbuf, cmd);


/*=============================== COLLECT PARAMETERS ===========================*/
Expand Down
4 changes: 2 additions & 2 deletions driver/ppm_fillers.c
Original file line number Diff line number Diff line change
Expand Up @@ -6732,8 +6732,8 @@ int f_sys_bpf_x(struct event_filler_arguments *args)

/* Parameter 2: cmd (type: PT_INT64) */
syscall_get_arguments_deprecated(args, 0, 1, &val);
cmd = (int32_t)bpf_cmd_to_scap(val);
res = val_to_ring(args, cmd, 0, false, 0);
cmd = (int32_t)val;
res = val_to_ring(args, (uint32_t)cmd, 0, false, 0);
CHECK_RES(res);
return add_sentinel(args);
}
Expand Down
12 changes: 0 additions & 12 deletions driver/ppm_flag_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -2200,16 +2200,4 @@ static __always_inline uint32_t mknod_mode_to_scap(uint32_t modes)

return res;
}

static __always_inline uint32_t bpf_cmd_to_scap (unsigned long cmd){
/*
* bpf opcodes are defined via enum in uapi/linux/bpf.h.
* It is userspace API (thus stable) and arch-independent.
* Therefore we map them 1:1; if any unmapped flag arrives,
* we will just print its value to userspace without mapping it to a string flag.
* We then need to append new flags to both flags_table and ppm_events_public PPM_ flags.
*/

return cmd;
}
#endif /* PPM_FLAG_HELPERS_H_ */

0 comments on commit 298be7d

Please sign in to comment.