Avoid creat.gen test failures on newer kernels

Include commit v6.11-20-g35eda7c44b7d "tests: do not rely on creat syscall
failing with ETXTBSY" to avoid failures of creat.gen test on kernels
that include commit 6.11-rc1~242^2~19 ("fs: don't block i_writecount
during exec"), as manifested in OSCI TMT tests..

* 0193-tests-do-not-rely-on-creat-syscall-failing-with-ETXT.patch: New
file.
* strace.spec (Release): Bump to 6.
(Patch193): New patch.
(%prep): Apply it.
(%changelog): Add a record.

Resolves: RHEL-65108
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
This commit is contained in:
Eugene Syromiatnikov 2024-11-05 17:26:17 +01:00
parent bf36fdf2da
commit be316cedbe
2 changed files with 194 additions and 1 deletions

View File

@ -0,0 +1,178 @@
From 35eda7c44b7de347fe723f300ab8bcc8f520ee6f Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@strace.io>
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

View File

@ -1,7 +1,7 @@
Summary: Tracks and displays system calls associated with a running process
Name: strace
Version: 6.7
Release: 5%{?dist}
Release: 6%{?dist}
# The test suite is GPLv2+, the bundled headers are GPLv2 with Linux syscall
# exception, all the rest is LGPLv2.1+.
%if 0%{?fedora} >= 35 || 0%{?centos} >= 9 || 0%{?rhel} >= 9
@ -153,6 +153,14 @@ Patch188: 0188-linux-s390-get_scno.c-use-NT_S390_SYSTEM_CALL-if-gpr.patch
Patch189: 0189-tests-move-k_setsockopt-definition-into-a-separate-f.patch
# "tests/sockopt-timestamp.c: use k_getsockopt and k_setsockopt"
Patch190: 0190-tests-sockopt-timestamp.c-use-k_getsockopt-and-k_set.patch
### Fix for prctl-sve.gen test failure on aarch64
## v5.19~14 "prctl: improve PR_SVE_[SG]ET_VL decoding"
#Patch191: 0191-prctl-improve-PR_SVE_-SG-ET_VL-decoding.patch
## v6.3~32 "tests/prctl-sve: fix prctl(PR_SVE_GET_VL) return expected value printing"
#Patch192: 0192-tests-prctl-sve-fix-prctl-PR_SVE_GET_VL-return-expec.patch
## A fix for OSCI creat.gen.test failures
# v6.11-20-g35eda7c44b7d "tests: do not rely on creat syscall failing with ETXTBSY"
Patch193: 0193-tests-do-not-rely-on-creat-syscall-failing-with-ETXT.patch
# Fallback definitions for make_build/make_install macros
%{?!__make: %global __make %_bindir/make}
@ -182,6 +190,9 @@ received by a process.
%patch 188 -p1
%patch 189 -p1
%patch 190 -p1
#%patch 191 -p1
#%patch 192 -p1
%patch 193 -p1
chmod a+x tests/*.test
@ -240,6 +251,10 @@ fi
%{_mandir}/man1/*
%changelog
* Tue Nov 05 2024 Eugene Syromiatnikov <esyr@redhat.com> - 6.7-6
- Avoid failures of creat.gen test on kernels that include commit
v6.11-rc1~242^2~19 ("fs: don't block i_writecount during exec").
* Tue Oct 29 2024 Eugene Syromiatnikov <esyr@redhat.com> - 6.7-5
- Fix incorrect syscall name reporting in restart_syscall() on attach when
PTRACE_GET_SYSCALL_INFO is in use (RHEL-65108).