From: Bradley Morgan <brads@mainlining.org>
To: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: "Bradley Morgan" <brads@mainlining.org>,
"Darren Hart" <dvhart@infradead.org>,
"Davidlohr Bueso" <dave@stgolabs.net>,
"André Almeida" <andrealmeid@igalia.com>,
"Shuah Khan" <shuah@kernel.org>, "Wake Liu" <wakel@google.com>,
"Arnd Bergmann" <arnd@arndb.de>,
linux-perf-users@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 0/3] two small fixes out of kernel/sys.c
Date: Thu, 5 Nov 2026 00:31:26 +0000 [thread overview]
Message-ID: <20261105003129.3130709-1-brads@mainlining.org> (raw)
Two unrelated things that came out of reading kernel/sys.c line by line.
They are in one series only because they came from the same read, patch 3
stands on its own and can be taken without the other two.
Patches 1 and 2 have to go in that order. PR_FUTEX_HASH is the only case
in the prctl switch that does not check the args it does not use, arg5
does not even reach futex_hash_prctl(). Patch 2 adds the checks. Patch 1
goes first because prctl() is variadic, so the two callers under tools/
leave the args they do not pass as whatever those registers hold, and
patch 2 would fail them at random without it.
Patch 3 is compat_sysinfo(). It scales the 64 bit memory values down so
they fit the 32 bit fields, and stops when the unit reaches PAGE_SIZE.
But do_sysinfo() hands it bytes with mem_unit at 1, so on a box with
enough ram it stops far too early and drops the high bits. 16 TiB reads
back as 0 and 17 TiB reads back as 1 TiB. The loop only runs longer on
the path that was already wrong, nothing that works today changes.
Tested on ppc64.
Bradley Morgan (3):
tools: pass the unused prctl() args explicitly for PR_FUTEX_HASH
futex: reject the unused PR_FUTEX_HASH arguments
compat: make compat_sysinfo() scale far enough to actually fit
include/linux/futex.h | 6 ++--
kernel/futex/core.c | 7 +++--
kernel/sys.c | 28 +++++++++----------
tools/perf/bench/futex.c | 4 +--
.../futex/functional/futex_priv_hash.c | 4 +--
5 files changed, 26 insertions(+), 23 deletions(-)
--
2.53.0
next reply other threads:[~2026-11-05 0:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 0:31 Bradley Morgan [this message]
2026-11-05 0:31 ` [PATCH 1/3] tools: pass the unused prctl() args explicitly for PR_FUTEX_HASH Bradley Morgan
2026-11-05 0:31 ` [PATCH 2/3] futex: reject the unused PR_FUTEX_HASH arguments Bradley Morgan
2026-11-05 0:31 ` [PATCH 3/3] compat: make compat_sysinfo() scale far enough to actually fit Bradley Morgan
2026-11-05 7:25 ` Arnd Bergmann
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=20261105003129.3130709-1-brads@mainlining.org \
--to=brads@mainlining.org \
--cc=acme@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=andrealmeid@igalia.com \
--cc=arnd@arndb.de \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=shuah@kernel.org \
--cc=tglx@kernel.org \
--cc=wakel@google.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®