aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhangjin Wu <falcon@tinylab.org>2023-07-08 02:46:20 +0800
committerWilly Tarreau <w@1wt.eu>2023-07-09 19:28:50 +0200
commit4e77700ca35748febd10a3eed2873d7063e5be13 (patch)
treeb90319038d4c95b2d5c5179a2a0ade406a27cc80
parentf3da821b3c9c07de80bb77a096df3622bb28f9b6 (diff)
downloadlinux-nolibc-20230709-nolibc-ser2-tom-syscall-configv4.tar.gz
selftests/nolibc: add chmod_argv0 test20230709-nolibc-ser2-tom-syscall-configv4
argv0 is readable and chmodable, let's use it for chmod test, but a safe umask should be used, the readable and executable modes should be reserved. Reviewed-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
-rw-r--r--tools/testing/selftests/nolibc/nolibc-test.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index 1f9df5867f571b..3f1bbd9fe19e23 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -706,6 +706,7 @@ int run_syscall(int min, int max)
CASE_TEST(chdir_root); EXPECT_SYSZR(1, chdir("/")); chdir(getenv("PWD")); break;
CASE_TEST(chdir_dot); EXPECT_SYSZR(1, chdir(".")); break;
CASE_TEST(chdir_blah); EXPECT_SYSER(1, chdir("/blah"), -1, ENOENT); break;
+ CASE_TEST(chmod_argv0); EXPECT_SYSZR(1, chmod(argv0, 0555)); break;
CASE_TEST(chmod_self); EXPECT_SYSER(proc, chmod("/proc/self", 0555), -1, EPERM); break;
CASE_TEST(chown_self); EXPECT_SYSER(proc, chown("/proc/self", 0, 0), -1, EPERM); break;
CASE_TEST(chroot_root); EXPECT_SYSZR(euid0, chroot("/")); break;