Skip to content

libbpf: fix possible use-after-free for externs #9163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: bpf-next_base
Choose a base branch
from

Conversation

kernel-patches-daemon-bpf[bot]
Copy link

Pull request for series with
subject: libbpf: fix possible use-after-free for externs
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=974002

@kernel-patches-daemon-bpf
Copy link
Author

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

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 99fe8af
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=974002
version: 1

The `name` field in `obj->externs` points into the BTF data at load time.
However, some functions may invalidate this after loading (e.g.
`bpf_map__set_value_size`), which results in pointers into freed memory and
undefined behavior.

The simplest solution is to simply `strdup` these strings, similar to the
`essent_name`, and free them at the same time.

Signed-off-by: Adin Scannell <[email protected]>
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.

1 participant