All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] bpf: cgroup: fix sysctl new-value handling in __cgroup_bpf_run_filter_sysctl
@ 2026-05-26 13:10 Dawei Feng
  2026-05-26 13:10 ` [PATCH 1/2] bpf: cgroup: fix sysctl new value replacement Dawei Feng
  2026-05-26 13:10 ` [PATCH 2/2] bpf: cgroup: Use kvfree instead of kfree in __cgroup_bpf_run_filter_sysctl Dawei Feng
  0 siblings, 2 replies; 8+ messages in thread
From: Dawei Feng @ 2026-05-26 13:10 UTC (permalink / raw)
  To: martin.lau
  Cc: ast, daniel, andrii, eddyz87, memxor, song, yonghong.song, jolsa,
	kees, joel.granados, bpf, linux-kernel, linux-fsdevel, jianhao.xu,
	Dawei Feng

This series fixes two bugs in __cgroup_bpf_run_filter_sysctl().

Patch 1 restores cgroup/sysctl new-value replacement after
4e63acdff864 ("bpf: Introduce bpf_sysctl_{get,set}_new_value helpers")
changed the success return value to 0 but left the replacement path
checking for ret == 1.

Patch 2 fixes the buffer free primitive for that same path. The sysctl
write buffer originates from proc_sys_call_handler(), which allocates it
with kvzalloc(), so freeing it with kfree() is incorrect when the
allocation falls back to vmalloc().

Patch 1 validated with a cgroup/sysctl BPF reproducer overriding a target
sysctl write.
Patch 2 reproduced on a v7.1-rc4 QEMU x86_64 guest with KASAN and
CONFIG_FAILSLAB. After applying the fix, rerunning the reproducer no
longer triggers the Oops.

Dawei Feng (2):
  bpf: cgroup: fix sysctl new value replacement
  bpf: cgroup: Use kvfree instead of kfree in
    __cgroup_bpf_run_filter_sysctl

 kernel/bpf/cgroup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.34.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-05-27 14:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-26 13:10 [PATCH 0/2] bpf: cgroup: fix sysctl new-value handling in __cgroup_bpf_run_filter_sysctl Dawei Feng
2026-05-26 13:10 ` [PATCH 1/2] bpf: cgroup: fix sysctl new value replacement Dawei Feng
2026-05-26 13:55   ` bot+bpf-ci
2026-05-26 14:03   ` sashiko-bot
2026-05-26 22:16   ` Emil Tsalapatis
2026-05-27 14:51     ` Dawei Feng
2026-05-26 13:10 ` [PATCH 2/2] bpf: cgroup: Use kvfree instead of kfree in __cgroup_bpf_run_filter_sysctl Dawei Feng
2026-05-26 22:24   ` Emil Tsalapatis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.