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:   Mon, 20 Feb 2023 22:38:27 +0000
From:   "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
To:     "keescook@...omium.org" <keescook@...omium.org>
CC:     "david@...hat.com" <david@...hat.com>,
        "bsingharora@...il.com" <bsingharora@...il.com>,
        "hpa@...or.com" <hpa@...or.com>,
        "Syromiatnikov, Eugene" <esyr@...hat.com>,
        "peterz@...radead.org" <peterz@...radead.org>,
        "rdunlap@...radead.org" <rdunlap@...radead.org>,
        "dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
        "Eranian, Stephane" <eranian@...gle.com>,
        "kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "fweimer@...hat.com" <fweimer@...hat.com>,
        "nadav.amit@...il.com" <nadav.amit@...il.com>,
        "jannh@...gle.com" <jannh@...gle.com>,
        "dethoma@...rosoft.com" <dethoma@...rosoft.com>,
        "kcc@...gle.com" <kcc@...gle.com>,
        "linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
        "bp@...en8.de" <bp@...en8.de>, "oleg@...hat.com" <oleg@...hat.com>,
        "hjl.tools@...il.com" <hjl.tools@...il.com>,
        "pavel@....cz" <pavel@....cz>,
        "Lutomirski, Andy" <luto@...nel.org>,
        "linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
        "arnd@...db.de" <arnd@...db.de>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "Schimpe, Christina" <christina.schimpe@...el.com>,
        "mike.kravetz@...cle.com" <mike.kravetz@...cle.com>,
        "x86@...nel.org" <x86@...nel.org>,
        "Yang, Weijiang" <weijiang.yang@...el.com>,
        "debug@...osinc.com" <debug@...osinc.com>,
        "jamorris@...ux.microsoft.com" <jamorris@...ux.microsoft.com>,
        "john.allen@....com" <john.allen@....com>,
        "rppt@...nel.org" <rppt@...nel.org>,
        "andrew.cooper3@...rix.com" <andrew.cooper3@...rix.com>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "corbet@....net" <corbet@....net>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-api@...r.kernel.org" <linux-api@...r.kernel.org>,
        "gorcunov@...il.com" <gorcunov@...il.com>,
        "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>
Subject: Re: [PATCH v6 25/41] x86/mm: Introduce MAP_ABOVE4G

On Sun, 2023-02-19 at 12:43 -0800, Kees Cook wrote:
> On Sat, Feb 18, 2023 at 01:14:17PM -0800, Rick Edgecombe wrote:
> > The x86 Control-flow Enforcement Technology (CET) feature includes
> > a new
> > type of memory called shadow stack. This shadow stack memory has
> > some
> > unusual properties, which require some core mm changes to function
> > properly.
> > 
> > One of the properties is that the shadow stack pointer (SSP), which
> > is a
> > CPU register that points to the shadow stack like the stack pointer
> > points
> > to the stack, can't be pointing outside of the 32 bit address space
> > when
> > the CPU is executing in 32 bit mode. It is desirable to prevent
> > executing
> > in 32 bit mode when shadow stack is enabled because the kernel
> > can't easily
> > support 32 bit signals.
> > 
> > On x86 it is possible to transition to 32 bit mode without any
> > special
> > interaction with the kernel, by doing a "far call" to a 32 bit
> > segment.
> > So the shadow stack implementation can use this address space
> > behavior
> > as a feature, by enforcing that shadow stack memory is always
> > crated
> > outside of the 32 bit address space. This way userspace will
> > trigger a
> > general protection fault which will in turn trigger a segfault if
> > it
> > tries to transition to 32 bit mode with shadow stack enabled.
> > 
> > This provides a clean error generating border for the user if they
> > try
> > attempt to do 32 bit mode shadow stack, rather than leave the
> > kernel in a
> > half working state for userspace to be surprised by.
> > 
> > So to allow future shadow stack enabling patches to map shadow
> > stacks
> > out of the 32 bit address space, introduce MAP_ABOVE4G. The
> > behavior
> > is pretty much like MAP_32BIT, except that it has the opposite
> > address
> > range. The are a few differences though.
> > 
> > If both MAP_32BIT and MAP_ABOVE4G are provided, the kernel will use
> > the
> > MAP_ABOVE4G behavior. Like MAP_32BIT, MAP_ABOVE4G is ignored in a
> > 32 bit
> > syscall.
> 
> Should the interface refuse to accept both set instead?

I guess that might be less surprising. But I think to do this would
either require adding logic to core mm or a new arch breakout. I
actually kind of wish there was an easy way to keep this flag from
being used from userspace and just be a kernel only thing. It is only
used internally in this series and there isn't any know use for
userspace.

> 
> Reviewed-by: Kees Cook <keescook@...omium.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ