-
Notifications
You must be signed in to change notification settings - Fork 109
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
Two tiny fixes for btf record #7716
Conversation
Upstream branch: c229c17 |
aa26220
to
60d2590
Compare
Upstream branch: 6182e0b |
51215c9
to
c36923c
Compare
60d2590
to
8a5dcb8
Compare
Upstream branch: ea02a94 |
c36923c
to
c129549
Compare
8a5dcb8
to
c6d0c20
Compare
Upstream branch: a18062d |
c129549
to
c05d40d
Compare
c6d0c20
to
f1b85e0
Compare
When security_bpf_map_create() in map_create() fails, map_create() will call btf_put() and ->map_free() callback to free the map. It doesn't free the btf_record of map value, so add the missed btf_record_free() when map creation fails. However btf_record_free() needs to be called after ->map_free() just like bpf_map_free_deferred() did, because ->map_free() may use the btf_record to free the special fields in preallocated map value. So factor out bpf_map_free() helper to free the map, btf_record, and btf orderly and use the helper in both map_create() and bpf_map_free_deferred(). Signed-off-by: Hou Tao <houtao1@huawei.com> Acked-by: Jiri Olsa <jolsa@kernel.org>
Call the missed kfree() in btf_parse_struct_metas() when there is no special field in btf, otherwise will get the following kmemleak report: unreferenced object 0xffff888101033620 (size 8): comm "test_progs", pid 604, jiffies 4295127011 ...... backtrace (crc e77dc444): [<00000000186f90f3>] kmemleak_alloc+0x4b/0x80 [<00000000ac8e9c4d>] __kmalloc_cache_noprof+0x2a1/0x310 [<00000000d99d68d6>] btf_new_fd+0x72d/0xe90 [<00000000f010b7f8>] __sys_bpf+0xec3/0x2410 [<00000000e077ed6f>] __x64_sys_bpf+0x1f/0x30 [<00000000a12f9e55>] x64_sys_call+0x199/0x9f0 [<00000000f3029ea6>] do_syscall_64+0x3b/0xc0 [<000000005640913a>] entry_SYSCALL_64_after_hwframe+0x4b/0x53 Fixes: 7a851ec ("bpf: Search for kptrs in prog BTF structs") Signed-off-by: Hou Tao <houtao1@huawei.com> Acked-by: Jiri Olsa <jolsa@kernel.org>
Upstream branch: 211bf9c |
c05d40d
to
4ec0984
Compare
f1b85e0
to
180045d
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=889522 irrelevant now. Closing PR. |
Pull request for series with
subject: Two tiny fixes for btf record
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=889522