From: Christian Brauner <brauner@kernel.org>
To: Aleksa Sarai <cyphar@cyphar.com>
Cc: Christian Brauner <brauner@kernel.org>,
Thomas Weissschuh <thomas@t-8ch.de>,
stable@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Dave Chinner <dchinner@redhat.com>, xu xin <cgel.zte@gmail.com>,
Al Viro <viro@zeniv.linux.org.uk>,
"Liam R. Howlett" <Liam.Howlett@Oracle.com>,
Zhihao Cheng <chengzhihao1@huawei.com>,
Stefan Roesch <shr@devkernel.io>,
Janis Danisevskis <jdanis@google.com>,
Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH v2] procfs: block chmod on /proc/thread-self/comm
Date: Thu, 13 Jul 2023 17:21:29 +0200 [thread overview]
Message-ID: <20230713-shrimps-urlaub-80a9818b50d9@brauner> (raw)
In-Reply-To: <20230713141001.27046-1-cyphar@cyphar.com>
On Fri, 14 Jul 2023 00:09:58 +1000, Aleksa Sarai wrote:
> Due to an oversight in commit 1b3044e39a89 ("procfs: fix pthread
> cross-thread naming if !PR_DUMPABLE") in switching from REG to NOD,
> chmod operations on /proc/thread-self/comm were no longer blocked as
> they are on almost all other procfs files.
>
> A very similar situation with /proc/self/environ was used to as a root
> exploit a long time ago, but procfs has SB_I_NOEXEC so this is simply a
> correctness issue.
>
> [...]
Just to reiterate: The long term fix to avoid these odd behavioral bugs
in the future is to remove the fallback to simple_setattr() we still
have in notify_change() that happens when no setattr inode operation has
been explicitly defined. To do this we need to change all filesystem
that rely on this fallback to explicitly set simple_setattr() as their
inode operation. Then notify_change() would simply return EOPNOTSUPP
when no setattr iop is defined making such omissions pretty obvious.
But that's a bigger patch. This is a backportable fix for this issue.
Needs long soaking in -next ofc.
---
Applied to the fs.proc.uapi branch of the vfs/vfs.git tree.
Patches in the fs.proc.uapi branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: fs.proc.uapi
[1/1] procfs: block chmod on /proc/thread-self/comm
https://git.kernel.org/vfs/vfs/c/ccf61486fe1e
prev parent reply other threads:[~2023-07-13 15:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-13 14:09 [PATCH v2] procfs: block chmod on /proc/thread-self/comm Aleksa Sarai
2023-07-13 15:21 ` Christian Brauner [this message]
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=20230713-shrimps-urlaub-80a9818b50d9@brauner \
--to=brauner@kernel.org \
--cc=Liam.Howlett@Oracle.com \
--cc=akpm@linux-foundation.org \
--cc=cgel.zte@gmail.com \
--cc=chengzhihao1@huawei.com \
--cc=cyphar@cyphar.com \
--cc=dchinner@redhat.com \
--cc=jdanis@google.com \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shr@devkernel.io \
--cc=stable@vger.kernel.org \
--cc=thomas@t-8ch.de \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).