Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1732720
| From | hpa@zytor.com |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] x86/asm/64: do not clear high 32 bits of syscall number when CONFIG_X86_X32=y |
| Date | 2017-09-15 08:00 +0200 |
| Message-ID | <upRPr-70H-7@gated-at.bofh.it> (permalink) |
| References | <up2jU-7sR-3@gated-at.bofh.it> <upJyz-1Kz-45@gated-at.bofh.it> <upK1z-1Uw-7@gated-at.bofh.it> <upKbg-1XT-5@gated-at.bofh.it> <upRw5-6Ur-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On September 14, 2017 10:31:55 PM PDT, Ingo Molnar <mingo@kernel.org> wrote: > >* Andy Lutomirski <luto@kernel.org> wrote: > >> >> > 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 >> >> >> >> I don't know much about x32 userspace, but there's an argument >that >> >> the high bits *should* be masked off if the x32 bit is set. >> > >> > Why? >> >> Because it always worked that way. >> >> That being said, I'd be okay with applying your patch and seeing >> whether anything breaks. Ingo? > >So I believe this was introduced with x32 as a 'fresh, modern syscall >ABI' >behavioral aspect, because we wanted to protect the overly complex >syscall entry >code from 'weird' input values. IIRC there was an old bug where we'd >overflow the >syscall table in certain circumstances ... > >But our new, redesigned entry code is a lot less complex, a lot more >readable and >a lot more maintainable (not to mention a lot more robust), so if >invalid RAX >values with high bits set get reliably turned into -ENOSYS or such then >I'd not >mind the patch per se either, as a general consistency improvement. > >Of course if something in x32 user-land breaks then this turns into an >ABI and we >have to reintroduce this aspect, as a quirk :-/ > >It should also improve x32 syscall performance a tiny bit, right? So >might be >worth a try on various grounds. > >( Another future advantage would be that _maybe_ we could use the high >RAX >component as an extra (64-bit only) special argument of sorts. Not that >I can > think of any such use right now. ) > >Thanks, > > Ingo If the consensus is that we should change the x86-64 ABI then we should change the x32 ABI to match, though. -- Sent from my Android device with K-9 Mail. Please excuse my brevity.
Back to linux.kernel | Previous | Next — Previous 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