mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
selftests/bpf: Add a selftest with > 512-byte percpu allocation size
Add a selftest to capture the verification failure when the allocation size is greater than 512. Acked-by: Hou Tao <houtao1@huawei.com> Signed-off-by: Yonghong Song <yonghong.song@linux.dev> Link: https://lore.kernel.org/r/20231222031812.1293190-1-yonghong.song@linux.dev Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
21f5a801c1
commit
adc8c4549d
1 changed files with 18 additions and 0 deletions
|
@ -17,6 +17,10 @@ struct val_with_rb_root_t {
|
|||
struct bpf_spin_lock lock;
|
||||
};
|
||||
|
||||
struct val_600b_t {
|
||||
char b[600];
|
||||
};
|
||||
|
||||
struct elem {
|
||||
long sum;
|
||||
struct val_t __percpu_kptr *pc;
|
||||
|
@ -161,4 +165,18 @@ int BPF_PROG(test_array_map_7)
|
|||
return 0;
|
||||
}
|
||||
|
||||
SEC("?fentry.s/bpf_fentry_test1")
|
||||
__failure __msg("bpf_percpu_obj_new type size (600) is greater than 512")
|
||||
int BPF_PROG(test_array_map_8)
|
||||
{
|
||||
struct val_600b_t __percpu_kptr *p;
|
||||
|
||||
p = bpf_percpu_obj_new(struct val_600b_t);
|
||||
if (!p)
|
||||
return 0;
|
||||
|
||||
bpf_percpu_obj_drop(p);
|
||||
return 0;
|
||||
}
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
|
Loading…
Add table
Reference in a new issue