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]
Date:   Wed, 1 Nov 2017 04:34:05 -0700
From:   Andy Lutomirski <luto@...nel.org>
To:     Dave Hansen <dave.hansen@...el.com>
Cc:     Andy Lutomirski <luto@...nel.org>, X86 ML <x86@...nel.org>,
        Borislav Petkov <bpetkov@...e.de>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Brian Gerst <brgerst@...il.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH 02/18] x86/asm/64: Split the iret-to-user and
 iret-to-kernel paths

On Fri, Oct 27, 2017 at 11:05 AM, Dave Hansen <dave.hansen@...el.com> wrote:
> On 10/26/2017 01:26 AM, Andy Lutomirski wrote:
>> +GLOBAL(restore_regs_and_return_to_usermode)
>> +#ifdef CONFIG_DEBUG_ENTRY
>> +     testl   $3, CS(%rsp)
>> +     jnz     1f
>> +     ud2
>
> A nit from the mere mortals in the audience: Could we start commenting
> or make a constant for the user segment bits in CS?

Yeah.  We have such a define, but it's not currently usable from asm.
Also, we can't do the obvious:

testl $SEGMENT_RPL_MASK, ...
jump_if_not_equal_to_KERNEL_RPL

because that makes no sense in asm :(

>
> Also, it would be nice to explain what's going on here.  Maybe:
>
> /*
>  * We think we are returning to the kernel.  Check the
>  * registers we are about to restore and if we appear to
>  * be returning to userspace, do something that will cause
>  * a fault and hopefully an oops report.
>  */
>
> Otherwise, I really like this change.  It's really hard to figure out
> what the context is in the entry assembly in a lot of cases.  It's a
> place where code reuse actually makes things harder to follow.

Powered by blists - more mailing lists