Skip to content

Commit 89ec22f

Browse files
ecbadeauxpoiana
authored andcommitted
cleanup: params inconsistencies
Signed-off-by: Everett Badeaux <[email protected]>
1 parent 1cc167d commit 89ec22f

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

driver/bpf/fillers.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -2597,7 +2597,7 @@ FILLER(proc_startupdate_3, true)
25972597
break;
25982598
}
25992599

2600-
flags = clone_flags_to_scap(flags);
2600+
flags = clone_flags_to_scap((int) flags);
26012601

26022602
if(pidns_level != 0) {
26032603
flags |= PPM_CL_CHILD_IN_PIDNS;
@@ -3010,7 +3010,7 @@ FILLER(sys_setns_e, true)
30103010

30113011
/* Parameter 2: nstype (type: PT_FLAGS32) */
30123012
unsigned long nstype = bpf_syscall_get_argument(data, 1);
3013-
return bpf_push_u32_to_ring(data, clone_flags_to_scap(nstype));
3013+
return bpf_push_u32_to_ring(data, clone_flags_to_scap((int) nstype));
30143014
}
30153015

30163016
FILLER(sys_setpgid_e, true)
@@ -3031,7 +3031,7 @@ FILLER(sys_unshare_e, true)
30313031
uint32_t flags;
30323032

30333033
val = bpf_syscall_get_argument(data, 0);
3034-
flags = clone_flags_to_scap(val);
3034+
flags = clone_flags_to_scap((int) val);
30353035
return bpf_push_u32_to_ring(data, flags);
30363036
}
30373037

@@ -4789,7 +4789,7 @@ FILLER(sys_flock_e, true)
47894789
CHECK_RES(res);
47904790

47914791
/* Parameter 2: operation (type: PT_FLAGS32) */
4792-
unsigned long operation = bpf_syscall_get_argument(data, 1);
4792+
int operation = bpf_syscall_get_argument(data, 1);
47934793
return bpf_push_u32_to_ring(data, flock_flags_to_scap(operation));
47944794
}
47954795

driver/modern_bpf/helpers/extract/extract_from_kernel.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ static __always_inline void extract__loginuid(struct task_struct *task, uint32_t
749749
*/
750750
static __always_inline unsigned long extract__clone_flags(struct task_struct *task, unsigned long flags)
751751
{
752-
unsigned long ppm_flags = clone_flags_to_scap(flags);
752+
unsigned long ppm_flags = clone_flags_to_scap((int) flags);
753753
struct pid *pid = extract__task_pid_struct(task, PIDTYPE_PID);
754754
struct pid_namespace *ns = extract__namespace_of_pid(pid);
755755
unsigned int ns_level;

driver/modern_bpf/programs/tail_called/events/syscall_dispatched_events/flock.bpf.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ int BPF_PROG(flock_e,
3131

3232
/* Parameter 2: operation (type: PT_FLAGS32) */
3333
unsigned long operation = extract__syscall_argument(regs, 1);
34-
ringbuf__store_u32(&ringbuf, flock_flags_to_scap(operation));
34+
ringbuf__store_u32(&ringbuf, flock_flags_to_scap((int) operation));
3535

3636
/*=============================== COLLECT PARAMETERS ===========================*/
3737

driver/modern_bpf/programs/tail_called/events/syscall_dispatched_events/setns.bpf.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ int BPF_PROG(setns_e,
3131

3232
/* Parameter 2: nstype (type: PT_FLAGS32) */
3333
unsigned long nstype = extract__syscall_argument(regs, 1);
34-
ringbuf__store_u32(&ringbuf, clone_flags_to_scap(nstype));
34+
ringbuf__store_u32(&ringbuf, clone_flags_to_scap((int) nstype));
3535

3636
/*=============================== COLLECT PARAMETERS ===========================*/
3737

driver/modern_bpf/programs/tail_called/events/syscall_dispatched_events/unshare.bpf.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ int BPF_PROG(unshare_e,
2727

2828
/* Parameter 1: flags (type: PT_FLAGS32) */
2929
unsigned long flags = extract__syscall_argument(regs, 0);
30-
ringbuf__store_u32(&ringbuf, clone_flags_to_scap(flags));
30+
ringbuf__store_u32(&ringbuf, clone_flags_to_scap((int) flags));
3131

3232
/*=============================== COLLECT PARAMETERS ===========================*/
3333

driver/ppm_fillers.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ int f_proc_startupdate(struct event_filler_arguments *args)
12101210
if(pidns != &init_pid_ns || pid_ns_for_children(current) != pidns)
12111211
in_pidns = PPM_CL_CHILD_IN_PIDNS;
12121212
#endif
1213-
res = val_to_ring(args, (uint64_t)clone_flags_to_scap(val) | in_pidns, 0, false, 0);
1213+
res = val_to_ring(args, (uint64_t)clone_flags_to_scap((int) val) | in_pidns, 0, false, 0);
12141214
CHECK_RES(res);
12151215

12161216
/*
@@ -6330,7 +6330,7 @@ int f_sys_flock_e(struct event_filler_arguments *args)
63306330

63316331
/* Parameter 2: operation (type: PT_FLAGS32) */
63326332
syscall_get_arguments_deprecated(args, 1, 1, &val);
6333-
flags = flock_flags_to_scap(val);
6333+
flags = flock_flags_to_scap((int) val);
63346334
res = val_to_ring(args, flags, 0, false, 0);
63356335
CHECK_RES(res);
63366336

@@ -6389,7 +6389,7 @@ int f_sys_setns_e(struct event_filler_arguments *args)
63896389

63906390
/* Parameter 2: nstype (type: PT_FLAGS32) */
63916391
syscall_get_arguments_deprecated(args, 1, 1, &val);
6392-
res = val_to_ring(args, clone_flags_to_scap(val), 0, true, 0);
6392+
res = val_to_ring(args, clone_flags_to_scap((int) val), 0, true, 0);
63936393
CHECK_RES(res);
63946394

63956395
return add_sentinel(args);
@@ -6427,7 +6427,7 @@ int f_sys_unshare_e(struct event_filler_arguments *args)
64276427
* get type, parse as clone flags as it's a subset of it
64286428
*/
64296429
syscall_get_arguments_deprecated(args, 0, 1, &val);
6430-
flags = clone_flags_to_scap(val);
6430+
flags = clone_flags_to_scap((int) val);
64316431
res = val_to_ring(args, flags, 0, true, 0);
64326432
CHECK_RES(res);
64336433

driver/ppm_flag_helpers.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ static __always_inline uint16_t signalfd4_flags_to_scap(int32_t flags)
470470
return res;
471471
}
472472

473-
static __always_inline uint32_t clone_flags_to_scap(unsigned long flags)
473+
static __always_inline uint32_t clone_flags_to_scap(int flags)
474474
{
475475
uint32_t res = 0;
476476

@@ -1411,7 +1411,7 @@ static __always_inline uint32_t pf_flags_to_scap(unsigned long flags)
14111411
return res;
14121412
}
14131413

1414-
static __always_inline uint32_t flock_flags_to_scap(unsigned long flags)
1414+
static __always_inline uint32_t flock_flags_to_scap(int flags)
14151415
{
14161416
uint32_t res = 0;
14171417

userspace/libscap/engine/gvisor/parsers.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,7 @@ static parse_result parse_clone(const char *proto, size_t proto_size, scap_sized
17461746
context_data.cwd().c_str(),
17471747
context_data.process_name().c_str(), // comm
17481748
scap_const_sized_buffer{cgroups.c_str(), cgroups.length() + 1},
1749-
clone_flags_to_scap(gvisor_evt.flags()),
1749+
clone_flags_to_scap((int) gvisor_evt.flags()),
17501750
context_data.credentials().effective_uid(), // uid
17511751
context_data.credentials().effective_gid(), // gid
17521752
context_data.thread_id(), // vtid

0 commit comments

Comments
 (0)