linux-stable/tools/testing
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
..
crypto/chacha20-s390
cxl Merge branch 'for-6.7/cxl-rch-eh' into cxl/next 2023-10-31 10:59:00 -07:00
fault-injection
ktest
kunit sound updates for 6.6-rc1 2023-08-30 13:45:05 -07:00
memblock memblock tests: fix warning ‘struct seq_file’ declared inside parameter list 2023-09-14 10:51:28 +03:00
nvdimm testing: nvdimm: make struct class structures constant 2023-10-11 09:04:28 -07:00
radix-tree maple_tree: do not preallocate nodes for slot stores 2023-12-20 13:46:19 -08:00
scatterlist
selftests selftests: secretmem: floor the memory size to the multiple of page_size 2023-12-20 13:46:19 -08:00
vsock vsock/test: fix SEQPACKET message bounds test 2023-11-23 08:49:16 -08:00