lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <f02212613904023c5e4f900ee1efdb15e8266c3c4f7d0572db4f515da3a700e5@mail.kernel.org>
Date: Fri, 23 Jan 2026 09:29:45 +0000 (UTC)
From: bot+bpf-ci@...nel.org
To: hui.zhu@...ux.dev,akpm@...ux-foundation.org,hannes@...xchg.org,mhocko@...nel.org,roman.gushchin@...ux.dev,shakeel.butt@...ux.dev,muchun.song@...ux.dev,ast@...nel.org,daniel@...earbox.net,andrii@...nel.org,martin.lau@...ux.dev,eddyz87@...il.com,song@...nel.org,yonghong.song@...ux.dev,john.fastabend@...il.com,kpsingh@...nel.org,sdf@...ichev.me,haoluo@...gle.com,jolsa@...nel.org,shuah@...nel.org,peterz@...radead.org,ojeda@...nel.org,nathan@...nel.org,kees@...nel.org,tj@...nel.org,jeffxu@...omium.org,mkoutny@...e.com,kernel@...rr.cc,brauner@...nel.org,rdunlap@...radead.org,brgerst@...il.com,masahiroy@...nel.org,davem@...emloft.net,kuba@...nel.org,hawk@...nel.org,inwardvessel@...il.com,willemb@...gle.com,kerneljasonxing@...il.com,paul.chaignon@...il.com,a.s.protopopov@...il.com,ameryhung@...il.com,chenridong@...weicloud.com,lance.yang@...ux.dev,jiayuan.chen@...ux.dev,linux-kernel@...r.kernel.org,linux-mm@...ck.org,cgroups@...r.kernel.org,bpf@...r.kernel.org,netdev@...r.kernel.org,linu
 x-kselftest@...r.kernel.org
Cc: zhuhui@...inos.cn,geliang@...nel.org,ast@...nel.org,andrii@...nel.org,daniel@...earbox.net,martin.lau@...nel.org,eddyz87@...il.com,yonghong.song@...ux.dev,clm@...a.com,ihor.solodrai@...ux.dev
Subject: Re: [RFC PATCH bpf-next v3 08/12] mm: memcontrol: Add BPF struct_ops for memory controller

> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index f3b8c71870d8..d71e86b85ba7 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h

[ ... ]

> +#else /* CONFIG_BPF_SYSCALL */
> +
> +static inline unsigned long
> +bpf_memcg_get_high_delay(struct mem_cgroup *memcg) { return 0 }
> +static inline bpf_memcg_below_low(struct mem_cgroup *memcg) { return false }
> +static inline bpf_memcg_below_min(struct mem_cgroup *memcg) { return false }
                 ^^^^^^^^^^^^^^^^^^^^

These stub functions appear to have syntax issues that would prevent
compilation when CONFIG_BPF_SYSCALL is disabled:

1. bpf_memcg_get_high_delay() is missing a semicolon after "return 0"
2. bpf_memcg_below_low() is missing the "bool" return type
3. bpf_memcg_below_min() is missing the "bool" return type

Should these be:

  static inline unsigned long
  bpf_memcg_get_high_delay(struct mem_cgroup *memcg) { return 0; }
  static inline bool bpf_memcg_below_low(struct mem_cgroup *memcg) { return false; }
  static inline bool bpf_memcg_below_min(struct mem_cgroup *memcg) { return false; }

> +static inline void memcontrol_bpf_online(struct mem_cgroup *memcg) { }
> +static inline void memcontrol_bpf_offline(struct mem_cgroup *memcg) { }
> +
> +#endif /* CONFIG_BPF_SYSCALL */

[ ... ]

> diff --git a/mm/bpf_memcontrol.c b/mm/bpf_memcontrol.c
> index 716df49d7647..415e3c59b6a6 100644
> --- a/mm/bpf_memcontrol.c
> +++ b/mm/bpf_memcontrol.c

[ ... ]

> +static void clean_memcg_bpf_ops(struct mem_cgroup *memcg,
> +				struct memcg_bpf_ops *ops)
> +{
> +	struct mem_cgroup *iter = NULL;
> +
> +	while ((iter = mem_cgroup_iter(memcg, iter, NULL))) {
> +		if (ops) {
> +			if (!WARN_ON(READ_ONCE(memcg->bpf_ops) != ops))
> +				WRITE_ONCE(memcg->bpf_ops, NULL);
                                         ^^^^^

When ops is non-NULL, this code checks and writes to memcg->bpf_ops, but
should it be using iter->bpf_ops instead? The else branch at the bottom
correctly uses iter. As written, when called from bpf_memcg_ops_unreg()
with a non-NULL ops argument, this only clears the root cgroup's bpf_ops
pointer while leaving all descendant cgroups with stale pointers to the
ops structure that will be freed after synchronize_srcu().

> +		} else
> +			WRITE_ONCE(iter->bpf_ops, NULL);
> +	}
> +}

[ ... ]

> +static int __init bpf_memcontrol_init(void)
> +{
> +	int err, err2;
> +
> +	err = register_btf_kfunc_id_set(BPF_PROG_TYPE_UNSPEC,
> +					&bpf_memcontrol_kfunc_set);
> +	if (err)
> +		pr_warn("error while registering bpf memcontrol kfuncs: %d", err);
> +
> +	err2 = register_bpf_struct_ops(&bpf_memcg_bpf_ops, memcg_bpf_ops);
> +	if (err)
            ^^^

The condition here checks err but prints err2. Should this be "if (err2)"
to log when the struct_ops registration fails?

> +		pr_warn("error while registering memcontrol bpf ops: %d", err2);
> +
> +	return err ? err : err2;
> +}
> +late_initcall(bpf_memcontrol_init);

Note: The clean_memcg_bpf_ops() issue appears to be addressed in a later
commit in this series (90eaa9cd0346 "mm/bpf: Add BPF_F_ALLOW_OVERRIDE
support for memcg_bpf_ops") which removes and rewrites the function
entirely. However, the syntax errors in the stubs and the error check
typo in bpf_memcontrol_init() do not appear to be fixed in the series.


---
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/21280790825

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ