diff options
| author | Leon Hwang <leon.hwang@linux.dev> | 2026-05-18 17:54:42 +0300 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-05-19 04:51:14 +0300 |
| commit | f05ddc6771c4a2eb1801dfdd0f7a212a78fa18a7 (patch) | |
| tree | a18905ac0ee5116dec76031c591141fed7d5f655 /lib/debugobjects.c | |
| parent | 576482b55c19e7ec00e162a0fde4c4f1a95128c7 (diff) | |
| download | linux-f05ddc6771c4a2eb1801dfdd0f7a212a78fa18a7.tar.xz | |
bpf: Check tail zero of bpf_common_attr using offsetofend
Because of the 8-byte alignment, the compiler will pad struct
bpf_common_attr to 24 bytes. That said, sizeof(attr_common) is 24 instead
of 20.
When check tail zero using sizeof(attr_common) in
bpf_check_uarg_tail_zero(), there will be 4 bytes that won't be checked.
To also check the padding 4 bytes, replace sizeof(attr_common) with
offsetofend(struct bpf_common_attr, log_true_size).
Fixes: f28771c0691b ("bpf: Extend BPF syscall with common attributes support")
Signed-off-by: Leon Hwang <leon.hwang@linux.dev>
Link: https://lore.kernel.org/r/20260518145446.6794-2-leon.hwang@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'lib/debugobjects.c')
0 files changed, 0 insertions, 0 deletions
