linux/tools/testing/selftests
Mike Kravetz fda153c89a selftests/memfd: clean up mapping in mfd_fail_write
Running the memfd script ./run_hugetlbfs_test.sh will often end in error
as follows:

    memfd-hugetlb: CREATE
    memfd-hugetlb: BASIC
    memfd-hugetlb: SEAL-WRITE
    memfd-hugetlb: SEAL-FUTURE-WRITE
    memfd-hugetlb: SEAL-SHRINK
    fallocate(ALLOC) failed: No space left on device
    ./run_hugetlbfs_test.sh: line 60: 166855 Aborted                 (core dumped) ./memfd_test hugetlbfs
    opening: ./mnt/memfd
    fuse: DONE

If no hugetlb pages have been preallocated, run_hugetlbfs_test.sh will
allocate 'just enough' pages to run the test.  In the SEAL-FUTURE-WRITE
test the mfd_fail_write routine maps the file, but does not unmap.  As a
result, two hugetlb pages remain reserved for the mapping.  When the
fallocate call in the SEAL-SHRINK test attempts allocate all hugetlb
pages, it is short by the two reserved pages.

Fix by making sure to unmap in mfd_fail_write.

Link: https://lkml.kernel.org/r/20220219004340.56478-1-mike.kravetz@oracle.com
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-02-26 09:51:17 -08:00
..
alsa
arm64
bpf selftests: bpf: Check bpf_msg_push_data return value 2022-02-15 10:10:31 -08:00
breakpoints
capabilities
cgroup
clone3 selftests: fixup build warnings in pidfd / clone3 tests 2022-02-04 13:07:07 -07:00
core
cpu-hotplug
cpufreq
damon
dma
dmabuf-heaps
drivers
efivarfs
exec selftests/exec: Add non-regular to TEST_GEN_PROGS 2022-02-11 10:18:13 -07:00
filesystems
firmware
fpu
ftrace selftests/ftrace: Do not trace do_softirq because of PREEMPT_RT 2022-02-14 13:28:17 -07:00
futex
gpio
ia64
intel_pstate
ipc
ir selftests/ir: fix build with ancient kernel headers 2022-02-04 13:14:41 -07:00
kcmp
kexec
kmod
kselftest
kvm selftests: kvm: Remove absent target file 2022-02-11 12:53:01 -05:00
landlock
lib
livepatch
lkdtm
locking
media_tests
membarrier
memfd selftests/memfd: clean up mapping in mfd_fail_write 2022-02-26 09:51:17 -08:00
memory-hotplug
mincore
mount
mount_setattr tests: fix idmapped mount_setattr test 2022-02-11 09:08:20 +01:00
move_mount_set_group
mqueue
nci
net selftests: mptcp: be more conservative with cookie MPJ limits 2022-02-19 12:28:01 +00:00
netfilter selftests: netfilter: disable rp_filter on router 2022-02-11 00:01:04 +01:00
nsfs
ntb
openat2
perf_events selftests/perf_events: Test modification of perf_event_attr::sig_data 2022-02-02 13:11:40 +01:00
pid_namespace
pidfd selftests: fixup build warnings in pidfd / clone3 tests 2022-02-04 13:07:07 -07:00
powerpc
prctl
proc
pstore
ptp
ptrace
rcutorture
resctrl
rlimits
rseq
rtc
safesetid
sched
seccomp selftests/seccomp: Fix seccomp failure by adding missing headers 2022-02-14 11:14:38 -07:00
sgx
sigaltstack
size
sparc64
splice
static_keys
sync
syscall_user_dispatch
sysctl
tc-testing
timens
timers
tmpfs
tpm2
uevent
user
vDSO kselftest: Fix vdso_test_abi return status 2022-01-31 10:35:14 -07:00
vm selftest/vm: fix map_fixed_noreplace test failure 2022-02-26 09:51:17 -08:00
watchdog
wireguard
x86
zram
.gitignore
gen_kselftest_tar.sh
kselftest_deps.sh
kselftest_harness.h
kselftest_install.sh
kselftest_module.h
kselftest.h
lib.mk
Makefile
run_kselftest.sh