From: "David Rheinsberg" <david@readahead.eu>
To: "Barnabás Pőcze" <pobrn@protonmail.com>,
"Andrew Morton" <akpm@linux-foundation.org>
Cc: "Jeff Xu" <jeffxu@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, dmitry.torokhov@gmail.com,
"Daniel Verkamp" <dverkamp@chromium.org>,
hughd@google.com, jorgelo@chromium.org,
skhan@linuxfoundation.org, "Kees Cook" <keescook@chromium.org>
Subject: Re: [PATCH v1] memfd: `MFD_NOEXEC_SEAL` should not imply `MFD_ALLOW_SEALING`
Date: Thu, 23 May 2024 10:24:19 +0200 [thread overview]
Message-ID: <08450f80-4c33-40db-886f-fee18e531545@app.fastmail.com> (raw)
In-Reply-To: <1KDsEBw8g7ymBVpGJZp9NRH1HmCBsQ_jjQ_jKOg90gLUFhW5W6lcG-bI4-5OPkrD24RiG7G83VoZL4SXPQjfldsNFDg7bFnFFgrVZWwSWXQ=@protonmail.com>
Hi
On Thu, May 23, 2024, at 4:25 AM, Barnabás Pőcze wrote:
> 2024. május 23., csütörtök 1:23 keltezéssel, Andrew Morton
> <akpm@linux-foundation.org> írta:
>> It's a change to a userspace API, yes? Please let's have a detailed
>> description of why this is OK. Why it won't affect any existing users.
>
> Yes, it is a uAPI change. To trigger user visible change, a program has to
>
> - create a memfd
> - with MFD_NOEXEC_SEAL,
> - without MFD_ALLOW_SEALING;
> - try to add seals / check the seals.
>
> This change in essence reverts the kernel's behaviour to that of Linux
> <6.3, where
> only `MFD_ALLOW_SEALING` enabled sealing. If a program works correctly
> on those
> kernels, it will likely work correctly after this change.
>
> I have looked through Debian Code Search and GitHub, searching for
> `MFD_NOEXEC_SEAL`.
> And I could find only a single breakage that this change would case:
> dbus-broker
> has its own memfd_create() wrapper that is aware of this implicit
> `MFD_ALLOW_SEALING`
> behaviour[0], and tries to work around it. This workaround will break.
> Luckily,
> however, as far as I could tell this only affects the test suite of
> dbus-broker,
> not its normal operations, so I believe it should be fine. I have
> prepared a PR
> with a fix[1].
We asked for exactly this fix before, so I very much support this. Our test-suite in `dbus-broker` merely verifies what the current kernel behavior is (just like the kernel selftests). I am certainly ok if the kernel breaks it. I will gladly adapt the test-suite.
Previous discussion was in:
[PATCH] memfd: support MFD_NOEXEC alongside MFD_EXEC
https://lore.kernel.org/lkml/20230714114753.170814-1-david@readahead.eu/
Note that this fix is particularly important in combination with `vm.memfd_noexec=2`, since this breaks existing user-space by enabling sealing on all memfds unconditionally. I also encourage backporting to stable kernels.
Reviewed-by: David Rheinsberg <david@readahead.eu>
Thanks
David
next prev parent reply other threads:[~2024-05-23 8:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-13 19:15 Barnabás Pőcze
2024-05-16 6:11 ` Jeff Xu
2024-05-22 23:23 ` Andrew Morton
2024-05-23 2:25 ` Barnabás Pőcze
2024-05-23 2:40 ` Jeff Xu
2024-05-23 8:24 ` David Rheinsberg [this message]
2024-05-23 16:20 ` Jeff Xu
2024-05-23 16:55 ` Jeff Xu
2024-05-24 14:28 ` David Rheinsberg
2024-05-28 17:13 ` Jeff Xu
2024-06-07 8:38 ` David Rheinsberg
2024-06-07 15:58 ` Jeff Xu
2024-05-24 16:12 ` Aleksa Sarai
2024-05-28 17:56 ` Jeff Xu
2024-06-02 9:45 ` Aleksa Sarai
2024-05-23 2:32 ` Jeff Xu
2024-05-23 19:45 ` Andrew Morton
2024-05-23 20:44 ` Jeff Xu
2024-05-23 20:50 ` Barnabás Pőcze
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=08450f80-4c33-40db-886f-fee18e531545@app.fastmail.com \
--to=david@readahead.eu \
--cc=akpm@linux-foundation.org \
--cc=dmitry.torokhov@gmail.com \
--cc=dverkamp@chromium.org \
--cc=hughd@google.com \
--cc=jeffxu@google.com \
--cc=jorgelo@chromium.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pobrn@protonmail.com \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox