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: <e8d21f15-56c6-43c3-9009-3de74cccdf3a@lucifer.local>
Date: Wed, 8 Jan 2025 19:06:13 +0000
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: Kees Cook <kees@...nel.org>
Cc: Jeff Xu <jeffxu@...omium.org>, Jann Horn <jannh@...gle.com>,
        "Isaac J. Manjarres" <isaacmanjarres@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Jeff Layton <jlayton@...nel.org>, Chuck Lever <chuck.lever@...cle.com>,
        Alexander Aring <alex.aring@...il.com>,
        "Liam R. Howlett" <Liam.Howlett@...cle.com>,
        Vlastimil Babka <vbabka@...e.cz>, Shuah Khan <shuah@...nel.org>,
        kernel-team@...roid.com, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        linux-kselftest@...r.kernel.org,
        Suren Baghdasaryan <surenb@...gle.com>,
        Kalesh Singh <kaleshsingh@...gle.com>,
        John Stultz <jstultz@...gle.com>
Subject: Re: [RFC PATCH v1 1/2] mm/memfd: Add support for F_SEAL_FUTURE_EXEC
 to memfd

On Mon, Jan 06, 2025 at 04:44:33PM -0800, Kees Cook wrote:
> On Mon, Jan 06, 2025 at 10:26:27AM -0800, Jeff Xu wrote:
> > + Kees because this is related to W^X memfd and security.
> >
> > On Fri, Jan 3, 2025 at 7:14 AM Jann Horn <jannh@...gle.com> wrote:
> > >
> > > On Fri, Dec 6, 2024 at 7:19 PM Lorenzo Stoakes
> > > <lorenzo.stoakes@...cle.com> wrote:
> > > > On Thu, Dec 05, 2024 at 05:09:22PM -0800, Isaac J. Manjarres wrote:
> > > > > +             if (is_exec_sealed(seals)) {
> > > >
> > > > Are we intentionally disallowing a MAP_PRIVATE memfd's mapping's execution?
> > > > I've not tested this scenario so don't know if we somehow disallow this in
> > > > another way but note on write checks we only care about shared mappings.
> > > >
> > > > I mean one could argue that a MAP_PRIVATE situation is the same as copying
> > > > the data into an anon buffer and doing what you want with it, here you
> > > > could argue the same...
> > > >
> > > > So probably we should only care about VM_SHARED?
> > >
> > > FWIW I think it doesn't make sense to distinguish between
> > > shared/private mappings here - in the scenario described in the cover
> > > letter, it wouldn't matter that much to an attacker whether the
> > > mapping is shared or private (as long as the VMA contents haven't been
> > > CoWed already).
> > +1 on this.
> > The concept of blocking this for only shared mapping is questionable.
>
> Right -- why does sharedness matter? It seems more robust to me to not
> create a corner case but rather apply the flag/behavior universally?
>

I'm struggling to understand what you are protecting against, if I can receive a
buffer '-not executable-'. But then copy it into another buffer I mapped, and
execute it?

I mean am I missing something? It's very possible :)

The cost is complexity. And the difference between mappings which are shared and
those which are private and moreso MAP_PRIVATE of an fd are actually quite a lot
internally (go look at anon_vma code if you have the great benefit of not yet
doing so to see the deepest, darkest, 9th circle of complexity hell :>).

Again, I may be missing the point here or misunderstanding the apparent attack
vector, but this is where I'm coming from.

> --
> Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ