From: Jan Beulich <jbeulich@suse.com>
To: Andy Lutomirski <luto@kernel.org>
Cc: the arch/x86 maintainers <x86@kernel.org>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86-64/entry: add instruction suffix to SYSRET
Date: Fri, 13 Dec 2019 10:55:31 +0100 [thread overview]
Message-ID: <ed9d8df6-0fe7-ca15-bab2-4d9cbbfe62f0@suse.com> (raw)
In-Reply-To: <CALCETrWHNunMzP1xHmOhvHG20_baoeXhNbCcEJgCgm5xzGM5Tw@mail.gmail.com>
On 12.12.2019 22:43, Andy Lutomirski wrote:
> 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?
Why not? It can set up a 32-bit code segment descriptor, far-branch
into it, and then execute SYSCALL. I can't see anything preventing
this in the logic involved in descriptor adjustment system calls. In
fact it looks to be at least partly the opposite - fill_ldt()
disallows creation of 64-bit code segments (oddly enough
fill_user_desc() then still copies the bit back, despite there
apparently being no way for it to get set).
> 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.
Fine with me, changed.
Jan
next prev parent reply other threads:[~2019-12-13 9:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-10 10:48 Jan Beulich
2019-12-10 15:29 ` Andy Lutomirski
2019-12-10 15:40 ` Jan Beulich
2019-12-12 21:43 ` Andy Lutomirski
2019-12-13 9:55 ` Jan Beulich [this message]
2019-12-13 17:49 ` Andy Lutomirski
2019-12-16 10:11 ` Jan Beulich
2019-12-16 15:23 ` Brian Gerst
2019-12-19 2:39 ` Andy Lutomirski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ed9d8df6-0fe7-ca15-bab2-4d9cbbfe62f0@suse.com \
--to=jbeulich@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®