[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z1DqsDSYxLF85ljc@kawka3.in.waw.pl>
Date: Wed, 4 Dec 2024 23:50:08 +0000
From: Zbigniew Jędrzejewski-Szmek <zbyszek@...waw.pl>
To: Kees Cook <kees@...nel.org>
Cc: Aleksa Sarai <cyphar@...har.com>, Al Viro <viro@...iv.linux.org.uk>,
Tycho Andersen <tandersen@...flix.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Eric Biederman <ebiederm@...ssion.com>,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
linux-mm@...ck.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] exec: fix up /proc/pid/comm in the
execveat(AT_EMPTY_PATH) case
On Sat, Nov 30, 2024 at 04:55:09PM +1100, Aleksa Sarai wrote:
> On 2024-11-29, Kees Cook <kees@...nel.org> wrote:
> > Zbigniew mentioned at Linux Plumber's that systemd is interested in
> > switching to execveat() for service execution, but can't, because the
> > contents of /proc/pid/comm are the file descriptor which was used,
> > instead of the path to the binary. This makes the output of tools like
> > top and ps useless, especially in a world where most fds are opened
> > CLOEXEC so the number is truly meaningless.
> >
> > When the filename passed in is empty (e.g. with AT_EMPTY_PATH), use the
> > dentry's filename for "comm" instead of using the useless numeral from
> > the synthetic fdpath construction. This way the actual exec machinery
> > is unchanged, but cosmetically the comm looks reasonable to admins
> > investigating things.
> >
> > Instead of adding TASK_COMM_LEN more bytes to bprm, use one of the unused
> > flag bits to indicate that we need to set "comm" from the dentry.
>
> Looks reasonable to me, feel free to take my
>
> Reviewed-by: Aleksa Sarai <cyphar@...har.com>
Thank you for making another version of the patch.
I tested this with systemd compiled to use fexecve and everything
seems to work as expected (the filename in /proc//comm).
Zbyszek
Powered by blists - more mailing lists