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  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:   Fri, 1 May 2020 13:17:32 -0700
From:   Dave Hansen <>
To:     Linus Torvalds <>,
        Dan Williams <>
Cc:     "Luck, Tony" <>,
        Andy Lutomirski <>,
        Thomas Gleixner <>,
        Ingo Molnar <>,
        Peter Zijlstra <>,
        Borislav Petkov <>,
        stable <>,
        the arch/x86 maintainers <>,
        "H. Peter Anvin" <>,
        Paul Mackerras <>,
        Benjamin Herrenschmidt <>,
        Erwin Tsaur <>,
        Michael Ellerman <>,
        Arnaldo Carvalho de Melo <>,
        linux-nvdimm <>,
        Linux Kernel Mailing List <>
Subject: Re: [PATCH v2 0/2] Replace and improve "mcsafe" with copy_safe()

On 5/1/20 11:28 AM, Linus Torvalds wrote:
> Plus on x86 you can't reasonably even have different code sequences
> for that case, because CLAC/STAC don't have a "enable users read
> accesses" vs "write accesses" case. It's an all-or-nothing "enable
> user faults".
> We _used_ to have a difference on x86, back when we did the whole "fs
> segment points to user space".

Protection keys might give us _some_ of this back.  If we're doing a
copy_from_user(), we could (logically) do:

	pkru |= ~0x55555555
	... do userspace read

That *should* generate a fault if we try to write to userspace in there
because PKRU affects all user *addresses* (PTEs with _PAGE_USER set) not
user-mode *accesses*.

Properly stashing the value off and context switching it correctly would
be fun, but probably not impossible to pull off.  You actually wouldn't
even technically need to restore PKRU in this path.  It would just need
to be restored before the thread runs userspace or hits a copy_to_user()

I can't imagine this would all be worth the trouble, but there are
crazier people out there than me.

Powered by blists - more mailing lists