selftests/nsfs: add ioctl validation tests
Add simple tests to validate that non-nsfs ioctls are rejected. Link: https://lore.kernel.org/r/20250219-work-nsfs-v1-2-21128d73c5e8@kernel.org Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <fcntl.h>
|
||||
#include <linux/auto_dev-ioctl.h>
|
||||
#include <linux/errno.h>
|
||||
#include <sched.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -146,4 +148,16 @@ TEST_F(iterate_mount_namespaces, iterate_backward)
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(iterate_mount_namespaces, nfs_valid_ioctl)
|
||||
{
|
||||
ASSERT_NE(ioctl(self->fd_mnt_ns[0], AUTOFS_DEV_IOCTL_OPENMOUNT, NULL), 0);
|
||||
ASSERT_EQ(errno, ENOTTY);
|
||||
|
||||
ASSERT_NE(ioctl(self->fd_mnt_ns[0], AUTOFS_DEV_IOCTL_CLOSEMOUNT, NULL), 0);
|
||||
ASSERT_EQ(errno, ENOTTY);
|
||||
|
||||
ASSERT_NE(ioctl(self->fd_mnt_ns[0], AUTOFS_DEV_IOCTL_READY, NULL), 0);
|
||||
ASSERT_EQ(errno, ENOTTY);
|
||||
}
|
||||
|
||||
TEST_HARNESS_MAIN
|
||||
|
||||
Reference in New Issue
Block a user