From 35eda7c44b7de347fe723f300ab8bcc8f520ee6f Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Sat, 26 Oct 2024 08:00:00 +0000 Subject: [PATCH] tests: do not rely on creat syscall failing with ETXTBSY For many years "creat" syscall used to fail with ETXTBSY when applied to the running executable: $ strace -v tests/creat execve("tests/creat", ["tests/creat"], []) = 0 ... creat("tests/creat", 000) = -1 ETXTBSY (Text file busy) ... Apparently, something has changed in Fedora Rawhide: $ strace -v tests/creat execve("tests/creat", ["tests/creat"], []) = 0 ... creat("tests/creat", 000) = 3 --- SIGBUS {si_signo=SIGBUS, si_code=BUS_ADRERR, si_addr=0x401288} --- +++ killed by SIGBUS (core dumped) +++ $ stat -c %s tests/creat 0 * tests/umode_t.c (sample): Change to ".". * tests/gen_tests.in (creat, mkdir, mkdirat): Update -a option argument. --- tests/gen_tests.in | 6 +++--- tests/umode_t.c | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/gen_tests.in b/tests/gen_tests.in index 89367890e992..7fda537d8d75 100644 --- a/tests/gen_tests.in +++ b/tests/gen_tests.in @@ -75,7 +75,7 @@ clone_ptrace-q +clone_ptrace.test -q clone_ptrace-qq +clone_ptrace.test -qq close_range -a21 7>>/dev/full copy_file_range -creat -a20 +creat -a16 delete_module -a23 dev--decode-fds-all -a30 -e trace=openat,fsync -P "/dev/full" -P "/dev/zero" -P "/dev/sda" -e decode-fds=all dev--decode-fds-dev -a30 -e trace=openat,fsync -P "/dev/full" -P "/dev/zero" -P "/dev/sda" -e decode-fds=dev @@ -560,8 +560,8 @@ memfd_secret-success-y -einject=memfd_secret:retval=7 -a16 -etrace=memfd_secret migrate_pages -a33 migrate_pages--pidns-translation test_pidns -a33 -e trace=migrate_pages mincore -a22 -mkdir -a20 -mkdirat -a28 +mkdir -a16 +mkdirat -a22 mknod -a18 mknodat -a35 mlock -a20 -e trace=mlock,munlock diff --git a/tests/umode_t.c b/tests/umode_t.c index 7363883d7c56..0e4c0111d66d 100644 --- a/tests/umode_t.c +++ b/tests/umode_t.c @@ -19,7 +19,7 @@ # define TEST_SYSCALL_PREFIX_STR "" #endif -static const char *sample; +static const char sample[] = "."; static void test_syscall(unsigned short mode) @@ -39,9 +39,8 @@ test_syscall(unsigned short mode) } int -main(int ac, char **av) +main(void) { - sample = av[0]; test_syscall(0); test_syscall(0xffff); test_syscall(06); diff --git a/tests-m32/gen_tests.in b/tests-m32/gen_tests.in index 89367890e992..7fda537d8d75 100644 --- a/tests-m32/gen_tests.in +++ b/tests-m32/gen_tests.in @@ -75,7 +75,7 @@ clone_ptrace-q +clone_ptrace.test -q clone_ptrace-qq +clone_ptrace.test -qq close_range -a21 7>>/dev/full copy_file_range -creat -a20 +creat -a16 delete_module -a23 dev--decode-fds-all -a30 -e trace=openat,fsync -P "/dev/full" -P "/dev/zero" -P "/dev/sda" -e decode-fds=all dev--decode-fds-dev -a30 -e trace=openat,fsync -P "/dev/full" -P "/dev/zero" -P "/dev/sda" -e decode-fds=dev @@ -560,8 +560,8 @@ memfd_secret-success-y -einject=memfd_secret:retval=7 -a16 -etrace=memfd_secret migrate_pages -a33 migrate_pages--pidns-translation test_pidns -a33 -e trace=migrate_pages mincore -a22 -mkdir -a20 -mkdirat -a28 +mkdir -a16 +mkdirat -a22 mknod -a18 mknodat -a35 mlock -a20 -e trace=mlock,munlock diff --git a/tests-m32/umode_t.c b/tests-m32/umode_t.c index 7363883d7c56..0e4c0111d66d 100644 --- a/tests-m32/umode_t.c +++ b/tests-m32/umode_t.c @@ -19,7 +19,7 @@ # define TEST_SYSCALL_PREFIX_STR "" #endif -static const char *sample; +static const char sample[] = "."; static void test_syscall(unsigned short mode) @@ -39,9 +39,8 @@ test_syscall(unsigned short mode) } int -main(int ac, char **av) +main(void) { - sample = av[0]; test_syscall(0); test_syscall(0xffff); test_syscall(06); diff --git a/tests-mx32/gen_tests.in b/tests-mx32/gen_tests.in index 89367890e992..7fda537d8d75 100644 --- a/tests-mx32/gen_tests.in +++ b/tests-mx32/gen_tests.in @@ -75,7 +75,7 @@ clone_ptrace-q +clone_ptrace.test -q clone_ptrace-qq +clone_ptrace.test -qq close_range -a21 7>>/dev/full copy_file_range -creat -a20 +creat -a16 delete_module -a23 dev--decode-fds-all -a30 -e trace=openat,fsync -P "/dev/full" -P "/dev/zero" -P "/dev/sda" -e decode-fds=all dev--decode-fds-dev -a30 -e trace=openat,fsync -P "/dev/full" -P "/dev/zero" -P "/dev/sda" -e decode-fds=dev @@ -560,8 +560,8 @@ memfd_secret-success-y -einject=memfd_secret:retval=7 -a16 -etrace=memfd_secret migrate_pages -a33 migrate_pages--pidns-translation test_pidns -a33 -e trace=migrate_pages mincore -a22 -mkdir -a20 -mkdirat -a28 +mkdir -a16 +mkdirat -a22 mknod -a18 mknodat -a35 mlock -a20 -e trace=mlock,munlock diff --git a/tests-mx32/umode_t.c b/tests-mx32/umode_t.c index 7363883d7c56..0e4c0111d66d 100644 --- a/tests-mx32/umode_t.c +++ b/tests-mx32/umode_t.c @@ -19,7 +19,7 @@ # define TEST_SYSCALL_PREFIX_STR "" #endif -static const char *sample; +static const char sample[] = "."; static void test_syscall(unsigned short mode) @@ -39,9 +39,8 @@ test_syscall(unsigned short mode) } int -main(int ac, char **av) +main(void) { - sample = av[0]; test_syscall(0); test_syscall(0xffff); test_syscall(06); -- 2.28.0