Re: [PATCH v2] procfs: block chmod on /proc/thread-self/comm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux