syscalls/mknod07: whiteout creation no longer requires privileges
PATCH 1/1 syscalls/mknod07: whiteout creation no longer requires privileges
Since commit a3c751a50fe6 ("vfs: allow unprivileged whiteout creation"), privileges are no longer required to create whiteout (0,0) char device.
Use /dev/null instead for EPERM test.
--- testcases/kernel/syscalls/mknod/mknod07.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
testcases/kernel/syscalls/mknod/mknod07.c +10 -7
@@ -43,6 +43,7 @@#include <sys/types.h> #include <sys/stat.h> #include <sys/mount.h> +#include <sys/sysmacros.h> #include "test.h" #include "safe_macros.h"
@@ -69,13 +70,14 @@ static struct test_case_t {char *pathname;int mode;int exp_errno; +int major, minor; } test_cases[] = { - { "testdir_1/tnode_1", SOCKET_MODE, EACCES }, - { "testdir_1/tnode_2", FIFO_MODE, EACCES }, - { "tnode_3", CHR_MODE, EPERM }, - { "tnode_4", BLK_MODE, EPERM }, - { "mntpoint/tnode_5", SOCKET_MODE, EROFS }, - { elooppathname, FIFO_MODE, ELOOP }, + { "testdir_1/tnode_1", SOCKET_MODE, EACCES, 0, 0 }, + { "testdir_1/tnode_2", FIFO_MODE, EACCES, 0, 0 }, + { "tnode_3", CHR_MODE, EPERM, 1, 3 }, + { "tnode_4", BLK_MODE, EPERM, 0, 0 }, + { "mntpoint/tnode_5", SOCKET_MODE, EROFS, 0, 0 }, + { elooppathname, FIFO_MODE, ELOOP, 0, 0 }, }; char *TCID = "mknod07";
@@ -149,7 +151,8 @@ static void setup(void)static void mknod_verify (const struct test_case_t *test_case) { -TEST (mknod (test_case->pathname, test_case->mode,0 )); +TEST (mknod (test_case->pathname, test_case->mode, +makedev (test_case->major, test_case->minor)));if (TEST_RETURN !=-1 ) {tst_resm (TFAIL ,"mknod succeeded unexpectedly" );
Signature · 1 line
2.18.1
PATCH 1/1 syscalls/mknod07: whiteout creation no longer requires privileges
Hi Jan
Acked.
Also Theses mknod/mknodat cases should convert into new api.
Best Regards
Yang Xu
Quoted 44 lines
Since commit
a3c751a50fe6("vfs: allow unprivileged whiteout creation"), privileges are no longer required to create whiteout (0,0) char device.Use
/dev/nullinstead for EPERM test.Signed-off-by Jan Stancek <[email protected]>--- testcases/kernel/syscalls/mknod/mknod07.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)testcases/kernel/syscalls/mknod/mknod07.c +8
-6@@ -43,6 +43,7 @@#include <sys/types.h> #include <sys/stat.h> #include <sys/mount.h> +#include <sys/sysmacros.h> #include "test.h" #include "safe_macros.h" @@ -69,13 +70,14 @@ static struct test_case_t {char *pathname;int mode;int exp_errno; +int major, minor; } test_cases[] = { - { "testdir_1/tnode_1", SOCKET_MODE, EACCES }, - { "testdir_1/tnode_2", FIFO_MODE, EACCES }, - { "tnode_3", CHR_MODE, EPERM }, - { "tnode_4", BLK_MODE, EPERM }, - { "mntpoint/tnode_5", SOCKET_MODE, EROFS }, - { elooppathname, FIFO_MODE, ELOOP }, + { "testdir_1/tnode_1", SOCKET_MODE, EACCES, 0, 0 }, + { "testdir_1/tnode_2", FIFO_MODE, EACCES, 0, 0 }, + { "tnode_3", CHR_MODE, EPERM, 1, 3 }, + { "tnode_4", BLK_MODE, EPERM, 0, 0 }, + { "mntpoint/tnode_5", SOCKET_MODE, EROFS, 0, 0 }, + { elooppathname, FIFO_MODE, ELOOP, 0, 0 }, }; char *TCID = "mknod07";
testcases/kernel/syscalls/mknod/mknod07.c static void setup(void) · line 158
Quoted 9 lines
testcases/kernel/syscalls/mknod/mknod07.c +2
-1@@ -149,7 +151,8 @@ static void setup(void)static void mknod_verify (const struct test_case_t *test_case) { -TEST (mknod (test_case->pathname, test_case->mode,0 )); +TEST (mknod (test_case->pathname, test_case->mode, +makedev (test_case->major, test_case->minor)));if (TEST_RETURN !=-1 ) {tst_resm (TFAIL ,"mknod succeeded unexpectedly" );
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200605/c7c0730c/attachment.htm>
PATCH 1/1 syscalls/mknod07: whiteout creation no longer requires privileges
----- Original Message -----
Quoted 3 lines
Hi Jan
Acked.
Pushed.