linux-stable/tools
Muhammad Usama Anjum 0aac13add2 selftests: secretmem: floor the memory size to the multiple of page_size
The "locked-in-memory size" limit per process can be non-multiple of
page_size.  The mmap() fails if we try to allocate locked-in-memory with
same size as the allowed limit if it isn't multiple of the page_size
because mmap() rounds off the memory size to be allocated to next multiple
of page_size.

Fix this by flooring the length to be allocated with mmap() to the
previous multiple of the page_size.

This was getting triggered on KernelCI regularly because of different
ulimit settings which wasn't multiple of the page_size.  Find logs
here: https://linux.kernelci.org/test/plan/id/657654bd8e81e654fae13532/
The bug in was present from the time test was first added.

Link: https://lkml.kernel.org/r/20231214101931.1155586-1-usama.anjum@collabora.com
Fixes: 76fe17ef58 ("secretmem: test: add basic selftest for memfd_secret(2)")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Reported-by: "kernelci.org bot" <bot@kernelci.org>
Closes: https://linux.kernelci.org/test/plan/id/657654bd8e81e654fae13532/
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-12-20 13:46:19 -08:00
..
accounting
arch perf tools fixes for v6.7: 1st batch 2023-12-01 10:17:16 +09:00
bootconfig
bpf
build
certs
cgroup
counter
crypto/ccp
debugging
edid
firewire
firmware
gpio
hv hv/hv_kvp_daemon: Some small fixes for handling NM keyfiles 2023-11-10 23:27:46 +00:00
iio
include tools: Disable __packed attribute compiler warning due to -Werror=attributes 2023-11-22 12:23:27 -08:00
kvm/kvm_stat
laptop
leds
lib perf tools changes for v6.7 2023-11-03 08:17:38 -10:00
memory-model
mm
net/ynl tools: ynl-gen: always construct struct ynl_req_state 2023-11-29 08:44:02 -08:00
objtool
pci
pcmcia
perf perf build: Ensure sysreg-defs Makefile respects output dir 2023-11-22 11:17:53 -08:00
power PM: tools: Fix sleepgraph syntax error 2023-11-20 17:59:58 +01:00
rcu
scripts
spi
testing selftests: secretmem: floor the memory size to the multiple of page_size 2023-12-20 13:46:19 -08:00
thermal
time
tracing
usb
verification
virtio
wmi
workqueue
Makefile