mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-23 19:14:30 +08:00
8bb2610bc4
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 |
||
---|---|---|
.. | ||
.gitignore | ||
check_cc.sh | ||
check_initial_reg_state.c | ||
entry_from_vm86.c | ||
fsgsbase.c | ||
ioperm.c | ||
iopl.c | ||
ldt_gdt.c | ||
Makefile | ||
mpx-debug.h | ||
mpx-dig.c | ||
mpx-hw.h | ||
mpx-mini-test.c | ||
mpx-mm.h | ||
pkey-helpers.h | ||
protection_keys.c | ||
ptrace_syscall.c | ||
raw_syscall_helper_32.S | ||
sigreturn.c | ||
single_step_syscall.c | ||
syscall_arg_fault.c | ||
syscall_nt.c | ||
sysret_rip.c | ||
sysret_ss_attrs.c | ||
test_FCMOV.c | ||
test_FCOMI.c | ||
test_FISTTP.c | ||
test_mremap_vdso.c | ||
test_syscall_vdso.c | ||
test_vdso.c | ||
test_vsyscall.c | ||
thunks_32.S | ||
thunks.S | ||
trivial_32bit_program.c | ||
trivial_64bit_program.c | ||
unwind_vdso.c | ||
vdso_restorer.c |