alistair23-linux/tools/testing/selftests
Andy Lutomirski 8bb2610bc4 x86/entry/64/compat: Preserve r8-r11 in int $0x80
32-bit user code that uses int $80 doesn't care about r8-r11.  There is,
however, some 64-bit user code that intentionally uses int $0x80 to invoke
32-bit system calls.  From what I've seen, basically all such code assumes
that r8-r15 are all preserved, but the kernel clobbers r8-r11.  Since I
doubt that there's any code that depends on int $0x80 zeroing r8-r11,
change the kernel to preserve them.

I suspect that very little user code is broken by the old clobber, since
r8-r11 are only rarely allocated by gcc, and they're clobbered by function
calls, so they only way we'd see a problem is if the same function that
invokes int $0x80 also spills something important to one of these
registers.

The current behavior seems to date back to the historical commit
"[PATCH] x86-64 merge for 2.6.4".  Before that, all regs were
preserved.  I can't find any explanation of why this change was made.

Update the test_syscall_vdso_32 testcase as well to verify the new
behavior, and it strengthens the test to make sure that the kernel doesn't
accidentally permute r8..r15.

Suggested-by: Denys Vlasenko <dvlasenk@redhat.com>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Link: https://lkml.kernel.org/r/d4c4d9985fbe64f8c9e19291886453914b48caee.1523975710.git.luto@kernel.org
2018-04-27 17:07:58 +02:00
..
android selftests/android/ion: Makefile: fix build error 2018-03-21 10:40:04 -06:00
bpf selftests/bpf: Selftest for sys_bind post-hooks. 2018-03-31 02:16:40 +02:00
breakpoints
capabilities
cpu-hotplug
cpufreq
drivers/gpu
efivarfs
exec
filesystems selftests/filesystems: Don't run dnotify_test by default 2018-04-17 17:01:16 -06:00
firmware test_firmware: modify custom fallback tests to use unique files 2018-03-20 09:28:47 +01:00
ftrace New features: 2018-04-10 11:27:30 -07:00
futex selftests: futex Makefile add top level TAP header echo to RUN_TESTS 2018-03-07 08:33:35 -07:00
gpio
ia64
intel_pstate selftests/intel_pstate: Fix build rule for x86 2018-04-02 11:55:47 -06:00
ipc
kcmp
kmod
kvm kvm: selftests: add vmx_tsc_adjust_test 2018-04-16 17:50:23 +02:00
lib
locking
media_tests
membarrier
memfd Merge tag 'linux-kselftest-4.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest 2018-02-28 13:38:52 -08:00
memory-hotplug selftests: memory-hotplug: fix emit_tests regression 2018-03-02 10:12:59 -07:00
mount
mqueue
net selftests: net: add in_netns.sh to TEST_PROGS 2018-04-12 21:52:47 -04:00
networking/timestamping selftests/txtimestamp: Add more configurable parameters 2018-03-16 15:05:57 -04:00
nsfs
ntb
powerpc selftests/powerpc: Fix copyloops build since Power4 assembler change 2018-04-03 21:50:09 +10:00
prctl
proc proc: fixup copyright sign 2018-04-12 20:52:25 -07:00
pstore
ptp
ptrace
rcutorture
seccomp selftests/seccomp: Allow get_metadata to XFAIL 2018-03-21 10:42:46 -06:00
sigaltstack
size
splice
static_keys
sync
sysctl
tc-testing tc-testing: Add newline when writing test case files 2018-03-30 14:22:51 -04:00
timers
user
vDSO
vm selftests/vm/run_vmtests: adjust hugetlb size according to nr_cpus 2018-03-09 16:40:01 -08:00
watchdog
x86 x86/entry/64/compat: Preserve r8-r11 in int $0x80 2018-04-27 17:07:58 +02:00
zram
.gitignore
gen_kselftest_tar.sh
kselftest.h selftests: kselftest framework: add handling for TAP header level 2018-03-05 19:10:27 -07:00
kselftest_harness.h selftests/seccomp: Allow get_metadata to XFAIL 2018-03-21 10:42:46 -06:00
kselftest_install.sh
lib.mk selftests: lib.mk set KSFT_TAP_LEVEL to prevent nested TAP headers 2018-03-05 19:10:35 -07:00
Makefile proc: test /proc/self/wchan 2018-04-11 10:28:34 -07:00