From: Andi Kleen <andi@firstfloor.org>
To: Feng Tang <feng.tang@linux.alibaba.com>
Cc: sashiko-reviews@lists.linux.dev, bpf@vger.kernel.org
Subject: Re: [PATCH] selftests: net: reuseport_bpf_numa: consider cpuless numa node
Date: Fri, 31 Jul 2026 12:59:23 -0700 [thread overview]
Message-ID: <amz-m8cu0lYc8LzR@firstfloor.org> (raw)
In-Reply-To: <amv0DwQoeESq2Cp7@U-2FWC9VHC-2323.local>
> > Will this crash if numa_allocate_cpumask() fails to allocate memory?
> >
> > It looks like cpumask could be NULL here, which is passed directly to
> > numa_node_to_cpus() and numa_bitmask_weight() without validation.
>
> Good point.
>
> If the allocation fail, will return 'false' to let the code go the
> original flow.
While it's technically true, checking for out of memory in ring 3
(or at least other checking than exit(1) on error) is usually
useless. Most of the time when this would fail you're as likely
to just get killed by the OOM killer, as well as the harness that
called you. Maybe it could happen without that with some very tight
ulimit settings, but with that not much else will work anyways.
Also these paths are basically never exercised so likely buggy
when non trivial.
For libnuma if you set numa_exit_on_error to 1 it will always
exiting after printing an error. That includes the allocation
functions.
> > > + ret = true;
> >
> > [Severity: Medium]
> > What happens if numa_node_to_cpus() fails?
> >
> > It can return a negative error value, leaving the cpumask unmodified with
> > zero bits set. Because the return value is not checked,
> > numa_bitmask_weight(cpumask) will evaluate to 0. Does this cause the function
> > to return true and silently skip testing on nodes where an error occurs,
> > rather than reporting the infrastructure issue?
>
> From the code logic (with above change), the 'node_id' and 'cpumask' have
> both been validated, and this numa_node_to_cpus() is very unlikely to fail
> here upon reading libnuma source code.
Yes it's unlikely to fail.
-Andi
prev parent reply other threads:[~2026-07-31 20:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 11:30 [PATCH] selftests: net: reuseport_bpf_numa: consider cpuless numa node Feng Tang
2026-07-30 11:37 ` sashiko-bot
2026-07-31 1:02 ` Feng Tang
2026-07-31 19:59 ` Andi Kleen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=amz-m8cu0lYc8LzR@firstfloor.org \
--to=andi@firstfloor.org \
--cc=bpf@vger.kernel.org \
--cc=feng.tang@linux.alibaba.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.