Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1731275
| From | "Dmitry V. Levin" <ldv@altlinux.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] x86/asm/64: do not clear high 32 bits of syscall number when CONFIG_X86_X32=y |
| Date | 2017-09-13 01:00 +0200 |
| Message-ID | <up2jU-7sR-3@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
Before this change, CONFIG_X86_X32=y fastpath behaviour was different
from slowpath:
$ gcc -xc -Wall -O2 - <<'EOF'
#include <unistd.h>
#include <asm/unistd.h>
int main(void) {
unsigned long nr = ~0xffffffffUL | __NR_exit;
return !!syscall(nr, 42, 1, 2, 3, 4, 5);
}
EOF
$ ./a.out; echo \$?=$?
$?=42
$ strace -enone ./a.out
syscall_18446744069414584380(0x2a, 0x1, 0x2, 0x3, 0x4, 0x5) = -1 (errno 38)
+++ exited with 1 +++
This change syncs CONFIG_X86_X32=y fastpath behaviour with the case
when CONFIG_X86_X32 is not enabled.
Fixes: fca460f95e92 ("x32: Handle the x32 system call flag")
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
arch/x86/entry/entry_64.S | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 4916725..3bab6af 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -185,12 +185,10 @@ entry_SYSCALL_64_fastpath:
*/
TRACE_IRQS_ON
ENABLE_INTERRUPTS(CLBR_NONE)
-#if __SYSCALL_MASK == ~0
- cmpq $__NR_syscall_max, %rax
-#else
- andl $__SYSCALL_MASK, %eax
- cmpl $__NR_syscall_max, %eax
+#if __SYSCALL_MASK != ~0
+ andq $__SYSCALL_MASK, %rax
#endif
+ cmpq $__NR_syscall_max, %rax
ja 1f /* return -ENOSYS (already in pt_regs->ax) */
movq %r10, %rcx
--
ldv
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] x86/asm/64: do not clear high 32 bits of syscall number when CONFIG_X86_X32=y "Dmitry V. Levin" <ldv@altlinux.org> - 2017-09-13 01:00 +0200
Re: [PATCH] x86/asm/64: do not clear high 32 bits of syscall number when CONFIG_X86_X32=y Oleg Nesterov <oleg@redhat.com> - 2017-09-13 18:50 +0200
Re: [PATCH] x86/asm/64: do not clear high 32 bits of syscall number when CONFIG_X86_X32=y Eugene Syromyatnikov <evgsyr@gmail.com> - 2017-09-14 21:50 +0200
Re: [PATCH] x86/asm/64: do not clear high 32 bits of syscall number when CONFIG_X86_X32=y "Dmitry V. Levin" <ldv@altlinux.org> - 2017-09-14 22:30 +0200
Re: [PATCH] x86/asm/64: do not clear high 32 bits of syscall number when CONFIG_X86_X32=y "Dmitry V. Levin" <ldv@altlinux.org> - 2017-09-14 22:30 +0200
Re: [PATCH] x86/asm/64: do not clear high 32 bits of syscall number when CONFIG_X86_X32=y Oleg Nesterov <oleg@redhat.com> - 2017-09-15 18:20 +0200
Re: [PATCH] x86/asm/64: do not clear high 32 bits of syscall number when CONFIG_X86_X32=y Andy Lutomirski <luto@kernel.org> - 2017-09-14 23:10 +0200
Re: [PATCH] x86/asm/64: do not clear high 32 bits of syscall number when CONFIG_X86_X32=y "Dmitry V. Levin" <ldv@altlinux.org> - 2017-09-14 23:40 +0200
Re: [PATCH] x86/asm/64: do not clear high 32 bits of syscall number when CONFIG_X86_X32=y Andy Lutomirski <luto@kernel.org> - 2017-09-14 23:50 +0200
Re: [PATCH] x86/asm/64: do not clear high 32 bits of syscall number when CONFIG_X86_X32=y Ingo Molnar <mingo@kernel.org> - 2017-09-15 07:40 +0200
Re: [PATCH] x86/asm/64: do not clear high 32 bits of syscall number when CONFIG_X86_X32=y hpa@zytor.com - 2017-09-15 08:00 +0200
Re: [PATCH] x86/asm/64: do not clear high 32 bits of syscall number when CONFIG_X86_X32=y "Dmitry V. Levin" <ldv@altlinux.org> - 2017-09-17 18:50 +0200
Re: [PATCH] x86/asm/64: do not clear high 32 bits of syscall number when CONFIG_X86_X32=y hpa@zytor.com - 2017-09-15 08:00 +0200
csiph-web