mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 15:12:13 +02:00
selftests/filesystems: add exec() test for anonymous inodes
Test that anonymous inodes cannot be exec()ed. Link: https://lore.kernel.org/20250407-work-anon_inode-v1-8-53a44c20d44e@kernel.org Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
fcf31ec7ca
commit
f8ca403ae7
|
|
@ -35,5 +35,18 @@ TEST(anon_inode_no_chmod)
|
|||
EXPECT_EQ(close(fd_context), 0);
|
||||
}
|
||||
|
||||
TEST(anon_inode_no_exec)
|
||||
{
|
||||
int fd_context;
|
||||
|
||||
fd_context = sys_fsopen("tmpfs", 0);
|
||||
ASSERT_GE(fd_context, 0);
|
||||
|
||||
ASSERT_LT(execveat(fd_context, "", NULL, NULL, AT_EMPTY_PATH), 0);
|
||||
ASSERT_EQ(errno, EACCES);
|
||||
|
||||
EXPECT_EQ(close(fd_context), 0);
|
||||
}
|
||||
|
||||
TEST_HARNESS_MAIN
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user