Skip to content

Commit 1a1ad73

Browse files
committed
pidfs: raise SB_I_NODEV and SB_I_NOEXEC
Similar to commit 1ed9528 ("anon_inode: raise SB_I_NODEV and SB_I_NOEXEC"): it shouldn't be possible to execute pidfds via execveat(fd_anon_inode, "", NULL, NULL, AT_EMPTY_PATH) so raise SB_I_NOEXEC so that no one gets any creative ideas. Also raise SB_I_NODEV as we don't expect or support any devices on pidfs. Link: https://lore.kernel.org/20250618-work-pidfs-persistent-v2-1-98f3456fd552@kernel.org Reviewed-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 19272b3 commit 1a1ad73

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

fs/pidfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,8 @@ static int pidfs_init_fs_context(struct fs_context *fc)
891891
if (!ctx)
892892
return -ENOMEM;
893893

894+
fc->s_iflags |= SB_I_NOEXEC;
895+
fc->s_iflags |= SB_I_NODEV;
894896
ctx->ops = &pidfs_sops;
895897
ctx->eops = &pidfs_export_operations;
896898
ctx->dops = &pidfs_dentry_operations;

0 commit comments

Comments
 (0)