Skip to content

Commit

Permalink
update(driver): add the TASK_COMM_LEN enum in vmlinux (x86, aarch64)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Terzolo <[email protected]>
Co-authored-by: Hendrik Brueckner <[email protected]>
  • Loading branch information
2 people authored and poiana committed Oct 25, 2022
1 parent 020e9cb commit fbc44ec
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 9 deletions.
8 changes: 8 additions & 0 deletions driver/modern_bpf/definitions/vmlinux.h
Original file line number Diff line number Diff line change
Expand Up @@ -2692,6 +2692,10 @@ enum rseq_cs_flags_bit {
RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT = 2,
};

enum {
TASK_COMM_LEN = 16,
};

struct rseq {
__u32 cpu_id_start;
__u32 cpu_id;
Expand Down Expand Up @@ -136555,6 +136559,10 @@ enum rseq_cs_flags_bit {
RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT = 2,
};

enum {
TASK_COMM_LEN = 16,
};

enum uclamp_id {
UCLAMP_MIN = 0,
UCLAMP_MAX = 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ int BPF_PROG(sched_p_exec,
auxmap__store_u32_param(auxmap, vm_swap);

/* Parameter 14: comm (type: PT_CHARBUF) */
auxmap__store_charbuf_param(auxmap, (unsigned long)task->comm, MAX_PROC_EXE, KERNEL);
auxmap__store_charbuf_param(auxmap, (unsigned long)task->comm, TASK_COMM_LEN, KERNEL);

/*=============================== COLLECT PARAMETERS ===========================*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ int BPF_PROG(sched_p_fork,
auxmap__store_u32_param(auxmap, vm_swap);

/* Parameter 14: comm (type: PT_CHARBUF) */
auxmap__store_charbuf_param(auxmap, (unsigned long)child->comm, MAX_PROC_EXE, KERNEL);
auxmap__store_charbuf_param(auxmap, (unsigned long)child->comm, TASK_COMM_LEN, KERNEL);

/*=============================== COLLECT PARAMETERS ===========================*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ int BPF_PROG(clone_x,
auxmap__store_u32_param(auxmap, vm_swap);

/* Parameter 14: comm (type: PT_CHARBUF) */
auxmap__store_charbuf_param(auxmap, (unsigned long)task->comm, MAX_PROC_EXE, KERNEL);
auxmap__store_charbuf_param(auxmap, (unsigned long)task->comm, TASK_COMM_LEN, KERNEL);

/*=============================== COLLECT PARAMETERS ===========================*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ int BPF_PROG(clone3_x,
auxmap__store_u32_param(auxmap, vm_swap);

/* Parameter 14: comm (type: PT_CHARBUF) */
auxmap__store_charbuf_param(auxmap, (unsigned long)task->comm, MAX_PROC_EXE, KERNEL);
auxmap__store_charbuf_param(auxmap, (unsigned long)task->comm, TASK_COMM_LEN, KERNEL);

/*=============================== COLLECT PARAMETERS ===========================*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ int BPF_PROG(execve_x,
auxmap__store_u32_param(auxmap, vm_swap);

/* Parameter 14: comm (type: PT_CHARBUF) */
auxmap__store_charbuf_param(auxmap, (unsigned long)task->comm, MAX_PROC_EXE, KERNEL);
auxmap__store_charbuf_param(auxmap, (unsigned long)task->comm, TASK_COMM_LEN, KERNEL);

/*=============================== COLLECT PARAMETERS ===========================*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ int BPF_PROG(execveat_x,
auxmap__store_u32_param(auxmap, vm_swap);

/* Parameter 14: comm (type: PT_CHARBUF) */
auxmap__store_charbuf_param(auxmap, (unsigned long)task->comm, MAX_PROC_EXE, KERNEL);
auxmap__store_charbuf_param(auxmap, (unsigned long)task->comm, TASK_COMM_LEN, KERNEL);

/*=============================== COLLECT PARAMETERS ===========================*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ int BPF_PROG(fork_x,
auxmap__store_u32_param(auxmap, vm_swap);

/* Parameter 14: comm (type: PT_CHARBUF) */
auxmap__store_charbuf_param(auxmap, (unsigned long)task->comm, MAX_PROC_EXE, KERNEL);
auxmap__store_charbuf_param(auxmap, (unsigned long)task->comm, TASK_COMM_LEN, KERNEL);

/*=============================== COLLECT PARAMETERS ===========================*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ int BPF_PROG(vfork_x,
auxmap__store_u32_param(auxmap, vm_swap);

/* Parameter 14: comm (type: PT_CHARBUF) */
auxmap__store_charbuf_param(auxmap, (unsigned long)task->comm, MAX_PROC_EXE, KERNEL);
auxmap__store_charbuf_param(auxmap, (unsigned long)task->comm, TASK_COMM_LEN, KERNEL);

/*=============================== COLLECT PARAMETERS ===========================*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ TEST(GenericTracepoints, sched_proc_fork_case_fork)
evt_test->assert_cgroup_param(15);

/* Parameter 16: flags (type: PT_FLAGS32) */
evt_test->assert_numeric_param(16, (uint32_t)(uint32_t)0);
evt_test->assert_numeric_param(16, (uint32_t)0);

/* Parameter 17: uid (type: PT_UINT32) */
evt_test->assert_numeric_param(17, (uint32_t)info.uid);
Expand Down

0 comments on commit fbc44ec

Please sign in to comment.