Re: [PATCH v2 3/5] memfd: improve userspace warnings for missing exec-related flags

From: Aleksa Sarai
Date: Mon Sep 04 2023 - 03:09:31 EST


On 2023-09-02, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Fri, 1 Sep 2023 07:13:45 +0200 Damian Tometzki <dtometzki@xxxxxxxxxxxxxxxxx> wrote:
>
> > > if (!(flags & (MFD_EXEC | MFD_NOEXEC_SEAL))) {
> > > - pr_warn_once(
> > > + pr_info_ratelimited(
> > > "%s[%d]: memfd_create() called without MFD_EXEC or MFD_NOEXEC_SEAL set\n",
> > > current->comm, task_pid_nr(current));
> > > }
> > >
> > > --
> > > 2.41.0
> > >
> > Hello Sarai,
> >
> > i got a lot of messages in dmesg with this. DMESG is unuseable with
> > this.
> > [ 1390.349462] __do_sys_memfd_create: 5 callbacks suppressed
> > [ 1390.349468] pipewire-pulse[2930]: memfd_create() called without MFD_EXEC or MFD_NOEXEC_SEAL set
> > [ 1390.350106] pipewire[2712]: memfd_create() called without MFD_EXEC or MFD_NOEXEC_SEAL set
>
> OK, thanks, I'll revert this. Spamming everyone even harder isn't a
> good way to get developers to fix their stuff.

Sorry, I'm on vacation. I will send a follow-up patch to remove this
logging entirely -- if we can't do rate-limited logging then logging a
single message effectively at boot time makes no sense. I had hoped that
this wouldn't be too much (given there is a fair amount of INFO-level
spam in the kernel log) but I guess the default ratelimit (5Hz) is too
liberal.

Perhaps we can re-consider adding some logging in the future, when more
programs have migrated. The only other "reasonable" way to reduce the
logging would be to add something to task_struct so we only log once per
task, but obviously that's massively overkill.

(FWIW, I don't think the logging was ever necessary. There's nothing
wrong with running an older program that doesn't pass the flags.)

--
Aleksa Sarai
Senior Software Engineer (Containers)
SUSE Linux GmbH
<https://www.cyphar.com/>

Attachment: signature.asc
Description: PGP signature