lkml.org 
[lkml]   [2019]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] x86-64/entry: add instruction suffix to SYSRET
On Tue, Dec 10, 2019 at 7:40 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 10.12.2019 16:29, Andy Lutomirski wrote:
> >> On Dec 10, 2019, at 2:48 AM, Jan Beulich <JBeulich@suse.com> wrote:
> >>
> >> Omitting suffixes from instructions in AT&T mode is bad practice when
> >> operand size cannot be determined by the assembler from register
> >> operands, and is likely going to be warned about by upstream gas in the
> >> future. Add the missing suffix here.
> >>
> >> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> >>
> >> --- a/arch/x86/entry/entry_64.S
> >> +++ b/arch/x86/entry/entry_64.S
> >> @@ -1728,7 +1728,7 @@ END(nmi)
> >> SYM_CODE_START(ignore_sysret)
> >> UNWIND_HINT_EMPTY
> >> mov $-ENOSYS, %eax
> >> - sysret
> >> + sysretl
> >
> > Isn’t the default sysretq? sysretl looks more correct, but that suggests
> > that your changelog is wrong.
>
> No, this is different from ret, and more like iret and lret.
>
> > Is this code even reachable?
>
> Yes afaict, supported by the comment ahead of the symbol. syscall_init()
> puts its address into MSR_CSTAR when !IA32_EMULATION.
>

What I meant was: can a program actually get itself into 32-bit mode
to execute a 32-bit SYSCALL instruction?

Anyway, the change itself is Acked-by: Andy Lutomirski <luto@kernel.org>

But let's please clarify the changelog:

ignore_sysret contains an unsuffixed 'sysret' instruction. gas
correctly interprets this as sysretl, but leaving it up to gas to
guess when there is no register operand that implies a size is bad
practice, and upstream gas is likely to warn about this in the future.
Use 'sysretl' explicitly. This does not change the assembled output.

--Andy

\
 
 \ /
  Last update: 2019-12-12 22:44    [W:0.044 / U:0.700 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site