mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
io_uring/bpf_filter: mark source as COW when cloning filters
io_bpf_filter_clone() shares the filter table between source and
destination and marks the destination as needing a copy before it can be
modified, but leaves the source as is. Registering another filter on the
source then modifies the shared table in place, and the change shows up
in everything that cloned it.
Mark the source as COW as well.
Fixes: ed82f35b92 ("io_uring: allow registration of per-task restrictions")
Assisted-by: LLM
Signed-off-by: Hui Peng <[email protected]>
Link: https://patch.msgid.link/[email protected]
[axboe: edited patch and commit message]
Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
@@ -253,6 +253,7 @@ void io_bpf_filter_clone(struct io_restriction *dst, struct io_restriction *src)
|
||||
* If the src filter is going away, just ignore it.
|
||||
*/
|
||||
if (refcount_inc_not_zero(&src->bpf_filters->refs)) {
|
||||
src->bpf_filters_cow = true;
|
||||
dst->bpf_filters = src->bpf_filters;
|
||||
dst->bpf_filters_cow = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user