strace/0189-tests-move-k_setsockopt-definition-into-a-separate-f.patch
Eugene Syromiatnikov bf36fdf2da Fix incorrect syscall name reporting in restart_syscall() on attach
* 0183-syscall-do-not-use-uninitialized-parts-of-struct-ptr.patch: New
file.
* 0184-startup_tcb-add-a-comment.patch: Likewise.
* 0185-tests-add-another-test-of-restart_syscall-decoding.patch:
Likewise.
* 0186-tests-workaround-net-yy-inet-for-new-kernels.patch: Rename
from 0001-tests-workaround-net-yy-inet-for-new-kernels.patch
to be in sync with RHEL 9, add tests-m32 and tests-mx32 hunks.
* 0187-tests-avoid-linkat-secontext_mismatch-failures-on-se.patch: New
file.
* 0188-linux-s390-get_scno.c-use-NT_S390_SYSTEM_CALL-if-gpr.patch:
Likewise.
* 0189-tests-move-k_setsockopt-definition-into-a-separate-f.patch:
Likewise.
* 0190-tests-sockopt-timestamp.c-use-k_getsockopt-and-k_set.patch:
Likewise.
* strace.spec (Patch183, Patch184, Patch185, Patch186, Patch187,
Patch188, Patch189, Patch190): New patches.
(Patch0001): Remove.
(%prep): Apply them.
(%changelog): Add a record.

Resolves: RHEL-65108
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2024-11-01 13:50:48 +01:00

699 lines
29 KiB
Diff

From e7f488a6d267001214636507c79210af57c2c6a7 Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Thu, 31 Oct 2024 13:28:00 +0100
Subject: [PATCH 189/190] tests: move k_setsockopt definition into a separate
file
...and add k_getsockopt definition as well (for completeness's sake
and because it will be utilised in the next patch).
* tests/k_sockopt.c: New file.
* tests/k_sockopt.h: Likewise.
* tests/Makefile.am (libtests_a_SOURCES): Add k_sockopt.c
and k_sockopt.h.
* tests/sockopt-timestamp.c: Include "k_sockopt.h".
---
tests/Makefile.am | 2 ++
tests/k_sockopt.c | 61 +++++++++++++++++++++++++++++++++++++++
tests/k_sockopt.h | 24 +++++++++++++++
tests/sockopt-timestamp.c | 25 +---------------
4 files changed, 88 insertions(+), 24 deletions(-)
create mode 100644 tests/k_sockopt.c
create mode 100644 tests/k_sockopt.h
Index: strace-6.7/tests/Makefile.am
===================================================================
--- strace-6.7.orig/tests/Makefile.am 2024-10-31 14:07:30.389665979 +0100
+++ strace-6.7/tests/Makefile.am 2024-10-31 14:07:30.445665345 +0100
@@ -61,6 +61,8 @@
hexquote_strndup.c \
ifindex.c \
inode_of_sockfd.c \
+ k_sockopt.c \
+ k_sockopt.h \
libmmsg.c \
libsocketcall.c \
lock_file.c \
Index: strace-6.7/tests/k_sockopt.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ strace-6.7/tests/k_sockopt.c 2024-10-31 14:07:30.445665345 +0100
@@ -0,0 +1,61 @@
+/*
+ * [gs]etsockopt() wrappers that avoid glibc and perform syscalls directly.
+ *
+ * Copyright (c) 2019 Dmitry V. Levin <ldv@strace.io>
+ * Copyright (c) 2019-2024 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "tests.h"
+#include "scno.h"
+
+#include <unistd.h>
+#include <sys/socket.h>
+
+#include "k_sockopt.h"
+
+static const kernel_ulong_t fill = (kernel_ulong_t) 0xdefaced00000000ULL;
+
+#if defined __NR_getsockopt || defined __NR_setsockopt
+static const kernel_ulong_t bad = (kernel_ulong_t) 0xbadc0dedbadc0dedULL;
+#endif
+
+#define SC_getsockopt 15
+long
+k_getsockopt(const unsigned int fd, const unsigned int level,
+ const unsigned int optname, const void *const optval,
+ const unsigned int *len)
+{
+ return syscall(
+#ifdef __NR_getsockopt
+ __NR_getsockopt,
+#else /* socketcall */
+ __NR_socketcall, SC_getsockopt,
+#endif
+ fill | fd , fill | level, fill | optname, optval, len
+#ifdef __NR_getsockopt
+ , bad
+#endif
+ );
+}
+
+# define SC_setsockopt 14
+long
+k_setsockopt(const unsigned int fd, const unsigned int level,
+ const unsigned int optname, const void *const optval,
+ const unsigned int len)
+{
+ return syscall(
+#ifdef __NR_setsockopt
+ __NR_setsockopt,
+#else /* socketcall */
+ __NR_socketcall, SC_setsockopt,
+#endif
+ fill | fd , fill | level, fill | optname, optval, fill | len
+#ifdef __NR_setsockopt
+ , bad
+#endif
+ );
+}
Index: strace-6.7/tests/k_sockopt.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ strace-6.7/tests/k_sockopt.h 2024-10-31 14:07:30.445665345 +0100
@@ -0,0 +1,24 @@
+/*
+ * [gs]etsockopt() wrappers that avoid glibc and perform syscalls directly.
+ *
+ * Copyright (c) 2019 Dmitry V. Levin <ldv@strace.io>
+ * Copyright (c) 2019-2024 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef STRACE_K_SOCKOPT_H
+#define STRACE_K_SOCKOPT_H
+
+extern long
+k_getsockopt(const unsigned int fd, const unsigned int level,
+ const unsigned int optname, const void *const optval,
+ const unsigned int *len);
+
+extern long
+k_setsockopt(const unsigned int fd, const unsigned int level,
+ const unsigned int optname, const void *const optval,
+ const unsigned int len);
+
+#endif /* STRACE_K_SOCKOPT_H */
Index: strace-6.7/tests/sockopt-timestamp.c
===================================================================
--- strace-6.7.orig/tests/sockopt-timestamp.c 2024-10-31 14:07:27.014704200 +0100
+++ strace-6.7/tests/sockopt-timestamp.c 2024-10-31 14:07:30.446665333 +0100
@@ -22,6 +22,7 @@
# include "kernel_time_types.h"
# include "kernel_timeval.h"
# include "kernel_old_timespec.h"
+# include "k_sockopt.h"
# define XLAT_MACROS_ONLY
# include "xlat/sock_options.h"
@@ -44,30 +45,6 @@
return rc;
}
-# define SC_setsockopt 14
-static long
-k_setsockopt(const unsigned int fd, const unsigned int level,
- const unsigned int optname, const void *const optval,
- const unsigned int len)
-{
- const kernel_ulong_t fill = (kernel_ulong_t) 0xdefaced00000000ULL;
-# ifdef __NR_setsockopt
- const kernel_ulong_t bad = (kernel_ulong_t) 0xbadc0dedbadc0dedULL;
-# endif
-
- return syscall(
-# ifdef __NR_setsockopt
- __NR_setsockopt,
-# else /* socketcall */
- __NR_socketcall, SC_setsockopt,
-# endif
- fill | fd , fill | level, fill | optname, optval, fill | len
-# ifdef __NR_setsockopt
- , bad
-# endif
- );
-}
-
static void
print_timestamp_old(const struct cmsghdr *c)
{
Index: strace-6.7/tests/Makefile.in
===================================================================
--- strace-6.7.orig/tests/Makefile.in 2024-10-31 14:07:30.402665832 +0100
+++ strace-6.7/tests/Makefile.in 2024-10-31 14:09:57.964994687 +0100
@@ -850,6 +850,7 @@
libtests_a-hexquote_strndup.$(OBJEXT) \
libtests_a-ifindex.$(OBJEXT) \
libtests_a-inode_of_sockfd.$(OBJEXT) \
+ libtests_a-k_sockopt.$(OBJEXT) \
libtests_a-libmmsg.$(OBJEXT) \
libtests_a-libsocketcall.$(OBJEXT) \
libtests_a-lock_file.$(OBJEXT) \
@@ -6803,6 +6804,7 @@
./$(DEPDIR)/libtests_a-hexquote_strndup.Po \
./$(DEPDIR)/libtests_a-ifindex.Po \
./$(DEPDIR)/libtests_a-inode_of_sockfd.Po \
+ ./$(DEPDIR)/libtests_a-k_sockopt.Po \
./$(DEPDIR)/libtests_a-libmmsg.Po \
./$(DEPDIR)/libtests_a-libsocketcall.Po \
./$(DEPDIR)/libtests_a-lock_file.Po \
@@ -8709,6 +8711,8 @@
hexquote_strndup.c \
ifindex.c \
inode_of_sockfd.c \
+ k_sockopt.c \
+ k_sockopt.h \
libmmsg.c \
libsocketcall.c \
lock_file.c \
@@ -16432,6 +16436,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-hexquote_strndup.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-ifindex.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-inode_of_sockfd.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-k_sockopt.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-libmmsg.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-libsocketcall.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-lock_file.Po@am__quote@ # am--include-marker
@@ -17367,6 +17372,20 @@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-inode_of_sockfd.obj `if test -f 'inode_of_sockfd.c'; then $(CYGPATH_W) 'inode_of_sockfd.c'; else $(CYGPATH_W) '$(srcdir)/inode_of_sockfd.c'; fi`
+libtests_a-k_sockopt.o: k_sockopt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-k_sockopt.o -MD -MP -MF $(DEPDIR)/libtests_a-k_sockopt.Tpo -c -o libtests_a-k_sockopt.o `test -f 'k_sockopt.c' || echo '$(srcdir)/'`k_sockopt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-k_sockopt.Tpo $(DEPDIR)/libtests_a-k_sockopt.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='k_sockopt.c' object='libtests_a-k_sockopt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-k_sockopt.o `test -f 'k_sockopt.c' || echo '$(srcdir)/'`k_sockopt.c
+
+libtests_a-k_sockopt.obj: k_sockopt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-k_sockopt.obj -MD -MP -MF $(DEPDIR)/libtests_a-k_sockopt.Tpo -c -o libtests_a-k_sockopt.obj `if test -f 'k_sockopt.c'; then $(CYGPATH_W) 'k_sockopt.c'; else $(CYGPATH_W) '$(srcdir)/k_sockopt.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-k_sockopt.Tpo $(DEPDIR)/libtests_a-k_sockopt.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='k_sockopt.c' object='libtests_a-k_sockopt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-k_sockopt.obj `if test -f 'k_sockopt.c'; then $(CYGPATH_W) 'k_sockopt.c'; else $(CYGPATH_W) '$(srcdir)/k_sockopt.c'; fi`
+
libtests_a-libmmsg.o: libmmsg.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-libmmsg.o -MD -MP -MF $(DEPDIR)/libtests_a-libmmsg.Tpo -c -o libtests_a-libmmsg.o `test -f 'libmmsg.c' || echo '$(srcdir)/'`libmmsg.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-libmmsg.Tpo $(DEPDIR)/libtests_a-libmmsg.Po
@@ -19014,6 +19033,7 @@
-rm -f ./$(DEPDIR)/libtests_a-hexquote_strndup.Po
-rm -f ./$(DEPDIR)/libtests_a-ifindex.Po
-rm -f ./$(DEPDIR)/libtests_a-inode_of_sockfd.Po
+ -rm -f ./$(DEPDIR)/libtests_a-k_sockopt.Po
-rm -f ./$(DEPDIR)/libtests_a-libmmsg.Po
-rm -f ./$(DEPDIR)/libtests_a-libsocketcall.Po
-rm -f ./$(DEPDIR)/libtests_a-lock_file.Po
@@ -20341,6 +20361,7 @@
-rm -f ./$(DEPDIR)/libtests_a-hexquote_strndup.Po
-rm -f ./$(DEPDIR)/libtests_a-ifindex.Po
-rm -f ./$(DEPDIR)/libtests_a-inode_of_sockfd.Po
+ -rm -f ./$(DEPDIR)/libtests_a-k_sockopt.Po
-rm -f ./$(DEPDIR)/libtests_a-libmmsg.Po
-rm -f ./$(DEPDIR)/libtests_a-libsocketcall.Po
-rm -f ./$(DEPDIR)/libtests_a-lock_file.Po
Index: strace-6.7/tests-m32/Makefile.am
===================================================================
--- strace-6.7.orig/tests-m32/Makefile.am 2024-10-31 14:07:27.014704200 +0100
+++ strace-6.7/tests-m32/Makefile.am 2024-10-31 14:07:30.449665299 +0100
@@ -61,6 +61,8 @@
hexquote_strndup.c \
ifindex.c \
inode_of_sockfd.c \
+ k_sockopt.c \
+ k_sockopt.h \
libmmsg.c \
libsocketcall.c \
lock_file.c \
Index: strace-6.7/tests-m32/k_sockopt.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ strace-6.7/tests-m32/k_sockopt.c 2024-10-31 14:07:30.449665299 +0100
@@ -0,0 +1,61 @@
+/*
+ * [gs]etsockopt() wrappers that avoid glibc and perform syscalls directly.
+ *
+ * Copyright (c) 2019 Dmitry V. Levin <ldv@strace.io>
+ * Copyright (c) 2019-2024 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "tests.h"
+#include "scno.h"
+
+#include <unistd.h>
+#include <sys/socket.h>
+
+#include "k_sockopt.h"
+
+static const kernel_ulong_t fill = (kernel_ulong_t) 0xdefaced00000000ULL;
+
+#if defined __NR_getsockopt || defined __NR_setsockopt
+static const kernel_ulong_t bad = (kernel_ulong_t) 0xbadc0dedbadc0dedULL;
+#endif
+
+#define SC_getsockopt 15
+long
+k_getsockopt(const unsigned int fd, const unsigned int level,
+ const unsigned int optname, const void *const optval,
+ const unsigned int *len)
+{
+ return syscall(
+#ifdef __NR_getsockopt
+ __NR_getsockopt,
+#else /* socketcall */
+ __NR_socketcall, SC_getsockopt,
+#endif
+ fill | fd , fill | level, fill | optname, optval, len
+#ifdef __NR_getsockopt
+ , bad
+#endif
+ );
+}
+
+# define SC_setsockopt 14
+long
+k_setsockopt(const unsigned int fd, const unsigned int level,
+ const unsigned int optname, const void *const optval,
+ const unsigned int len)
+{
+ return syscall(
+#ifdef __NR_setsockopt
+ __NR_setsockopt,
+#else /* socketcall */
+ __NR_socketcall, SC_setsockopt,
+#endif
+ fill | fd , fill | level, fill | optname, optval, fill | len
+#ifdef __NR_setsockopt
+ , bad
+#endif
+ );
+}
Index: strace-6.7/tests-m32/k_sockopt.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ strace-6.7/tests-m32/k_sockopt.h 2024-10-31 14:07:30.449665299 +0100
@@ -0,0 +1,24 @@
+/*
+ * [gs]etsockopt() wrappers that avoid glibc and perform syscalls directly.
+ *
+ * Copyright (c) 2019 Dmitry V. Levin <ldv@strace.io>
+ * Copyright (c) 2019-2024 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef STRACE_K_SOCKOPT_H
+#define STRACE_K_SOCKOPT_H
+
+extern long
+k_getsockopt(const unsigned int fd, const unsigned int level,
+ const unsigned int optname, const void *const optval,
+ const unsigned int *len);
+
+extern long
+k_setsockopt(const unsigned int fd, const unsigned int level,
+ const unsigned int optname, const void *const optval,
+ const unsigned int len);
+
+#endif /* STRACE_K_SOCKOPT_H */
Index: strace-6.7/tests-m32/sockopt-timestamp.c
===================================================================
--- strace-6.7.orig/tests-m32/sockopt-timestamp.c 2024-10-31 14:07:27.014704200 +0100
+++ strace-6.7/tests-m32/sockopt-timestamp.c 2024-10-31 14:07:30.450665288 +0100
@@ -22,6 +22,7 @@
# include "kernel_time_types.h"
# include "kernel_timeval.h"
# include "kernel_old_timespec.h"
+# include "k_sockopt.h"
# define XLAT_MACROS_ONLY
# include "xlat/sock_options.h"
@@ -44,30 +45,6 @@
return rc;
}
-# define SC_setsockopt 14
-static long
-k_setsockopt(const unsigned int fd, const unsigned int level,
- const unsigned int optname, const void *const optval,
- const unsigned int len)
-{
- const kernel_ulong_t fill = (kernel_ulong_t) 0xdefaced00000000ULL;
-# ifdef __NR_setsockopt
- const kernel_ulong_t bad = (kernel_ulong_t) 0xbadc0dedbadc0dedULL;
-# endif
-
- return syscall(
-# ifdef __NR_setsockopt
- __NR_setsockopt,
-# else /* socketcall */
- __NR_socketcall, SC_setsockopt,
-# endif
- fill | fd , fill | level, fill | optname, optval, fill | len
-# ifdef __NR_setsockopt
- , bad
-# endif
- );
-}
-
static void
print_timestamp_old(const struct cmsghdr *c)
{
Index: strace-6.7/tests-m32/Makefile.in
===================================================================
--- strace-6.7.orig/tests-m32/Makefile.in 2024-10-31 14:07:30.394665922 +0100
+++ strace-6.7/tests-m32/Makefile.in 2024-10-31 14:07:30.453665254 +0100
@@ -850,6 +850,7 @@
libtests_a-hexquote_strndup.$(OBJEXT) \
libtests_a-ifindex.$(OBJEXT) \
libtests_a-inode_of_sockfd.$(OBJEXT) \
+ libtests_a-k_sockopt.$(OBJEXT) \
libtests_a-libmmsg.$(OBJEXT) \
libtests_a-libsocketcall.$(OBJEXT) \
libtests_a-lock_file.$(OBJEXT) \
@@ -6803,6 +6804,7 @@
./$(DEPDIR)/libtests_a-hexquote_strndup.Po \
./$(DEPDIR)/libtests_a-ifindex.Po \
./$(DEPDIR)/libtests_a-inode_of_sockfd.Po \
+ ./$(DEPDIR)/libtests_a-k_sockopt.Po \
./$(DEPDIR)/libtests_a-libmmsg.Po \
./$(DEPDIR)/libtests_a-libsocketcall.Po \
./$(DEPDIR)/libtests_a-lock_file.Po \
@@ -8709,6 +8711,8 @@
hexquote_strndup.c \
ifindex.c \
inode_of_sockfd.c \
+ k_sockopt.c \
+ k_sockopt.h \
libmmsg.c \
libsocketcall.c \
lock_file.c \
@@ -16432,6 +16436,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-hexquote_strndup.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-ifindex.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-inode_of_sockfd.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-k_sockopt.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-libmmsg.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-libsocketcall.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-lock_file.Po@am__quote@ # am--include-marker
@@ -17367,6 +17372,20 @@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-inode_of_sockfd.obj `if test -f 'inode_of_sockfd.c'; then $(CYGPATH_W) 'inode_of_sockfd.c'; else $(CYGPATH_W) '$(srcdir)/inode_of_sockfd.c'; fi`
+libtests_a-k_sockopt.o: k_sockopt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-k_sockopt.o -MD -MP -MF $(DEPDIR)/libtests_a-k_sockopt.Tpo -c -o libtests_a-k_sockopt.o `test -f 'k_sockopt.c' || echo '$(srcdir)/'`k_sockopt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-k_sockopt.Tpo $(DEPDIR)/libtests_a-k_sockopt.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='k_sockopt.c' object='libtests_a-k_sockopt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-k_sockopt.o `test -f 'k_sockopt.c' || echo '$(srcdir)/'`k_sockopt.c
+
+libtests_a-k_sockopt.obj: k_sockopt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-k_sockopt.obj -MD -MP -MF $(DEPDIR)/libtests_a-k_sockopt.Tpo -c -o libtests_a-k_sockopt.obj `if test -f 'k_sockopt.c'; then $(CYGPATH_W) 'k_sockopt.c'; else $(CYGPATH_W) '$(srcdir)/k_sockopt.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-k_sockopt.Tpo $(DEPDIR)/libtests_a-k_sockopt.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='k_sockopt.c' object='libtests_a-k_sockopt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-k_sockopt.obj `if test -f 'k_sockopt.c'; then $(CYGPATH_W) 'k_sockopt.c'; else $(CYGPATH_W) '$(srcdir)/k_sockopt.c'; fi`
+
libtests_a-libmmsg.o: libmmsg.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-libmmsg.o -MD -MP -MF $(DEPDIR)/libtests_a-libmmsg.Tpo -c -o libtests_a-libmmsg.o `test -f 'libmmsg.c' || echo '$(srcdir)/'`libmmsg.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-libmmsg.Tpo $(DEPDIR)/libtests_a-libmmsg.Po
@@ -19014,6 +19033,7 @@
-rm -f ./$(DEPDIR)/libtests_a-hexquote_strndup.Po
-rm -f ./$(DEPDIR)/libtests_a-ifindex.Po
-rm -f ./$(DEPDIR)/libtests_a-inode_of_sockfd.Po
+ -rm -f ./$(DEPDIR)/libtests_a-k_sockopt.Po
-rm -f ./$(DEPDIR)/libtests_a-libmmsg.Po
-rm -f ./$(DEPDIR)/libtests_a-libsocketcall.Po
-rm -f ./$(DEPDIR)/libtests_a-lock_file.Po
@@ -20341,6 +20361,7 @@
-rm -f ./$(DEPDIR)/libtests_a-hexquote_strndup.Po
-rm -f ./$(DEPDIR)/libtests_a-ifindex.Po
-rm -f ./$(DEPDIR)/libtests_a-inode_of_sockfd.Po
+ -rm -f ./$(DEPDIR)/libtests_a-k_sockopt.Po
-rm -f ./$(DEPDIR)/libtests_a-libmmsg.Po
-rm -f ./$(DEPDIR)/libtests_a-libsocketcall.Po
-rm -f ./$(DEPDIR)/libtests_a-lock_file.Po
Index: strace-6.7/tests-mx32/Makefile.am
===================================================================
--- strace-6.7.orig/tests-mx32/Makefile.am 2024-10-31 14:07:27.014704200 +0100
+++ strace-6.7/tests-mx32/Makefile.am 2024-10-31 14:07:30.453665254 +0100
@@ -61,6 +61,8 @@
hexquote_strndup.c \
ifindex.c \
inode_of_sockfd.c \
+ k_sockopt.c \
+ k_sockopt.h \
libmmsg.c \
libsocketcall.c \
lock_file.c \
Index: strace-6.7/tests-mx32/k_sockopt.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ strace-6.7/tests-mx32/k_sockopt.c 2024-10-31 14:07:30.453665254 +0100
@@ -0,0 +1,61 @@
+/*
+ * [gs]etsockopt() wrappers that avoid glibc and perform syscalls directly.
+ *
+ * Copyright (c) 2019 Dmitry V. Levin <ldv@strace.io>
+ * Copyright (c) 2019-2024 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "tests.h"
+#include "scno.h"
+
+#include <unistd.h>
+#include <sys/socket.h>
+
+#include "k_sockopt.h"
+
+static const kernel_ulong_t fill = (kernel_ulong_t) 0xdefaced00000000ULL;
+
+#if defined __NR_getsockopt || defined __NR_setsockopt
+static const kernel_ulong_t bad = (kernel_ulong_t) 0xbadc0dedbadc0dedULL;
+#endif
+
+#define SC_getsockopt 15
+long
+k_getsockopt(const unsigned int fd, const unsigned int level,
+ const unsigned int optname, const void *const optval,
+ const unsigned int *len)
+{
+ return syscall(
+#ifdef __NR_getsockopt
+ __NR_getsockopt,
+#else /* socketcall */
+ __NR_socketcall, SC_getsockopt,
+#endif
+ fill | fd , fill | level, fill | optname, optval, len
+#ifdef __NR_getsockopt
+ , bad
+#endif
+ );
+}
+
+# define SC_setsockopt 14
+long
+k_setsockopt(const unsigned int fd, const unsigned int level,
+ const unsigned int optname, const void *const optval,
+ const unsigned int len)
+{
+ return syscall(
+#ifdef __NR_setsockopt
+ __NR_setsockopt,
+#else /* socketcall */
+ __NR_socketcall, SC_setsockopt,
+#endif
+ fill | fd , fill | level, fill | optname, optval, fill | len
+#ifdef __NR_setsockopt
+ , bad
+#endif
+ );
+}
Index: strace-6.7/tests-mx32/k_sockopt.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ strace-6.7/tests-mx32/k_sockopt.h 2024-10-31 14:07:30.453665254 +0100
@@ -0,0 +1,24 @@
+/*
+ * [gs]etsockopt() wrappers that avoid glibc and perform syscalls directly.
+ *
+ * Copyright (c) 2019 Dmitry V. Levin <ldv@strace.io>
+ * Copyright (c) 2019-2024 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef STRACE_K_SOCKOPT_H
+#define STRACE_K_SOCKOPT_H
+
+extern long
+k_getsockopt(const unsigned int fd, const unsigned int level,
+ const unsigned int optname, const void *const optval,
+ const unsigned int *len);
+
+extern long
+k_setsockopt(const unsigned int fd, const unsigned int level,
+ const unsigned int optname, const void *const optval,
+ const unsigned int len);
+
+#endif /* STRACE_K_SOCKOPT_H */
Index: strace-6.7/tests-mx32/sockopt-timestamp.c
===================================================================
--- strace-6.7.orig/tests-mx32/sockopt-timestamp.c 2024-10-31 14:07:27.014704200 +0100
+++ strace-6.7/tests-mx32/sockopt-timestamp.c 2024-10-31 14:07:30.453665254 +0100
@@ -22,6 +22,7 @@
# include "kernel_time_types.h"
# include "kernel_timeval.h"
# include "kernel_old_timespec.h"
+# include "k_sockopt.h"
# define XLAT_MACROS_ONLY
# include "xlat/sock_options.h"
@@ -44,30 +45,6 @@
return rc;
}
-# define SC_setsockopt 14
-static long
-k_setsockopt(const unsigned int fd, const unsigned int level,
- const unsigned int optname, const void *const optval,
- const unsigned int len)
-{
- const kernel_ulong_t fill = (kernel_ulong_t) 0xdefaced00000000ULL;
-# ifdef __NR_setsockopt
- const kernel_ulong_t bad = (kernel_ulong_t) 0xbadc0dedbadc0dedULL;
-# endif
-
- return syscall(
-# ifdef __NR_setsockopt
- __NR_setsockopt,
-# else /* socketcall */
- __NR_socketcall, SC_setsockopt,
-# endif
- fill | fd , fill | level, fill | optname, optval, fill | len
-# ifdef __NR_setsockopt
- , bad
-# endif
- );
-}
-
static void
print_timestamp_old(const struct cmsghdr *c)
{
Index: strace-6.7/tests-mx32/Makefile.in
===================================================================
--- strace-6.7.orig/tests-mx32/Makefile.in 2024-10-31 14:07:30.398665877 +0100
+++ strace-6.7/tests-mx32/Makefile.in 2024-10-31 14:07:30.456665220 +0100
@@ -850,6 +850,7 @@
libtests_a-hexquote_strndup.$(OBJEXT) \
libtests_a-ifindex.$(OBJEXT) \
libtests_a-inode_of_sockfd.$(OBJEXT) \
+ libtests_a-k_sockopt.$(OBJEXT) \
libtests_a-libmmsg.$(OBJEXT) \
libtests_a-libsocketcall.$(OBJEXT) \
libtests_a-lock_file.$(OBJEXT) \
@@ -6803,6 +6804,7 @@
./$(DEPDIR)/libtests_a-hexquote_strndup.Po \
./$(DEPDIR)/libtests_a-ifindex.Po \
./$(DEPDIR)/libtests_a-inode_of_sockfd.Po \
+ ./$(DEPDIR)/libtests_a-k_sockopt.Po \
./$(DEPDIR)/libtests_a-libmmsg.Po \
./$(DEPDIR)/libtests_a-libsocketcall.Po \
./$(DEPDIR)/libtests_a-lock_file.Po \
@@ -8709,6 +8711,8 @@
hexquote_strndup.c \
ifindex.c \
inode_of_sockfd.c \
+ k_sockopt.c \
+ k_sockopt.h \
libmmsg.c \
libsocketcall.c \
lock_file.c \
@@ -16432,6 +16436,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-hexquote_strndup.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-ifindex.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-inode_of_sockfd.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-k_sockopt.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-libmmsg.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-libsocketcall.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtests_a-lock_file.Po@am__quote@ # am--include-marker
@@ -17367,6 +17372,20 @@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-inode_of_sockfd.obj `if test -f 'inode_of_sockfd.c'; then $(CYGPATH_W) 'inode_of_sockfd.c'; else $(CYGPATH_W) '$(srcdir)/inode_of_sockfd.c'; fi`
+libtests_a-k_sockopt.o: k_sockopt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-k_sockopt.o -MD -MP -MF $(DEPDIR)/libtests_a-k_sockopt.Tpo -c -o libtests_a-k_sockopt.o `test -f 'k_sockopt.c' || echo '$(srcdir)/'`k_sockopt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-k_sockopt.Tpo $(DEPDIR)/libtests_a-k_sockopt.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='k_sockopt.c' object='libtests_a-k_sockopt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-k_sockopt.o `test -f 'k_sockopt.c' || echo '$(srcdir)/'`k_sockopt.c
+
+libtests_a-k_sockopt.obj: k_sockopt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-k_sockopt.obj -MD -MP -MF $(DEPDIR)/libtests_a-k_sockopt.Tpo -c -o libtests_a-k_sockopt.obj `if test -f 'k_sockopt.c'; then $(CYGPATH_W) 'k_sockopt.c'; else $(CYGPATH_W) '$(srcdir)/k_sockopt.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-k_sockopt.Tpo $(DEPDIR)/libtests_a-k_sockopt.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='k_sockopt.c' object='libtests_a-k_sockopt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libtests_a-k_sockopt.obj `if test -f 'k_sockopt.c'; then $(CYGPATH_W) 'k_sockopt.c'; else $(CYGPATH_W) '$(srcdir)/k_sockopt.c'; fi`
+
libtests_a-libmmsg.o: libmmsg.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtests_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libtests_a-libmmsg.o -MD -MP -MF $(DEPDIR)/libtests_a-libmmsg.Tpo -c -o libtests_a-libmmsg.o `test -f 'libmmsg.c' || echo '$(srcdir)/'`libmmsg.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtests_a-libmmsg.Tpo $(DEPDIR)/libtests_a-libmmsg.Po
@@ -19014,6 +19033,7 @@
-rm -f ./$(DEPDIR)/libtests_a-hexquote_strndup.Po
-rm -f ./$(DEPDIR)/libtests_a-ifindex.Po
-rm -f ./$(DEPDIR)/libtests_a-inode_of_sockfd.Po
+ -rm -f ./$(DEPDIR)/libtests_a-k_sockopt.Po
-rm -f ./$(DEPDIR)/libtests_a-libmmsg.Po
-rm -f ./$(DEPDIR)/libtests_a-libsocketcall.Po
-rm -f ./$(DEPDIR)/libtests_a-lock_file.Po
@@ -20341,6 +20361,7 @@
-rm -f ./$(DEPDIR)/libtests_a-hexquote_strndup.Po
-rm -f ./$(DEPDIR)/libtests_a-ifindex.Po
-rm -f ./$(DEPDIR)/libtests_a-inode_of_sockfd.Po
+ -rm -f ./$(DEPDIR)/libtests_a-k_sockopt.Po
-rm -f ./$(DEPDIR)/libtests_a-libmmsg.Po
-rm -f ./$(DEPDIR)/libtests_a-libsocketcall.Po
-rm -f ./$(DEPDIR)/libtests_a-lock_file.Po