diff options
| author | Mingpei CAO <caomingpei@gmail.com> | 2026-09-15 16:22:36 +0000 |
|---|---|---|
| committer | Andrii Nakryiko <andrii@kernel.org> | 2026-09-17 15:25:13 -0700 |
| commit | 961b8946acb482b6d7a39c266d623e5f9c4e873f (patch) | |
| tree | bfe219e5493ea33e71b5bfb3877e32fada2cf27a /include/linux/debugobjects.h | |
| parent | 8cca9a6bb68181bf50f3a9b4c54c06cd695be4dc (diff) | |
libbpf: Reject local struct_ops bitfields before data access
A local struct_ops type can contain a bitfield absent from the
corresponding kernel BTF type. bpf_map__init_kern_struct_ops() checks
whether data for an absent local member is zero.
For a bitfield, member->offset contains the bit offset and field width.
bpf_map__init_kern_struct_ops() used the encoded value to calculate the
member data pointer before rejecting the bitfield. The zero-data check
could therefore read outside st_ops->data and crash libbpf.
Reject local bitfields before calculating the member data pointer. Keep
the existing rejection for bitfields in the kernel type.
Fixes: c911fc61a7ce ("libbpf: Skip zeroed or null fields if not found in the kernel type.")
Signed-off-by: Mingpei CAO <caomingpei@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Amery Hung <ameryhung@gmail.com>
Link: https://lore.kernel.org/bpf/20260915162252.473044-2-caomingpei@gmail.com
Diffstat (limited to 'include/linux/debugobjects.h')
0 files changed, 0 insertions, 0 deletions
