[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202212080827.41F083F@keescook>
Date: Thu, 8 Dec 2022 08:27:50 -0800
From: Kees Cook <keescook@...omium.org>
To: jeffxu@...omium.org
Cc: skhan@...uxfoundation.org, akpm@...ux-foundation.org,
dmitry.torokhov@...il.com, dverkamp@...omium.org, hughd@...gle.com,
jeffxu@...gle.com, jorgelo@...omium.org,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
linux-mm@...ck.org, jannh@...gle.com,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH v6 4/6] mm/memfd: Add write seals when apply SEAL_EXEC to
executable memfd
On Wed, Dec 07, 2022 at 03:49:37PM +0000, jeffxu@...omium.org wrote:
> From: Jeff Xu <jeffxu@...gle.com>
>
> In order to avoid WX mappings, add F_SEAL_WRITE when apply
> F_SEAL_EXEC to an executable memfd, so W^X from start.
>
> This implys application need to fill the content of the memfd first,
> after F_SEAL_EXEC is applied, application can no longer modify the
> content of the memfd.
>
> Typically, application seals the memfd right after writing to it.
> For example:
> 1. memfd_create(MFD_EXEC).
> 2. write() code to the memfd.
> 3. fcntl(F_ADD_SEALS, F_SEAL_EXEC) to convert the memfd to W^X.
> 4. call exec() on the memfd.
>
> Signed-off-by: Jeff Xu <jeffxu@...gle.com>
Reviewed-by: Kees Cook <keescook@...omium.org>
--
Kees Cook
Powered by blists - more mailing lists