1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/tools/testing/selftests
Zenghui Yu 309505dd56 KVM: selftests: Fix mapping length truncation in m{,un}map()
max_mem_slots is now declared as uint32_t. The result of (0x200000 * 32767)
is unexpectedly truncated to be 0xffe00000, whilst we actually need to
allocate about, 63GB. Cast max_mem_slots to size_t in both mmap() and
munmap() to fix the length truncation.

We'll otherwise see the failure on arm64 thanks to the access_ok() checking
in __kvm_set_memory_region(), as the unmapped VA happen to go beyond the
task's allowed address space.

 # ./set_memory_region_test
Allowed number of memory slots: 32767
Adding slots 0..32766, each memory region with 2048K size
==== Test Assertion Failure ====
  set_memory_region_test.c:391: ret == 0
  pid=94861 tid=94861 errno=22 - Invalid argument
     1	0x00000000004015a7: test_add_max_memory_regions at set_memory_region_test.c:389
     2	 (inlined by) main at set_memory_region_test.c:426
     3	0x0000ffffb8e67bdf: ?? ??:0
     4	0x00000000004016db: _start at :?
  KVM_SET_USER_MEMORY_REGION IOCTL failed,
  rc: -1 errno: 22 slot: 2615

Fixes: 3bf0fcd754 ("KVM: selftests: Speed up set_memory_region_test")
Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
Message-Id: <20210624070931.565-1-yuzenghui@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-06-24 04:04:38 -04:00
..
arm64 kselftest/arm64: Add missing stddef.h include to BTI tests 2021-05-10 10:19:01 +01:00
bpf bpf, selftests: Adjust few selftest outcomes wrt unreachable code 2021-06-14 23:06:38 +02:00
breakpoints selftests: breakpoints: Use correct error messages in breakpoint_test_arm64.c 2021-02-08 17:04:41 -07:00
capabilities .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
cgroup kselftests: cgroup: update kmem test for new vmstat implementation 2021-04-30 11:20:38 -07:00
clone3 selftests/clone3: Fix build error 2020-12-07 14:34:55 -07:00
core selftests/core: add regression test for CLOSE_RANGE_UNSHARE | CLOSE_RANGE_CLOEXEC 2020-12-19 16:23:19 +01:00
cpu-hotplug
cpufreq
dma dma-mapping: benchmark: Add support for multi-pages map/unmap 2021-04-02 16:41:08 +02:00
dmabuf-heaps kselftests: dmabuf-heaps: Add extra checking that allocated buffers are zeroed 2021-02-08 16:25:53 -07:00
drivers selftests: mlxsw: Fix mausezahn invocation in ERSPAN scale test 2021-04-23 14:01:28 -07:00
efivarfs .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
exec tools/testing/selftests/exec: fix link error 2021-05-22 15:09:07 -10:00
filesystems kselftest: introduce new epoll test case 2021-05-06 19:24:13 -07:00
firmware firmware_loader: Remove unnecessary conversion to bool 2021-03-23 14:51:50 +01:00
fpu selftests/fpu: Add an FPU selftest 2020-06-29 10:02:23 +02:00
ftrace selftests/ftrace: Add '!event' synthetic event syntax check 2021-02-11 16:22:32 -05:00
futex .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
gpio selftests: gpio: update .gitignore 2021-03-08 11:59:16 +01:00
ia64 .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
intel_pstate selftests: intel_pstate: ftime() is deprecated 2020-11-10 14:41:32 -07:00
ipc selftests/ipc: remove unneeded semicolon 2021-02-08 16:32:43 -07:00
ir .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
kcmp .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
kexec
kmod selftests: kmod: use variable NAME in kmod_test_0001() 2020-08-12 10:58:01 -07:00
kselftest tweewide: Fix most Shebang lines 2020-12-08 23:30:04 +09:00
kvm KVM: selftests: Fix mapping length truncation in m{,un}map() 2021-06-24 04:04:38 -04:00
landlock landlock: Enable user space to infer supported features 2021-04-22 12:22:11 -07:00
lib lib: make a test module with set/clear bit 2020-06-04 19:06:25 -07:00
livepatch selftests/livepatch: Do not check order when using "comm" for dmesg checking 2020-08-27 15:27:24 +02:00
lkdtm lkdtm: Add REPORT_STACK for checking stack offsets 2021-04-08 14:05:20 +02:00
locking
media_tests .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
membarrier .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
memfd selftests/memfd: Fix implicit declaration warnings 2020-11-10 14:42:04 -07:00
memory-hotplug
mincore selftests: remove duplicate include 2021-05-07 00:26:33 -07:00
mount selftests: mount: add nosymfollow tests 2020-08-27 16:06:47 -04:00
mount_setattr tests: add mount_setattr() selftests 2021-01-24 14:43:45 +01:00
mqueue .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
nci selftests: Add .gitignore for nci test suite 2021-05-20 12:51:24 -07:00
net selftests/net: Add icmp.sh for testing ICMP dummy address responses 2021-06-18 12:13:24 -07:00
netfilter selftests: netfilter: add fib test case 2021-06-09 21:06:35 +02:00
nsfs tools/testing: Replace zero-length array with flexible-array 2020-05-08 09:42:14 -06:00
ntb NTB: ntb_test: Fix bug when counting remote files 2020-06-05 20:02:09 -04:00
openat2 selftests: openat2: add RESOLVE_ conflict test 2020-12-03 10:16:28 +01:00
perf_events signal: Deliver all of the siginfo perf data in _perf 2021-05-18 16:20:54 -05:00
pid_namespace selftests: Remove unneeded selftest API headers 2020-07-06 15:59:07 -06:00
pidfd selftests: pidfd: drop needless linux/kcmp.h inclusion in pidfd_setns_test.c 2020-10-27 17:04:01 -06:00
powerpc Merge branch 'akpm' (patches from Andrew) 2021-05-07 00:34:51 -07:00
prctl .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
proc proc: add .gitignore for proc-subset-pid selftest 2021-06-05 08:58:11 -07:00
pstore pstore/platform: Use backend name for console registration 2020-05-30 10:34:02 -07:00
ptp testptp: add new options for perout phase and pulse width 2020-07-20 18:04:59 -07:00
ptrace selftests: Add missing gitignore entries 2020-09-23 10:19:25 -06:00
rcutorture Merge branches 'bitmaprange.2021.03.08a', 'fixes.2021.03.15a', 'kvfree_rcu.2021.03.08a', 'mmdumpobj.2021.03.08a', 'nocb.2021.03.15a', 'poll.2021.03.24a', 'rt.2021.03.08a', 'tasks.2021.03.08a', 'torture.2021.03.08a' and 'torturescript.2021.03.22a' into HEAD 2021-03-24 17:20:18 -07:00
resctrl selftests/resctrl: Change a few printed messages 2021-04-07 16:37:49 -06:00
rseq rseq/selftests: Fix MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ build error under other arch. 2020-12-07 14:09:45 -07:00
rtc .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
safesetid .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
seccomp powerpc/64s/syscall: Use pt_regs.trap to distinguish syscall ABI difference between sc and scv syscalls 2021-05-21 00:58:03 +10:00
sgx x86/sgx: Expose SGX architectural definitions to the kernel 2021-04-06 09:43:41 +02:00
sigaltstack selftests: sigaltstack: do not use ksft_exit_skip after ksft_set_plan 2020-07-06 15:57:15 -06:00
size .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
sparc64 .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
splice selftests: splice: Check behavior of full and short splices 2020-08-07 10:50:11 -07:00
static_keys
sync selftests: sync_test: do not use ksft_exit_skip after ksft_set_plan 2020-07-06 15:57:28 -06:00
syscall_user_dispatch entry: Use different define for selector variable in SUD 2021-02-06 00:21:42 +01:00
sysctl linux-kselftest-5.8-rc1 2020-06-09 10:03:12 -07:00
tc-testing net/sched: fq_pie: re-factor fix for fq_pie endless loop 2021-05-23 17:16:09 -07:00
timens selftests/timens: Fix gettime_perf to work on powerpc 2021-04-21 22:52:32 +10:00
timers selftests/timers: Fix spelling mistake "clocksourc" -> "clocksource" 2021-03-26 11:37:17 -06:00
tmpfs .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
tpm2 selftests: tpm: upgrade TPM2 tests from Python 2 to Python 3 2020-07-06 14:20:35 -06:00
uevent selftests: Remove unneeded selftest API headers 2020-07-06 15:59:07 -06:00
user
vDSO selftests/vDSO: fix ABI selftest on riscv 2021-02-08 16:38:34 -07:00
vm selftests/vm: gup_test: test faulting in kernel, and verify pinnable pages 2021-05-05 11:27:26 -07:00
watchdog .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
wireguard wireguard: selftests: make sure rp_filter is disabled on vethc 2021-06-04 14:25:14 -07:00
x86 selftests/x86: Add a missing .note.GNU-stack section to thunks_32.S 2021-03-18 11:05:14 +01:00
zram
.gitignore SPDX patches for 5.7-rc1. 2020-04-03 13:12:26 -07:00
gen_kselftest_tar.sh selftests: introduce gen_tar Makefile target 2020-05-19 16:11:46 -06:00
kselftest.h linux-kselftest-5.9-rc1 2020-08-05 10:28:25 -07:00
kselftest_deps.sh selftests: remove obsolete gpio references from kselftest_deps.sh 2021-02-15 11:43:28 +01:00
kselftest_harness.h selftests: kselftest_harness.h: partially fix kernel-doc markups 2021-01-21 14:06:00 -07:00
kselftest_install.sh
kselftest_module.h kselftest: add support for skipped tests 2021-02-15 11:07:42 +01:00
lib.mk Networking changes for 5.13. 2021-04-29 11:57:23 -07:00
Makefile selftests/landlock: Add user space tests 2021-04-22 12:22:11 -07:00
run_kselftest.sh selftests/run_kselftest.sh: fix dry-run typo 2020-11-10 14:51:39 -07:00