Skip to content

Conversation

@kernel-patches-daemon-bpf
Copy link

Pull request for series with
subject: libbpf: Fix OOB read in btf_dump_get_bitfield_value
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1039160

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: ab86d0b
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1039160
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 9df5fad
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1039160
version: 1

When dumping bitfield data, btf_dump_get_bitfield_value() reads data
based on the underlying type's size (t->size). However, it does not
verify that the provided data buffer (data_sz) is large enough to
contain these bytes.

If btf_dump__dump_type_data() is called with a buffer smaller than
the type's size, this leads to an out-of-bounds read. This was
confirmed by AddressSanitizer in the linked issue.

Fix this by ensuring we do not read past the provided data_sz limit.

Fixes: a1d3cc3 ("libbpf: Avoid use of __int128 in typed dump display")
Reported-by: Harrison Green <harrisonmichaelgreen@gmail.com>
Closes: libbpf/libbpf#928
Suggested-by: Alan Maguire <alan.maguire@oracle.com>
Signed-off-by: Varun R Mallya <varunrmallya@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants