bpf, arena: keep range tree consistent on kmalloc_nolock failure - #8636
bpf, arena: keep range tree consistent on kmalloc_nolock failure#8636kernel-patches-daemon-bpf-rc[bot] wants to merge 3 commits into
Conversation
|
Upstream branch: 11c1e83 |
28abc40 to
1824cf2
Compare
|
Upstream branch: 7d008cd |
30b8a3d to
53f96d9
Compare
1824cf2 to
6ac2541
Compare
|
Upstream branch: 8c7f55d |
53f96d9 to
18a63a5
Compare
6ac2541 to
bbe1ae8
Compare
|
Upstream branch: 41c129f |
18a63a5 to
25fe22c
Compare
bbe1ae8 to
dd2acb0
Compare
|
Upstream branch: 2b1f9f6 |
25fe22c to
fd637d7
Compare
dd2acb0 to
75f1c0e
Compare
|
Upstream branch: e1d9b82 |
fd637d7 to
a2092c9
Compare
75f1c0e to
f776207
Compare
|
Upstream branch: 51476f6 |
a2092c9 to
6acd310
Compare
f776207 to
b882df0
Compare
|
Upstream branch: 8b365b3 |
6acd310 to
b31cff6
Compare
b882df0 to
818432c
Compare
|
Upstream branch: d114bb9 |
range_tree_clear() modifies the range tree before allocating the node needed to split a range. If the allocation fails, the function returns -ENOMEM with part of the range already removed from the tree, leaving those arena slots permanently unavailable. Pre-allocate the node before modifying the tree so a failure leaves it unmodified. Fixes: b795379 ("bpf: Introduce range_tree data structure and use it in bpf arena") Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>
range_tree_set() clears overlapping ranges before allocating the node for the new range. If the allocation fails, the function returns -ENOMEM with the cleared range already removed from the tree, leaving those arena slots permanently unavailable. Allocate only when the range has no adjacent free range on either side; this is known before the clear, since any range covering start - 1 or last + 1 survives it as an adjacent piece. A failure therefore still leaves the tree unmodified. Fixes: b795379 ("bpf: Introduce range_tree data structure and use it in bpf arena") Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>
…_free_worker arena_free_pages() and arena_free_worker() ignore range_tree_set() errors and proceed to clear PTEs and free pages, even though the range tree still considers the range allocated. The range then becomes permanently unavailable. Check the return value: in arena_free_pages() abort the free on error; in arena_free_worker() move range_tree_set() before PTE clearing and skip the span on error. Fixes: b795379 ("bpf: Introduce range_tree data structure and use it in bpf arena") Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>
b31cff6 to
a59e484
Compare
Pull request for series with
subject: bpf, arena: keep range tree consistent on kmalloc_nolock failure
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1141108