lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <62d9f87d-de55-3fb4-664d-d24897f4dd9b@suse.com>
Date:   Mon, 16 Dec 2019 11:11:51 +0100
From:   Jan Beulich <jbeulich@...e.com>
To:     Andy Lutomirski <luto@...nel.org>
Cc:     the arch/x86 maintainers <x86@...nel.org>,
        lkml <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86-64/entry: add instruction suffix to SYSRET

On 13.12.2019 18:49, Andy Lutomirski wrote:
> On Fri, Dec 13, 2019 at 1:55 AM Jan Beulich <jbeulich@...e.com> wrote:
>>
>> On 12.12.2019 22:43, Andy Lutomirski wrote:
>>> On Tue, Dec 10, 2019 at 7:40 AM Jan Beulich <jbeulich@...e.com> wrote:
>>>>
>>>> On 10.12.2019 16:29, Andy Lutomirski wrote:
>>>>>> On Dec 10, 2019, at 2:48 AM, Jan Beulich <JBeulich@...e.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@...e.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).
> 
> Do we allow creation of 32-bit code segments on !IA32_EMULATION
> kernels?

As per above - I think so.

>  I think we shouldn't, but I'm not really sure.

It may be a little exotic, but I can't see any reason to disallow
a 64-bit process to switch to compatibility mode temporarily. One
contrived use case could be to be able to invoke INTO or BOUND.

Jan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ