Skip to content

two small fixes out of kernel/sys.c

Bradley Morgan linux-kselftest linux-perf-users lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3tools: pass the unused prctl() args explicitly for PR_FUTEX_HASHtools/perf/bench/futex.c tools/testing/selftests/futex/functional/futex_priv_hash.c+4 -40 replies
2/3futex: reject the unused PR_FUTEX_HASH argumentsinclude/linux/futex.h kernel/futex/core.c kernel/sys.c+10 -51 reply
3/3compat: make compat_sysinfo() scale far enough to actually fitkernel/sys.c+12 -143 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchArnd Bergmann
1/3
2/3
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] two small fixes out of kernel/sys.c

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(-)
Signature · 1 line
2.53.0