Skip to content

Commit fceb8bd

Browse files
committed
selftests/bpf: Fix SIGSEGV, failure in cgrp_local_storage test
root@qemu-armhf:/usr/libexec/kselftests-bpf# /linux/tools/testing/selftests/bpf/./test_progs -w0 -a cgrp_local_storage cgrp2_local_storage:PASS:join_cgroup /cgrp_local_storage 0 nsec torvalds#64 cgrp_local_storage:FAIL Caught signal torvalds#11! Stack trace: Segmentation fault test_cgroup_iter_sleepable:PASS:skel_open 0 nsec test_cgroup_iter_sleepable:PASS:skel_load 0 nsec test_cgroup_iter_sleepable:PASS:attach_iter 0 nsec test_cgroup_iter_sleepable:PASS:iter_create 0 nsec test_cgroup_iter_sleepable:FAIL:cgroup_id unexpected cgroup_id: actual 4294967311 != expected 15 torvalds#64/11 cgrp_local_storage/cgrp1_iter_sleepable:FAIL Signed-off-by: Tony Ambardar <[email protected]>
1 parent 666a10a commit fceb8bd

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

tools/testing/selftests/bpf/prog_tests/cgrp_local_storage.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static void cgroup_mode_value_init(bool cgroup, int hid)
3737
static void test_tp_btf(int cgroup_fd)
3838
{
3939
struct cgrp_ls_tp_btf *skel;
40-
long val1 = 1, val2 = 0;
40+
__s64 val1 = 1, val2 = 0;
4141
int err;
4242

4343
skel = cgrp_ls_tp_btf__open_and_load();
@@ -310,7 +310,8 @@ static void cgrp2_local_storage(void)
310310

311311
static void cgrp1_local_storage(void)
312312
{
313-
int cgrp1_fd, cgrp1_hid, cgrp1_id, err;
313+
__u64 cgrp1_id;
314+
int cgrp1_fd, cgrp1_hid, err;
314315

315316
/* Setup cgroup1 hierarchy */
316317
err = setup_classid_environment();

tools/testing/selftests/bpf/progs/cgrp_ls_negative.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ struct {
1111
__uint(type, BPF_MAP_TYPE_CGRP_STORAGE);
1212
__uint(map_flags, BPF_F_NO_PREALLOC);
1313
__type(key, int);
14-
__type(value, long);
14+
__type(value, __s64);
1515
} map_a SEC(".maps");
1616

1717
SEC("tp_btf/sys_enter")

tools/testing/selftests/bpf/progs/cgrp_ls_recursion.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ struct {
1111
__uint(type, BPF_MAP_TYPE_CGRP_STORAGE);
1212
__uint(map_flags, BPF_F_NO_PREALLOC);
1313
__type(key, int);
14-
__type(value, long);
14+
__type(value, __s64);
1515
} map_a SEC(".maps");
1616

1717
struct {
1818
__uint(type, BPF_MAP_TYPE_CGRP_STORAGE);
1919
__uint(map_flags, BPF_F_NO_PREALLOC);
2020
__type(key, int);
21-
__type(value, long);
21+
__type(value, __s64);
2222
} map_b SEC(".maps");
2323

2424
int target_hid = 0;

tools/testing/selftests/bpf/progs/cgrp_ls_sleepable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ struct {
1111
__uint(type, BPF_MAP_TYPE_CGRP_STORAGE);
1212
__uint(map_flags, BPF_F_NO_PREALLOC);
1313
__type(key, int);
14-
__type(value, long);
14+
__type(value, __s64);
1515
} map_a SEC(".maps");
1616

1717
__s32 target_pid;

tools/testing/selftests/bpf/progs/cgrp_ls_tp_btf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ struct {
1111
__uint(type, BPF_MAP_TYPE_CGRP_STORAGE);
1212
__uint(map_flags, BPF_F_NO_PREALLOC);
1313
__type(key, int);
14-
__type(value, long);
14+
__type(value, __s64);
1515
} map_a SEC(".maps");
1616

1717
struct {
1818
__uint(type, BPF_MAP_TYPE_CGRP_STORAGE);
1919
__uint(map_flags, BPF_F_NO_PREALLOC);
2020
__type(key, int);
21-
__type(value, long);
21+
__type(value, __s64);
2222
} map_b SEC(".maps");
2323

2424
#define MAGIC_VALUE 0xabcd1234

0 commit comments

Comments
 (0)