Re: [PATCH v2 3/3] bpf: cgroup: restore sysctl new-value replacement
From: bot+bpf-ci
Date: Thu May 28 2026 - 23:59:59 EST
> diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c
> index a0b5f8cd8b10..3f06e2270f5c 100644
> --- a/kernel/bpf/cgroup.c
> +++ b/kernel/bpf/cgroup.c
> @@ -1935,7 +1935,7 @@ int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head,
>
> kfree(ctx.cur_val);
>
> - if (ret == 1 && ctx.new_updated) {
> + if (!ret && ctx.new_updated) {
> kvfree(*buf);
> *buf = ctx.new_val;
> *pcount = ctx.new_len;
With the success check now testing !ret, does the kerneldoc above
__cgroup_bpf_run_filter_sysctl() still describe the right convention? It
currently reads:
* This function will return %-EPERM if an attached program is found and
* returned value != 1 during execution. In all other cases 0 is returned.
Since bpf_prog_run_array_cg() returns 0 on success rather than 1, should
that line say "returned value != 0" to match the new check?
This point was raised in v1 review but does not appear to have been
changed in v2.
Now for the Fixes: tag. The commit message states:
> Fixes: 4e63acdff864 ("bpf: Introduce bpf_sysctl_{get,set}_new_value helpers")
Is this the commit that actually introduced the problem? At 4e63acdff864
the runner was BPF_PROG_RUN_ARRAY, which returned 1 on success, so the
ret == 1 check was correct at that time.
There appear to be two candidate commits that changed the return
convention to 0-on-success and left the ret == 1 check stale:
c4dcfdd406aa ("bpf: Move getsockopt retval to struct bpf_cg_run_ctx")
f10d05966196 ("bpf: Make BPF_PROG_RUN_ARRAY return -err instead of allow boolean")
Should the Fixes: tag point at one of these instead of 4e63acdff864?
The f10d05966196 suggestion was raised by the bpf-ci review in v1 but the
tag was unchanged in v2.
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/26616337824