* [LTP] [PATCH] syscalls/mknod07: whiteout creation no longer requires privileges
@ 2020-06-03 11:54 Jan Stancek
2020-06-05 5:39 ` Yang Xu
0 siblings, 1 reply; 3+ messages in thread
From: Jan Stancek @ 2020-06-03 11:54 UTC (permalink / raw)
To: ltp
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.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
testcases/kernel/syscalls/mknod/mknod07.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/testcases/kernel/syscalls/mknod/mknod07.c b/testcases/kernel/syscalls/mknod/mknod07.c
index 69cff02d95d1..829199061532 100644
--- a/testcases/kernel/syscalls/mknod/mknod07.c
+++ b/testcases/kernel/syscalls/mknod/mknod07.c
@@ -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");
--
2.18.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [LTP] [PATCH] syscalls/mknod07: whiteout creation no longer requires privileges
2020-06-03 11:54 [LTP] [PATCH] syscalls/mknod07: whiteout creation no longer requires privileges Jan Stancek
@ 2020-06-05 5:39 ` Yang Xu
2020-06-05 6:16 ` Jan Stancek
0 siblings, 1 reply; 3+ messages in thread
From: Yang Xu @ 2020-06-05 5:39 UTC (permalink / raw)
To: ltp
Hi Jan
Acked.
Also Theses mknod/mknodat cases should convert into new api.
Best Regards
Yang Xu
> 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.
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
> testcases/kernel/syscalls/mknod/mknod07.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/mknod/mknod07.c b/testcases/kernel/syscalls/mknod/mknod07.c
> index 69cff02d95d1..829199061532 100644
> --- a/testcases/kernel/syscalls/mknod/mknod07.c
> +++ b/testcases/kernel/syscalls/mknod/mknod07.c
> @@ -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");
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200605/c7c0730c/attachment.htm>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-05 6:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-03 11:54 [LTP] [PATCH] syscalls/mknod07: whiteout creation no longer requires privileges Jan Stancek
2020-06-05 5:39 ` Yang Xu
2020-06-05 6:16 ` Jan Stancek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox