diff options
| author | Sean Christopherson <seanjc@google.com> | 2026-09-02 17:16:19 -0700 |
|---|---|---|
| committer | Sean Christopherson <seanjc@google.com> | 2026-09-11 09:35:47 -0700 |
| commit | be3c6888e1ab29d1d2a36af224eaf7739985c414 (patch) | |
| tree | 1672caacaf002ccd60e4d1ec8452635aeff67b2f /tools/perf/scripts/python | |
| parent | ebb7027078965527d920360e7835a14eac6f835e (diff) | |
KVM: selftests: Account for kernel's off-by-one bug in NUMA node syscalls
Add and use MAXNODE_FOR_MASK() to compute the "correct" maxnode value that
is passed to various NUMA-related syscalls, e.g. get_mempolicy(), mbind(),
migrate_pages(), etc. In quotes, because the kernel has an undocumented,
longstanding off-by-one bug that requires userspace to specify the number
of bits plus one, i.e. the max node plus two.
The kernel bug has been known since 2007[*]:
: And this is I think the reason why we can't change this now. I assume
: numactl allocates 1024 bits (0 to 1023) and passes 1025 to make sure all
: 1024 bits are processed. If we change it now, kernel will process 1025
: bits (0 to 1024) and overflow the allocated bitmask. If it happens to be
: at the border of mmaped vma, it's a segfault...
But unfortunately the manpages haven't yet been updated, e.g.
: The maxnode argument is the maximum node number in the bit mask plus one
Link: https://lore.kernel.org/all/63ccc890-fd57-118b-5997-e0259f507d28@suse.cz[*]
Reviewed-by: Shivank Garg <shivankg@amd.com>
Link: https://patch.msgid.link/20260903001625.2792367-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
