summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/nolibc
diff options
context:
space:
mode:
authorZhangjin Wu <falcon@tinylab.org>2023-07-08 02:46:20 +0800
committerWilly Tarreau <w@1wt.eu>2023-08-23 04:40:15 +0200
commit148e9718e2a288ef4fee16089cb9555414052fbb (patch)
treec409781a51f315cd33eb13d361bf7aa5e6889b1e /tools/testing/selftests/nolibc
parent135b622e4855981cad487aead7e6992358a0d25c (diff)
downloadlinux-stable-148e9718e2a288ef4fee16089cb9555414052fbb.tar.gz
linux-stable-148e9718e2a288ef4fee16089cb9555414052fbb.tar.bz2
linux-stable-148e9718e2a288ef4fee16089cb9555414052fbb.zip
selftests/nolibc: add chmod_argv0 test
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>
Diffstat (limited to 'tools/testing/selftests/nolibc')
-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 be9f664c8435..6c94e491e2f8 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_net); EXPECT_SYSZR(proc, chmod("/proc/self/net", 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;