-
Notifications
You must be signed in to change notification settings - Fork 148
bpf: Free special fields when update [lru_,]percpu_hash maps #10212
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
base: bpf-next_base
Are you sure you want to change the base?
Conversation
|
Upstream branch: 4cb4897 |
de0745f to
efe6edf
Compare
|
Upstream branch: b54a8e1 |
f834703 to
5ef8cc9
Compare
efe6edf to
f6af497
Compare
|
Upstream branch: b54a8e1 |
5ef8cc9 to
b742af3
Compare
f6af497 to
baaa336
Compare
|
Upstream branch: 6f1f4c1 |
b742af3 to
77c5f03
Compare
baaa336 to
b6555d5
Compare
|
Upstream branch: f8c67d8 |
77c5f03 to
dd2bdc7
Compare
|
Upstream branch: f8c67d8 |
As [lru_,]percpu_hash maps support BPF_KPTR_{REF,PERCPU}, missing
calls to 'bpf_obj_free_fields()' in 'pcpu_copy_value()' could cause the
memory referenced by BPF_KPTR_{REF,PERCPU} fields to be held until the
map gets freed.
Fix this by calling 'bpf_obj_free_fields()' after
'copy_map_value[,_long]()' in 'pcpu_copy_value()'.
Fixes: 65334e6 ("bpf: Support kptrs in percpu hashmap and percpu LRU hashmap")
Signed-off-by: Leon Hwang <leon.hwang@linux.dev>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
…ate [lru_,]percpu_hash maps Add test to verify that updating [lru_,]percpu_hash maps decrements refcount when BPF_KPTR_REF objects are involved. The tests perform the following steps: 1. Call update_elem() to insert an initial value. 2. Use bpf_refcount_acquire() to increment the refcount. 3. Store the node pointer in the map value. 4. Add the node to a linked list. 5. Probe-read the refcount and verify it is *2*. 6. Call update_elem() again to trigger refcount decrement. 7. Probe-read the refcount and verify it is *1*. Signed-off-by: Leon Hwang <leon.hwang@linux.dev> Acked-by: Yonghong Song <yonghong.song@linux.dev>
dd2bdc7 to
6a3651e
Compare
Pull request for series with
subject: bpf: Free special fields when update [lru_,]percpu_hash maps
version: 6
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1019940