Compare commits
5 Commits
imports/c8
...
c8
Author | SHA1 | Date | |
---|---|---|---|
f79ea5d554 | |||
|
63ee62a810 | ||
|
02ddc292d1 | ||
|
fefbb4cf09 | ||
|
34ac6c3594 |
.gitignore.strace.metadata
SOURCES
0113-io_uring-Remove-struct-io_cqring_offsets-compile-tim.patch0114-io_uring-Add-io_cqring_offset-flags.patch0115-xlat-update-IORING_-constants.patch0118-types-skip-field-lines-that-start-with-comments.patch0119-print_fields.h-add-PRINT_FIELD_LEN-macro.patch0120-Move-ilog-functions-from-util.c-to-defs.h.patch0122-tests-inject-nf.test-replace-getpid-with-geteuid.patch0123-fcntl-use-print_fields.h-macros.patch0124-kcmp-fix-KCMP_FILE-decoding.patch0125-printsiginfo-fix-printing-of-siginfo_t.si_pid-and-si.patch0126-Use-PRINT_FIELD_UID-instead-of-printuid-where-approp.patch0127-Consistently-print-process-ids-as-signed-integers.patch0128-Remove-tcb-parameter-of-read_int_from_file.patch0129-Add-struct-tcb-parameters-to-various-functions.patch0130-Modify-process-class-trace-syscalls-associated-with-.patch0131-Introduce-SYS_FUNC-tkill.patch0132-tests-check-decoding-of-tkill-syscall.patch0133-tests-check-decoding-of-tgkill-syscall.patch0134-PID-namespace-translation-support.patch0135-Use-printpid-in-decoders.patch0136-Use-get_proc_pid-for-proc-paths.patch0137-Implement-testing-framework-for-pidns.patch0138-Add-tests-for-PID-namespace-translation.patch0175-src-xlat-remove-remnants-of-unnecessary-idx-usage-in.patch0176-strauss-tips-whitespace-and-phrasing-cleanups.patch0177-strauss-fix-off-by-one-error-in-strauss-array-access.patch0178-util-add-offs-sanity-check-to-print_clock_t.patch0179-secontext-print-context-of-Unix-socket-s-sun_path-fi.patch0180-pathtrace-util-do-not-print-deleted-as-part-of-the-p.patch0181-secontext-fix-expected-SELinux-context-check-for-unl.patch0182-tests-bpf-fix-sloppy-low-FD-number-usage.patch0183-syscall-do-not-use-uninitialized-parts-of-struct-ptr.patch0184-startup_tcb-add-a-comment.patch0185-tests-add-another-test-of-restart_syscall-decoding.patch0186-tests-workaround-net-yy-inet-for-new-kernels.patch0187-tests-avoid-linkat-secontext_mismatch-failures-on-se.patch0188-linux-s390-get_scno.c-use-NT_S390_SYSTEM_CALL-if-gpr.patch0191-prctl-improve-PR_SVE_-SG-ET_VL-decoding.patch0192-tests-prctl-sve-fix-prctl-PR_SVE_GET_VL-return-expec.patch2001-limit-qual_fault-scope-on-aarch64.patch2003-undef-ARRAY_SIZE.patch
SPECS
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
||||
SOURCES/strace-5.7.tar.xz
|
||||
SOURCES/strace-5.18.tar.xz
|
||||
|
@ -1 +1 @@
|
||||
95c9d5aa664982d53ce1e5ab058d8fb73e200f0c SOURCES/strace-5.7.tar.xz
|
||||
e038ea9fc29366ce6119cde27d8cf16ac554a353 SOURCES/strace-5.18.tar.xz
|
||||
|
@ -1,44 +0,0 @@
|
||||
From ff85f882bbd8a399e036b8465520d1ff0867f4f1 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Packham <chris.packham@alliedtelesis.co.nz>
|
||||
Date: Mon, 15 Jun 2020 22:01:25 +1200
|
||||
Subject: [PATCH 113/115] io_uring: Remove struct io_cqring_offsets compile
|
||||
time asserts
|
||||
|
||||
The generated types/check-io_uring.c already checks the kernel's struct
|
||||
io_cqring_offsets for compatibility with the strace definition so
|
||||
there's no need for manual checks.
|
||||
|
||||
* io_uring.c [HAVE_STRUCT_IO_CQRING_OFFSETS]: Remove static_asserts.
|
||||
---
|
||||
io_uring.c | 15 ---------------
|
||||
1 file changed, 15 deletions(-)
|
||||
|
||||
diff --git a/io_uring.c b/io_uring.c
|
||||
index ac1807b..fd83313 100644
|
||||
--- a/io_uring.c
|
||||
+++ b/io_uring.c
|
||||
@@ -17,21 +17,6 @@
|
||||
#include "xlat/uring_enter_flags.h"
|
||||
#include "xlat/uring_register_opcodes.h"
|
||||
|
||||
-#ifdef HAVE_STRUCT_IO_CQRING_OFFSETS
|
||||
-# ifdef HAVE_STRUCT_IO_CQRING_OFFSETS_RESV
|
||||
-static_assert(offsetof(struct_io_cqring_offsets, resv)
|
||||
- >= offsetof(struct io_cqring_offsets, resv),
|
||||
- "struct io_cqring_offsets.resv offset mismatch"
|
||||
- ", please update the decoder");
|
||||
-static_assert(sizeof_field(struct_io_cqring_offsets, resv)
|
||||
- <= sizeof_field(struct io_cqring_offsets, resv),
|
||||
- "struct io_cqring_offsets.resv size mismatch"
|
||||
- ", please update the decoder");
|
||||
-# else /* !HAVE_STRUCT_IO_CQRING_OFFSETS_RESV */
|
||||
-static_assert(0, "struct io_cqring_offsets.resv is missing"
|
||||
- ", please update the decoder");
|
||||
-# endif
|
||||
-#endif /* HAVE_STRUCT_IO_CQRING_OFFSETS */
|
||||
#ifdef HAVE_STRUCT_IO_URING_PARAMS
|
||||
# ifdef HAVE_STRUCT_IO_URING_PARAMS_RESV
|
||||
static_assert(offsetof(struct_io_uring_params, resv)
|
||||
--
|
||||
2.1.4
|
||||
|
@ -1,383 +0,0 @@
|
||||
From c51b292b237214ccfcae5a84085f8d0a7e85c8ba Mon Sep 17 00:00:00 2001
|
||||
From: Chris Packham <chris.packham@alliedtelesis.co.nz>
|
||||
Date: Mon, 15 Jun 2020 22:01:26 +1200
|
||||
Subject: [PATCH 114/115] io_uring: Add io_cqring_offset flags
|
||||
|
||||
Add support for displaying struct io_cqring_offsets.flags introduced
|
||||
by Linux kernel commits v5.8-rc1~190^2~22 and v5.8-rc1~190^2~21.
|
||||
|
||||
* types/io_uring.h (struct_io_cqring_offsets): Replace resv array
|
||||
with flags, resv1, and resv2 fields.
|
||||
* xlat/uring_cqring_flags.in: New file.
|
||||
* configure.ac (AC_CHECK_MEMBERS): Check struct io_cqring_offsets.flags.
|
||||
* io_uring.c: Include "xlat/uring_cqring_flags.h".
|
||||
(SYS_FUNC(io_uring_setup)): Replace printing of the resv array
|
||||
of struct io_cqring_offsets with flags, resv1, and resv2 fields.
|
||||
* tests/io_uring_setup.c: Check it.
|
||||
|
||||
Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
|
||||
Resolves: https://github.com/strace/strace/issues/138
|
||||
---
|
||||
configure.ac | 1 +
|
||||
io_uring.c | 11 +++++++----
|
||||
tests/io_uring_setup.c | 31 ++++++++++++++++++++++++++-----
|
||||
types/io_uring.h | 4 +++-
|
||||
xlat/uring_cqring_flags.in | 1 +
|
||||
5 files changed, 38 insertions(+), 10 deletions(-)
|
||||
create mode 100644 xlat/uring_cqring_flags.in
|
||||
|
||||
Index: strace-5.7/configure.ac
|
||||
===================================================================
|
||||
--- strace-5.7.orig/configure.ac 2020-11-09 04:39:07.197892960 +0100
|
||||
+++ strace-5.7/configure.ac 2020-11-09 04:39:14.943826575 +0100
|
||||
@@ -481,6 +481,7 @@
|
||||
|
||||
AC_CHECK_HEADERS([linux/io_uring.h], [
|
||||
AC_CHECK_MEMBERS(m4_normalize([
|
||||
+ struct io_cqring_offsets.flags,
|
||||
struct io_uring_params.features,
|
||||
struct io_uring_params.wq_fd,
|
||||
struct io_uring_params.resv
|
||||
Index: strace-5.7/io_uring.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/io_uring.c 2020-11-09 04:39:07.197892960 +0100
|
||||
+++ strace-5.7/io_uring.c 2020-11-09 04:39:14.943826575 +0100
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "xlat/uring_setup_flags.h"
|
||||
#include "xlat/uring_enter_flags.h"
|
||||
#include "xlat/uring_register_opcodes.h"
|
||||
+#include "xlat/uring_cqring_flags.h"
|
||||
|
||||
#ifdef HAVE_STRUCT_IO_URING_PARAMS
|
||||
# ifdef HAVE_STRUCT_IO_URING_PARAMS_RESV
|
||||
@@ -88,10 +89,12 @@
|
||||
PRINT_FIELD_U(", ", params.cq_off, ring_entries);
|
||||
PRINT_FIELD_U(", ", params.cq_off, overflow);
|
||||
PRINT_FIELD_U(", ", params.cq_off, cqes);
|
||||
- if (!IS_ARRAY_ZERO(params.cq_off.resv)) {
|
||||
- PRINT_FIELD_ARRAY(", ", params.cq_off, resv, tcp,
|
||||
- print_xint64_array_member);
|
||||
- }
|
||||
+ PRINT_FIELD_FLAGS(", ", params.cq_off, flags,
|
||||
+ uring_cqring_flags, "IORING_CQ_???");
|
||||
+ if (params.cq_off.resv1)
|
||||
+ PRINT_FIELD_X(", ", params.cq_off, resv1);
|
||||
+ if (params.cq_off.resv2)
|
||||
+ PRINT_FIELD_X(", ", params.cq_off, resv2);
|
||||
tprints("}");
|
||||
}
|
||||
tprints("}");
|
||||
Index: strace-5.7/tests/io_uring_setup.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/io_uring_setup.c 2020-11-09 04:39:07.197892960 +0100
|
||||
+++ strace-5.7/tests/io_uring_setup.c 2020-11-09 04:39:14.943826575 +0100
|
||||
@@ -27,6 +27,7 @@
|
||||
# include "xlat.h"
|
||||
|
||||
# include "xlat/uring_setup_features.h"
|
||||
+# include "xlat/uring_cqring_flags.h"
|
||||
|
||||
# ifdef HAVE_STRUCT_IO_URING_PARAMS_FEATURES
|
||||
# ifdef HAVE_STRUCT_IO_URING_PARAMS_WQ_FD
|
||||
@@ -144,20 +145,40 @@
|
||||
params->sq_off.resv2);
|
||||
|
||||
printf("}, cq_off={head=%u, tail=%u, ring_mask=%u"
|
||||
- ", ring_entries=%u, overflow=%u, cqes=%u",
|
||||
+ ", ring_entries=%u, overflow=%u, cqes=%u, flags=",
|
||||
params->cq_off.head,
|
||||
params->cq_off.tail,
|
||||
params->cq_off.ring_mask,
|
||||
params->cq_off.ring_entries,
|
||||
params->cq_off.overflow,
|
||||
params->cq_off.cqes);
|
||||
- if (params->cq_off.resv[0] || params->cq_off.resv[1]) {
|
||||
- printf(", resv=[%#llx, %#llx]",
|
||||
+#ifdef HAVE_STRUCT_IO_CQRING_OFFSETS_FLAGS
|
||||
+ printflags(uring_cqring_flags,
|
||||
+ params->cq_off.flags,
|
||||
+ "IORING_CQ_???");
|
||||
+ if (params->cq_off.resv1)
|
||||
+ printf(", resv1=%#x", params->cq_off.resv1);
|
||||
+ if (params->cq_off.resv2)
|
||||
+ printf(", resv2=%#llx",
|
||||
(unsigned long long)
|
||||
- params->cq_off.resv[0],
|
||||
+ params->cq_off.resv2);
|
||||
+#else
|
||||
+ union {
|
||||
+ struct {
|
||||
+ uint32_t flags;
|
||||
+ uint32_t resv1;
|
||||
+ } s;
|
||||
+ uint64_t v;
|
||||
+ } u = { .v = params->cq_off.resv[0] };
|
||||
+ printflags(uring_cqring_flags, u.s.flags,
|
||||
+ "IORING_CQ_???");
|
||||
+ if (u.s.resv1)
|
||||
+ printf(", resv1=%#x", u.s.resv1);
|
||||
+ if (params->cq_off.resv[1])
|
||||
+ printf(", resv2=%#llx",
|
||||
(unsigned long long)
|
||||
params->cq_off.resv[1]);
|
||||
- }
|
||||
+#endif
|
||||
|
||||
printf("}}) = %ld<anon_inode:[io_uring]>\n", rc);
|
||||
}
|
||||
Index: strace-5.7/types/io_uring.h
|
||||
===================================================================
|
||||
--- strace-5.7.orig/types/io_uring.h 2020-11-09 04:39:07.198892952 +0100
|
||||
+++ strace-5.7/types/io_uring.h 2020-11-09 04:39:14.944826567 +0100
|
||||
@@ -31,7 +31,9 @@
|
||||
uint32_t ring_entries;
|
||||
uint32_t overflow;
|
||||
uint32_t cqes;
|
||||
- uint64_t resv[2];
|
||||
+ /** Added by v5.8-rc1~190^2~22 */ uint32_t flags;
|
||||
+ /** Added by v5.8-rc1~190^2~22 */ uint32_t resv1;
|
||||
+ /** Added by v5.8-rc1~190^2~22 */ uint64_t resv2;
|
||||
} struct_io_cqring_offsets;
|
||||
|
||||
typedef struct {
|
||||
Index: strace-5.7/xlat/uring_cqring_flags.in
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ strace-5.7/xlat/uring_cqring_flags.in 2020-11-09 04:39:14.944826567 +0100
|
||||
@@ -0,0 +1 @@
|
||||
+IORING_CQ_EVENTFD_DISABLED 1U
|
||||
Index: strace-5.7/Makefile.in
|
||||
===================================================================
|
||||
--- strace-5.7.orig/Makefile.in 2020-11-09 04:39:07.201892926 +0100
|
||||
+++ strace-5.7/Makefile.in 2020-11-09 04:42:54.519945367 +0100
|
||||
@@ -1506,10 +1506,10 @@
|
||||
xlat/uffd_register_mode_flags.in xlat/uffd_zeropage_flags.in \
|
||||
xlat/umount_flags.in xlat/unix_diag_attrs.in \
|
||||
xlat/unix_diag_show.in xlat/unshare_flags.in \
|
||||
- xlat/uring_enter_flags.in xlat/uring_op_flags.in \
|
||||
- xlat/uring_ops.in xlat/uring_register_opcodes.in \
|
||||
- xlat/uring_setup_features.in xlat/uring_setup_flags.in \
|
||||
- xlat/usagewho.in xlat/v4l2_buf_flags.in \
|
||||
+ xlat/uring_cqring_flags.in xlat/uring_enter_flags.in \
|
||||
+ xlat/uring_op_flags.in xlat/uring_ops.in \
|
||||
+ xlat/uring_register_opcodes.in xlat/uring_setup_features.in \
|
||||
+ xlat/uring_setup_flags.in xlat/usagewho.in xlat/v4l2_buf_flags.in \
|
||||
xlat/v4l2_buf_flags_masks.in xlat/v4l2_buf_flags_ts_src.in \
|
||||
xlat/v4l2_buf_flags_ts_type.in xlat/v4l2_buf_types.in \
|
||||
xlat/v4l2_capture_modes.in xlat/v4l2_colorspaces.in \
|
||||
@@ -1755,10 +1755,10 @@
|
||||
xlat/uffd_register_mode_flags.h xlat/uffd_zeropage_flags.h \
|
||||
xlat/umount_flags.h xlat/unix_diag_attrs.h \
|
||||
xlat/unix_diag_show.h xlat/unshare_flags.h \
|
||||
- xlat/uring_enter_flags.h xlat/uring_op_flags.h \
|
||||
- xlat/uring_ops.h xlat/uring_register_opcodes.h \
|
||||
- xlat/uring_setup_features.h xlat/uring_setup_flags.h \
|
||||
- xlat/usagewho.h xlat/v4l2_buf_flags.h \
|
||||
+ xlat/uring_cqring_flags.h xlat/uring_enter_flags.h \
|
||||
+ xlat/uring_op_flags.h xlat/uring_ops.h \
|
||||
+ xlat/uring_register_opcodes.h xlat/uring_setup_features.h \
|
||||
+ xlat/uring_setup_flags.h xlat/usagewho.h xlat/v4l2_buf_flags.h \
|
||||
xlat/v4l2_buf_flags_masks.h xlat/v4l2_buf_flags_ts_src.h \
|
||||
xlat/v4l2_buf_flags_ts_type.h xlat/v4l2_buf_types.h \
|
||||
xlat/v4l2_capture_modes.h xlat/v4l2_colorspaces.h \
|
||||
@@ -9974,6 +9974,8 @@
|
||||
$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
|
||||
$(top_srcdir)/xlat/unshare_flags.h: $(top_srcdir)/xlat/unshare_flags.in $(top_srcdir)/xlat/gen.sh
|
||||
$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
|
||||
+$(top_srcdir)/xlat/uring_cqring_flags.h: $(top_srcdir)/xlat/uring_cqring_flags.in $(top_srcdir)/xlat/gen.sh
|
||||
+ $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
|
||||
$(top_srcdir)/xlat/uring_enter_flags.h: $(top_srcdir)/xlat/uring_enter_flags.in $(top_srcdir)/xlat/gen.sh
|
||||
$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
|
||||
$(top_srcdir)/xlat/uring_op_flags.h: $(top_srcdir)/xlat/uring_op_flags.in $(top_srcdir)/xlat/gen.sh
|
||||
Index: strace-5.7/configure
|
||||
===================================================================
|
||||
--- strace-5.7.orig/configure 2020-11-09 04:39:07.205892892 +0100
|
||||
+++ strace-5.7/configure 2020-11-09 05:07:10.675485410 +0100
|
||||
@@ -12580,7 +12580,17 @@
|
||||
#define HAVE_LINUX_IO_URING_H 1
|
||||
_ACEOF
|
||||
|
||||
- ac_fn_c_check_member "$LINENO" "struct io_uring_params" "features" "ac_cv_member_struct_io_uring_params_features" "#include <linux/io_uring.h>
|
||||
+ ac_fn_c_check_member "$LINENO" "struct io_cqring_offsets" "flags" "ac_cv_member_struct_io_cqring_offsets_flags" "#include <linux/io_uring.h>
|
||||
+"
|
||||
+if test "x$ac_cv_member_struct_io_cqring_offsets_flags" = xyes; then :
|
||||
+
|
||||
+cat >>confdefs.h <<_ACEOF
|
||||
+#define HAVE_STRUCT_IO_CQRING_OFFSETS_FLAGS 1
|
||||
+_ACEOF
|
||||
+
|
||||
+
|
||||
+fi
|
||||
+ac_fn_c_check_member "$LINENO" "struct io_uring_params" "features" "ac_cv_member_struct_io_uring_params_features" "#include <linux/io_uring.h>
|
||||
"
|
||||
if test "x$ac_cv_member_struct_io_uring_params_features" = xyes; then :
|
||||
|
||||
Index: strace-5.7/tests-m32/io_uring_setup.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/io_uring_setup.c 2020-11-09 04:39:07.206892883 +0100
|
||||
+++ strace-5.7/tests-m32/io_uring_setup.c 2020-11-09 04:39:14.951826507 +0100
|
||||
@@ -27,6 +27,7 @@
|
||||
# include "xlat.h"
|
||||
|
||||
# include "xlat/uring_setup_features.h"
|
||||
+# include "xlat/uring_cqring_flags.h"
|
||||
|
||||
# ifdef HAVE_STRUCT_IO_URING_PARAMS_FEATURES
|
||||
# ifdef HAVE_STRUCT_IO_URING_PARAMS_WQ_FD
|
||||
@@ -144,20 +145,40 @@
|
||||
params->sq_off.resv2);
|
||||
|
||||
printf("}, cq_off={head=%u, tail=%u, ring_mask=%u"
|
||||
- ", ring_entries=%u, overflow=%u, cqes=%u",
|
||||
+ ", ring_entries=%u, overflow=%u, cqes=%u, flags=",
|
||||
params->cq_off.head,
|
||||
params->cq_off.tail,
|
||||
params->cq_off.ring_mask,
|
||||
params->cq_off.ring_entries,
|
||||
params->cq_off.overflow,
|
||||
params->cq_off.cqes);
|
||||
- if (params->cq_off.resv[0] || params->cq_off.resv[1]) {
|
||||
- printf(", resv=[%#llx, %#llx]",
|
||||
+#ifdef HAVE_STRUCT_IO_CQRING_OFFSETS_FLAGS
|
||||
+ printflags(uring_cqring_flags,
|
||||
+ params->cq_off.flags,
|
||||
+ "IORING_CQ_???");
|
||||
+ if (params->cq_off.resv1)
|
||||
+ printf(", resv1=%#x", params->cq_off.resv1);
|
||||
+ if (params->cq_off.resv2)
|
||||
+ printf(", resv2=%#llx",
|
||||
(unsigned long long)
|
||||
- params->cq_off.resv[0],
|
||||
+ params->cq_off.resv2);
|
||||
+#else
|
||||
+ union {
|
||||
+ struct {
|
||||
+ uint32_t flags;
|
||||
+ uint32_t resv1;
|
||||
+ } s;
|
||||
+ uint64_t v;
|
||||
+ } u = { .v = params->cq_off.resv[0] };
|
||||
+ printflags(uring_cqring_flags, u.s.flags,
|
||||
+ "IORING_CQ_???");
|
||||
+ if (u.s.resv1)
|
||||
+ printf(", resv1=%#x", u.s.resv1);
|
||||
+ if (params->cq_off.resv[1])
|
||||
+ printf(", resv2=%#llx",
|
||||
(unsigned long long)
|
||||
params->cq_off.resv[1]);
|
||||
- }
|
||||
+#endif
|
||||
|
||||
printf("}}) = %ld<anon_inode:[io_uring]>\n", rc);
|
||||
}
|
||||
Index: strace-5.7/tests-mx32/io_uring_setup.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/io_uring_setup.c 2020-11-09 04:39:07.206892883 +0100
|
||||
+++ strace-5.7/tests-mx32/io_uring_setup.c 2020-11-09 04:39:14.951826507 +0100
|
||||
@@ -27,6 +27,7 @@
|
||||
# include "xlat.h"
|
||||
|
||||
# include "xlat/uring_setup_features.h"
|
||||
+# include "xlat/uring_cqring_flags.h"
|
||||
|
||||
# ifdef HAVE_STRUCT_IO_URING_PARAMS_FEATURES
|
||||
# ifdef HAVE_STRUCT_IO_URING_PARAMS_WQ_FD
|
||||
@@ -144,20 +145,40 @@
|
||||
params->sq_off.resv2);
|
||||
|
||||
printf("}, cq_off={head=%u, tail=%u, ring_mask=%u"
|
||||
- ", ring_entries=%u, overflow=%u, cqes=%u",
|
||||
+ ", ring_entries=%u, overflow=%u, cqes=%u, flags=",
|
||||
params->cq_off.head,
|
||||
params->cq_off.tail,
|
||||
params->cq_off.ring_mask,
|
||||
params->cq_off.ring_entries,
|
||||
params->cq_off.overflow,
|
||||
params->cq_off.cqes);
|
||||
- if (params->cq_off.resv[0] || params->cq_off.resv[1]) {
|
||||
- printf(", resv=[%#llx, %#llx]",
|
||||
+#ifdef HAVE_STRUCT_IO_CQRING_OFFSETS_FLAGS
|
||||
+ printflags(uring_cqring_flags,
|
||||
+ params->cq_off.flags,
|
||||
+ "IORING_CQ_???");
|
||||
+ if (params->cq_off.resv1)
|
||||
+ printf(", resv1=%#x", params->cq_off.resv1);
|
||||
+ if (params->cq_off.resv2)
|
||||
+ printf(", resv2=%#llx",
|
||||
(unsigned long long)
|
||||
- params->cq_off.resv[0],
|
||||
+ params->cq_off.resv2);
|
||||
+#else
|
||||
+ union {
|
||||
+ struct {
|
||||
+ uint32_t flags;
|
||||
+ uint32_t resv1;
|
||||
+ } s;
|
||||
+ uint64_t v;
|
||||
+ } u = { .v = params->cq_off.resv[0] };
|
||||
+ printflags(uring_cqring_flags, u.s.flags,
|
||||
+ "IORING_CQ_???");
|
||||
+ if (u.s.resv1)
|
||||
+ printf(", resv1=%#x", u.s.resv1);
|
||||
+ if (params->cq_off.resv[1])
|
||||
+ printf(", resv2=%#llx",
|
||||
(unsigned long long)
|
||||
params->cq_off.resv[1]);
|
||||
- }
|
||||
+#endif
|
||||
|
||||
printf("}}) = %ld<anon_inode:[io_uring]>\n", rc);
|
||||
}
|
||||
Index: strace-5.7/xlat/uring_cqring_flags.h
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ strace-5.7/xlat/uring_cqring_flags.h 2020-11-09 05:07:27.046345327 +0100
|
||||
@@ -0,0 +1,48 @@
|
||||
+/* Generated by ./xlat/gen.sh from ./xlat/uring_cqring_flags.in; do not edit. */
|
||||
+
|
||||
+#include "gcc_compat.h"
|
||||
+#include "static_assert.h"
|
||||
+
|
||||
+#if defined(IORING_CQ_EVENTFD_DISABLED) || (defined(HAVE_DECL_IORING_CQ_EVENTFD_DISABLED) && HAVE_DECL_IORING_CQ_EVENTFD_DISABLED)
|
||||
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
|
||||
+static_assert((IORING_CQ_EVENTFD_DISABLED) == (1U), "IORING_CQ_EVENTFD_DISABLED != 1U");
|
||||
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
|
||||
+#else
|
||||
+# define IORING_CQ_EVENTFD_DISABLED 1U
|
||||
+#endif
|
||||
+
|
||||
+#ifndef XLAT_MACROS_ONLY
|
||||
+
|
||||
+# ifdef IN_MPERS
|
||||
+
|
||||
+# error static const struct xlat uring_cqring_flags in mpers mode
|
||||
+
|
||||
+# else
|
||||
+
|
||||
+static const struct xlat_data uring_cqring_flags_xdata[] = {
|
||||
+ XLAT(IORING_CQ_EVENTFD_DISABLED),
|
||||
+ #define XLAT_VAL_0 ((unsigned) (IORING_CQ_EVENTFD_DISABLED))
|
||||
+ #define XLAT_STR_0 STRINGIFY(IORING_CQ_EVENTFD_DISABLED)
|
||||
+};
|
||||
+static
|
||||
+const struct xlat uring_cqring_flags[1] = { {
|
||||
+ .data = uring_cqring_flags_xdata,
|
||||
+ .size = ARRAY_SIZE(uring_cqring_flags_xdata),
|
||||
+ .type = XT_NORMAL,
|
||||
+ .flags_mask = 0
|
||||
+# ifdef XLAT_VAL_0
|
||||
+ | XLAT_VAL_0
|
||||
+# endif
|
||||
+ ,
|
||||
+ .flags_strsz = 0
|
||||
+# ifdef XLAT_STR_0
|
||||
+ + sizeof(XLAT_STR_0)
|
||||
+# endif
|
||||
+ ,
|
||||
+} };
|
||||
+
|
||||
+# undef XLAT_STR_0
|
||||
+# undef XLAT_VAL_0
|
||||
+# endif /* !IN_MPERS */
|
||||
+
|
||||
+#endif /* !XLAT_MACROS_ONLY */
|
@ -1,217 +0,0 @@
|
||||
From dd6b70f5d4db14b432f424071d262e87fa944c96 Mon Sep 17 00:00:00 2001
|
||||
From: "Dmitry V. Levin" <ldv@altlinux.org>
|
||||
Date: Sun, 28 Jun 2020 08:00:00 +0000
|
||||
Subject: [PATCH 115/115] xlat: update IORING_* constants
|
||||
|
||||
* xlat/uring_ops.in (IORING_OP_TEE): New constant introduced by Linux
|
||||
kernel commit v5.8-rc1~190^2~14.
|
||||
* tests/io_uring_register.c: Update expected output.
|
||||
---
|
||||
tests/io_uring_register.c | 12 ++++++------
|
||||
xlat/uring_ops.in | 1 +
|
||||
2 files changed, 7 insertions(+), 6 deletions(-)
|
||||
|
||||
Index: strace-5.7/tests/io_uring_register.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/io_uring_register.c 2020-11-09 04:44:38.311057254 +0100
|
||||
+++ strace-5.7/tests/io_uring_register.c 2020-11-09 04:44:40.445038991 +0100
|
||||
@@ -225,12 +225,12 @@
|
||||
probe->ops[0].flags = 0;
|
||||
probe->ops[0].resv2 = 0xbeefface;
|
||||
|
||||
- probe->ops[1].op = 32;
|
||||
+ probe->ops[1].op = 33;
|
||||
probe->ops[1].resv = 0;
|
||||
probe->ops[1].flags = IO_URING_OP_SUPPORTED;
|
||||
probe->ops[1].resv2 = 0xdeadc0de;
|
||||
|
||||
- probe->ops[2].op = 33;
|
||||
+ probe->ops[2].op = 34;
|
||||
probe->ops[2].resv = 0xaf;
|
||||
probe->ops[2].flags = 0xbeef;
|
||||
probe->ops[2].resv2 = 0;
|
||||
@@ -245,22 +245,22 @@
|
||||
", {last_op=IORING_OP_EPOLL_CTL, ops_len=%hhu"
|
||||
", resv2=[0, %#x, 0], ops=["
|
||||
"{op=IORING_OP_NOP, resv=0xde, flags=0, resv2=0xbeefface}, "
|
||||
- "{op=IORING_OP_REMOVE_BUFFERS, flags=IO_URING_OP_SUPPORTED"
|
||||
+ "{op=IORING_OP_TEE, flags=IO_URING_OP_SUPPORTED"
|
||||
", resv2=0xdeadc0de}, "
|
||||
- "{op=33 /* IORING_OP_??? */, resv=0xaf"
|
||||
+ "{op=34 /* IORING_OP_??? */, resv=0xaf"
|
||||
", flags=IO_URING_OP_SUPPORTED|0xbeee}, "
|
||||
"{op=254 /* IORING_OP_??? */"
|
||||
", flags=0xc0de /* IO_URING_OP_??? */}]}, 4) = %s\n",
|
||||
fd_null, path_null, probe->ops_len, probe->resv2[1], errstr);
|
||||
|
||||
- probe->last_op = 33;
|
||||
+ probe->last_op = 34;
|
||||
probe->resv2[1] = 0;
|
||||
fill_memory_ex(probe->ops, sizeof(probe->ops[0]) * (DEFAULT_STRLEN + 1),
|
||||
0x40, 0x80);
|
||||
sys_io_uring_register(fd_null, IORING_REGISTER_PROBE, probe,
|
||||
DEFAULT_STRLEN + 1);
|
||||
printf("io_uring_register(%u<%s>, IORING_REGISTER_PROBE"
|
||||
- ", {last_op=33 /* IORING_OP_??? */, ops_len=%hhu, ops=[",
|
||||
+ ", {last_op=34 /* IORING_OP_??? */, ops_len=%hhu, ops=[",
|
||||
fd_null, path_null, probe->ops_len);
|
||||
for (size_t i = 0; i < DEFAULT_STRLEN; i++) {
|
||||
printf("%s{op=%u /* IORING_OP_??? */, resv=%#hhx"
|
||||
Index: strace-5.7/xlat/uring_ops.in
|
||||
===================================================================
|
||||
--- strace-5.7.orig/xlat/uring_ops.in 2020-11-09 04:44:38.311057254 +0100
|
||||
+++ strace-5.7/xlat/uring_ops.in 2020-11-09 04:44:40.445038991 +0100
|
||||
@@ -32,3 +32,4 @@
|
||||
IORING_OP_SPLICE 30
|
||||
IORING_OP_PROVIDE_BUFFERS 31
|
||||
IORING_OP_REMOVE_BUFFERS 32
|
||||
+IORING_OP_TEE 33
|
||||
Index: strace-5.7/tests-m32/io_uring_register.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/io_uring_register.c 2020-11-09 04:44:38.312057246 +0100
|
||||
+++ strace-5.7/tests-m32/io_uring_register.c 2020-11-09 04:44:40.445038991 +0100
|
||||
@@ -225,12 +225,12 @@
|
||||
probe->ops[0].flags = 0;
|
||||
probe->ops[0].resv2 = 0xbeefface;
|
||||
|
||||
- probe->ops[1].op = 32;
|
||||
+ probe->ops[1].op = 33;
|
||||
probe->ops[1].resv = 0;
|
||||
probe->ops[1].flags = IO_URING_OP_SUPPORTED;
|
||||
probe->ops[1].resv2 = 0xdeadc0de;
|
||||
|
||||
- probe->ops[2].op = 33;
|
||||
+ probe->ops[2].op = 34;
|
||||
probe->ops[2].resv = 0xaf;
|
||||
probe->ops[2].flags = 0xbeef;
|
||||
probe->ops[2].resv2 = 0;
|
||||
@@ -245,22 +245,22 @@
|
||||
", {last_op=IORING_OP_EPOLL_CTL, ops_len=%hhu"
|
||||
", resv2=[0, %#x, 0], ops=["
|
||||
"{op=IORING_OP_NOP, resv=0xde, flags=0, resv2=0xbeefface}, "
|
||||
- "{op=IORING_OP_REMOVE_BUFFERS, flags=IO_URING_OP_SUPPORTED"
|
||||
+ "{op=IORING_OP_TEE, flags=IO_URING_OP_SUPPORTED"
|
||||
", resv2=0xdeadc0de}, "
|
||||
- "{op=33 /* IORING_OP_??? */, resv=0xaf"
|
||||
+ "{op=34 /* IORING_OP_??? */, resv=0xaf"
|
||||
", flags=IO_URING_OP_SUPPORTED|0xbeee}, "
|
||||
"{op=254 /* IORING_OP_??? */"
|
||||
", flags=0xc0de /* IO_URING_OP_??? */}]}, 4) = %s\n",
|
||||
fd_null, path_null, probe->ops_len, probe->resv2[1], errstr);
|
||||
|
||||
- probe->last_op = 33;
|
||||
+ probe->last_op = 34;
|
||||
probe->resv2[1] = 0;
|
||||
fill_memory_ex(probe->ops, sizeof(probe->ops[0]) * (DEFAULT_STRLEN + 1),
|
||||
0x40, 0x80);
|
||||
sys_io_uring_register(fd_null, IORING_REGISTER_PROBE, probe,
|
||||
DEFAULT_STRLEN + 1);
|
||||
printf("io_uring_register(%u<%s>, IORING_REGISTER_PROBE"
|
||||
- ", {last_op=33 /* IORING_OP_??? */, ops_len=%hhu, ops=[",
|
||||
+ ", {last_op=34 /* IORING_OP_??? */, ops_len=%hhu, ops=[",
|
||||
fd_null, path_null, probe->ops_len);
|
||||
for (size_t i = 0; i < DEFAULT_STRLEN; i++) {
|
||||
printf("%s{op=%u /* IORING_OP_??? */, resv=%#hhx"
|
||||
Index: strace-5.7/tests-mx32/io_uring_register.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/io_uring_register.c 2020-11-09 04:44:38.312057246 +0100
|
||||
+++ strace-5.7/tests-mx32/io_uring_register.c 2020-11-09 04:44:40.446038982 +0100
|
||||
@@ -225,12 +225,12 @@
|
||||
probe->ops[0].flags = 0;
|
||||
probe->ops[0].resv2 = 0xbeefface;
|
||||
|
||||
- probe->ops[1].op = 32;
|
||||
+ probe->ops[1].op = 33;
|
||||
probe->ops[1].resv = 0;
|
||||
probe->ops[1].flags = IO_URING_OP_SUPPORTED;
|
||||
probe->ops[1].resv2 = 0xdeadc0de;
|
||||
|
||||
- probe->ops[2].op = 33;
|
||||
+ probe->ops[2].op = 34;
|
||||
probe->ops[2].resv = 0xaf;
|
||||
probe->ops[2].flags = 0xbeef;
|
||||
probe->ops[2].resv2 = 0;
|
||||
@@ -245,22 +245,22 @@
|
||||
", {last_op=IORING_OP_EPOLL_CTL, ops_len=%hhu"
|
||||
", resv2=[0, %#x, 0], ops=["
|
||||
"{op=IORING_OP_NOP, resv=0xde, flags=0, resv2=0xbeefface}, "
|
||||
- "{op=IORING_OP_REMOVE_BUFFERS, flags=IO_URING_OP_SUPPORTED"
|
||||
+ "{op=IORING_OP_TEE, flags=IO_URING_OP_SUPPORTED"
|
||||
", resv2=0xdeadc0de}, "
|
||||
- "{op=33 /* IORING_OP_??? */, resv=0xaf"
|
||||
+ "{op=34 /* IORING_OP_??? */, resv=0xaf"
|
||||
", flags=IO_URING_OP_SUPPORTED|0xbeee}, "
|
||||
"{op=254 /* IORING_OP_??? */"
|
||||
", flags=0xc0de /* IO_URING_OP_??? */}]}, 4) = %s\n",
|
||||
fd_null, path_null, probe->ops_len, probe->resv2[1], errstr);
|
||||
|
||||
- probe->last_op = 33;
|
||||
+ probe->last_op = 34;
|
||||
probe->resv2[1] = 0;
|
||||
fill_memory_ex(probe->ops, sizeof(probe->ops[0]) * (DEFAULT_STRLEN + 1),
|
||||
0x40, 0x80);
|
||||
sys_io_uring_register(fd_null, IORING_REGISTER_PROBE, probe,
|
||||
DEFAULT_STRLEN + 1);
|
||||
printf("io_uring_register(%u<%s>, IORING_REGISTER_PROBE"
|
||||
- ", {last_op=33 /* IORING_OP_??? */, ops_len=%hhu, ops=[",
|
||||
+ ", {last_op=34 /* IORING_OP_??? */, ops_len=%hhu, ops=[",
|
||||
fd_null, path_null, probe->ops_len);
|
||||
for (size_t i = 0; i < DEFAULT_STRLEN; i++) {
|
||||
printf("%s{op=%u /* IORING_OP_??? */, resv=%#hhx"
|
||||
Index: strace-5.7/xlat/uring_ops.h
|
||||
===================================================================
|
||||
--- strace-5.7.orig/xlat/uring_ops.h 2020-11-09 04:44:38.313057237 +0100
|
||||
+++ strace-5.7/xlat/uring_ops.h 2020-11-09 04:47:01.835829135 +0100
|
||||
@@ -234,6 +234,13 @@
|
||||
#else
|
||||
# define IORING_OP_REMOVE_BUFFERS 32
|
||||
#endif
|
||||
+#if defined(IORING_OP_TEE) || (defined(HAVE_DECL_IORING_OP_TEE) && HAVE_DECL_IORING_OP_TEE)
|
||||
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
|
||||
+static_assert((IORING_OP_TEE) == (33), "IORING_OP_TEE != 33");
|
||||
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
|
||||
+#else
|
||||
+# define IORING_OP_TEE 33
|
||||
+#endif
|
||||
|
||||
#ifndef XLAT_MACROS_ONLY
|
||||
|
||||
@@ -343,6 +350,9 @@
|
||||
[IORING_OP_REMOVE_BUFFERS] = XLAT(IORING_OP_REMOVE_BUFFERS),
|
||||
#define XLAT_VAL_32 ((unsigned) (IORING_OP_REMOVE_BUFFERS))
|
||||
#define XLAT_STR_32 STRINGIFY(IORING_OP_REMOVE_BUFFERS)
|
||||
+ [IORING_OP_TEE] = XLAT(IORING_OP_TEE),
|
||||
+ #define XLAT_VAL_33 ((unsigned) (IORING_OP_TEE))
|
||||
+ #define XLAT_STR_33 STRINGIFY(IORING_OP_TEE)
|
||||
};
|
||||
static
|
||||
const struct xlat uring_ops[1] = { {
|
||||
@@ -449,6 +459,9 @@
|
||||
# ifdef XLAT_VAL_32
|
||||
| XLAT_VAL_32
|
||||
# endif
|
||||
+# ifdef XLAT_VAL_33
|
||||
+ | XLAT_VAL_33
|
||||
+# endif
|
||||
,
|
||||
.flags_strsz = 0
|
||||
# ifdef XLAT_STR_0
|
||||
@@ -550,6 +563,9 @@
|
||||
# ifdef XLAT_STR_32
|
||||
+ sizeof(XLAT_STR_32)
|
||||
# endif
|
||||
+# ifdef XLAT_STR_33
|
||||
+ + sizeof(XLAT_STR_33)
|
||||
+# endif
|
||||
,
|
||||
} };
|
||||
|
||||
@@ -619,6 +635,8 @@
|
||||
# undef XLAT_VAL_31
|
||||
# undef XLAT_STR_32
|
||||
# undef XLAT_VAL_32
|
||||
+# undef XLAT_STR_33
|
||||
+# undef XLAT_VAL_33
|
||||
# endif /* !IN_MPERS */
|
||||
|
||||
#endif /* !XLAT_MACROS_ONLY */
|
@ -1,84 +0,0 @@
|
||||
From b0a361c0a9095b396ff7100203c767ec9ffd2cfa Mon Sep 17 00:00:00 2001
|
||||
From: "Dmitry V. Levin" <ldv@altlinux.org>
|
||||
Date: Tue, 16 Jun 2020 08:00:00 +0000
|
||||
Subject: [PATCH] types: skip field lines that start with comments
|
||||
|
||||
This allows to exclude certain fields from type checks by placing
|
||||
comments at the beginning of the corresponding lines.
|
||||
|
||||
* types/find_last_type_fields.awk: Skip lines starting with spaces
|
||||
followed by "/".
|
||||
---
|
||||
types/find_last_type_fields.awk | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
Index: strace-5.7/types/find_last_type_fields.awk
|
||||
===================================================================
|
||||
--- strace-5.7.orig/types/find_last_type_fields.awk 2020-01-21 19:02:38.000000000 +0100
|
||||
+++ strace-5.7/types/find_last_type_fields.awk 2020-11-09 04:47:06.976785148 +0100
|
||||
@@ -17,7 +17,7 @@
|
||||
print a[1] "." last_field
|
||||
next
|
||||
}
|
||||
- if (match($0, /^[[:space:]]+[^];:[]+[[:space:]]+([^][:space:];:[]+)(\[[^];:[]*\])?;.*$/, a)) {
|
||||
+ if (match($0, /^[[:space:]]+[^];[:space:]:\/[][^];:[]*[[:space:]]+([^][:space:];:[]+)(\[[^];:[]*\])?;.*$/, a)) {
|
||||
last_field = a[1]
|
||||
next
|
||||
}
|
||||
Index: strace-5.7/types/check-io_uring.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/types/check-io_uring.c 2020-11-09 04:47:06.977785139 +0100
|
||||
+++ strace-5.7/types/check-io_uring.c 2020-11-09 04:49:10.033732186 +0100
|
||||
@@ -14,13 +14,13 @@
|
||||
#endif /* HAVE_STRUCT_IO_SQRING_OFFSETS */
|
||||
|
||||
#ifdef HAVE_STRUCT_IO_CQRING_OFFSETS
|
||||
-# ifdef HAVE_STRUCT_IO_CQRING_OFFSETS_RESV
|
||||
+# ifdef HAVE_STRUCT_IO_CQRING_OFFSETS_CQES
|
||||
static_assert(sizeof(struct io_cqring_offsets) == sizeof(struct_io_cqring_offsets),
|
||||
"struct io_cqring_offsets size mismatch, please update the decoder or fix the kernel");
|
||||
# else
|
||||
-static_assert(sizeof(struct io_cqring_offsets) <= offsetof(struct_io_cqring_offsets, resv),
|
||||
+static_assert(sizeof(struct io_cqring_offsets) <= offsetof(struct_io_cqring_offsets, cqes),
|
||||
"struct io_cqring_offsets size mismatch, please update the decoder or fix the kernel");
|
||||
-# endif /* HAVE_STRUCT_IO_CQRING_OFFSETS_RESV */
|
||||
+# endif /* HAVE_STRUCT_IO_CQRING_OFFSETS_CQES */
|
||||
#endif /* HAVE_STRUCT_IO_CQRING_OFFSETS */
|
||||
|
||||
#ifdef HAVE_STRUCT_IO_URING_PARAMS
|
||||
Index: strace-5.7/config.h.in
|
||||
===================================================================
|
||||
--- strace-5.7.orig/config.h.in 2020-11-09 04:47:06.980785114 +0100
|
||||
+++ strace-5.7/config.h.in 2020-11-09 04:50:11.871203054 +0100
|
||||
@@ -2596,8 +2596,8 @@
|
||||
/* Define to 1 if the system has the type `struct io_cqring_offsets'. */
|
||||
#undef HAVE_STRUCT_IO_CQRING_OFFSETS
|
||||
|
||||
-/* Define to 1 if `resv' is a member of `struct io_cqring_offsets'. */
|
||||
-#undef HAVE_STRUCT_IO_CQRING_OFFSETS_RESV
|
||||
+/* Define to 1 if `cqes' is a member of `struct io_cqring_offsets'. */
|
||||
+#undef HAVE_STRUCT_IO_CQRING_OFFSETS_CQES
|
||||
|
||||
/* Define to 1 if the system has the type `struct io_sqring_offsets'. */
|
||||
#undef HAVE_STRUCT_IO_SQRING_OFFSETS
|
||||
Index: strace-5.7/configure
|
||||
===================================================================
|
||||
--- strace-5.7.orig/configure 2020-11-09 04:47:06.988785045 +0100
|
||||
+++ strace-5.7/configure 2020-11-09 04:51:12.500684263 +0100
|
||||
@@ -13475,13 +13475,13 @@
|
||||
#define HAVE_STRUCT_IO_CQRING_OFFSETS 1
|
||||
_ACEOF
|
||||
|
||||
-ac_fn_c_check_member "$LINENO" "struct io_cqring_offsets" "resv" "ac_cv_member_struct_io_cqring_offsets_resv" "$ac_includes_default
|
||||
+ac_fn_c_check_member "$LINENO" "struct io_cqring_offsets" "cqes" "ac_cv_member_struct_io_cqring_offsets_cqes" "$ac_includes_default
|
||||
#include <linux/io_uring.h>
|
||||
"
|
||||
-if test "x$ac_cv_member_struct_io_cqring_offsets_resv" = xyes; then :
|
||||
+if test "x$ac_cv_member_struct_io_cqring_offsets_cqes" = xyes; then :
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
-#define HAVE_STRUCT_IO_CQRING_OFFSETS_RESV 1
|
||||
+#define HAVE_STRUCT_IO_CQRING_OFFSETS_CQES 1
|
||||
_ACEOF
|
||||
|
||||
|
@ -1,155 +0,0 @@
|
||||
From 8806a21b612d76c8732d0df2ebaf52b62166ce51 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81kos=20Uzonyi?= <uzonyi.akos@gmail.com>
|
||||
Date: Sat, 13 Jun 2020 18:18:31 +0200
|
||||
Subject: [PATCH 119/138] print_fields.h: add PRINT_FIELD_LEN macro
|
||||
|
||||
* print_fields.h (PRINT_FIELD_LEN): New macro.
|
||||
* net.c: (print_get_linger, print_get_ucred, print_tpacket_stats):
|
||||
Rewrite using PRINT_FIELD_LEN.
|
||||
---
|
||||
net.c | 90 ++++++----------------------------------------------------
|
||||
print_fields.h | 15 ++++++++++
|
||||
2 files changed, 23 insertions(+), 82 deletions(-)
|
||||
|
||||
diff --git a/net.c b/net.c
|
||||
index a58fa92..9ea34b2 100644
|
||||
--- a/net.c
|
||||
+++ b/net.c
|
||||
@@ -579,24 +579,8 @@ print_get_linger(struct tcb *const tcp, const kernel_ulong_t addr,
|
||||
if (umoven_or_printaddr(tcp, addr, len, &linger))
|
||||
return;
|
||||
|
||||
- if (len < sizeof(linger.l_onoff)) {
|
||||
- tprints("{l_onoff=");
|
||||
- print_quoted_string((void *) &linger.l_onoff,
|
||||
- len, QUOTE_FORCE_HEX);
|
||||
- } else {
|
||||
- PRINT_FIELD_D("{", linger, l_onoff);
|
||||
-
|
||||
- if (len > offsetof(struct linger, l_linger)) {
|
||||
- len -= offsetof(struct linger, l_linger);
|
||||
- if (len < sizeof(linger.l_linger)) {
|
||||
- tprints(", l_linger=");
|
||||
- print_quoted_string((void *) &linger.l_linger,
|
||||
- len, QUOTE_FORCE_HEX);
|
||||
- } else {
|
||||
- PRINT_FIELD_D(", ", linger, l_linger);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
+ PRINT_FIELD_LEN("{", linger, l_onoff, len, PRINT_FIELD_D);
|
||||
+ PRINT_FIELD_LEN(", ", linger, l_linger, len, PRINT_FIELD_D);
|
||||
tprints("}");
|
||||
}
|
||||
|
||||
@@ -617,38 +601,9 @@ print_get_ucred(struct tcb *const tcp, const kernel_ulong_t addr,
|
||||
if (umoven_or_printaddr(tcp, addr, len, &uc))
|
||||
return;
|
||||
|
||||
- if (len < sizeof(uc.pid)) {
|
||||
- tprints("{pid=");
|
||||
- print_quoted_string((void *) &uc.pid,
|
||||
- len, QUOTE_FORCE_HEX);
|
||||
- } else {
|
||||
- PRINT_FIELD_D("{", uc, pid);
|
||||
-
|
||||
- if (len > offsetof(struct ucred, uid)) {
|
||||
- len -= offsetof(struct ucred, uid);
|
||||
- if (len < sizeof(uc.uid)) {
|
||||
- tprints(", uid=");
|
||||
- print_quoted_string((void *) &uc.uid,
|
||||
- len, QUOTE_FORCE_HEX);
|
||||
- } else {
|
||||
- PRINT_FIELD_UID(", ", uc, uid);
|
||||
-
|
||||
- if (len > offsetof(struct ucred, gid) -
|
||||
- offsetof(struct ucred, uid)) {
|
||||
- len -= offsetof(struct ucred, gid) -
|
||||
- offsetof(struct ucred, uid);
|
||||
- if (len < sizeof(uc.gid)) {
|
||||
- tprints(", gid=");
|
||||
- print_quoted_string((void *) &uc.gid,
|
||||
- len,
|
||||
- QUOTE_FORCE_HEX);
|
||||
- } else {
|
||||
- PRINT_FIELD_UID(", ", uc, gid);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
+ PRINT_FIELD_LEN("{", uc, pid, len, PRINT_FIELD_D);
|
||||
+ PRINT_FIELD_LEN(", ", uc, uid, len, PRINT_FIELD_UID);
|
||||
+ PRINT_FIELD_LEN(", ", uc, gid, len, PRINT_FIELD_UID);
|
||||
tprints("}");
|
||||
}
|
||||
|
||||
@@ -688,38 +643,9 @@ print_tpacket_stats(struct tcb *const tcp, const kernel_ulong_t addr,
|
||||
if (umoven_or_printaddr(tcp, addr, len, &stats))
|
||||
return;
|
||||
|
||||
- if (len < sizeof(stats.tp_packets)) {
|
||||
- tprints("{tp_packets=");
|
||||
- print_quoted_string((void *) &stats.tp_packets,
|
||||
- len, QUOTE_FORCE_HEX);
|
||||
- } else {
|
||||
- PRINT_FIELD_U("{", stats, tp_packets);
|
||||
-
|
||||
- if (len > offsetof(struct tp_stats, tp_drops)) {
|
||||
- len -= offsetof(struct tp_stats, tp_drops);
|
||||
- if (len < sizeof(stats.tp_drops)) {
|
||||
- tprints(", tp_drops=");
|
||||
- print_quoted_string((void *) &stats.tp_drops,
|
||||
- len, QUOTE_FORCE_HEX);
|
||||
- } else {
|
||||
- PRINT_FIELD_U(", ", stats, tp_drops);
|
||||
-
|
||||
- if (len > offsetof(struct tp_stats, tp_freeze_q_cnt) -
|
||||
- offsetof(struct tp_stats, tp_drops)) {
|
||||
- len -= offsetof(struct tp_stats, tp_freeze_q_cnt) -
|
||||
- offsetof(struct tp_stats, tp_drops);
|
||||
- if (len < sizeof(stats.tp_freeze_q_cnt)) {
|
||||
- tprints(", tp_freeze_q_cnt=");
|
||||
- print_quoted_string((void *) &stats.tp_freeze_q_cnt,
|
||||
- len,
|
||||
- QUOTE_FORCE_HEX);
|
||||
- } else {
|
||||
- PRINT_FIELD_U(", ", stats, tp_freeze_q_cnt);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
+ PRINT_FIELD_LEN("{", stats, tp_packets, len, PRINT_FIELD_U);
|
||||
+ PRINT_FIELD_LEN(", ", stats, tp_drops, len, PRINT_FIELD_U);
|
||||
+ PRINT_FIELD_LEN(", ", stats, tp_freeze_q_cnt, len, PRINT_FIELD_U);
|
||||
tprints("}");
|
||||
}
|
||||
#endif /* PACKET_STATISTICS */
|
||||
diff --git a/print_fields.h b/print_fields.h
|
||||
index 02c56bf..70dbbff 100644
|
||||
--- a/print_fields.h
|
||||
+++ b/print_fields.h
|
||||
@@ -277,4 +277,19 @@
|
||||
(size_), (hwtype_)); \
|
||||
} while (0)
|
||||
|
||||
+# define PRINT_FIELD_LEN(prefix_, where_, field_, \
|
||||
+ len_, print_func_, ...) \
|
||||
+ do { \
|
||||
+ unsigned int start = offsetof(typeof(where_), field_); \
|
||||
+ unsigned int end = start + sizeof(where_.field_); \
|
||||
+ if (len_ >= end) { \
|
||||
+ print_func_(prefix_, where_, field_, \
|
||||
+ ##__VA_ARGS__); \
|
||||
+ } else if (len_ > start) { \
|
||||
+ tprintf("%s%s=", prefix_, #field_); \
|
||||
+ print_quoted_string((void *)&where_.field_, \
|
||||
+ len_ - start, QUOTE_FORCE_HEX); \
|
||||
+ } \
|
||||
+ } while (0)
|
||||
+
|
||||
#endif /* !STRACE_PRINT_FIELDS_H */
|
||||
--
|
||||
2.1.4
|
||||
|
@ -1,157 +0,0 @@
|
||||
From c9e41cd3485fa1a65dc6206c5b210b4be4c5597c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81kos=20Uzonyi?= <uzonyi.akos@gmail.com>
|
||||
Date: Sat, 13 Jun 2020 18:18:32 +0200
|
||||
Subject: [PATCH 120/138] Move ilog* functions from util.c to defs.h
|
||||
|
||||
* util.c (ILOG2_ITER_, ilog2_klong, ilog2_64, ilog2_32): Move ...
|
||||
* defs.h: ... here.
|
||||
---
|
||||
defs.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
util.c | 62 --------------------------------------------------------------
|
||||
2 files changed, 60 insertions(+), 62 deletions(-)
|
||||
|
||||
diff --git a/defs.h b/defs.h
|
||||
index 3aa07fb..d8bd513 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -1698,4 +1698,64 @@ scno_is_valid(kernel_ulong_t scno)
|
||||
|
||||
# define SYS_FUNC(syscall_name) int SYS_FUNC_NAME(sys_ ## syscall_name)(struct tcb *tcp)
|
||||
|
||||
+#define ILOG2_ITER_(val_, ret_, bit_) \
|
||||
+ do { \
|
||||
+ typeof(ret_) shift_ = \
|
||||
+ ((val_) > ((((typeof(val_)) 1) \
|
||||
+ << (1 << (bit_))) - 1)) << (bit_); \
|
||||
+ (val_) >>= shift_; \
|
||||
+ (ret_) |= shift_; \
|
||||
+ } while (0)
|
||||
+
|
||||
+/**
|
||||
+ * Calculate floor(log2(val)), with the exception of val == 0, for which 0
|
||||
+ * is returned as well.
|
||||
+ *
|
||||
+ * @param val 64-bit value to calculate integer base-2 logarithm for.
|
||||
+ * @return (unsigned int) floor(log2(val)) if val > 0, 0 if val == 0.
|
||||
+ */
|
||||
+static inline unsigned int
|
||||
+ilog2_64(uint64_t val)
|
||||
+{
|
||||
+ unsigned int ret = 0;
|
||||
+
|
||||
+ ILOG2_ITER_(val, ret, 5);
|
||||
+ ILOG2_ITER_(val, ret, 4);
|
||||
+ ILOG2_ITER_(val, ret, 3);
|
||||
+ ILOG2_ITER_(val, ret, 2);
|
||||
+ ILOG2_ITER_(val, ret, 1);
|
||||
+ ILOG2_ITER_(val, ret, 0);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * Calculate floor(log2(val)), with the exception of val == 0, for which 0
|
||||
+ * is returned as well.
|
||||
+ *
|
||||
+ * @param val 32-bit value to calculate integer base-2 logarithm for.
|
||||
+ * @return (unsigned int) floor(log2(val)) if val > 0, 0 if val == 0.
|
||||
+ */
|
||||
+static inline unsigned int
|
||||
+ilog2_32(uint32_t val)
|
||||
+{
|
||||
+ unsigned int ret = 0;
|
||||
+
|
||||
+ ILOG2_ITER_(val, ret, 4);
|
||||
+ ILOG2_ITER_(val, ret, 3);
|
||||
+ ILOG2_ITER_(val, ret, 2);
|
||||
+ ILOG2_ITER_(val, ret, 1);
|
||||
+ ILOG2_ITER_(val, ret, 0);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+#if SIZEOF_KERNEL_LONG_T > 4
|
||||
+# define ilog2_klong ilog2_64
|
||||
+#else
|
||||
+# define ilog2_klong ilog2_32
|
||||
+#endif
|
||||
+
|
||||
+#undef ILOG2_ITER_
|
||||
+
|
||||
#endif /* !STRACE_DEFS_H */
|
||||
diff --git a/util.c b/util.c
|
||||
index 59696b5..cde76c1 100644
|
||||
--- a/util.c
|
||||
+++ b/util.c
|
||||
@@ -1120,68 +1120,6 @@ dumpiov_upto(struct tcb *const tcp, const int len, const kernel_ulong_t addr,
|
||||
#undef iov
|
||||
}
|
||||
|
||||
-#define ILOG2_ITER_(val_, ret_, bit_) \
|
||||
- do { \
|
||||
- typeof(ret_) shift_ = \
|
||||
- ((val_) > ((((typeof(val_)) 1) \
|
||||
- << (1 << (bit_))) - 1)) << (bit_); \
|
||||
- (val_) >>= shift_; \
|
||||
- (ret_) |= shift_; \
|
||||
- } while (0)
|
||||
-
|
||||
-#if SIZEOF_KERNEL_LONG_T > 4
|
||||
-
|
||||
-# define ilog2_klong ilog2_64
|
||||
-/**
|
||||
- * Calculate floor(log2(val)), with the exception of val == 0, for which 0
|
||||
- * is returned as well.
|
||||
- *
|
||||
- * @param val 64-bit value to calculate integer base-2 logarithm for.
|
||||
- * @return (unsigned int) floor(log2(val)) if val > 0, 0 if val == 0.
|
||||
- */
|
||||
-static inline unsigned int
|
||||
-ilog2_64(uint64_t val)
|
||||
-{
|
||||
- unsigned int ret = 0;
|
||||
-
|
||||
- ILOG2_ITER_(val, ret, 5);
|
||||
- ILOG2_ITER_(val, ret, 4);
|
||||
- ILOG2_ITER_(val, ret, 3);
|
||||
- ILOG2_ITER_(val, ret, 2);
|
||||
- ILOG2_ITER_(val, ret, 1);
|
||||
- ILOG2_ITER_(val, ret, 0);
|
||||
-
|
||||
- return ret;
|
||||
-}
|
||||
-
|
||||
-#else /* SIZEOF_KERNEL_LONG_T == 4 */
|
||||
-
|
||||
-# define ilog2_klong ilog2_32
|
||||
-/**
|
||||
- * Calculate floor(log2(val)), with the exception of val == 0, for which 0
|
||||
- * is returned as well.
|
||||
- *
|
||||
- * @param val 32-bit value to calculate integer base-2 logarithm for.
|
||||
- * @return (unsigned int) floor(log2(val)) if val > 0, 0 if val == 0.
|
||||
- */
|
||||
-static inline unsigned int
|
||||
-ilog2_32(uint32_t val)
|
||||
-{
|
||||
- unsigned int ret = 0;
|
||||
-
|
||||
- ILOG2_ITER_(val, ret, 4);
|
||||
- ILOG2_ITER_(val, ret, 3);
|
||||
- ILOG2_ITER_(val, ret, 2);
|
||||
- ILOG2_ITER_(val, ret, 1);
|
||||
- ILOG2_ITER_(val, ret, 0);
|
||||
-
|
||||
- return ret;
|
||||
-}
|
||||
-
|
||||
-#endif /* SIZEOF_KERNEL_LONG_T */
|
||||
-
|
||||
-#undef ILOG2_ITER_
|
||||
-
|
||||
void
|
||||
dumpstr(struct tcb *const tcp, const kernel_ulong_t addr,
|
||||
const kernel_ulong_t len)
|
||||
--
|
||||
2.1.4
|
||||
|
@ -1,235 +0,0 @@
|
||||
From c5be5bb949988c262012e7f4763b1d658c1769b9 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81kos=20Uzonyi?= <uzonyi.akos@gmail.com>
|
||||
Date: Fri, 19 Jun 2020 12:06:42 +0200
|
||||
Subject: [PATCH 122/138] tests/inject-nf.test: replace getpid with geteuid
|
||||
|
||||
Since we treat PIDs as signed integers, large values (>=2^31) will
|
||||
cause overflow when we use printpid.
|
||||
UIDs are treated as unsigned integers, so geteuid is a good alternative.
|
||||
(getuid would be problematic, as it does not exists on alpha).
|
||||
Also, on systems where geteuid32 exists, geteuid returns maximum 16 bit
|
||||
values, so we have to use geteuid32 in this case.
|
||||
|
||||
[ldv: geteuid syscall was introduced on Alpha by Linux kernel commit
|
||||
v5.1-rc1~160^2~3^2~1, so this test will not work on old Alpha kernels.]
|
||||
|
||||
* tests/inject-nf.c: Replace getpid with either geteuid32 or geteuid.
|
||||
[__alpha__]: Remove.
|
||||
[__NR_geteuid32]: New condition.
|
||||
* tests/inject-nf.test (SYSCALL): Replace getpid with '/^geteuid(32)?$'.
|
||||
Remove alpha workaround.
|
||||
---
|
||||
tests/inject-nf.c | 20 +++++++++-----------
|
||||
tests/inject-nf.test | 9 +--------
|
||||
2 files changed, 10 insertions(+), 19 deletions(-)
|
||||
|
||||
Index: strace-5.7/tests/inject-nf.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/inject-nf.c 2020-09-09 14:50:44.159739392 +0200
|
||||
+++ strace-5.7/tests/inject-nf.c 2020-09-09 14:56:17.193937896 +0200
|
||||
@@ -16,28 +16,26 @@
|
||||
|
||||
#include "raw_syscall.h"
|
||||
|
||||
-#ifdef __alpha__
|
||||
-/* alpha has no getpid */
|
||||
-# define SC_NR __NR_getpgrp
|
||||
-# define SC_NAME "getpgrp"
|
||||
-# define getpid getpgrp
|
||||
+#ifdef __NR_geteuid32
|
||||
+# define SC_NR __NR_geteuid32
|
||||
+# define SC_NAME "geteuid32"
|
||||
#else
|
||||
-# define SC_NR __NR_getpid
|
||||
-# define SC_NAME "getpid"
|
||||
+# define SC_NR __NR_geteuid
|
||||
+# define SC_NAME "geteuid"
|
||||
#endif
|
||||
|
||||
#ifdef raw_syscall_0
|
||||
# define INVOKE_SC(err) raw_syscall_0(SC_NR, &err)
|
||||
#else
|
||||
-/* No raw_syscall_0, let's use getpid() and hope for the best. */
|
||||
-# define INVOKE_SC(err) getpid()
|
||||
+/* No raw_syscall_0, let's use geteuid() and hope for the best. */
|
||||
+# define INVOKE_SC(err) geteuid()
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This prototype is intentionally different
|
||||
* from the prototype provided by <unistd.h>.
|
||||
*/
|
||||
-extern kernel_ulong_t getpid(void);
|
||||
+extern kernel_ulong_t geteuid(void);
|
||||
|
||||
int
|
||||
main(int ac, char **av)
|
||||
@@ -45,7 +43,7 @@
|
||||
assert(ac == 1 || ac == 2);
|
||||
|
||||
kernel_ulong_t expected =
|
||||
- (ac == 1) ? getpid() : strtoull(av[1], NULL, 0);
|
||||
+ (ac == 1) ? geteuid() : strtoull(av[1], NULL, 0);
|
||||
kernel_ulong_t err = 0;
|
||||
kernel_ulong_t rc = INVOKE_SC(err);
|
||||
|
||||
Index: strace-5.7/tests/inject-nf.test
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/inject-nf.test 2020-09-09 14:50:44.159739392 +0200
|
||||
+++ strace-5.7/tests/inject-nf.test 2020-09-09 14:56:17.194937896 +0200
|
||||
@@ -9,14 +9,7 @@
|
||||
|
||||
. "${srcdir=.}/scno_tampering.sh"
|
||||
|
||||
-case "$STRACE_ARCH" in
|
||||
-alpha)
|
||||
- SYSCALL=getpgrp
|
||||
- ;;
|
||||
-*)
|
||||
- SYSCALL=getpid
|
||||
- ;;
|
||||
-esac
|
||||
+SYSCALL='/^geteuid(32)?$'
|
||||
|
||||
run_prog
|
||||
prog="$args"
|
||||
Index: strace-5.7/tests-m32/inject-nf.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/inject-nf.c 2019-09-25 03:02:03.000000000 +0200
|
||||
+++ strace-5.7/tests-m32/inject-nf.c 2020-09-09 14:58:03.687001371 +0200
|
||||
@@ -16,28 +16,26 @@
|
||||
|
||||
#include "raw_syscall.h"
|
||||
|
||||
-#ifdef __alpha__
|
||||
-/* alpha has no getpid */
|
||||
-# define SC_NR __NR_getpgrp
|
||||
-# define SC_NAME "getpgrp"
|
||||
-# define getpid getpgrp
|
||||
+#ifdef __NR_geteuid32
|
||||
+# define SC_NR __NR_geteuid32
|
||||
+# define SC_NAME "geteuid32"
|
||||
#else
|
||||
-# define SC_NR __NR_getpid
|
||||
-# define SC_NAME "getpid"
|
||||
+# define SC_NR __NR_geteuid
|
||||
+# define SC_NAME "geteuid"
|
||||
#endif
|
||||
|
||||
#ifdef raw_syscall_0
|
||||
# define INVOKE_SC(err) raw_syscall_0(SC_NR, &err)
|
||||
#else
|
||||
-/* No raw_syscall_0, let's use getpid() and hope for the best. */
|
||||
-# define INVOKE_SC(err) getpid()
|
||||
+/* No raw_syscall_0, let's use geteuid() and hope for the best. */
|
||||
+# define INVOKE_SC(err) geteuid()
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This prototype is intentionally different
|
||||
* from the prototype provided by <unistd.h>.
|
||||
*/
|
||||
-extern kernel_ulong_t getpid(void);
|
||||
+extern kernel_ulong_t geteuid(void);
|
||||
|
||||
int
|
||||
main(int ac, char **av)
|
||||
@@ -45,7 +43,7 @@
|
||||
assert(ac == 1 || ac == 2);
|
||||
|
||||
kernel_ulong_t expected =
|
||||
- (ac == 1) ? getpid() : strtoull(av[1], NULL, 0);
|
||||
+ (ac == 1) ? geteuid() : strtoull(av[1], NULL, 0);
|
||||
kernel_ulong_t err = 0;
|
||||
kernel_ulong_t rc = INVOKE_SC(err);
|
||||
|
||||
Index: strace-5.7/tests-m32/inject-nf.test
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/inject-nf.test 2018-12-25 00:46:43.000000000 +0100
|
||||
+++ strace-5.7/tests-m32/inject-nf.test 2020-09-09 14:58:03.727001394 +0200
|
||||
@@ -9,14 +9,7 @@
|
||||
|
||||
. "${srcdir=.}/scno_tampering.sh"
|
||||
|
||||
-case "$STRACE_ARCH" in
|
||||
-alpha)
|
||||
- SYSCALL=getpgrp
|
||||
- ;;
|
||||
-*)
|
||||
- SYSCALL=getpid
|
||||
- ;;
|
||||
-esac
|
||||
+SYSCALL='/^geteuid(32)?$'
|
||||
|
||||
run_prog
|
||||
prog="$args"
|
||||
Index: strace-5.7/tests-mx32/inject-nf.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/inject-nf.c 2019-09-25 03:02:03.000000000 +0200
|
||||
+++ strace-5.7/tests-mx32/inject-nf.c 2020-09-09 14:58:03.708001383 +0200
|
||||
@@ -16,28 +16,26 @@
|
||||
|
||||
#include "raw_syscall.h"
|
||||
|
||||
-#ifdef __alpha__
|
||||
-/* alpha has no getpid */
|
||||
-# define SC_NR __NR_getpgrp
|
||||
-# define SC_NAME "getpgrp"
|
||||
-# define getpid getpgrp
|
||||
+#ifdef __NR_geteuid32
|
||||
+# define SC_NR __NR_geteuid32
|
||||
+# define SC_NAME "geteuid32"
|
||||
#else
|
||||
-# define SC_NR __NR_getpid
|
||||
-# define SC_NAME "getpid"
|
||||
+# define SC_NR __NR_geteuid
|
||||
+# define SC_NAME "geteuid"
|
||||
#endif
|
||||
|
||||
#ifdef raw_syscall_0
|
||||
# define INVOKE_SC(err) raw_syscall_0(SC_NR, &err)
|
||||
#else
|
||||
-/* No raw_syscall_0, let's use getpid() and hope for the best. */
|
||||
-# define INVOKE_SC(err) getpid()
|
||||
+/* No raw_syscall_0, let's use geteuid() and hope for the best. */
|
||||
+# define INVOKE_SC(err) geteuid()
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This prototype is intentionally different
|
||||
* from the prototype provided by <unistd.h>.
|
||||
*/
|
||||
-extern kernel_ulong_t getpid(void);
|
||||
+extern kernel_ulong_t geteuid(void);
|
||||
|
||||
int
|
||||
main(int ac, char **av)
|
||||
@@ -45,7 +43,7 @@
|
||||
assert(ac == 1 || ac == 2);
|
||||
|
||||
kernel_ulong_t expected =
|
||||
- (ac == 1) ? getpid() : strtoull(av[1], NULL, 0);
|
||||
+ (ac == 1) ? geteuid() : strtoull(av[1], NULL, 0);
|
||||
kernel_ulong_t err = 0;
|
||||
kernel_ulong_t rc = INVOKE_SC(err);
|
||||
|
||||
Index: strace-5.7/tests-mx32/inject-nf.test
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/inject-nf.test 2018-12-25 00:46:43.000000000 +0100
|
||||
+++ strace-5.7/tests-mx32/inject-nf.test 2020-09-09 14:58:03.750001408 +0200
|
||||
@@ -9,14 +9,7 @@
|
||||
|
||||
. "${srcdir=.}/scno_tampering.sh"
|
||||
|
||||
-case "$STRACE_ARCH" in
|
||||
-alpha)
|
||||
- SYSCALL=getpgrp
|
||||
- ;;
|
||||
-*)
|
||||
- SYSCALL=getpid
|
||||
- ;;
|
||||
-esac
|
||||
+SYSCALL='/^geteuid(32)?$'
|
||||
|
||||
run_prog
|
||||
prog="$args"
|
@ -1,60 +0,0 @@
|
||||
From eba856eb0246ce2a2ba99d68611da1af7814080e Mon Sep 17 00:00:00 2001
|
||||
From: "Dmitry V. Levin" <ldv@altlinux.org>
|
||||
Date: Mon, 13 Jul 2020 08:00:00 +0000
|
||||
Subject: [PATCH 123/138] fcntl: use print_fields.h macros
|
||||
|
||||
* fcntl.c: Include "print_fields.h".
|
||||
(print_struct_flock64, print_f_owner_ex): Use PRINT_FIELD_* macros
|
||||
from print_fields.h.
|
||||
---
|
||||
fcntl.c | 19 +++++++++----------
|
||||
1 file changed, 9 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/fcntl.c b/fcntl.c
|
||||
index 0b4221c..e84549e 100644
|
||||
--- a/fcntl.c
|
||||
+++ b/fcntl.c
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "defs.h"
|
||||
#include "flock.h"
|
||||
+#include "print_fields.h"
|
||||
|
||||
#include "xlat/f_owner_types.h"
|
||||
#include "xlat/f_seals.h"
|
||||
@@ -22,14 +23,12 @@
|
||||
static void
|
||||
print_struct_flock64(const struct_kernel_flock64 *fl, const int getlk)
|
||||
{
|
||||
- tprints("{l_type=");
|
||||
- printxval(lockfcmds, (unsigned short) fl->l_type, "F_???");
|
||||
- tprints(", l_whence=");
|
||||
- printxval(whence_codes, (unsigned short) fl->l_whence, "SEEK_???");
|
||||
- tprintf(", l_start=%" PRId64 ", l_len=%" PRId64,
|
||||
- (int64_t) fl->l_start, (int64_t) fl->l_len);
|
||||
+ PRINT_FIELD_XVAL("{", *fl, l_type, lockfcmds, "F_???");
|
||||
+ PRINT_FIELD_XVAL(", ", *fl, l_whence, whence_codes, "SEEK_???");
|
||||
+ PRINT_FIELD_D(", ", *fl, l_start);
|
||||
+ PRINT_FIELD_D(", ", *fl, l_len);
|
||||
if (getlk)
|
||||
- tprintf(", l_pid=%lu", (unsigned long) fl->l_pid);
|
||||
+ PRINT_FIELD_D(", ", *fl, l_pid);
|
||||
tprints("}");
|
||||
}
|
||||
|
||||
@@ -59,9 +58,9 @@ print_f_owner_ex(struct tcb *const tcp, const kernel_ulong_t addr)
|
||||
if (umove_or_printaddr(tcp, addr, &owner))
|
||||
return;
|
||||
|
||||
- tprints("{type=");
|
||||
- printxval(f_owner_types, owner.type, "F_OWNER_???");
|
||||
- tprintf(", pid=%d}", owner.pid);
|
||||
+ PRINT_FIELD_XVAL("{", owner, type, f_owner_types, "F_OWNER_???");
|
||||
+ PRINT_FIELD_D(", ", owner, pid);
|
||||
+ tprints("}");
|
||||
}
|
||||
|
||||
static int
|
||||
--
|
||||
2.1.4
|
||||
|
@ -1,28 +0,0 @@
|
||||
From 86923d3a0a01c520ea25d22587143ad6b8dab18b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81kos=20Uzonyi?= <uzonyi.akos@gmail.com>
|
||||
Date: Sat, 13 Jun 2020 18:18:28 +0200
|
||||
Subject: [PATCH 124/138] kcmp: fix KCMP_FILE decoding
|
||||
|
||||
* kcmp.c (SYS_FUNC(kcmp)): Fix KCMP_FILE pid arguments.
|
||||
|
||||
Fixes: v4.20~66 ("kcmp: output fds using a separate function")
|
||||
---
|
||||
kcmp.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/kcmp.c b/kcmp.c
|
||||
index 6819265..6211555 100644
|
||||
--- a/kcmp.c
|
||||
+++ b/kcmp.c
|
||||
@@ -38,7 +38,7 @@ SYS_FUNC(kcmp)
|
||||
tprints(", ");
|
||||
printfd_pid_tracee_ns(tcp, pid1, idx1);
|
||||
tprints(", ");
|
||||
- printfd_pid_tracee_ns(tcp, pid1, idx2);
|
||||
+ printfd_pid_tracee_ns(tcp, pid2, idx2);
|
||||
|
||||
break;
|
||||
|
||||
--
|
||||
2.1.4
|
||||
|
@ -1,518 +0,0 @@
|
||||
From 56a29d0e192b119c101146e2197246f51661b6b5 Mon Sep 17 00:00:00 2001
|
||||
From: "Dmitry V. Levin" <ldv@altlinux.org>
|
||||
Date: Fri, 17 Jul 2020 08:00:00 +0000
|
||||
Subject: [PATCH 125/138] printsiginfo: fix printing of siginfo_t.si_pid and
|
||||
siginfo_t.si_uid
|
||||
|
||||
* printsiginfo.c (printsigsource): Print siginfo_t.si_pid using
|
||||
PRINT_FIELD_D, print siginfo_t.si_uid using PRINT_FIELD_UID.
|
||||
* tests/clone_ptrace.c (main): Update expected output.
|
||||
* tests/orphaned_process_group.c (main): Likewise.
|
||||
* tests/pidfd_send_signal.c (main): Likewise.
|
||||
* tests/ptrace.c (test_peeksiginfo): Likewise.
|
||||
* tests/rt_sigqueueinfo.c (main): Likewise.
|
||||
* tests/rt_tgsigqueueinfo.c (main): Likewise.
|
||||
* tests/siginfo.c (main): Likewise.
|
||||
* tests/waitid.c (sprint_siginfo): Likewise.
|
||||
---
|
||||
printsiginfo.c | 5 ++---
|
||||
tests/clone_ptrace.c | 2 +-
|
||||
tests/orphaned_process_group.c | 2 +-
|
||||
tests/pidfd_send_signal.c | 2 +-
|
||||
tests/ptrace.c | 12 ++++++------
|
||||
tests/rt_sigqueueinfo.c | 2 +-
|
||||
tests/rt_tgsigqueueinfo.c | 4 ++--
|
||||
tests/siginfo.c | 10 +++++-----
|
||||
tests/waitid.c | 4 ++--
|
||||
9 files changed, 21 insertions(+), 22 deletions(-)
|
||||
|
||||
Index: strace-5.7/printsiginfo.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/printsiginfo.c 2020-09-09 14:50:44.013739305 +0200
|
||||
+++ strace-5.7/printsiginfo.c 2020-09-09 14:58:30.753017503 +0200
|
||||
@@ -58,9 +58,8 @@
|
||||
static void
|
||||
printsigsource(const siginfo_t *sip)
|
||||
{
|
||||
- tprintf(", si_pid=%u, si_uid=%u",
|
||||
- (unsigned int) sip->si_pid,
|
||||
- (unsigned int) sip->si_uid);
|
||||
+ PRINT_FIELD_D(", ", *sip, si_pid);
|
||||
+ PRINT_FIELD_UID(", ", *sip, si_uid);
|
||||
}
|
||||
|
||||
static void
|
||||
Index: strace-5.7/tests/clone_ptrace.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/clone_ptrace.c 2020-09-09 14:50:44.013739305 +0200
|
||||
+++ strace-5.7/tests/clone_ptrace.c 2020-09-09 14:58:30.754017504 +0200
|
||||
@@ -96,7 +96,7 @@
|
||||
error_msg_and_fail("unexpected child exit status %d", status);
|
||||
|
||||
printf("--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=%d"
|
||||
- ", si_uid=%u, si_status=%s, si_utime=%u, si_stime=%u} ---\n"
|
||||
+ ", si_uid=%d, si_status=%s, si_utime=%u, si_stime=%u} ---\n"
|
||||
#if !QUIET_EXIT
|
||||
"+++ exited with 0 +++\n"
|
||||
#endif
|
||||
Index: strace-5.7/tests/orphaned_process_group.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/orphaned_process_group.c 2020-09-09 14:50:44.013739305 +0200
|
||||
+++ strace-5.7/tests/orphaned_process_group.c 2020-09-09 14:58:30.754017504 +0200
|
||||
@@ -139,7 +139,7 @@
|
||||
*/
|
||||
leader = getpid();
|
||||
printf("%-5d --- %s {si_signo=%s, si_code=SI_TKILL"
|
||||
- ", si_pid=%d, si_uid=%u} ---\n",
|
||||
+ ", si_pid=%d, si_uid=%d} ---\n",
|
||||
stopped, "SIGSTOP", "SIGSTOP", stopped, geteuid());
|
||||
printf("%-5d --- stopped by SIGSTOP ---\n", stopped);
|
||||
printf("%-5d +++ exited with 0 +++\n", leader);
|
||||
Index: strace-5.7/tests/pidfd_send_signal.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/pidfd_send_signal.c 2020-09-09 14:50:44.013739305 +0200
|
||||
+++ strace-5.7/tests/pidfd_send_signal.c 2020-09-09 14:58:30.754017504 +0200
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
sys_pidfd_send_signal(fd, SIGUSR2, si, -1);
|
||||
printf("pidfd_send_signal(%d, SIGUSR2, {si_signo=SIGUSR1"
|
||||
- ", si_code=SI_QUEUE, si_errno=%u, si_pid=%u, si_uid=%u"
|
||||
+ ", si_code=SI_QUEUE, si_errno=%u, si_pid=%d, si_uid=%d"
|
||||
", si_value={int=%d, ptr=%p}}, %#x) = %s\n",
|
||||
fd, si->si_errno, si->si_pid, si->si_uid, si->si_int, si->si_ptr,
|
||||
-1U, errstr);
|
||||
Index: strace-5.7/tests/ptrace.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/ptrace.c 2020-09-09 14:50:44.013739305 +0200
|
||||
+++ strace-5.7/tests/ptrace.c 2020-09-09 14:58:30.754017504 +0200
|
||||
@@ -127,16 +127,16 @@
|
||||
printf("ptrace(PTRACE_PEEKSIGINFO, %u"
|
||||
", {off=%llu, flags=0, nr=%u}"
|
||||
", [{si_signo=SIGUSR1, si_code=SI_TKILL"
|
||||
- ", si_pid=%u, si_uid=%u}"
|
||||
+ ", si_pid=%d, si_uid=%d}"
|
||||
", {si_signo=SIGUSR2, si_code=SI_TKILL"
|
||||
- ", si_pid=%u, si_uid=%u}"
|
||||
+ ", si_pid=%d, si_uid=%d}"
|
||||
", {si_signo=SIGALRM, si_code=SI_TKILL"
|
||||
- ", si_pid=%u, si_uid=%u}"
|
||||
+ ", si_pid=%d, si_uid=%d}"
|
||||
"]) = %s\n",
|
||||
(unsigned) pid, psi->off, psi->nr,
|
||||
- (unsigned) pid, (unsigned) uid,
|
||||
- (unsigned) pid, (unsigned) uid,
|
||||
- (unsigned) pid, (unsigned) uid,
|
||||
+ (int) pid, (int) uid,
|
||||
+ (int) pid, (int) uid,
|
||||
+ (int) pid, (int) uid,
|
||||
errstr);
|
||||
}
|
||||
|
||||
Index: strace-5.7/tests/rt_sigqueueinfo.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/rt_sigqueueinfo.c 2020-09-09 14:50:44.013739305 +0200
|
||||
+++ strace-5.7/tests/rt_sigqueueinfo.c 2020-09-09 14:58:30.754017504 +0200
|
||||
@@ -27,7 +27,7 @@
|
||||
if (sigqueue(pid, SIGUSR1, value))
|
||||
perror_msg_and_skip("sigqueue");
|
||||
printf("rt_sigqueueinfo(%u, SIGUSR1, {si_signo=SIGUSR1, "
|
||||
- "si_code=SI_QUEUE, si_pid=%u, si_uid=%u, "
|
||||
+ "si_code=SI_QUEUE, si_pid=%d, si_uid=%d, "
|
||||
"si_value={int=%d, ptr=%p}}) = 0\n",
|
||||
pid, pid, getuid(), value.sival_int, value.sival_ptr);
|
||||
printf("+++ exited with 0 +++\n");
|
||||
Index: strace-5.7/tests/rt_tgsigqueueinfo.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/rt_tgsigqueueinfo.c 2020-09-09 14:50:44.013739305 +0200
|
||||
+++ strace-5.7/tests/rt_tgsigqueueinfo.c 2020-09-09 14:58:30.755017504 +0200
|
||||
@@ -53,8 +53,8 @@
|
||||
"rt_tgsigqueueinfo");
|
||||
|
||||
printf("rt_tgsigqueueinfo(%u, %u, %s, {si_signo=%s"
|
||||
- ", si_code=SI_QUEUE, si_errno=ENOENT, si_pid=%u"
|
||||
- ", si_uid=%u, si_value={int=%d, ptr=%p}}) = 0\n",
|
||||
+ ", si_code=SI_QUEUE, si_errno=ENOENT, si_pid=%d"
|
||||
+ ", si_uid=%d, si_value={int=%d, ptr=%p}}) = 0\n",
|
||||
info->si_pid, info->si_pid, "SIGUSR1", "SIGUSR1",
|
||||
info->si_pid, info->si_uid, info->si_value.sival_int,
|
||||
info->si_value.sival_ptr);
|
||||
Index: strace-5.7/tests/siginfo.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/siginfo.c 2020-09-09 14:50:44.013739305 +0200
|
||||
+++ strace-5.7/tests/siginfo.c 2020-09-09 14:58:30.755017504 +0200
|
||||
@@ -63,7 +63,7 @@
|
||||
|
||||
sigsuspend(&unblock_mask);
|
||||
tprintf("--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED"
|
||||
- ", si_pid=%d, si_uid=%u, si_status=%d"
|
||||
+ ", si_pid=%d, si_uid=%d, si_status=%d"
|
||||
", si_utime=%llu, si_stime=%llu} ---\n",
|
||||
sinfo.si_pid, sinfo.si_uid, sinfo.si_status,
|
||||
zero_extend_signed_to_ull(sinfo.si_utime),
|
||||
@@ -94,7 +94,7 @@
|
||||
|
||||
sigsuspend(&unblock_mask);
|
||||
tprintf("--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED"
|
||||
- ", si_pid=%d, si_uid=%u, si_status=SIGUSR1"
|
||||
+ ", si_pid=%d, si_uid=%d, si_status=SIGUSR1"
|
||||
", si_utime=%llu, si_stime=%llu} ---\n",
|
||||
sinfo.si_pid, sinfo.si_uid,
|
||||
zero_extend_signed_to_ull(sinfo.si_utime),
|
||||
@@ -121,7 +121,7 @@
|
||||
|
||||
sigsuspend(&unblock_mask);
|
||||
tprintf("--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_STOPPED"
|
||||
- ", si_pid=%d, si_uid=%u, si_status=SIGSTOP"
|
||||
+ ", si_pid=%d, si_uid=%d, si_status=SIGSTOP"
|
||||
", si_utime=%llu, si_stime=%llu} ---\n",
|
||||
sinfo.si_pid, sinfo.si_uid,
|
||||
zero_extend_signed_to_ull(sinfo.si_utime),
|
||||
@@ -131,7 +131,7 @@
|
||||
|
||||
sigsuspend(&unblock_mask);
|
||||
tprintf("--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_CONTINUED"
|
||||
- ", si_pid=%d, si_uid=%u, si_status=SIGCONT"
|
||||
+ ", si_pid=%d, si_uid=%d, si_status=SIGCONT"
|
||||
", si_utime=%llu, si_stime=%llu} ---\n",
|
||||
sinfo.si_pid, sinfo.si_uid,
|
||||
zero_extend_signed_to_ull(sinfo.si_utime),
|
||||
@@ -142,7 +142,7 @@
|
||||
|
||||
sigsuspend(&unblock_mask);
|
||||
tprintf("--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED"
|
||||
- ", si_pid=%d, si_uid=%u, si_status=0"
|
||||
+ ", si_pid=%d, si_uid=%d, si_status=0"
|
||||
", si_utime=%llu, si_stime=%llu} ---\n",
|
||||
sinfo.si_pid, sinfo.si_uid,
|
||||
zero_extend_signed_to_ull(sinfo.si_utime),
|
||||
Index: strace-5.7/tests/waitid.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/waitid.c 2020-09-09 14:50:44.013739305 +0200
|
||||
+++ strace-5.7/tests/waitid.c 2020-09-09 14:58:30.755017504 +0200
|
||||
@@ -103,8 +103,8 @@
|
||||
snprintf(buf, sizeof(buf),
|
||||
"{si_signo=SIGCHLD"
|
||||
", si_code=%s"
|
||||
- ", si_pid=%u"
|
||||
- ", si_uid=%u"
|
||||
+ ", si_pid=%d"
|
||||
+ ", si_uid=%d"
|
||||
", si_status=%s"
|
||||
", si_utime=%llu"
|
||||
", si_stime=%llu}",
|
||||
Index: strace-5.7/tests-m32/clone_ptrace.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/clone_ptrace.c 2020-04-04 00:58:26.000000000 +0200
|
||||
+++ strace-5.7/tests-m32/clone_ptrace.c 2020-09-09 14:59:06.931039067 +0200
|
||||
@@ -96,7 +96,7 @@
|
||||
error_msg_and_fail("unexpected child exit status %d", status);
|
||||
|
||||
printf("--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=%d"
|
||||
- ", si_uid=%u, si_status=%s, si_utime=%u, si_stime=%u} ---\n"
|
||||
+ ", si_uid=%d, si_status=%s, si_utime=%u, si_stime=%u} ---\n"
|
||||
#if !QUIET_EXIT
|
||||
"+++ exited with 0 +++\n"
|
||||
#endif
|
||||
Index: strace-5.7/tests-m32/orphaned_process_group.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/orphaned_process_group.c 2019-03-06 17:02:38.000000000 +0100
|
||||
+++ strace-5.7/tests-m32/orphaned_process_group.c 2020-09-09 14:59:07.012039115 +0200
|
||||
@@ -139,7 +139,7 @@
|
||||
*/
|
||||
leader = getpid();
|
||||
printf("%-5d --- %s {si_signo=%s, si_code=SI_TKILL"
|
||||
- ", si_pid=%d, si_uid=%u} ---\n",
|
||||
+ ", si_pid=%d, si_uid=%d} ---\n",
|
||||
stopped, "SIGSTOP", "SIGSTOP", stopped, geteuid());
|
||||
printf("%-5d --- stopped by SIGSTOP ---\n", stopped);
|
||||
printf("%-5d +++ exited with 0 +++\n", leader);
|
||||
Index: strace-5.7/tests-m32/pidfd_send_signal.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/pidfd_send_signal.c 2019-08-14 13:22:32.000000000 +0200
|
||||
+++ strace-5.7/tests-m32/pidfd_send_signal.c 2020-09-09 14:59:07.077039154 +0200
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
sys_pidfd_send_signal(fd, SIGUSR2, si, -1);
|
||||
printf("pidfd_send_signal(%d, SIGUSR2, {si_signo=SIGUSR1"
|
||||
- ", si_code=SI_QUEUE, si_errno=%u, si_pid=%u, si_uid=%u"
|
||||
+ ", si_code=SI_QUEUE, si_errno=%u, si_pid=%d, si_uid=%d"
|
||||
", si_value={int=%d, ptr=%p}}, %#x) = %s\n",
|
||||
fd, si->si_errno, si->si_pid, si->si_uid, si->si_int, si->si_ptr,
|
||||
-1U, errstr);
|
||||
Index: strace-5.7/tests-m32/ptrace.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/ptrace.c 2019-09-25 03:02:03.000000000 +0200
|
||||
+++ strace-5.7/tests-m32/ptrace.c 2020-09-09 14:59:07.142039193 +0200
|
||||
@@ -127,16 +127,16 @@
|
||||
printf("ptrace(PTRACE_PEEKSIGINFO, %u"
|
||||
", {off=%llu, flags=0, nr=%u}"
|
||||
", [{si_signo=SIGUSR1, si_code=SI_TKILL"
|
||||
- ", si_pid=%u, si_uid=%u}"
|
||||
+ ", si_pid=%d, si_uid=%d}"
|
||||
", {si_signo=SIGUSR2, si_code=SI_TKILL"
|
||||
- ", si_pid=%u, si_uid=%u}"
|
||||
+ ", si_pid=%d, si_uid=%d}"
|
||||
", {si_signo=SIGALRM, si_code=SI_TKILL"
|
||||
- ", si_pid=%u, si_uid=%u}"
|
||||
+ ", si_pid=%d, si_uid=%d}"
|
||||
"]) = %s\n",
|
||||
(unsigned) pid, psi->off, psi->nr,
|
||||
- (unsigned) pid, (unsigned) uid,
|
||||
- (unsigned) pid, (unsigned) uid,
|
||||
- (unsigned) pid, (unsigned) uid,
|
||||
+ (int) pid, (int) uid,
|
||||
+ (int) pid, (int) uid,
|
||||
+ (int) pid, (int) uid,
|
||||
errstr);
|
||||
}
|
||||
|
||||
Index: strace-5.7/tests-m32/rt_sigqueueinfo.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/rt_sigqueueinfo.c 2018-12-25 00:46:43.000000000 +0100
|
||||
+++ strace-5.7/tests-m32/rt_sigqueueinfo.c 2020-09-09 14:59:07.204039230 +0200
|
||||
@@ -27,7 +27,7 @@
|
||||
if (sigqueue(pid, SIGUSR1, value))
|
||||
perror_msg_and_skip("sigqueue");
|
||||
printf("rt_sigqueueinfo(%u, SIGUSR1, {si_signo=SIGUSR1, "
|
||||
- "si_code=SI_QUEUE, si_pid=%u, si_uid=%u, "
|
||||
+ "si_code=SI_QUEUE, si_pid=%d, si_uid=%d, "
|
||||
"si_value={int=%d, ptr=%p}}) = 0\n",
|
||||
pid, pid, getuid(), value.sival_int, value.sival_ptr);
|
||||
printf("+++ exited with 0 +++\n");
|
||||
Index: strace-5.7/tests-m32/rt_tgsigqueueinfo.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/rt_tgsigqueueinfo.c 2019-09-25 03:02:03.000000000 +0200
|
||||
+++ strace-5.7/tests-m32/rt_tgsigqueueinfo.c 2020-09-09 14:59:07.258039262 +0200
|
||||
@@ -53,8 +53,8 @@
|
||||
"rt_tgsigqueueinfo");
|
||||
|
||||
printf("rt_tgsigqueueinfo(%u, %u, %s, {si_signo=%s"
|
||||
- ", si_code=SI_QUEUE, si_errno=ENOENT, si_pid=%u"
|
||||
- ", si_uid=%u, si_value={int=%d, ptr=%p}}) = 0\n",
|
||||
+ ", si_code=SI_QUEUE, si_errno=ENOENT, si_pid=%d"
|
||||
+ ", si_uid=%d, si_value={int=%d, ptr=%p}}) = 0\n",
|
||||
info->si_pid, info->si_pid, "SIGUSR1", "SIGUSR1",
|
||||
info->si_pid, info->si_uid, info->si_value.sival_int,
|
||||
info->si_value.sival_ptr);
|
||||
Index: strace-5.7/tests-m32/siginfo.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/siginfo.c 2018-12-25 00:46:43.000000000 +0100
|
||||
+++ strace-5.7/tests-m32/siginfo.c 2020-09-09 14:59:07.311039293 +0200
|
||||
@@ -63,7 +63,7 @@
|
||||
|
||||
sigsuspend(&unblock_mask);
|
||||
tprintf("--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED"
|
||||
- ", si_pid=%d, si_uid=%u, si_status=%d"
|
||||
+ ", si_pid=%d, si_uid=%d, si_status=%d"
|
||||
", si_utime=%llu, si_stime=%llu} ---\n",
|
||||
sinfo.si_pid, sinfo.si_uid, sinfo.si_status,
|
||||
zero_extend_signed_to_ull(sinfo.si_utime),
|
||||
@@ -94,7 +94,7 @@
|
||||
|
||||
sigsuspend(&unblock_mask);
|
||||
tprintf("--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED"
|
||||
- ", si_pid=%d, si_uid=%u, si_status=SIGUSR1"
|
||||
+ ", si_pid=%d, si_uid=%d, si_status=SIGUSR1"
|
||||
", si_utime=%llu, si_stime=%llu} ---\n",
|
||||
sinfo.si_pid, sinfo.si_uid,
|
||||
zero_extend_signed_to_ull(sinfo.si_utime),
|
||||
@@ -121,7 +121,7 @@
|
||||
|
||||
sigsuspend(&unblock_mask);
|
||||
tprintf("--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_STOPPED"
|
||||
- ", si_pid=%d, si_uid=%u, si_status=SIGSTOP"
|
||||
+ ", si_pid=%d, si_uid=%d, si_status=SIGSTOP"
|
||||
", si_utime=%llu, si_stime=%llu} ---\n",
|
||||
sinfo.si_pid, sinfo.si_uid,
|
||||
zero_extend_signed_to_ull(sinfo.si_utime),
|
||||
@@ -131,7 +131,7 @@
|
||||
|
||||
sigsuspend(&unblock_mask);
|
||||
tprintf("--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_CONTINUED"
|
||||
- ", si_pid=%d, si_uid=%u, si_status=SIGCONT"
|
||||
+ ", si_pid=%d, si_uid=%d, si_status=SIGCONT"
|
||||
", si_utime=%llu, si_stime=%llu} ---\n",
|
||||
sinfo.si_pid, sinfo.si_uid,
|
||||
zero_extend_signed_to_ull(sinfo.si_utime),
|
||||
@@ -142,7 +142,7 @@
|
||||
|
||||
sigsuspend(&unblock_mask);
|
||||
tprintf("--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED"
|
||||
- ", si_pid=%d, si_uid=%u, si_status=0"
|
||||
+ ", si_pid=%d, si_uid=%d, si_status=0"
|
||||
", si_utime=%llu, si_stime=%llu} ---\n",
|
||||
sinfo.si_pid, sinfo.si_uid,
|
||||
zero_extend_signed_to_ull(sinfo.si_utime),
|
||||
Index: strace-5.7/tests-m32/waitid.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/waitid.c 2020-04-19 03:22:29.000000000 +0200
|
||||
+++ strace-5.7/tests-m32/waitid.c 2020-09-09 14:59:07.371039329 +0200
|
||||
@@ -103,8 +103,8 @@
|
||||
snprintf(buf, sizeof(buf),
|
||||
"{si_signo=SIGCHLD"
|
||||
", si_code=%s"
|
||||
- ", si_pid=%u"
|
||||
- ", si_uid=%u"
|
||||
+ ", si_pid=%d"
|
||||
+ ", si_uid=%d"
|
||||
", si_status=%s"
|
||||
", si_utime=%llu"
|
||||
", si_stime=%llu}",
|
||||
Index: strace-5.7/tests-mx32/clone_ptrace.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/clone_ptrace.c 2020-04-04 00:58:26.000000000 +0200
|
||||
+++ strace-5.7/tests-mx32/clone_ptrace.c 2020-09-09 14:59:06.978039095 +0200
|
||||
@@ -96,7 +96,7 @@
|
||||
error_msg_and_fail("unexpected child exit status %d", status);
|
||||
|
||||
printf("--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=%d"
|
||||
- ", si_uid=%u, si_status=%s, si_utime=%u, si_stime=%u} ---\n"
|
||||
+ ", si_uid=%d, si_status=%s, si_utime=%u, si_stime=%u} ---\n"
|
||||
#if !QUIET_EXIT
|
||||
"+++ exited with 0 +++\n"
|
||||
#endif
|
||||
Index: strace-5.7/tests-mx32/orphaned_process_group.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/orphaned_process_group.c 2019-03-06 17:02:38.000000000 +0100
|
||||
+++ strace-5.7/tests-mx32/orphaned_process_group.c 2020-09-09 14:59:07.046039135 +0200
|
||||
@@ -139,7 +139,7 @@
|
||||
*/
|
||||
leader = getpid();
|
||||
printf("%-5d --- %s {si_signo=%s, si_code=SI_TKILL"
|
||||
- ", si_pid=%d, si_uid=%u} ---\n",
|
||||
+ ", si_pid=%d, si_uid=%d} ---\n",
|
||||
stopped, "SIGSTOP", "SIGSTOP", stopped, geteuid());
|
||||
printf("%-5d --- stopped by SIGSTOP ---\n", stopped);
|
||||
printf("%-5d +++ exited with 0 +++\n", leader);
|
||||
Index: strace-5.7/tests-mx32/pidfd_send_signal.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/pidfd_send_signal.c 2019-08-14 13:22:32.000000000 +0200
|
||||
+++ strace-5.7/tests-mx32/pidfd_send_signal.c 2020-09-09 14:59:07.110039174 +0200
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
sys_pidfd_send_signal(fd, SIGUSR2, si, -1);
|
||||
printf("pidfd_send_signal(%d, SIGUSR2, {si_signo=SIGUSR1"
|
||||
- ", si_code=SI_QUEUE, si_errno=%u, si_pid=%u, si_uid=%u"
|
||||
+ ", si_code=SI_QUEUE, si_errno=%u, si_pid=%d, si_uid=%d"
|
||||
", si_value={int=%d, ptr=%p}}, %#x) = %s\n",
|
||||
fd, si->si_errno, si->si_pid, si->si_uid, si->si_int, si->si_ptr,
|
||||
-1U, errstr);
|
||||
Index: strace-5.7/tests-mx32/ptrace.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/ptrace.c 2019-09-25 03:02:03.000000000 +0200
|
||||
+++ strace-5.7/tests-mx32/ptrace.c 2020-09-09 14:59:07.174039212 +0200
|
||||
@@ -127,16 +127,16 @@
|
||||
printf("ptrace(PTRACE_PEEKSIGINFO, %u"
|
||||
", {off=%llu, flags=0, nr=%u}"
|
||||
", [{si_signo=SIGUSR1, si_code=SI_TKILL"
|
||||
- ", si_pid=%u, si_uid=%u}"
|
||||
+ ", si_pid=%d, si_uid=%d}"
|
||||
", {si_signo=SIGUSR2, si_code=SI_TKILL"
|
||||
- ", si_pid=%u, si_uid=%u}"
|
||||
+ ", si_pid=%d, si_uid=%d}"
|
||||
", {si_signo=SIGALRM, si_code=SI_TKILL"
|
||||
- ", si_pid=%u, si_uid=%u}"
|
||||
+ ", si_pid=%d, si_uid=%d}"
|
||||
"]) = %s\n",
|
||||
(unsigned) pid, psi->off, psi->nr,
|
||||
- (unsigned) pid, (unsigned) uid,
|
||||
- (unsigned) pid, (unsigned) uid,
|
||||
- (unsigned) pid, (unsigned) uid,
|
||||
+ (int) pid, (int) uid,
|
||||
+ (int) pid, (int) uid,
|
||||
+ (int) pid, (int) uid,
|
||||
errstr);
|
||||
}
|
||||
|
||||
Index: strace-5.7/tests-mx32/rt_sigqueueinfo.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/rt_sigqueueinfo.c 2018-12-25 00:46:43.000000000 +0100
|
||||
+++ strace-5.7/tests-mx32/rt_sigqueueinfo.c 2020-09-09 14:59:07.232039246 +0200
|
||||
@@ -27,7 +27,7 @@
|
||||
if (sigqueue(pid, SIGUSR1, value))
|
||||
perror_msg_and_skip("sigqueue");
|
||||
printf("rt_sigqueueinfo(%u, SIGUSR1, {si_signo=SIGUSR1, "
|
||||
- "si_code=SI_QUEUE, si_pid=%u, si_uid=%u, "
|
||||
+ "si_code=SI_QUEUE, si_pid=%d, si_uid=%d, "
|
||||
"si_value={int=%d, ptr=%p}}) = 0\n",
|
||||
pid, pid, getuid(), value.sival_int, value.sival_ptr);
|
||||
printf("+++ exited with 0 +++\n");
|
||||
Index: strace-5.7/tests-mx32/rt_tgsigqueueinfo.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/rt_tgsigqueueinfo.c 2019-09-25 03:02:03.000000000 +0200
|
||||
+++ strace-5.7/tests-mx32/rt_tgsigqueueinfo.c 2020-09-09 14:59:07.284039277 +0200
|
||||
@@ -53,8 +53,8 @@
|
||||
"rt_tgsigqueueinfo");
|
||||
|
||||
printf("rt_tgsigqueueinfo(%u, %u, %s, {si_signo=%s"
|
||||
- ", si_code=SI_QUEUE, si_errno=ENOENT, si_pid=%u"
|
||||
- ", si_uid=%u, si_value={int=%d, ptr=%p}}) = 0\n",
|
||||
+ ", si_code=SI_QUEUE, si_errno=ENOENT, si_pid=%d"
|
||||
+ ", si_uid=%d, si_value={int=%d, ptr=%p}}) = 0\n",
|
||||
info->si_pid, info->si_pid, "SIGUSR1", "SIGUSR1",
|
||||
info->si_pid, info->si_uid, info->si_value.sival_int,
|
||||
info->si_value.sival_ptr);
|
||||
Index: strace-5.7/tests-mx32/siginfo.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/siginfo.c 2018-12-25 00:46:43.000000000 +0100
|
||||
+++ strace-5.7/tests-mx32/siginfo.c 2020-09-09 14:59:07.338039310 +0200
|
||||
@@ -63,7 +63,7 @@
|
||||
|
||||
sigsuspend(&unblock_mask);
|
||||
tprintf("--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED"
|
||||
- ", si_pid=%d, si_uid=%u, si_status=%d"
|
||||
+ ", si_pid=%d, si_uid=%d, si_status=%d"
|
||||
", si_utime=%llu, si_stime=%llu} ---\n",
|
||||
sinfo.si_pid, sinfo.si_uid, sinfo.si_status,
|
||||
zero_extend_signed_to_ull(sinfo.si_utime),
|
||||
@@ -94,7 +94,7 @@
|
||||
|
||||
sigsuspend(&unblock_mask);
|
||||
tprintf("--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED"
|
||||
- ", si_pid=%d, si_uid=%u, si_status=SIGUSR1"
|
||||
+ ", si_pid=%d, si_uid=%d, si_status=SIGUSR1"
|
||||
", si_utime=%llu, si_stime=%llu} ---\n",
|
||||
sinfo.si_pid, sinfo.si_uid,
|
||||
zero_extend_signed_to_ull(sinfo.si_utime),
|
||||
@@ -121,7 +121,7 @@
|
||||
|
||||
sigsuspend(&unblock_mask);
|
||||
tprintf("--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_STOPPED"
|
||||
- ", si_pid=%d, si_uid=%u, si_status=SIGSTOP"
|
||||
+ ", si_pid=%d, si_uid=%d, si_status=SIGSTOP"
|
||||
", si_utime=%llu, si_stime=%llu} ---\n",
|
||||
sinfo.si_pid, sinfo.si_uid,
|
||||
zero_extend_signed_to_ull(sinfo.si_utime),
|
||||
@@ -131,7 +131,7 @@
|
||||
|
||||
sigsuspend(&unblock_mask);
|
||||
tprintf("--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_CONTINUED"
|
||||
- ", si_pid=%d, si_uid=%u, si_status=SIGCONT"
|
||||
+ ", si_pid=%d, si_uid=%d, si_status=SIGCONT"
|
||||
", si_utime=%llu, si_stime=%llu} ---\n",
|
||||
sinfo.si_pid, sinfo.si_uid,
|
||||
zero_extend_signed_to_ull(sinfo.si_utime),
|
||||
@@ -142,7 +142,7 @@
|
||||
|
||||
sigsuspend(&unblock_mask);
|
||||
tprintf("--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED"
|
||||
- ", si_pid=%d, si_uid=%u, si_status=0"
|
||||
+ ", si_pid=%d, si_uid=%d, si_status=0"
|
||||
", si_utime=%llu, si_stime=%llu} ---\n",
|
||||
sinfo.si_pid, sinfo.si_uid,
|
||||
zero_extend_signed_to_ull(sinfo.si_utime),
|
||||
Index: strace-5.7/tests-mx32/waitid.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/waitid.c 2020-04-19 03:22:29.000000000 +0200
|
||||
+++ strace-5.7/tests-mx32/waitid.c 2020-09-09 14:59:07.398039345 +0200
|
||||
@@ -103,8 +103,8 @@
|
||||
snprintf(buf, sizeof(buf),
|
||||
"{si_signo=SIGCHLD"
|
||||
", si_code=%s"
|
||||
- ", si_pid=%u"
|
||||
- ", si_uid=%u"
|
||||
+ ", si_pid=%d"
|
||||
+ ", si_uid=%d"
|
||||
", si_status=%s"
|
||||
", si_utime=%llu"
|
||||
", si_stime=%llu}",
|
@ -1,105 +0,0 @@
|
||||
From 64d04198d3c64756ae8a51646b6eac3dff419cb6 Mon Sep 17 00:00:00 2001
|
||||
From: "Dmitry V. Levin" <ldv@altlinux.org>
|
||||
Date: Fri, 17 Jul 2020 08:00:00 +0000
|
||||
Subject: [PATCH 126/138] Use PRINT_FIELD_UID instead of printuid where
|
||||
appropriate
|
||||
|
||||
* ipc_msgctl.c: Include "print_fields.h".
|
||||
(print_msqid_ds): Use PRINT_FIELD_UID instead of printuid.
|
||||
* ipc_shmctl.c: Include "print_fields.h".
|
||||
(print_shmid_ds): Use PRINT_FIELD_UID instead of printuid.
|
||||
* statx.c (SYS_FUNC(statx)): Use PRINT_FIELD_UID instead of printuid.
|
||||
---
|
||||
ipc_msgctl.c | 10 +++++-----
|
||||
ipc_shmctl.c | 10 +++++-----
|
||||
statx.c | 4 ++--
|
||||
3 files changed, 12 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/ipc_msgctl.c b/ipc_msgctl.c
|
||||
index 92eda11..920ed72 100644
|
||||
--- a/ipc_msgctl.c
|
||||
+++ b/ipc_msgctl.c
|
||||
@@ -22,6 +22,7 @@ typedef struct NAME_OF_STRUCT_MSQID_DS msqid_ds_t;
|
||||
|
||||
#include MPERS_DEFS
|
||||
|
||||
+#include "print_fields.h"
|
||||
#include "xlat/msgctl_flags.h"
|
||||
|
||||
static void
|
||||
@@ -37,9 +38,8 @@ print_msqid_ds(struct tcb *const tcp, const kernel_ulong_t addr, int cmd)
|
||||
if (umove_or_printaddr(tcp, addr, &msqid_ds))
|
||||
return;
|
||||
|
||||
- tprints("{msg_perm={");
|
||||
- printuid("uid=", msqid_ds.msg_perm.uid);
|
||||
- printuid(", gid=", msqid_ds.msg_perm.gid);
|
||||
+ PRINT_FIELD_UID("{msg_perm={", msqid_ds.msg_perm, uid);
|
||||
+ PRINT_FIELD_UID(", ", msqid_ds.msg_perm, gid);
|
||||
tprints(", mode=");
|
||||
print_numeric_umode_t(msqid_ds.msg_perm.mode);
|
||||
|
||||
@@ -50,8 +50,8 @@ print_msqid_ds(struct tcb *const tcp, const kernel_ulong_t addr, int cmd)
|
||||
|
||||
tprintf(", key=%u",
|
||||
(unsigned) msqid_ds.msg_perm.NAME_OF_STRUCT_IPC_PERM_KEY);
|
||||
- printuid(", cuid=", msqid_ds.msg_perm.cuid);
|
||||
- printuid(", cgid=", msqid_ds.msg_perm.cgid);
|
||||
+ PRINT_FIELD_UID(", ", msqid_ds.msg_perm, cuid);
|
||||
+ PRINT_FIELD_UID(", ", msqid_ds.msg_perm, cgid);
|
||||
tprints("}");
|
||||
tprintf(", msg_stime=%u", (unsigned) msqid_ds.msg_stime);
|
||||
tprintf(", msg_rtime=%u", (unsigned) msqid_ds.msg_rtime);
|
||||
diff --git a/ipc_shmctl.c b/ipc_shmctl.c
|
||||
index 0fb584e..83e36f3 100644
|
||||
--- a/ipc_shmctl.c
|
||||
+++ b/ipc_shmctl.c
|
||||
@@ -22,6 +22,7 @@ typedef struct NAME_OF_STRUCT_SHMID_DS shmid_ds_t;
|
||||
|
||||
#include MPERS_DEFS
|
||||
|
||||
+#include "print_fields.h"
|
||||
#include "xlat/shmctl_flags.h"
|
||||
|
||||
static void
|
||||
@@ -37,9 +38,8 @@ print_shmid_ds(struct tcb *const tcp, const kernel_ulong_t addr, int cmd)
|
||||
if (umove_or_printaddr(tcp, addr, &shmid_ds))
|
||||
return;
|
||||
|
||||
- tprints("{shm_perm={");
|
||||
- printuid("uid=", shmid_ds.shm_perm.uid);
|
||||
- printuid(", gid=", shmid_ds.shm_perm.gid);
|
||||
+ PRINT_FIELD_UID("{shm_perm={", shmid_ds.shm_perm, uid);
|
||||
+ PRINT_FIELD_UID(", ", shmid_ds.shm_perm, gid);
|
||||
tprints(", mode=");
|
||||
print_numeric_umode_t(shmid_ds.shm_perm.mode);
|
||||
|
||||
@@ -50,8 +50,8 @@ print_shmid_ds(struct tcb *const tcp, const kernel_ulong_t addr, int cmd)
|
||||
|
||||
tprintf(", key=%u",
|
||||
(unsigned) shmid_ds.shm_perm.NAME_OF_STRUCT_IPC_PERM_KEY);
|
||||
- printuid(", cuid=", shmid_ds.shm_perm.cuid);
|
||||
- printuid(", cgid=", shmid_ds.shm_perm.cgid);
|
||||
+ PRINT_FIELD_UID(", ", shmid_ds.shm_perm, cuid);
|
||||
+ PRINT_FIELD_UID(", ", shmid_ds.shm_perm, cgid);
|
||||
tprints("}");
|
||||
tprintf(", shm_segsz=%u", (unsigned) shmid_ds.shm_segsz);
|
||||
tprintf(", shm_cpid=%u", (unsigned) shmid_ds.shm_cpid);
|
||||
diff --git a/statx.c b/statx.c
|
||||
index 54b6d7c..7b00b8e 100644
|
||||
--- a/statx.c
|
||||
+++ b/statx.c
|
||||
@@ -60,8 +60,8 @@ SYS_FUNC(statx)
|
||||
|
||||
if (!abbrev(tcp)) {
|
||||
PRINT_FIELD_U(", ", stx, stx_nlink);
|
||||
- printuid(", stx_uid=", stx.stx_uid);
|
||||
- printuid(", stx_gid=", stx.stx_gid);
|
||||
+ PRINT_FIELD_UID(", ", stx, stx_uid);
|
||||
+ PRINT_FIELD_UID(", ", stx, stx_gid);
|
||||
}
|
||||
|
||||
tprints(", stx_mode=");
|
||||
--
|
||||
2.1.4
|
||||
|
@ -1,525 +0,0 @@
|
||||
From edf6f95bd19f5ce7ac0ef62f923cd17fb6052f51 Mon Sep 17 00:00:00 2001
|
||||
From: "Dmitry V. Levin" <ldv@altlinux.org>
|
||||
Date: Sat, 18 Jul 2020 08:00:00 +0000
|
||||
Subject: [PATCH 127/138] Consistently print process ids as signed integers
|
||||
|
||||
* block.c (block_ioctl): Print struct_blk_user_trace_setup.pid using
|
||||
PRINT_FIELD_D instead of PRINT_FIELD_U.
|
||||
* bpf.c (BPF_TASK_FD_QUERY): Print task_fd_query.pid using PRINT_FIELD_D
|
||||
instead of PRINT_FIELD_U.
|
||||
* ipc_msgctl.c (print_msqid_ds): Print msqid_ds.msg_lspid
|
||||
and msqid_ds.msg_lrpid using PRINT_FIELD_D.
|
||||
* ipc_shmctl.c (print_shmid_ds): Print shmid_ds.shm_cpid and shm_lpid
|
||||
using PRINT_FIELD_D.
|
||||
* msghdr.c (print_scm_creds): Print ucred.pid using PRINT_FIELD_D
|
||||
instead of PRINT_FIELD_U.
|
||||
* netlink.c (print_nlmsghdr): Print nlmsghdr.nlmsg_pid using %d format
|
||||
instead of %u.
|
||||
* tests/bpf.c (BPF_TASK_FD_QUERY_checks): Update expected output.
|
||||
* tests/ioctl_block.c (main): Update expected output.
|
||||
* tests/ipc_msg.c (main): Likewise.
|
||||
* tests/ipc_shm.c (main): Likewise.
|
||||
* tests/net-yy-netlink.c (main): Likewise.
|
||||
* tests/netlink_protocol.c (test_nlmsgerr): Likewise.
|
||||
---
|
||||
block.c | 2 +-
|
||||
bpf.c | 2 +-
|
||||
ipc_msgctl.c | 4 ++--
|
||||
ipc_shmctl.c | 4 ++--
|
||||
msghdr.c | 2 +-
|
||||
netlink.c | 2 +-
|
||||
tests/bpf.c | 8 ++++----
|
||||
tests/ioctl_block.c | 2 +-
|
||||
tests/ipc_msg.c | 6 +++---
|
||||
tests/ipc_shm.c | 8 ++++----
|
||||
tests/net-yy-netlink.c | 4 ++--
|
||||
tests/netlink_protocol.c | 4 ++--
|
||||
12 files changed, 24 insertions(+), 24 deletions(-)
|
||||
|
||||
Index: strace-5.7/block.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/block.c 2020-09-09 14:50:43.878739225 +0200
|
||||
+++ strace-5.7/block.c 2020-09-09 14:59:14.715043707 +0200
|
||||
@@ -179,7 +179,7 @@
|
||||
PRINT_FIELD_U(", ", buts, buf_nr);
|
||||
PRINT_FIELD_U(", ", buts, start_lba);
|
||||
PRINT_FIELD_U(", ", buts, end_lba);
|
||||
- PRINT_FIELD_U(", ", buts, pid);
|
||||
+ PRINT_FIELD_D(", ", buts, pid);
|
||||
return 0;
|
||||
} else {
|
||||
struct_blk_user_trace_setup buts;
|
||||
Index: strace-5.7/bpf.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/bpf.c 2020-09-09 14:50:43.878739225 +0200
|
||||
+++ strace-5.7/bpf.c 2020-09-09 14:59:14.715043707 +0200
|
||||
@@ -927,7 +927,7 @@
|
||||
if (entering(tcp)) {
|
||||
set_tcb_priv_ulong(tcp, attr.buf_len);
|
||||
|
||||
- PRINT_FIELD_U("{task_fd_query={", attr, pid);
|
||||
+ PRINT_FIELD_D("{task_fd_query={", attr, pid);
|
||||
PRINT_FIELD_FD(", ", attr, fd, tcp);
|
||||
PRINT_FIELD_U(", ", attr, flags);
|
||||
PRINT_FIELD_U(", ", attr, buf_len);
|
||||
Index: strace-5.7/ipc_msgctl.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/ipc_msgctl.c 2020-09-09 14:59:12.909042630 +0200
|
||||
+++ strace-5.7/ipc_msgctl.c 2020-09-09 14:59:14.715043707 +0200
|
||||
@@ -58,8 +58,8 @@
|
||||
tprintf(", msg_ctime=%u", (unsigned) msqid_ds.msg_ctime);
|
||||
tprintf(", msg_qnum=%u", (unsigned) msqid_ds.msg_qnum);
|
||||
tprintf(", msg_qbytes=%u", (unsigned) msqid_ds.msg_qbytes);
|
||||
- tprintf(", msg_lspid=%u", (unsigned) msqid_ds.msg_lspid);
|
||||
- tprintf(", msg_lrpid=%u", (unsigned) msqid_ds.msg_lrpid);
|
||||
+ PRINT_FIELD_D(", ", msqid_ds, msg_lspid);
|
||||
+ PRINT_FIELD_D(", ", msqid_ds, msg_lrpid);
|
||||
tprints("}");
|
||||
break;
|
||||
|
||||
Index: strace-5.7/ipc_shmctl.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/ipc_shmctl.c 2020-09-09 14:59:12.909042630 +0200
|
||||
+++ strace-5.7/ipc_shmctl.c 2020-09-09 14:59:14.716043707 +0200
|
||||
@@ -54,8 +54,8 @@
|
||||
PRINT_FIELD_UID(", ", shmid_ds.shm_perm, cgid);
|
||||
tprints("}");
|
||||
tprintf(", shm_segsz=%u", (unsigned) shmid_ds.shm_segsz);
|
||||
- tprintf(", shm_cpid=%u", (unsigned) shmid_ds.shm_cpid);
|
||||
- tprintf(", shm_lpid=%u", (unsigned) shmid_ds.shm_lpid);
|
||||
+ PRINT_FIELD_D(", ", shmid_ds, shm_cpid);
|
||||
+ PRINT_FIELD_D(", ", shmid_ds, shm_lpid);
|
||||
tprintf(", shm_nattch=%u", (unsigned) shmid_ds.shm_nattch);
|
||||
tprintf(", shm_atime=%u", (unsigned) shmid_ds.shm_atime);
|
||||
tprintf(", shm_dtime=%u", (unsigned) shmid_ds.shm_dtime);
|
||||
Index: strace-5.7/msghdr.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/msghdr.c 2020-09-09 14:50:43.878739225 +0200
|
||||
+++ strace-5.7/msghdr.c 2020-09-09 14:59:14.717043708 +0200
|
||||
@@ -69,7 +69,7 @@
|
||||
{
|
||||
const struct ucred *uc = cmsg_data;
|
||||
|
||||
- PRINT_FIELD_U("{", *uc, pid);
|
||||
+ PRINT_FIELD_D("{", *uc, pid);
|
||||
PRINT_FIELD_UID(", ", *uc, uid);
|
||||
PRINT_FIELD_UID(", ", *uc, gid);
|
||||
tprints("}");
|
||||
Index: strace-5.7/netlink.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/netlink.c 2020-09-09 14:50:43.878739225 +0200
|
||||
+++ strace-5.7/netlink.c 2020-09-09 14:59:14.717043708 +0200
|
||||
@@ -446,7 +446,7 @@
|
||||
decode_nlmsg_flags(nlmsghdr->nlmsg_flags,
|
||||
nlmsghdr->nlmsg_type, family);
|
||||
|
||||
- tprintf(", seq=%u, pid=%u}", nlmsghdr->nlmsg_seq,
|
||||
+ tprintf(", seq=%u, pid=%d}", nlmsghdr->nlmsg_seq,
|
||||
nlmsghdr->nlmsg_pid);
|
||||
}
|
||||
|
||||
Index: strace-5.7/tests/bpf.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/bpf.c 2020-09-09 14:50:43.878739225 +0200
|
||||
+++ strace-5.7/tests/bpf.c 2020-09-09 14:59:14.717043708 +0200
|
||||
@@ -1289,16 +1289,16 @@
|
||||
|
||||
static const struct bpf_attr_check BPF_TASK_FD_QUERY_checks[] = {
|
||||
{
|
||||
- .data = { .BPF_TASK_FD_QUERY_data = { .pid = 0xdeadbeef } },
|
||||
+ .data = { .BPF_TASK_FD_QUERY_data = { .pid = 1735928559 } },
|
||||
.size = offsetofend(struct BPF_TASK_FD_QUERY_struct, pid),
|
||||
- .str = "task_fd_query={pid=3735928559, fd=0" FD0_PATH
|
||||
+ .str = "task_fd_query={pid=1735928559, fd=0" FD0_PATH
|
||||
", flags=0, buf_len=0, buf=NULL, prog_id=0"
|
||||
", fd_type=BPF_FD_TYPE_RAW_TRACEPOINT"
|
||||
", probe_offset=0, probe_addr=0}"
|
||||
},
|
||||
{ /* 1 */
|
||||
.data = { .BPF_TASK_FD_QUERY_data = {
|
||||
- .pid = 0xcafef00d,
|
||||
+ .pid = 1405705229,
|
||||
.fd = 0xdeadbeef,
|
||||
.flags = 0xfacefeed,
|
||||
.buf_len = 0xdefaced,
|
||||
@@ -1309,7 +1309,7 @@
|
||||
.probe_addr = 0xfac5fed5fac7fed8
|
||||
} },
|
||||
.size = offsetofend(struct BPF_TASK_FD_QUERY_struct, probe_addr),
|
||||
- .str = "task_fd_query={pid=3405705229"
|
||||
+ .str = "task_fd_query={pid=1405705229"
|
||||
", fd=-559038737"
|
||||
", flags=4207869677"
|
||||
", buf_len=233811181"
|
||||
Index: strace-5.7/tests/ioctl_block.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/ioctl_block.c 2020-09-09 14:50:43.878739225 +0200
|
||||
+++ strace-5.7/tests/ioctl_block.c 2020-09-09 14:59:14.717043708 +0200
|
||||
@@ -165,7 +165,7 @@
|
||||
|
||||
ioctl(-1, BLKTRACESETUP, buts);
|
||||
printf("ioctl(-1, BLKTRACESETUP, {act_mask=%hu, buf_size=%u, buf_nr=%u"
|
||||
- ", start_lba=%" PRI__u64 ", end_lba=%" PRI__u64 ", pid=%u})"
|
||||
+ ", start_lba=%" PRI__u64 ", end_lba=%" PRI__u64 ", pid=%d})"
|
||||
" = -1 EBADF (%m)\n",
|
||||
buts->act_mask, buts->buf_size, buts->buf_nr,
|
||||
buts->start_lba, buts->end_lba, buts->pid);
|
||||
Index: strace-5.7/tests/ipc_msg.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/ipc_msg.c 2020-09-09 14:50:43.878739225 +0200
|
||||
+++ strace-5.7/tests/ipc_msg.c 2020-09-09 14:59:14.717043708 +0200
|
||||
@@ -128,15 +128,15 @@
|
||||
printf("msgctl\\(%d, (%s\\|)?%s, \\{msg_perm=\\{uid=%u"
|
||||
", gid=%u, mode=%#o, key=%u, cuid=%u, cgid=%u\\}, msg_stime=%u"
|
||||
", msg_rtime=%u, msg_ctime=%u, msg_qnum=%u, msg_qbytes=%u"
|
||||
- ", msg_lspid=%u, msg_lrpid=%u\\}\\) = 0\n",
|
||||
+ ", msg_lspid=%d, msg_lrpid=%d\\}\\) = 0\n",
|
||||
id, str_ipc_64, str_ipc_stat,
|
||||
(unsigned) ds.msg_perm.uid, (unsigned) ds.msg_perm.gid,
|
||||
(unsigned) ds.msg_perm.mode, (unsigned) ds.msg_perm.__key,
|
||||
(unsigned) ds.msg_perm.cuid, (unsigned) ds.msg_perm.cgid,
|
||||
(unsigned) ds.msg_stime, (unsigned) ds.msg_rtime,
|
||||
(unsigned) ds.msg_ctime, (unsigned) ds.msg_qnum,
|
||||
- (unsigned) ds.msg_qbytes, (unsigned) ds.msg_lspid,
|
||||
- (unsigned) ds.msg_lrpid);
|
||||
+ (unsigned) ds.msg_qbytes, (int) ds.msg_lspid,
|
||||
+ (int) ds.msg_lrpid);
|
||||
|
||||
if (msgctl(id, IPC_SET, &ds))
|
||||
perror_msg_and_skip("msgctl IPC_SET");
|
||||
Index: strace-5.7/tests/ipc_shm.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/ipc_shm.c 2020-09-09 14:50:43.878739225 +0200
|
||||
+++ strace-5.7/tests/ipc_shm.c 2020-09-09 14:59:14.718043708 +0200
|
||||
@@ -168,15 +168,15 @@
|
||||
if (shmctl(id, IPC_STAT, &ds))
|
||||
perror_msg_and_skip("shmctl IPC_STAT");
|
||||
printf("shmctl\\(%d, (%s\\|)?%s, \\{shm_perm=\\{uid=%u, gid=%u, "
|
||||
- "mode=%#o, key=%u, cuid=%u, cgid=%u\\}, shm_segsz=%u, shm_cpid=%u, "
|
||||
- "shm_lpid=%u, shm_nattch=%u, shm_atime=%u, shm_dtime=%u, "
|
||||
+ "mode=%#o, key=%u, cuid=%u, cgid=%u\\}, shm_segsz=%u, shm_cpid=%d, "
|
||||
+ "shm_lpid=%d, shm_nattch=%u, shm_atime=%u, shm_dtime=%u, "
|
||||
"shm_ctime=%u\\}\\) = 0\n",
|
||||
id, str_ipc_64, str_ipc_stat,
|
||||
(unsigned) ds.shm_perm.uid, (unsigned) ds.shm_perm.gid,
|
||||
(unsigned) ds.shm_perm.mode, (unsigned) ds.shm_perm.__key,
|
||||
(unsigned) ds.shm_perm.cuid, (unsigned) ds.shm_perm.cgid,
|
||||
- (unsigned) ds.shm_segsz, (unsigned) ds.shm_cpid,
|
||||
- (unsigned) ds.shm_lpid, (unsigned) ds.shm_nattch,
|
||||
+ (unsigned) ds.shm_segsz, (int) ds.shm_cpid,
|
||||
+ (int) ds.shm_lpid, (unsigned) ds.shm_nattch,
|
||||
(unsigned) ds.shm_atime, (unsigned) ds.shm_dtime,
|
||||
(unsigned) ds. shm_ctime);
|
||||
|
||||
Index: strace-5.7/tests/net-yy-netlink.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/net-yy-netlink.c 2020-09-09 14:50:43.878739225 +0200
|
||||
+++ strace-5.7/tests/net-yy-netlink.c 2020-09-09 14:59:14.718043708 +0200
|
||||
@@ -67,13 +67,13 @@
|
||||
if (bind(fd, sa, *len))
|
||||
perror_msg_and_skip("bind");
|
||||
printf("bind(%d" FMT_UNBOUND ", {sa_family=AF_NETLINK"
|
||||
- ", nl_pid=%u, nl_groups=00000000}, %u) = 0\n",
|
||||
+ ", nl_pid=%d, nl_groups=00000000}, %u) = 0\n",
|
||||
fd, ARG_UNBOUND, addr.nl_pid, (unsigned) *len);
|
||||
|
||||
if (getsockname(fd, sa, len))
|
||||
perror_msg_and_fail("getsockname");
|
||||
printf("getsockname(%d" FMT_BOUND ", {sa_family=AF_NETLINK"
|
||||
- ", nl_pid=%u, nl_groups=00000000}, [%u]) = 0\n",
|
||||
+ ", nl_pid=%d, nl_groups=00000000}, [%u]) = 0\n",
|
||||
fd, ARG_BOUND, addr.nl_pid, (unsigned) *len);
|
||||
|
||||
if (close(fd))
|
||||
Index: strace-5.7/tests/netlink_protocol.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/netlink_protocol.c 2020-09-09 14:50:43.878739225 +0200
|
||||
+++ strace-5.7/tests/netlink_protocol.c 2020-09-09 14:59:14.718043708 +0200
|
||||
@@ -264,7 +264,7 @@
|
||||
printf("sendto(%d, {{len=%u, type=NLMSG_ERROR, flags=NLM_F_REQUEST"
|
||||
", seq=0, pid=0}, {error=-EACCES"
|
||||
", msg={len=%u, type=NLMSG_NOOP, flags=NLM_F_REQUEST|0x%x"
|
||||
- ", seq=%u, pid=%u}}}, %u, MSG_DONTWAIT, NULL, 0) = %s\n",
|
||||
+ ", seq=%u, pid=%d}}}, %u, MSG_DONTWAIT, NULL, 0) = %s\n",
|
||||
fd, nlh->nlmsg_len, err->msg.nlmsg_len, NLM_F_DUMP,
|
||||
err->msg.nlmsg_seq, err->msg.nlmsg_pid,
|
||||
nlh->nlmsg_len, sprintrc(rc));
|
||||
@@ -289,7 +289,7 @@
|
||||
printf("sendto(%d, {{len=%u, type=NLMSG_ERROR, flags=NLM_F_REQUEST"
|
||||
", seq=0, pid=0}, {error=-EACCES"
|
||||
", msg={{len=%u, type=NLMSG_NOOP, flags=NLM_F_REQUEST|0x%x"
|
||||
- ", seq=%u, pid=%u}, \"\\x61\\x62\\x63\\x64\"}}}"
|
||||
+ ", seq=%u, pid=%d}, \"\\x61\\x62\\x63\\x64\"}}}"
|
||||
", %u, MSG_DONTWAIT, NULL, 0) = %s\n",
|
||||
fd, nlh->nlmsg_len, err->msg.nlmsg_len, NLM_F_DUMP,
|
||||
err->msg.nlmsg_seq, err->msg.nlmsg_pid,
|
||||
Index: strace-5.7/tests-m32/bpf.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/bpf.c 2020-04-18 15:47:17.000000000 +0200
|
||||
+++ strace-5.7/tests-m32/bpf.c 2020-09-09 14:59:52.229066067 +0200
|
||||
@@ -1289,16 +1289,16 @@
|
||||
|
||||
static const struct bpf_attr_check BPF_TASK_FD_QUERY_checks[] = {
|
||||
{
|
||||
- .data = { .BPF_TASK_FD_QUERY_data = { .pid = 0xdeadbeef } },
|
||||
+ .data = { .BPF_TASK_FD_QUERY_data = { .pid = 1735928559 } },
|
||||
.size = offsetofend(struct BPF_TASK_FD_QUERY_struct, pid),
|
||||
- .str = "task_fd_query={pid=3735928559, fd=0" FD0_PATH
|
||||
+ .str = "task_fd_query={pid=1735928559, fd=0" FD0_PATH
|
||||
", flags=0, buf_len=0, buf=NULL, prog_id=0"
|
||||
", fd_type=BPF_FD_TYPE_RAW_TRACEPOINT"
|
||||
", probe_offset=0, probe_addr=0}"
|
||||
},
|
||||
{ /* 1 */
|
||||
.data = { .BPF_TASK_FD_QUERY_data = {
|
||||
- .pid = 0xcafef00d,
|
||||
+ .pid = 1405705229,
|
||||
.fd = 0xdeadbeef,
|
||||
.flags = 0xfacefeed,
|
||||
.buf_len = 0xdefaced,
|
||||
@@ -1309,7 +1309,7 @@
|
||||
.probe_addr = 0xfac5fed5fac7fed8
|
||||
} },
|
||||
.size = offsetofend(struct BPF_TASK_FD_QUERY_struct, probe_addr),
|
||||
- .str = "task_fd_query={pid=3405705229"
|
||||
+ .str = "task_fd_query={pid=1405705229"
|
||||
", fd=-559038737"
|
||||
", flags=4207869677"
|
||||
", buf_len=233811181"
|
||||
Index: strace-5.7/tests-m32/ioctl_block.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/ioctl_block.c 2019-07-24 19:12:18.000000000 +0200
|
||||
+++ strace-5.7/tests-m32/ioctl_block.c 2020-09-09 14:59:52.290066103 +0200
|
||||
@@ -165,7 +165,7 @@
|
||||
|
||||
ioctl(-1, BLKTRACESETUP, buts);
|
||||
printf("ioctl(-1, BLKTRACESETUP, {act_mask=%hu, buf_size=%u, buf_nr=%u"
|
||||
- ", start_lba=%" PRI__u64 ", end_lba=%" PRI__u64 ", pid=%u})"
|
||||
+ ", start_lba=%" PRI__u64 ", end_lba=%" PRI__u64 ", pid=%d})"
|
||||
" = -1 EBADF (%m)\n",
|
||||
buts->act_mask, buts->buf_size, buts->buf_nr,
|
||||
buts->start_lba, buts->end_lba, buts->pid);
|
||||
Index: strace-5.7/tests-m32/ipc_msg.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/ipc_msg.c 2019-09-25 03:02:03.000000000 +0200
|
||||
+++ strace-5.7/tests-m32/ipc_msg.c 2020-09-09 14:59:52.349066138 +0200
|
||||
@@ -128,15 +128,15 @@
|
||||
printf("msgctl\\(%d, (%s\\|)?%s, \\{msg_perm=\\{uid=%u"
|
||||
", gid=%u, mode=%#o, key=%u, cuid=%u, cgid=%u\\}, msg_stime=%u"
|
||||
", msg_rtime=%u, msg_ctime=%u, msg_qnum=%u, msg_qbytes=%u"
|
||||
- ", msg_lspid=%u, msg_lrpid=%u\\}\\) = 0\n",
|
||||
+ ", msg_lspid=%d, msg_lrpid=%d\\}\\) = 0\n",
|
||||
id, str_ipc_64, str_ipc_stat,
|
||||
(unsigned) ds.msg_perm.uid, (unsigned) ds.msg_perm.gid,
|
||||
(unsigned) ds.msg_perm.mode, (unsigned) ds.msg_perm.__key,
|
||||
(unsigned) ds.msg_perm.cuid, (unsigned) ds.msg_perm.cgid,
|
||||
(unsigned) ds.msg_stime, (unsigned) ds.msg_rtime,
|
||||
(unsigned) ds.msg_ctime, (unsigned) ds.msg_qnum,
|
||||
- (unsigned) ds.msg_qbytes, (unsigned) ds.msg_lspid,
|
||||
- (unsigned) ds.msg_lrpid);
|
||||
+ (unsigned) ds.msg_qbytes, (int) ds.msg_lspid,
|
||||
+ (int) ds.msg_lrpid);
|
||||
|
||||
if (msgctl(id, IPC_SET, &ds))
|
||||
perror_msg_and_skip("msgctl IPC_SET");
|
||||
Index: strace-5.7/tests-m32/ipc_shm.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/ipc_shm.c 2019-11-28 20:30:05.000000000 +0100
|
||||
+++ strace-5.7/tests-m32/ipc_shm.c 2020-09-09 14:59:52.406066172 +0200
|
||||
@@ -168,15 +168,15 @@
|
||||
if (shmctl(id, IPC_STAT, &ds))
|
||||
perror_msg_and_skip("shmctl IPC_STAT");
|
||||
printf("shmctl\\(%d, (%s\\|)?%s, \\{shm_perm=\\{uid=%u, gid=%u, "
|
||||
- "mode=%#o, key=%u, cuid=%u, cgid=%u\\}, shm_segsz=%u, shm_cpid=%u, "
|
||||
- "shm_lpid=%u, shm_nattch=%u, shm_atime=%u, shm_dtime=%u, "
|
||||
+ "mode=%#o, key=%u, cuid=%u, cgid=%u\\}, shm_segsz=%u, shm_cpid=%d, "
|
||||
+ "shm_lpid=%d, shm_nattch=%u, shm_atime=%u, shm_dtime=%u, "
|
||||
"shm_ctime=%u\\}\\) = 0\n",
|
||||
id, str_ipc_64, str_ipc_stat,
|
||||
(unsigned) ds.shm_perm.uid, (unsigned) ds.shm_perm.gid,
|
||||
(unsigned) ds.shm_perm.mode, (unsigned) ds.shm_perm.__key,
|
||||
(unsigned) ds.shm_perm.cuid, (unsigned) ds.shm_perm.cgid,
|
||||
- (unsigned) ds.shm_segsz, (unsigned) ds.shm_cpid,
|
||||
- (unsigned) ds.shm_lpid, (unsigned) ds.shm_nattch,
|
||||
+ (unsigned) ds.shm_segsz, (int) ds.shm_cpid,
|
||||
+ (int) ds.shm_lpid, (unsigned) ds.shm_nattch,
|
||||
(unsigned) ds.shm_atime, (unsigned) ds.shm_dtime,
|
||||
(unsigned) ds. shm_ctime);
|
||||
|
||||
Index: strace-5.7/tests-m32/net-yy-netlink.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/net-yy-netlink.c 2020-04-04 00:58:26.000000000 +0200
|
||||
+++ strace-5.7/tests-m32/net-yy-netlink.c 2020-09-09 14:59:52.464066207 +0200
|
||||
@@ -67,13 +67,13 @@
|
||||
if (bind(fd, sa, *len))
|
||||
perror_msg_and_skip("bind");
|
||||
printf("bind(%d" FMT_UNBOUND ", {sa_family=AF_NETLINK"
|
||||
- ", nl_pid=%u, nl_groups=00000000}, %u) = 0\n",
|
||||
+ ", nl_pid=%d, nl_groups=00000000}, %u) = 0\n",
|
||||
fd, ARG_UNBOUND, addr.nl_pid, (unsigned) *len);
|
||||
|
||||
if (getsockname(fd, sa, len))
|
||||
perror_msg_and_fail("getsockname");
|
||||
printf("getsockname(%d" FMT_BOUND ", {sa_family=AF_NETLINK"
|
||||
- ", nl_pid=%u, nl_groups=00000000}, [%u]) = 0\n",
|
||||
+ ", nl_pid=%d, nl_groups=00000000}, [%u]) = 0\n",
|
||||
fd, ARG_BOUND, addr.nl_pid, (unsigned) *len);
|
||||
|
||||
if (close(fd))
|
||||
Index: strace-5.7/tests-m32/netlink_protocol.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/netlink_protocol.c 2018-12-30 16:35:21.000000000 +0100
|
||||
+++ strace-5.7/tests-m32/netlink_protocol.c 2020-09-09 14:59:52.524066242 +0200
|
||||
@@ -264,7 +264,7 @@
|
||||
printf("sendto(%d, {{len=%u, type=NLMSG_ERROR, flags=NLM_F_REQUEST"
|
||||
", seq=0, pid=0}, {error=-EACCES"
|
||||
", msg={len=%u, type=NLMSG_NOOP, flags=NLM_F_REQUEST|0x%x"
|
||||
- ", seq=%u, pid=%u}}}, %u, MSG_DONTWAIT, NULL, 0) = %s\n",
|
||||
+ ", seq=%u, pid=%d}}}, %u, MSG_DONTWAIT, NULL, 0) = %s\n",
|
||||
fd, nlh->nlmsg_len, err->msg.nlmsg_len, NLM_F_DUMP,
|
||||
err->msg.nlmsg_seq, err->msg.nlmsg_pid,
|
||||
nlh->nlmsg_len, sprintrc(rc));
|
||||
@@ -289,7 +289,7 @@
|
||||
printf("sendto(%d, {{len=%u, type=NLMSG_ERROR, flags=NLM_F_REQUEST"
|
||||
", seq=0, pid=0}, {error=-EACCES"
|
||||
", msg={{len=%u, type=NLMSG_NOOP, flags=NLM_F_REQUEST|0x%x"
|
||||
- ", seq=%u, pid=%u}, \"\\x61\\x62\\x63\\x64\"}}}"
|
||||
+ ", seq=%u, pid=%d}, \"\\x61\\x62\\x63\\x64\"}}}"
|
||||
", %u, MSG_DONTWAIT, NULL, 0) = %s\n",
|
||||
fd, nlh->nlmsg_len, err->msg.nlmsg_len, NLM_F_DUMP,
|
||||
err->msg.nlmsg_seq, err->msg.nlmsg_pid,
|
||||
Index: strace-5.7/tests-mx32/bpf.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/bpf.c 2020-04-18 15:47:17.000000000 +0200
|
||||
+++ strace-5.7/tests-mx32/bpf.c 2020-09-09 14:59:52.261066086 +0200
|
||||
@@ -1289,16 +1289,16 @@
|
||||
|
||||
static const struct bpf_attr_check BPF_TASK_FD_QUERY_checks[] = {
|
||||
{
|
||||
- .data = { .BPF_TASK_FD_QUERY_data = { .pid = 0xdeadbeef } },
|
||||
+ .data = { .BPF_TASK_FD_QUERY_data = { .pid = 1735928559 } },
|
||||
.size = offsetofend(struct BPF_TASK_FD_QUERY_struct, pid),
|
||||
- .str = "task_fd_query={pid=3735928559, fd=0" FD0_PATH
|
||||
+ .str = "task_fd_query={pid=1735928559, fd=0" FD0_PATH
|
||||
", flags=0, buf_len=0, buf=NULL, prog_id=0"
|
||||
", fd_type=BPF_FD_TYPE_RAW_TRACEPOINT"
|
||||
", probe_offset=0, probe_addr=0}"
|
||||
},
|
||||
{ /* 1 */
|
||||
.data = { .BPF_TASK_FD_QUERY_data = {
|
||||
- .pid = 0xcafef00d,
|
||||
+ .pid = 1405705229,
|
||||
.fd = 0xdeadbeef,
|
||||
.flags = 0xfacefeed,
|
||||
.buf_len = 0xdefaced,
|
||||
@@ -1309,7 +1309,7 @@
|
||||
.probe_addr = 0xfac5fed5fac7fed8
|
||||
} },
|
||||
.size = offsetofend(struct BPF_TASK_FD_QUERY_struct, probe_addr),
|
||||
- .str = "task_fd_query={pid=3405705229"
|
||||
+ .str = "task_fd_query={pid=1405705229"
|
||||
", fd=-559038737"
|
||||
", flags=4207869677"
|
||||
", buf_len=233811181"
|
||||
Index: strace-5.7/tests-mx32/ioctl_block.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/ioctl_block.c 2019-07-24 19:12:18.000000000 +0200
|
||||
+++ strace-5.7/tests-mx32/ioctl_block.c 2020-09-09 14:59:52.319066120 +0200
|
||||
@@ -165,7 +165,7 @@
|
||||
|
||||
ioctl(-1, BLKTRACESETUP, buts);
|
||||
printf("ioctl(-1, BLKTRACESETUP, {act_mask=%hu, buf_size=%u, buf_nr=%u"
|
||||
- ", start_lba=%" PRI__u64 ", end_lba=%" PRI__u64 ", pid=%u})"
|
||||
+ ", start_lba=%" PRI__u64 ", end_lba=%" PRI__u64 ", pid=%d})"
|
||||
" = -1 EBADF (%m)\n",
|
||||
buts->act_mask, buts->buf_size, buts->buf_nr,
|
||||
buts->start_lba, buts->end_lba, buts->pid);
|
||||
Index: strace-5.7/tests-mx32/ipc_msg.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/ipc_msg.c 2019-09-25 03:02:03.000000000 +0200
|
||||
+++ strace-5.7/tests-mx32/ipc_msg.c 2020-09-09 14:59:52.377066155 +0200
|
||||
@@ -128,15 +128,15 @@
|
||||
printf("msgctl\\(%d, (%s\\|)?%s, \\{msg_perm=\\{uid=%u"
|
||||
", gid=%u, mode=%#o, key=%u, cuid=%u, cgid=%u\\}, msg_stime=%u"
|
||||
", msg_rtime=%u, msg_ctime=%u, msg_qnum=%u, msg_qbytes=%u"
|
||||
- ", msg_lspid=%u, msg_lrpid=%u\\}\\) = 0\n",
|
||||
+ ", msg_lspid=%d, msg_lrpid=%d\\}\\) = 0\n",
|
||||
id, str_ipc_64, str_ipc_stat,
|
||||
(unsigned) ds.msg_perm.uid, (unsigned) ds.msg_perm.gid,
|
||||
(unsigned) ds.msg_perm.mode, (unsigned) ds.msg_perm.__key,
|
||||
(unsigned) ds.msg_perm.cuid, (unsigned) ds.msg_perm.cgid,
|
||||
(unsigned) ds.msg_stime, (unsigned) ds.msg_rtime,
|
||||
(unsigned) ds.msg_ctime, (unsigned) ds.msg_qnum,
|
||||
- (unsigned) ds.msg_qbytes, (unsigned) ds.msg_lspid,
|
||||
- (unsigned) ds.msg_lrpid);
|
||||
+ (unsigned) ds.msg_qbytes, (int) ds.msg_lspid,
|
||||
+ (int) ds.msg_lrpid);
|
||||
|
||||
if (msgctl(id, IPC_SET, &ds))
|
||||
perror_msg_and_skip("msgctl IPC_SET");
|
||||
Index: strace-5.7/tests-mx32/ipc_shm.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/ipc_shm.c 2019-11-28 20:30:05.000000000 +0100
|
||||
+++ strace-5.7/tests-mx32/ipc_shm.c 2020-09-09 14:59:52.435066189 +0200
|
||||
@@ -168,15 +168,15 @@
|
||||
if (shmctl(id, IPC_STAT, &ds))
|
||||
perror_msg_and_skip("shmctl IPC_STAT");
|
||||
printf("shmctl\\(%d, (%s\\|)?%s, \\{shm_perm=\\{uid=%u, gid=%u, "
|
||||
- "mode=%#o, key=%u, cuid=%u, cgid=%u\\}, shm_segsz=%u, shm_cpid=%u, "
|
||||
- "shm_lpid=%u, shm_nattch=%u, shm_atime=%u, shm_dtime=%u, "
|
||||
+ "mode=%#o, key=%u, cuid=%u, cgid=%u\\}, shm_segsz=%u, shm_cpid=%d, "
|
||||
+ "shm_lpid=%d, shm_nattch=%u, shm_atime=%u, shm_dtime=%u, "
|
||||
"shm_ctime=%u\\}\\) = 0\n",
|
||||
id, str_ipc_64, str_ipc_stat,
|
||||
(unsigned) ds.shm_perm.uid, (unsigned) ds.shm_perm.gid,
|
||||
(unsigned) ds.shm_perm.mode, (unsigned) ds.shm_perm.__key,
|
||||
(unsigned) ds.shm_perm.cuid, (unsigned) ds.shm_perm.cgid,
|
||||
- (unsigned) ds.shm_segsz, (unsigned) ds.shm_cpid,
|
||||
- (unsigned) ds.shm_lpid, (unsigned) ds.shm_nattch,
|
||||
+ (unsigned) ds.shm_segsz, (int) ds.shm_cpid,
|
||||
+ (int) ds.shm_lpid, (unsigned) ds.shm_nattch,
|
||||
(unsigned) ds.shm_atime, (unsigned) ds.shm_dtime,
|
||||
(unsigned) ds. shm_ctime);
|
||||
|
||||
Index: strace-5.7/tests-mx32/net-yy-netlink.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/net-yy-netlink.c 2020-04-04 00:58:26.000000000 +0200
|
||||
+++ strace-5.7/tests-mx32/net-yy-netlink.c 2020-09-09 14:59:52.494066225 +0200
|
||||
@@ -67,13 +67,13 @@
|
||||
if (bind(fd, sa, *len))
|
||||
perror_msg_and_skip("bind");
|
||||
printf("bind(%d" FMT_UNBOUND ", {sa_family=AF_NETLINK"
|
||||
- ", nl_pid=%u, nl_groups=00000000}, %u) = 0\n",
|
||||
+ ", nl_pid=%d, nl_groups=00000000}, %u) = 0\n",
|
||||
fd, ARG_UNBOUND, addr.nl_pid, (unsigned) *len);
|
||||
|
||||
if (getsockname(fd, sa, len))
|
||||
perror_msg_and_fail("getsockname");
|
||||
printf("getsockname(%d" FMT_BOUND ", {sa_family=AF_NETLINK"
|
||||
- ", nl_pid=%u, nl_groups=00000000}, [%u]) = 0\n",
|
||||
+ ", nl_pid=%d, nl_groups=00000000}, [%u]) = 0\n",
|
||||
fd, ARG_BOUND, addr.nl_pid, (unsigned) *len);
|
||||
|
||||
if (close(fd))
|
||||
Index: strace-5.7/tests-mx32/netlink_protocol.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/netlink_protocol.c 2018-12-30 16:35:21.000000000 +0100
|
||||
+++ strace-5.7/tests-mx32/netlink_protocol.c 2020-09-09 14:59:52.553066260 +0200
|
||||
@@ -264,7 +264,7 @@
|
||||
printf("sendto(%d, {{len=%u, type=NLMSG_ERROR, flags=NLM_F_REQUEST"
|
||||
", seq=0, pid=0}, {error=-EACCES"
|
||||
", msg={len=%u, type=NLMSG_NOOP, flags=NLM_F_REQUEST|0x%x"
|
||||
- ", seq=%u, pid=%u}}}, %u, MSG_DONTWAIT, NULL, 0) = %s\n",
|
||||
+ ", seq=%u, pid=%d}}}, %u, MSG_DONTWAIT, NULL, 0) = %s\n",
|
||||
fd, nlh->nlmsg_len, err->msg.nlmsg_len, NLM_F_DUMP,
|
||||
err->msg.nlmsg_seq, err->msg.nlmsg_pid,
|
||||
nlh->nlmsg_len, sprintrc(rc));
|
||||
@@ -289,7 +289,7 @@
|
||||
printf("sendto(%d, {{len=%u, type=NLMSG_ERROR, flags=NLM_F_REQUEST"
|
||||
", seq=0, pid=0}, {error=-EACCES"
|
||||
", msg={{len=%u, type=NLMSG_NOOP, flags=NLM_F_REQUEST|0x%x"
|
||||
- ", seq=%u, pid=%u}, \"\\x61\\x62\\x63\\x64\"}}}"
|
||||
+ ", seq=%u, pid=%d}, \"\\x61\\x62\\x63\\x64\"}}}"
|
||||
", %u, MSG_DONTWAIT, NULL, 0) = %s\n",
|
||||
fd, nlh->nlmsg_len, err->msg.nlmsg_len, NLM_F_DUMP,
|
||||
err->msg.nlmsg_seq, err->msg.nlmsg_pid,
|
@ -1,56 +0,0 @@
|
||||
From 924f71a4296be54e109784dfdb487b732bfc9bbf Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81kos=20Uzonyi?= <uzonyi.akos@gmail.com>
|
||||
Date: Fri, 17 Jul 2020 23:24:36 +0200
|
||||
Subject: [PATCH 128/138] Remove tcb parameter of read_int_from_file
|
||||
|
||||
* defs.h (read_int_from_file): Remove tcb parameter.
|
||||
* util.c (read_int_from_file): Likewise.
|
||||
* msghdr.c (get_optmem_max): Remove tcb parameter of read_int_from_file.
|
||||
---
|
||||
defs.h | 2 +-
|
||||
msghdr.c | 2 +-
|
||||
util.c | 2 +-
|
||||
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/defs.h b/defs.h
|
||||
index d8bd513..dae1cd9 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -498,7 +498,7 @@ extern unsigned os_release;
|
||||
# undef KERNEL_VERSION
|
||||
# define KERNEL_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
|
||||
|
||||
-extern int read_int_from_file(struct tcb *, const char *, int *);
|
||||
+extern int read_int_from_file(const char *, int *);
|
||||
|
||||
extern void set_sortby(const char *);
|
||||
extern int set_overhead(const char *);
|
||||
diff --git a/msghdr.c b/msghdr.c
|
||||
index becbb51..1ab4c6e 100644
|
||||
--- a/msghdr.c
|
||||
+++ b/msghdr.c
|
||||
@@ -293,7 +293,7 @@ get_optmem_max(struct tcb *tcp)
|
||||
static int optmem_max;
|
||||
|
||||
if (!optmem_max) {
|
||||
- if (read_int_from_file(tcp, "/proc/sys/net/core/optmem_max",
|
||||
+ if (read_int_from_file("/proc/sys/net/core/optmem_max",
|
||||
&optmem_max) || optmem_max <= 0) {
|
||||
optmem_max = sizeof(long long) * (2 * IOV_MAX + 512);
|
||||
} else {
|
||||
diff --git a/util.c b/util.c
|
||||
index cde76c1..286c690 100644
|
||||
--- a/util.c
|
||||
+++ b/util.c
|
||||
@@ -1517,7 +1517,7 @@ print_abnormal_hi(const kernel_ulong_t val)
|
||||
}
|
||||
|
||||
int
|
||||
-read_int_from_file(struct tcb *tcp, const char *const fname, int *const pvalue)
|
||||
+read_int_from_file(const char *const fname, int *const pvalue)
|
||||
{
|
||||
const int fd = open_file(fname, O_RDONLY);
|
||||
if (fd < 0)
|
||||
--
|
||||
2.1.4
|
||||
|
@ -1,417 +0,0 @@
|
||||
From 09ca090db1a67eaf590372ae85a94ba8b41223c2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81kos=20Uzonyi?= <uzonyi.akos@gmail.com>
|
||||
Date: Mon, 27 Jul 2020 20:54:06 +0200
|
||||
Subject: [PATCH 129/138] Add "struct tcb *" parameters to various functions
|
||||
|
||||
This is going to be needed to implement pidns support.
|
||||
|
||||
* defs.h (print_sockaddr): Add a "struct tcb *" parameter.
|
||||
* printsiginfo.h (printsiginfo): Likewise.
|
||||
* fcntl.c (print_struct_flock64): Likewise. All callers updated.
|
||||
* print_fields.h (PRINT_FIELD_SOCKADDR): Likewise. All callers updated.
|
||||
* printsiginfo.c (printsigsource, print_si_info, printsiginfo): Likewise.
|
||||
All callers updated.
|
||||
* sockaddr.c (print_sockaddr_data_un, print_sockaddr_data_in,
|
||||
print_sockaddr_data_in6, print_sockaddr_data_ax25,
|
||||
print_sockaddr_data_ipx, print_sockaddr_data_x25,
|
||||
print_sockaddr_data_nl, print_sockaddr_data_ll,
|
||||
print_sockaddr_data_bt, sockaddr_printer, print_sockaddr): Likewise.
|
||||
All callers updated.
|
||||
---
|
||||
defs.h | 2 +-
|
||||
fcntl.c | 6 +++---
|
||||
msghdr.c | 4 ++--
|
||||
print_fields.h | 4 ++--
|
||||
print_group_req.c | 2 +-
|
||||
printsiginfo.c | 22 +++++++++++-----------
|
||||
printsiginfo.h | 2 +-
|
||||
sock.c | 10 +++++-----
|
||||
sockaddr.c | 33 ++++++++++++++++++++-------------
|
||||
strace.c | 2 +-
|
||||
10 files changed, 47 insertions(+), 40 deletions(-)
|
||||
|
||||
diff --git a/defs.h b/defs.h
|
||||
index dae1cd9..48987f9 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -1059,7 +1059,7 @@ printfd(struct tcb *tcp, int fd)
|
||||
* of the tracee the descriptor tcp). This is a stub.
|
||||
*/
|
||||
extern void printfd_pid_tracee_ns(struct tcb *tcp, pid_t pid, int fd);
|
||||
-extern void print_sockaddr(const void *sa, int len);
|
||||
+extern void print_sockaddr(struct tcb *, const void *sa, int len);
|
||||
extern bool
|
||||
print_inet_addr(int af, const void *addr, unsigned int len, const char *var_name);
|
||||
extern bool
|
||||
diff --git a/fcntl.c b/fcntl.c
|
||||
index e84549e..345634c 100644
|
||||
--- a/fcntl.c
|
||||
+++ b/fcntl.c
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "xlat/notifyflags.h"
|
||||
|
||||
static void
|
||||
-print_struct_flock64(const struct_kernel_flock64 *fl, const int getlk)
|
||||
+print_struct_flock64(struct tcb *const tcp, const struct_kernel_flock64 *fl, const int getlk)
|
||||
{
|
||||
PRINT_FIELD_XVAL("{", *fl, l_type, lockfcmds, "F_???");
|
||||
PRINT_FIELD_XVAL(", ", *fl, l_whence, whence_codes, "SEEK_???");
|
||||
@@ -38,7 +38,7 @@ printflock64(struct tcb *const tcp, const kernel_ulong_t addr, const int getlk)
|
||||
struct_kernel_flock64 fl;
|
||||
|
||||
if (fetch_struct_flock64(tcp, addr, &fl))
|
||||
- print_struct_flock64(&fl, getlk);
|
||||
+ print_struct_flock64(tcp, &fl, getlk);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -47,7 +47,7 @@ printflock(struct tcb *const tcp, const kernel_ulong_t addr, const int getlk)
|
||||
struct_kernel_flock64 fl;
|
||||
|
||||
if (fetch_struct_flock(tcp, addr, &fl))
|
||||
- print_struct_flock64(&fl, getlk);
|
||||
+ print_struct_flock64(tcp, &fl, getlk);
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/msghdr.c b/msghdr.c
|
||||
index 1ab4c6e..ef6dc24 100644
|
||||
--- a/msghdr.c
|
||||
+++ b/msghdr.c
|
||||
@@ -216,7 +216,7 @@ print_cmsg_ip_recverr(struct tcb *tcp, const void *cmsg_data,
|
||||
PRINT_FIELD_U(", ", *err, ee_code);
|
||||
PRINT_FIELD_U(", ", *err, ee_info);
|
||||
PRINT_FIELD_U(", ", *err, ee_data);
|
||||
- PRINT_FIELD_SOCKADDR(", ", *err, offender);
|
||||
+ PRINT_FIELD_SOCKADDR(", ", *err, offender, tcp);
|
||||
tprints("}");
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ print_cmsg_ip_origdstaddr(struct tcb *tcp, const void *cmsg_data,
|
||||
data_len > sizeof(struct sockaddr_storage)
|
||||
? sizeof(struct sockaddr_storage) : data_len;
|
||||
|
||||
- print_sockaddr(cmsg_data, addr_len);
|
||||
+ print_sockaddr(tcp, cmsg_data, addr_len);
|
||||
}
|
||||
|
||||
typedef void (* const cmsg_printer)(struct tcb *, const void *, unsigned int);
|
||||
diff --git a/print_fields.h b/print_fields.h
|
||||
index 70dbbff..2413398 100644
|
||||
--- a/print_fields.h
|
||||
+++ b/print_fields.h
|
||||
@@ -211,10 +211,10 @@
|
||||
print_ifindex((where_).field_); \
|
||||
} while (0)
|
||||
|
||||
-# define PRINT_FIELD_SOCKADDR(prefix_, where_, field_) \
|
||||
+# define PRINT_FIELD_SOCKADDR(prefix_, where_, field_, tcp_) \
|
||||
do { \
|
||||
STRACE_PRINTF("%s%s=", (prefix_), #field_); \
|
||||
- print_sockaddr(&(where_).field_, \
|
||||
+ print_sockaddr(tcp_, &(where_).field_, \
|
||||
sizeof((where_).field_)); \
|
||||
} while (0)
|
||||
|
||||
diff --git a/print_group_req.c b/print_group_req.c
|
||||
index f0ce58b..9e8ce60 100644
|
||||
--- a/print_group_req.c
|
||||
+++ b/print_group_req.c
|
||||
@@ -30,7 +30,7 @@ MPERS_PRINTER_DECL(void, print_group_req, struct tcb *const tcp,
|
||||
printaddr(addr);
|
||||
} else if (!umove_or_printaddr(tcp, addr, &greq)) {
|
||||
PRINT_FIELD_IFINDEX("{", greq, gr_interface);
|
||||
- PRINT_FIELD_SOCKADDR(", ", greq, gr_group);
|
||||
+ PRINT_FIELD_SOCKADDR(", ", greq, gr_group, tcp);
|
||||
tprints("}");
|
||||
}
|
||||
}
|
||||
diff --git a/printsiginfo.c b/printsiginfo.c
|
||||
index 0a9932d..8ed1e7b 100644
|
||||
--- a/printsiginfo.c
|
||||
+++ b/printsiginfo.c
|
||||
@@ -56,7 +56,7 @@
|
||||
#endif
|
||||
|
||||
static void
|
||||
-printsigsource(const siginfo_t *sip)
|
||||
+printsigsource(struct tcb *tcp, const siginfo_t *sip)
|
||||
{
|
||||
PRINT_FIELD_D(", ", *sip, si_pid);
|
||||
PRINT_FIELD_UID(", ", *sip, si_uid);
|
||||
@@ -116,7 +116,7 @@ print_si_code(int si_signo, unsigned int si_code)
|
||||
}
|
||||
|
||||
static void
|
||||
-print_si_info(const siginfo_t *sip)
|
||||
+print_si_info(struct tcb *tcp, const siginfo_t *sip)
|
||||
{
|
||||
if (sip->si_errno)
|
||||
PRINT_FIELD_ERR_U(", ", *sip, si_errno);
|
||||
@@ -124,10 +124,10 @@ print_si_info(const siginfo_t *sip)
|
||||
if (SI_FROMUSER(sip)) {
|
||||
switch (sip->si_code) {
|
||||
case SI_USER:
|
||||
- printsigsource(sip);
|
||||
+ printsigsource(tcp, sip);
|
||||
break;
|
||||
case SI_TKILL:
|
||||
- printsigsource(sip);
|
||||
+ printsigsource(tcp, sip);
|
||||
break;
|
||||
#if defined HAVE_SIGINFO_T_SI_TIMERID && defined HAVE_SIGINFO_T_SI_OVERRUN
|
||||
case SI_TIMER:
|
||||
@@ -137,7 +137,7 @@ print_si_info(const siginfo_t *sip)
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
- printsigsource(sip);
|
||||
+ printsigsource(tcp, sip);
|
||||
if (sip->si_ptr)
|
||||
printsigval(sip);
|
||||
break;
|
||||
@@ -145,7 +145,7 @@ print_si_info(const siginfo_t *sip)
|
||||
} else {
|
||||
switch (sip->si_signo) {
|
||||
case SIGCHLD:
|
||||
- printsigsource(sip);
|
||||
+ printsigsource(tcp, sip);
|
||||
tprints(", si_status=");
|
||||
if (sip->si_code == CLD_EXITED)
|
||||
tprintf("%d", sip->si_status);
|
||||
@@ -204,7 +204,7 @@ print_si_info(const siginfo_t *sip)
|
||||
#endif
|
||||
default:
|
||||
if (sip->si_pid || sip->si_uid)
|
||||
- printsigsource(sip);
|
||||
+ printsigsource(tcp, sip);
|
||||
if (sip->si_ptr)
|
||||
printsigval(sip);
|
||||
}
|
||||
@@ -215,7 +215,7 @@ print_si_info(const siginfo_t *sip)
|
||||
static
|
||||
#endif
|
||||
void
|
||||
-printsiginfo(const siginfo_t *sip)
|
||||
+printsiginfo(struct tcb *tcp, const siginfo_t *sip)
|
||||
{
|
||||
if (sip->si_signo == 0) {
|
||||
tprints("{}");
|
||||
@@ -230,7 +230,7 @@ printsiginfo(const siginfo_t *sip)
|
||||
#ifdef SI_NOINFO
|
||||
if (sip->si_code != SI_NOINFO)
|
||||
#endif
|
||||
- print_si_info(sip);
|
||||
+ print_si_info(tcp, sip);
|
||||
|
||||
tprints("}");
|
||||
}
|
||||
@@ -241,13 +241,13 @@ MPERS_PRINTER_DECL(void, printsiginfo_at,
|
||||
siginfo_t si;
|
||||
|
||||
if (!umove_or_printaddr(tcp, addr, &si))
|
||||
- printsiginfo(&si);
|
||||
+ printsiginfo(tcp, &si);
|
||||
}
|
||||
|
||||
static bool
|
||||
print_siginfo_t(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
|
||||
{
|
||||
- printsiginfo((const siginfo_t *) elem_buf);
|
||||
+ printsiginfo(tcp, (const siginfo_t *) elem_buf);
|
||||
return true;
|
||||
}
|
||||
|
||||
diff --git a/printsiginfo.h b/printsiginfo.h
|
||||
index 4088cb5..3fec2ab 100644
|
||||
--- a/printsiginfo.h
|
||||
+++ b/printsiginfo.h
|
||||
@@ -8,6 +8,6 @@
|
||||
#ifndef STRACE_PRINTSIGINFO_H
|
||||
# define STRACE_PRINTSIGINFO_H
|
||||
|
||||
-extern void printsiginfo(const siginfo_t *);
|
||||
+extern void printsiginfo(struct tcb *, const siginfo_t *);
|
||||
|
||||
#endif /* !STRACE_PRINTSIGINFO_H */
|
||||
diff --git a/sock.c b/sock.c
|
||||
index 5b14007..99a3190 100644
|
||||
--- a/sock.c
|
||||
+++ b/sock.c
|
||||
@@ -44,19 +44,19 @@ print_ifreq(struct tcb *const tcp, const unsigned int code,
|
||||
switch (code) {
|
||||
case SIOCSIFADDR:
|
||||
case SIOCGIFADDR:
|
||||
- PRINT_FIELD_SOCKADDR("", *ifr, ifr_addr);
|
||||
+ PRINT_FIELD_SOCKADDR("", *ifr, ifr_addr, tcp);
|
||||
break;
|
||||
case SIOCSIFDSTADDR:
|
||||
case SIOCGIFDSTADDR:
|
||||
- PRINT_FIELD_SOCKADDR("", *ifr, ifr_dstaddr);
|
||||
+ PRINT_FIELD_SOCKADDR("", *ifr, ifr_dstaddr, tcp);
|
||||
break;
|
||||
case SIOCSIFBRDADDR:
|
||||
case SIOCGIFBRDADDR:
|
||||
- PRINT_FIELD_SOCKADDR("", *ifr, ifr_broadaddr);
|
||||
+ PRINT_FIELD_SOCKADDR("", *ifr, ifr_broadaddr, tcp);
|
||||
break;
|
||||
case SIOCSIFNETMASK:
|
||||
case SIOCGIFNETMASK:
|
||||
- PRINT_FIELD_SOCKADDR("", *ifr, ifr_netmask);
|
||||
+ PRINT_FIELD_SOCKADDR("", *ifr, ifr_netmask, tcp);
|
||||
break;
|
||||
case SIOCSIFHWADDR:
|
||||
case SIOCGIFHWADDR: {
|
||||
@@ -126,7 +126,7 @@ print_ifconf_ifreq(struct tcb *tcp, void *elem_buf, size_t elem_size,
|
||||
|
||||
tprints("{ifr_name=");
|
||||
print_ifname(ifr->ifr_name);
|
||||
- PRINT_FIELD_SOCKADDR(", ", *ifr, ifr_addr);
|
||||
+ PRINT_FIELD_SOCKADDR(", ", *ifr, ifr_addr, tcp);
|
||||
tprints("}");
|
||||
|
||||
return true;
|
||||
diff --git a/sockaddr.c b/sockaddr.c
|
||||
index b6b9aa7..b004633 100644
|
||||
--- a/sockaddr.c
|
||||
+++ b/sockaddr.c
|
||||
@@ -47,7 +47,7 @@ const size_t arp_hardware_types_size = ARRAY_SIZE(arp_hardware_types) - 1;
|
||||
const size_t ethernet_protocols_size = ARRAY_SIZE(ethernet_protocols) - 1;
|
||||
|
||||
static void
|
||||
-print_sockaddr_data_un(const void *const buf, const int addrlen)
|
||||
+print_sockaddr_data_un(struct tcb *tcp, const void *const buf, const int addrlen)
|
||||
{
|
||||
const struct sockaddr_un *const sa_un = buf;
|
||||
const int un_len = addrlen > (int) sizeof(*sa_un)
|
||||
@@ -172,7 +172,8 @@ decode_inet_addr(struct tcb *const tcp,
|
||||
}
|
||||
|
||||
static void
|
||||
-print_sockaddr_data_in(const void *const buf, const int addrlen)
|
||||
+print_sockaddr_data_in(struct tcb *tcp, const void *const buf,
|
||||
+ const int addrlen)
|
||||
{
|
||||
const struct sockaddr_in *const sa_in = buf;
|
||||
|
||||
@@ -183,7 +184,8 @@ print_sockaddr_data_in(const void *const buf, const int addrlen)
|
||||
#define SIN6_MIN_LEN offsetof(struct sockaddr_in6, sin6_scope_id)
|
||||
|
||||
static void
|
||||
-print_sockaddr_data_in6(const void *const buf, const int addrlen)
|
||||
+print_sockaddr_data_in6(struct tcb *tcp, const void *const buf,
|
||||
+ const int addrlen)
|
||||
{
|
||||
const struct sockaddr_in6 *const sa_in6 = buf;
|
||||
|
||||
@@ -322,7 +324,8 @@ print_ax25_addr(const void /* ax25_address */ *addr_void)
|
||||
}
|
||||
|
||||
static void
|
||||
-print_sockaddr_data_ax25(const void *const buf, const int addrlen)
|
||||
+print_sockaddr_data_ax25(struct tcb *tcp, const void *const buf,
|
||||
+ const int addrlen)
|
||||
{
|
||||
const struct full_sockaddr_ax25 *const sax25 = buf;
|
||||
size_t addrlen_us = MAX(addrlen, 0);
|
||||
@@ -372,7 +375,8 @@ digis_end:
|
||||
}
|
||||
|
||||
static void
|
||||
-print_sockaddr_data_ipx(const void *const buf, const int addrlen)
|
||||
+print_sockaddr_data_ipx(struct tcb *tcp, const void *const buf,
|
||||
+ const int addrlen)
|
||||
{
|
||||
const struct sockaddr_ipx *const sa_ipx = buf;
|
||||
unsigned int i;
|
||||
@@ -399,7 +403,8 @@ print_x25_addr(const void /* struct x25_address */ *addr_void)
|
||||
}
|
||||
|
||||
static void
|
||||
-print_sockaddr_data_x25(const void *const buf, const int addrlen)
|
||||
+print_sockaddr_data_x25(struct tcb *tcp, const void *const buf,
|
||||
+ const int addrlen)
|
||||
{
|
||||
const struct sockaddr_x25 *const sa_x25 = buf;
|
||||
|
||||
@@ -407,7 +412,7 @@ print_sockaddr_data_x25(const void *const buf, const int addrlen)
|
||||
}
|
||||
|
||||
static void
|
||||
-print_sockaddr_data_nl(const void *const buf, const int addrlen)
|
||||
+print_sockaddr_data_nl(struct tcb *tcp, const void *const buf, const int addrlen)
|
||||
{
|
||||
const struct sockaddr_nl *const sa_nl = buf;
|
||||
|
||||
@@ -442,7 +447,8 @@ print_sll_protocol(const struct sockaddr_ll *const sa_ll)
|
||||
}
|
||||
|
||||
static void
|
||||
-print_sockaddr_data_ll(const void *const buf, const int addrlen)
|
||||
+print_sockaddr_data_ll(struct tcb *tcp, const void *const buf,
|
||||
+ const int addrlen)
|
||||
{
|
||||
const struct sockaddr_ll *const sa_ll = buf;
|
||||
|
||||
@@ -567,7 +573,8 @@ print_bluetooth_l2_cid_end:
|
||||
}
|
||||
|
||||
static void
|
||||
-print_sockaddr_data_bt(const void *const buf, const int addrlen)
|
||||
+print_sockaddr_data_bt(struct tcb *tcp, const void *const buf,
|
||||
+ const int addrlen)
|
||||
{
|
||||
struct sockaddr_hci {
|
||||
/* sa_family_t */ uint16_t hci_family;
|
||||
@@ -651,7 +658,7 @@ print_sockaddr_data_bt(const void *const buf, const int addrlen)
|
||||
}
|
||||
}
|
||||
|
||||
-typedef void (* const sockaddr_printer)(const void *const, const int);
|
||||
+typedef void (* const sockaddr_printer)(struct tcb *tcp, const void *const, const int);
|
||||
|
||||
static const struct {
|
||||
const sockaddr_printer printer;
|
||||
@@ -669,7 +676,7 @@ static const struct {
|
||||
};
|
||||
|
||||
void
|
||||
-print_sockaddr(const void *const buf, const int addrlen)
|
||||
+print_sockaddr(struct tcb *tcp, const void *const buf, const int addrlen)
|
||||
{
|
||||
const struct sockaddr *const sa = buf;
|
||||
|
||||
@@ -682,7 +689,7 @@ print_sockaddr(const void *const buf, const int addrlen)
|
||||
if (sa->sa_family < ARRAY_SIZE(sa_printers)
|
||||
&& sa_printers[sa->sa_family].printer
|
||||
&& addrlen >= sa_printers[sa->sa_family].min_len) {
|
||||
- sa_printers[sa->sa_family].printer(buf, addrlen);
|
||||
+ sa_printers[sa->sa_family].printer(tcp, buf, addrlen);
|
||||
} else {
|
||||
print_sockaddr_data_raw(buf, addrlen);
|
||||
}
|
||||
@@ -713,7 +720,7 @@ decode_sockaddr(struct tcb *const tcp, const kernel_ulong_t addr, int addrlen)
|
||||
|
||||
memset(&addrbuf.pad[addrlen], 0, sizeof(addrbuf.pad) - addrlen);
|
||||
|
||||
- print_sockaddr(&addrbuf, addrlen);
|
||||
+ print_sockaddr(tcp, &addrbuf, addrlen);
|
||||
|
||||
return addrbuf.sa.sa_family;
|
||||
}
|
||||
diff --git a/strace.c b/strace.c
|
||||
index 311e4d6..4c96a98 100644
|
||||
--- a/strace.c
|
||||
+++ b/strace.c
|
||||
@@ -2941,7 +2941,7 @@ print_stopped(struct tcb *tcp, const siginfo_t *si, const unsigned int sig)
|
||||
printleader(tcp);
|
||||
if (si) {
|
||||
tprintf("--- %s ", sprintsigname(sig));
|
||||
- printsiginfo(si);
|
||||
+ printsiginfo(tcp, si);
|
||||
tprints(" ---\n");
|
||||
} else
|
||||
tprintf("--- stopped by %s ---\n", sprintsigname(sig));
|
||||
--
|
||||
2.1.4
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,415 +0,0 @@
|
||||
From 98cb4de5002be3b81c45489200bcab0ae323123d Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81kos=20Uzonyi?= <uzonyi.akos@gmail.com>
|
||||
Date: Mon, 27 Jul 2020 20:54:07 +0200
|
||||
Subject: [PATCH 131/138] Introduce SYS_FUNC(tkill)
|
||||
|
||||
This is going to be needed to implement pidns support
|
||||
in tkill syscall decoder.
|
||||
|
||||
syscallent*.h files are updated automatically by:
|
||||
git grep -l 'SEN(kill).*"tkill"' |
|
||||
xargs sed -i '/"tkill"/ s/SEN(kill)/SEN(tkill)/'
|
||||
|
||||
* signal.c (SYS_FUNC(tkill)): New syscall decoder.
|
||||
* linux/32/syscallent.h: Use SEN(tkill) for "tkill" syscall.
|
||||
* linux/64/syscallent.h: Likewise.
|
||||
* linux/alpha/syscallent.h: Likewise.
|
||||
* linux/arm/syscallent.h: Likewise.
|
||||
* linux/avr32/syscallent.h: Likewise.
|
||||
* linux/bfin/syscallent.h: Likewise.
|
||||
* linux/hppa/syscallent.h: Likewise.
|
||||
* linux/i386/syscallent.h: Likewise.
|
||||
* linux/ia64/syscallent.h: Likewise.
|
||||
* linux/m68k/syscallent.h: Likewise.
|
||||
* linux/microblaze/syscallent.h: Likewise.
|
||||
* linux/mips/syscallent-n32.h: Likewise.
|
||||
* linux/mips/syscallent-n64.h: Likewise.
|
||||
* linux/mips/syscallent-o32.h: Likewise.
|
||||
* linux/powerpc/syscallent.h: Likewise.
|
||||
* linux/powerpc64/syscallent.h: Likewise.
|
||||
* linux/s390/syscallent.h: Likewise.
|
||||
* linux/s390x/syscallent.h: Likewise.
|
||||
* linux/sh/syscallent.h: Likewise.
|
||||
* linux/sh64/syscallent.h: Likewise.
|
||||
* linux/sparc/syscallent.h: Likewise.
|
||||
* linux/sparc64/syscallent.h: Likewise.
|
||||
* linux/x32/syscallent.h: Likewise.
|
||||
* linux/x86_64/syscallent.h: Likewise.
|
||||
* linux/xtensa/syscallent.h: Likewise.
|
||||
---
|
||||
linux/32/syscallent.h | 2 +-
|
||||
linux/64/syscallent.h | 2 +-
|
||||
linux/alpha/syscallent.h | 2 +-
|
||||
linux/arm/syscallent.h | 2 +-
|
||||
linux/avr32/syscallent.h | 2 +-
|
||||
linux/bfin/syscallent.h | 2 +-
|
||||
linux/hppa/syscallent.h | 2 +-
|
||||
linux/i386/syscallent.h | 2 +-
|
||||
linux/ia64/syscallent.h | 2 +-
|
||||
linux/m68k/syscallent.h | 2 +-
|
||||
linux/microblaze/syscallent.h | 2 +-
|
||||
linux/mips/syscallent-n32.h | 2 +-
|
||||
linux/mips/syscallent-n64.h | 2 +-
|
||||
linux/mips/syscallent-o32.h | 2 +-
|
||||
linux/powerpc/syscallent.h | 2 +-
|
||||
linux/powerpc64/syscallent.h | 2 +-
|
||||
linux/s390/syscallent.h | 2 +-
|
||||
linux/s390x/syscallent.h | 2 +-
|
||||
linux/sh/syscallent.h | 2 +-
|
||||
linux/sh64/syscallent.h | 2 +-
|
||||
linux/sparc/syscallent.h | 2 +-
|
||||
linux/sparc64/syscallent.h | 2 +-
|
||||
linux/x32/syscallent.h | 2 +-
|
||||
linux/x86_64/syscallent.h | 2 +-
|
||||
linux/xtensa/syscallent.h | 2 +-
|
||||
signal.c | 9 +++++++++
|
||||
26 files changed, 34 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/linux/32/syscallent.h b/linux/32/syscallent.h
|
||||
index c74ab18..79c36e0 100644
|
||||
--- a/linux/32/syscallent.h
|
||||
+++ b/linux/32/syscallent.h
|
||||
@@ -142,7 +142,7 @@
|
||||
/* [127] sched_rr_get_interval */
|
||||
[128] = { 0, 0, SEN(restart_syscall), "restart_syscall" },
|
||||
[129] = { 2, TS|TP, SEN(kill), "kill" },
|
||||
-[130] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[130] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[131] = { 3, TS|TP, SEN(tgkill), "tgkill" },
|
||||
[132] = { 2, TS, SEN(sigaltstack), "sigaltstack" },
|
||||
[133] = { 2, TS, SEN(rt_sigsuspend), "rt_sigsuspend" },
|
||||
diff --git a/linux/64/syscallent.h b/linux/64/syscallent.h
|
||||
index 3fb1305..ce5602e 100644
|
||||
--- a/linux/64/syscallent.h
|
||||
+++ b/linux/64/syscallent.h
|
||||
@@ -135,7 +135,7 @@
|
||||
[127] = { 2, 0, SEN(sched_rr_get_interval_time64),"sched_rr_get_interval"},
|
||||
[128] = { 0, 0, SEN(restart_syscall), "restart_syscall" },
|
||||
[129] = { 2, TS|TP, SEN(kill), "kill" },
|
||||
-[130] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[130] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[131] = { 3, TS|TP, SEN(tgkill), "tgkill" },
|
||||
[132] = { 2, TS, SEN(sigaltstack), "sigaltstack" },
|
||||
[133] = { 2, TS, SEN(rt_sigsuspend), "rt_sigsuspend" },
|
||||
diff --git a/linux/alpha/syscallent.h b/linux/alpha/syscallent.h
|
||||
index 93f0b0e..7859b9c 100644
|
||||
--- a/linux/alpha/syscallent.h
|
||||
+++ b/linux/alpha/syscallent.h
|
||||
@@ -325,7 +325,7 @@
|
||||
[378] = { 0, PU|NF, SEN(gettid), "gettid" },
|
||||
[379] = { 3, TD, SEN(readahead), "readahead" },
|
||||
[380] = { },
|
||||
-[381] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[381] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[382] = { 5, TF, SEN(setxattr), "setxattr" },
|
||||
[383] = { 5, TF, SEN(setxattr), "lsetxattr" },
|
||||
[384] = { 5, TD, SEN(fsetxattr), "fsetxattr" },
|
||||
diff --git a/linux/arm/syscallent.h b/linux/arm/syscallent.h
|
||||
index 73497b6..87b0687 100644
|
||||
--- a/linux/arm/syscallent.h
|
||||
+++ b/linux/arm/syscallent.h
|
||||
@@ -245,7 +245,7 @@
|
||||
[235] = { 2, TF, SEN(removexattr), "removexattr" },
|
||||
[236] = { 2, TF, SEN(removexattr), "lremovexattr" },
|
||||
[237] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
|
||||
-[238] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[238] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[239] = { 4, TD|TN, SEN(sendfile64), "sendfile64" },
|
||||
[240] = { 6, 0, SEN(futex_time32), "futex" },
|
||||
[241] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
|
||||
diff --git a/linux/avr32/syscallent.h b/linux/avr32/syscallent.h
|
||||
index b3cf2da..491ff8e 100644
|
||||
--- a/linux/avr32/syscallent.h
|
||||
+++ b/linux/avr32/syscallent.h
|
||||
@@ -196,7 +196,7 @@
|
||||
[187] = { 2, TF, SEN(removexattr), "removexattr" },
|
||||
[188] = { 2, TF, SEN(removexattr), "lremovexattr" },
|
||||
[189] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
|
||||
-[190] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[190] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[191] = { 4, TD|TN, SEN(sendfile64), "sendfile64" },
|
||||
[192] = { 6, 0, SEN(futex_time32), "futex" },
|
||||
[193] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
|
||||
diff --git a/linux/bfin/syscallent.h b/linux/bfin/syscallent.h
|
||||
index b93a844..53d5c23 100644
|
||||
--- a/linux/bfin/syscallent.h
|
||||
+++ b/linux/bfin/syscallent.h
|
||||
@@ -244,7 +244,7 @@
|
||||
[235] = { 2, TF, SEN(removexattr), "removexattr" },
|
||||
[236] = { 2, TF, SEN(removexattr), "lremovexattr" },
|
||||
[237] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
|
||||
-[238] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[238] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[239] = { 4, TD|TN, SEN(sendfile64), "sendfile64" },
|
||||
[240] = { 6, 0, SEN(futex_time32), "futex" },
|
||||
[241] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
|
||||
diff --git a/linux/hppa/syscallent.h b/linux/hppa/syscallent.h
|
||||
index 31341d4..20cae3c 100644
|
||||
--- a/linux/hppa/syscallent.h
|
||||
+++ b/linux/hppa/syscallent.h
|
||||
@@ -211,7 +211,7 @@
|
||||
[205] = { 5, 0, SEN(printargs), "acl_set" },
|
||||
[206] = { 0, PU|NF, SEN(gettid), "gettid" },
|
||||
[207] = { 4, TD, SEN(readahead), "readahead" },
|
||||
-[208] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[208] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[209] = { 4, TD|TN, SEN(sendfile64), "sendfile64" },
|
||||
[210] = { 6, 0, SEN(futex_time32), "futex" },
|
||||
[211] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
|
||||
diff --git a/linux/i386/syscallent.h b/linux/i386/syscallent.h
|
||||
index efe0ff7..521e7ba 100644
|
||||
--- a/linux/i386/syscallent.h
|
||||
+++ b/linux/i386/syscallent.h
|
||||
@@ -244,7 +244,7 @@
|
||||
[235] = { 2, TF, SEN(removexattr), "removexattr" },
|
||||
[236] = { 2, TF, SEN(removexattr), "lremovexattr" },
|
||||
[237] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
|
||||
-[238] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[238] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[239] = { 4, TD|TN, SEN(sendfile64), "sendfile64" },
|
||||
[240] = { 6, 0, SEN(futex_time32), "futex" },
|
||||
[241] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
|
||||
diff --git a/linux/ia64/syscallent.h b/linux/ia64/syscallent.h
|
||||
index 8aeda41..c5088e1 100644
|
||||
--- a/linux/ia64/syscallent.h
|
||||
+++ b/linux/ia64/syscallent.h
|
||||
@@ -225,7 +225,7 @@
|
||||
[BASE_NR + 202] = { 2, TF, SEN(removexattr), "removexattr" },
|
||||
[BASE_NR + 203] = { 2, TF, SEN(removexattr), "lremovexattr" },
|
||||
[BASE_NR + 204] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
|
||||
-[BASE_NR + 205] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[BASE_NR + 205] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[BASE_NR + 206] = { 6, 0, SEN(futex_time64), "futex" },
|
||||
[BASE_NR + 207] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
|
||||
[BASE_NR + 208] = { 3, 0, SEN(sched_getaffinity), "sched_getaffinity" },
|
||||
diff --git a/linux/m68k/syscallent.h b/linux/m68k/syscallent.h
|
||||
index 1876bed..107780c 100644
|
||||
--- a/linux/m68k/syscallent.h
|
||||
+++ b/linux/m68k/syscallent.h
|
||||
@@ -228,7 +228,7 @@
|
||||
[218 ... 219] = { },
|
||||
[220] = { 3, TD, SEN(getdents64), "getdents64" },
|
||||
[221] = { 0, PU|NF, SEN(gettid), "gettid" },
|
||||
-[222] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[222] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[223] = { 5, TF, SEN(setxattr), "setxattr" },
|
||||
[224] = { 5, TF, SEN(setxattr), "lsetxattr" },
|
||||
[225] = { 5, TD, SEN(fsetxattr), "fsetxattr" },
|
||||
diff --git a/linux/microblaze/syscallent.h b/linux/microblaze/syscallent.h
|
||||
index 5d071bc..d830a3e 100644
|
||||
--- a/linux/microblaze/syscallent.h
|
||||
+++ b/linux/microblaze/syscallent.h
|
||||
@@ -244,7 +244,7 @@
|
||||
[235] = { 2, TF, SEN(removexattr), "removexattr" },
|
||||
[236] = { 2, TF, SEN(removexattr), "lremovexattr" },
|
||||
[237] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
|
||||
-[238] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[238] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[239] = { 4, TD|TN, SEN(sendfile64), "sendfile64" },
|
||||
[240] = { 6, 0, SEN(futex_time32), "futex" },
|
||||
[241] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
|
||||
diff --git a/linux/mips/syscallent-n32.h b/linux/mips/syscallent-n32.h
|
||||
index cfd199d..5ab0c53 100644
|
||||
--- a/linux/mips/syscallent-n32.h
|
||||
+++ b/linux/mips/syscallent-n32.h
|
||||
@@ -200,7 +200,7 @@
|
||||
[BASE_NR + 189] = { 2, TF, SEN(removexattr), "removexattr" },
|
||||
[BASE_NR + 190] = { 2, TF, SEN(removexattr), "lremovexattr" },
|
||||
[BASE_NR + 191] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
|
||||
-[BASE_NR + 192] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[BASE_NR + 192] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[BASE_NR + 193] = { 1, TCL, SEN(time), "time" },
|
||||
[BASE_NR + 194] = { 6, 0, SEN(futex_time32), "futex" },
|
||||
[BASE_NR + 195] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
|
||||
diff --git a/linux/mips/syscallent-n64.h b/linux/mips/syscallent-n64.h
|
||||
index 7ef6700..1964872 100644
|
||||
--- a/linux/mips/syscallent-n64.h
|
||||
+++ b/linux/mips/syscallent-n64.h
|
||||
@@ -200,7 +200,7 @@
|
||||
[BASE_NR + 189] = { 2, TF, SEN(removexattr), "removexattr" },
|
||||
[BASE_NR + 190] = { 2, TF, SEN(removexattr), "lremovexattr" },
|
||||
[BASE_NR + 191] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
|
||||
-[BASE_NR + 192] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[BASE_NR + 192] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[BASE_NR + 193] = { 1, TCL, SEN(time), "time" },
|
||||
[BASE_NR + 194] = { 6, 0, SEN(futex_time64), "futex" },
|
||||
[BASE_NR + 195] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
|
||||
diff --git a/linux/mips/syscallent-o32.h b/linux/mips/syscallent-o32.h
|
||||
index d2b26f7..eb8908e 100644
|
||||
--- a/linux/mips/syscallent-o32.h
|
||||
+++ b/linux/mips/syscallent-o32.h
|
||||
@@ -245,7 +245,7 @@
|
||||
[BASE_NR + 233] = { 2, TF, SEN(removexattr), "removexattr" },
|
||||
[BASE_NR + 234] = { 2, TF, SEN(removexattr), "lremovexattr" },
|
||||
[BASE_NR + 235] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
|
||||
-[BASE_NR + 236] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[BASE_NR + 236] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[BASE_NR + 237] = { 4, TD|TN, SEN(sendfile64), "sendfile64" },
|
||||
[BASE_NR + 238] = { 6, 0, SEN(futex_time32), "futex" },
|
||||
[BASE_NR + 239] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
|
||||
diff --git a/linux/powerpc/syscallent.h b/linux/powerpc/syscallent.h
|
||||
index b0962b4..7a77979 100644
|
||||
--- a/linux/powerpc/syscallent.h
|
||||
+++ b/linux/powerpc/syscallent.h
|
||||
@@ -215,7 +215,7 @@
|
||||
[205] = { 3, TM, SEN(madvise), "madvise" },
|
||||
[206] = { 3, TM, SEN(mincore), "mincore" },
|
||||
[207] = { 0, PU|NF, SEN(gettid), "gettid" },
|
||||
-[208] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[208] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[209] = { 5, TF, SEN(setxattr), "setxattr" },
|
||||
[210] = { 5, TF, SEN(setxattr), "lsetxattr" },
|
||||
[211] = { 5, TD, SEN(fsetxattr), "fsetxattr" },
|
||||
diff --git a/linux/powerpc64/syscallent.h b/linux/powerpc64/syscallent.h
|
||||
index 1a0dfb5..f20fd78 100644
|
||||
--- a/linux/powerpc64/syscallent.h
|
||||
+++ b/linux/powerpc64/syscallent.h
|
||||
@@ -210,7 +210,7 @@
|
||||
[205] = { 3, TM, SEN(madvise), "madvise" },
|
||||
[206] = { 3, TM, SEN(mincore), "mincore" },
|
||||
[207] = { 0, PU|NF, SEN(gettid), "gettid" },
|
||||
-[208] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[208] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[209] = { 5, TF, SEN(setxattr), "setxattr" },
|
||||
[210] = { 5, TF, SEN(setxattr), "lsetxattr" },
|
||||
[211] = { 5, TD, SEN(fsetxattr), "fsetxattr" },
|
||||
diff --git a/linux/s390/syscallent.h b/linux/s390/syscallent.h
|
||||
index 105089f..6844c7e 100644
|
||||
--- a/linux/s390/syscallent.h
|
||||
+++ b/linux/s390/syscallent.h
|
||||
@@ -246,7 +246,7 @@
|
||||
[234] = { 2, TF, SEN(removexattr), "lremovexattr" },
|
||||
[235] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
|
||||
[236] = { 0, PU|NF, SEN(gettid), "gettid" },
|
||||
-[237] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[237] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[238] = { 6, 0, SEN(futex_time32), "futex" },
|
||||
[239] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
|
||||
[240] = { 3, 0, SEN(sched_getaffinity), "sched_getaffinity" },
|
||||
diff --git a/linux/s390x/syscallent.h b/linux/s390x/syscallent.h
|
||||
index e9cf57a..c805204 100644
|
||||
--- a/linux/s390x/syscallent.h
|
||||
+++ b/linux/s390x/syscallent.h
|
||||
@@ -230,7 +230,7 @@
|
||||
[234] = { 2, TF, SEN(removexattr), "lremovexattr" },
|
||||
[235] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
|
||||
[236] = { 0, PU|NF, SEN(gettid), "gettid" },
|
||||
-[237] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[237] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[238] = { 6, 0, SEN(futex_time64), "futex" },
|
||||
[239] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
|
||||
[240] = { 3, 0, SEN(sched_getaffinity), "sched_getaffinity" },
|
||||
diff --git a/linux/sh/syscallent.h b/linux/sh/syscallent.h
|
||||
index 70dc7da..6a89f75 100644
|
||||
--- a/linux/sh/syscallent.h
|
||||
+++ b/linux/sh/syscallent.h
|
||||
@@ -245,7 +245,7 @@
|
||||
[235] = { 2, TF, SEN(removexattr), "removexattr" },
|
||||
[236] = { 2, TF, SEN(removexattr), "lremovexattr" },
|
||||
[237] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
|
||||
-[238] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[238] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[239] = { 4, TD|TN, SEN(sendfile64), "sendfile64" },
|
||||
[240] = { 6, 0, SEN(futex_time32), "futex" },
|
||||
[241] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
|
||||
diff --git a/linux/sh64/syscallent.h b/linux/sh64/syscallent.h
|
||||
index eff5dc0..4ec35d3 100644
|
||||
--- a/linux/sh64/syscallent.h
|
||||
+++ b/linux/sh64/syscallent.h
|
||||
@@ -271,7 +271,7 @@
|
||||
[263] = { 2, TF, SEN(removexattr), "removexattr" },
|
||||
[264] = { 2, TF, SEN(removexattr), "lremovexattr" },
|
||||
[265] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
|
||||
-[266] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[266] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[267] = { 4, TD|TN, SEN(sendfile64), "sendfile64" },
|
||||
[268] = { 6, 0, SEN(futex_time64), "futex" },
|
||||
[269] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
|
||||
diff --git a/linux/sparc/syscallent.h b/linux/sparc/syscallent.h
|
||||
index 8c8bd18..a274791 100644
|
||||
--- a/linux/sparc/syscallent.h
|
||||
+++ b/linux/sparc/syscallent.h
|
||||
@@ -192,7 +192,7 @@
|
||||
[184] = { 5, 0, SEN(query_module), "query_module" },
|
||||
[185] = { 2, 0, SEN(setpgid), "setpgid" },
|
||||
[186] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
|
||||
-[187] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[187] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[188] = { 1, TP|SE, SEN(exit), "exit_group" },
|
||||
[189] = { 1, 0, SEN(uname), "uname" },
|
||||
[190] = { 3, 0, SEN(init_module), "init_module" },
|
||||
diff --git a/linux/sparc64/syscallent.h b/linux/sparc64/syscallent.h
|
||||
index 0e0e0c4..61c32f9 100644
|
||||
--- a/linux/sparc64/syscallent.h
|
||||
+++ b/linux/sparc64/syscallent.h
|
||||
@@ -190,7 +190,7 @@
|
||||
[184] = { 5, 0, SEN(query_module), "query_module" },
|
||||
[185] = { 2, 0, SEN(setpgid), "setpgid" },
|
||||
[186] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
|
||||
-[187] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[187] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[188] = { 1, TP|SE, SEN(exit), "exit_group" },
|
||||
[189] = { 1, 0, SEN(uname), "uname" },
|
||||
[190] = { 3, 0, SEN(init_module), "init_module" },
|
||||
diff --git a/linux/x32/syscallent.h b/linux/x32/syscallent.h
|
||||
index db8ecfd..d64060d 100644
|
||||
--- a/linux/x32/syscallent.h
|
||||
+++ b/linux/x32/syscallent.h
|
||||
@@ -205,7 +205,7 @@
|
||||
[197] = { 2, TF, SEN(removexattr), "removexattr" },
|
||||
[198] = { 2, TF, SEN(removexattr), "lremovexattr" },
|
||||
[199] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
|
||||
-[200] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[200] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[201] = { 1, TCL, SEN(time), "time" },
|
||||
[202] = { 6, 0, SEN(futex_time64), "futex" },
|
||||
[203] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
|
||||
diff --git a/linux/x86_64/syscallent.h b/linux/x86_64/syscallent.h
|
||||
index c69a5aa..027093a 100644
|
||||
--- a/linux/x86_64/syscallent.h
|
||||
+++ b/linux/x86_64/syscallent.h
|
||||
@@ -205,7 +205,7 @@
|
||||
[197] = { 2, TF, SEN(removexattr), "removexattr" },
|
||||
[198] = { 2, TF, SEN(removexattr), "lremovexattr" },
|
||||
[199] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
|
||||
-[200] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[200] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[201] = { 1, TCL, SEN(time), "time" },
|
||||
[202] = { 6, 0, SEN(futex_time64), "futex" },
|
||||
[203] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
|
||||
diff --git a/linux/xtensa/syscallent.h b/linux/xtensa/syscallent.h
|
||||
index 61f1dd4..6de03d2 100644
|
||||
--- a/linux/xtensa/syscallent.h
|
||||
+++ b/linux/xtensa/syscallent.h
|
||||
@@ -124,7 +124,7 @@
|
||||
[121] = { 4, TP, SEN(wait4), "wait4" },
|
||||
[122] = { 5, TP, SEN(waitid), "waitid" },
|
||||
[123] = { 2, TS|TP, SEN(kill), "kill" },
|
||||
-[124] = { 2, TS|TP, SEN(kill), "tkill" },
|
||||
+[124] = { 2, TS|TP, SEN(tkill), "tkill" },
|
||||
[125] = { 3, TS|TP, SEN(tgkill), "tgkill" },
|
||||
[126] = { 1, 0, SEN(set_tid_address), "set_tid_address" },
|
||||
[127] = { 0, PU|NF, SEN(gettid), "gettid" },
|
||||
diff --git a/signal.c b/signal.c
|
||||
index 3cb54bb..5f1acac 100644
|
||||
--- a/signal.c
|
||||
+++ b/signal.c
|
||||
@@ -446,6 +446,15 @@ SYS_FUNC(kill)
|
||||
return RVAL_DECODED;
|
||||
}
|
||||
|
||||
+SYS_FUNC(tkill)
|
||||
+{
|
||||
+ tprintf("%d", (int) tcp->u_arg[0]);
|
||||
+ tprints(", ");
|
||||
+ printsignal(tcp->u_arg[1]);
|
||||
+
|
||||
+ return RVAL_DECODED;
|
||||
+}
|
||||
+
|
||||
SYS_FUNC(tgkill)
|
||||
{
|
||||
/* tgid, tid */
|
||||
--
|
||||
2.1.4
|
||||
|
@ -1,683 +0,0 @@
|
||||
From 24119509205a17c71de10e913cfc38dc52aa6563 Mon Sep 17 00:00:00 2001
|
||||
From: "Dmitry V. Levin" <ldv@altlinux.org>
|
||||
Date: Sat, 1 Aug 2020 08:00:00 +0000
|
||||
Subject: [PATCH 132/138] tests: check decoding of tkill syscall
|
||||
|
||||
* tests/tkill.c: New file.
|
||||
* tests/gen_tests.in (tkill): New entry.
|
||||
* tests/pure_executables.list: Add tkill.
|
||||
* tests/.gitignore: Likewise.
|
||||
---
|
||||
tests/.gitignore | 1 +
|
||||
tests/gen_tests.in | 1 +
|
||||
tests/pure_executables.list | 1 +
|
||||
tests/tkill.c | 60 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
4 files changed, 63 insertions(+)
|
||||
create mode 100644 tests/tkill.c
|
||||
|
||||
Index: strace-5.7/tests/gen_tests.in
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/gen_tests.in 2020-09-09 15:47:07.671767616 +0200
|
||||
+++ strace-5.7/tests/gen_tests.in 2020-09-09 19:30:36.780885588 +0200
|
||||
@@ -668,6 +668,7 @@
|
||||
timerfd_xettime -e trace=timerfd_create,timerfd_settime,timerfd_gettime
|
||||
times -esignal=none
|
||||
times-fail -a12 -e trace=times
|
||||
+tkill -a12 --signal='!cont'
|
||||
trace_clock test_trace_expr 'clock_nanosleep|times' -e%clock
|
||||
trace_creds test_trace_expr '([gs]et[^p]*([gu]id|groups)|caps|prctl|[fl]?chown|print(path-umovestr|strn-umoven)-undumpable|ptrace|quotactl|rt_sigtimedwait|rt_(tg)?sigqueueinfo).*' -e%creds
|
||||
trace_fstat test_trace_expr '' -e%fstat -v -P stat.sample -P /dev/full
|
||||
Index: strace-5.7/tests/pure_executables.list
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/pure_executables.list 2020-09-09 15:47:07.671767616 +0200
|
||||
+++ strace-5.7/tests/pure_executables.list 2020-09-09 19:30:36.780885588 +0200
|
||||
@@ -589,6 +589,7 @@
|
||||
timerfd_xettime
|
||||
times
|
||||
times-fail
|
||||
+tkill
|
||||
truncate
|
||||
truncate64
|
||||
ugetrlimit
|
||||
Index: strace-5.7/tests/tkill.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ strace-5.7/tests/tkill.c 2020-09-09 19:21:10.469548041 +0200
|
||||
@@ -0,0 +1,60 @@
|
||||
+/*
|
||||
+ * Check decoding of tkill syscall.
|
||||
+ *
|
||||
+ * Copyright (c) 2020 Dmitry V. Levin <ldv@altlinux.org>
|
||||
+ * All rights reserved.
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: GPL-2.0-or-later
|
||||
+ */
|
||||
+
|
||||
+#include "tests.h"
|
||||
+#include "scno.h"
|
||||
+
|
||||
+#ifdef __NR_tkill
|
||||
+
|
||||
+# include <signal.h>
|
||||
+# include <stdio.h>
|
||||
+# include <unistd.h>
|
||||
+
|
||||
+static const char *errstr;
|
||||
+
|
||||
+static long
|
||||
+k_tkill(const unsigned int tid, const unsigned int sig)
|
||||
+{
|
||||
+ const kernel_ulong_t fill = (kernel_ulong_t) 0xdefaced00000000ULL;
|
||||
+ const kernel_ulong_t bad = (kernel_ulong_t) 0xbadc0dedbadc0dedULL;
|
||||
+ const kernel_ulong_t arg1 = fill | tid;
|
||||
+ const kernel_ulong_t arg2 = fill | sig;
|
||||
+ const long rc = syscall(__NR_tkill, arg1, arg2, bad, bad, bad, bad);
|
||||
+ errstr = sprintrc(rc);
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main(void)
|
||||
+{
|
||||
+ const int pid = getpid();
|
||||
+ const int bad_pid = -1;
|
||||
+ const int bad_sig = 0xface;
|
||||
+
|
||||
+ k_tkill(pid, 0);
|
||||
+ printf("tkill(%d, 0) = %s\n", pid, errstr);
|
||||
+
|
||||
+ k_tkill(pid, SIGCONT);
|
||||
+ printf("tkill(%d, SIGCONT) = %s\n", pid, errstr);
|
||||
+
|
||||
+ k_tkill(bad_pid, bad_sig);
|
||||
+ printf("tkill(%d, %d) = %s\n", bad_pid, bad_sig, errstr);
|
||||
+
|
||||
+ k_tkill(bad_pid, -bad_sig);
|
||||
+ printf("tkill(%d, %d) = %s\n", bad_pid, -bad_sig, errstr);
|
||||
+
|
||||
+ puts("+++ exited with 0 +++");
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#else
|
||||
+
|
||||
+SKIP_MAIN_UNDEFINED("__NR_tkill")
|
||||
+
|
||||
+#endif
|
||||
Index: strace-5.7/tests-m32/gen_tests.in
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/gen_tests.in 2020-09-09 15:47:07.671767616 +0200
|
||||
+++ strace-5.7/tests-m32/gen_tests.in 2020-09-09 19:30:36.780885588 +0200
|
||||
@@ -668,6 +668,7 @@
|
||||
timerfd_xettime -e trace=timerfd_create,timerfd_settime,timerfd_gettime
|
||||
times -esignal=none
|
||||
times-fail -a12 -e trace=times
|
||||
+tkill -a12 --signal='!cont'
|
||||
trace_clock test_trace_expr 'clock_nanosleep|times' -e%clock
|
||||
trace_creds test_trace_expr '([gs]et[^p]*([gu]id|groups)|caps|prctl|[fl]?chown|print(path-umovestr|strn-umoven)-undumpable|ptrace|quotactl|rt_sigtimedwait|rt_(tg)?sigqueueinfo).*' -e%creds
|
||||
trace_fstat test_trace_expr '' -e%fstat -v -P stat.sample -P /dev/full
|
||||
Index: strace-5.7/tests-m32/pure_executables.list
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/pure_executables.list 2020-09-09 15:47:07.671767616 +0200
|
||||
+++ strace-5.7/tests-m32/pure_executables.list 2020-09-09 19:30:36.780885588 +0200
|
||||
@@ -589,6 +589,7 @@
|
||||
timerfd_xettime
|
||||
times
|
||||
times-fail
|
||||
+tkill
|
||||
truncate
|
||||
truncate64
|
||||
ugetrlimit
|
||||
Index: strace-5.7/tests-m32/tkill.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ strace-5.7/tests-m32/tkill.c 2020-09-09 19:21:10.469548041 +0200
|
||||
@@ -0,0 +1,60 @@
|
||||
+/*
|
||||
+ * Check decoding of tkill syscall.
|
||||
+ *
|
||||
+ * Copyright (c) 2020 Dmitry V. Levin <ldv@altlinux.org>
|
||||
+ * All rights reserved.
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: GPL-2.0-or-later
|
||||
+ */
|
||||
+
|
||||
+#include "tests.h"
|
||||
+#include "scno.h"
|
||||
+
|
||||
+#ifdef __NR_tkill
|
||||
+
|
||||
+# include <signal.h>
|
||||
+# include <stdio.h>
|
||||
+# include <unistd.h>
|
||||
+
|
||||
+static const char *errstr;
|
||||
+
|
||||
+static long
|
||||
+k_tkill(const unsigned int tid, const unsigned int sig)
|
||||
+{
|
||||
+ const kernel_ulong_t fill = (kernel_ulong_t) 0xdefaced00000000ULL;
|
||||
+ const kernel_ulong_t bad = (kernel_ulong_t) 0xbadc0dedbadc0dedULL;
|
||||
+ const kernel_ulong_t arg1 = fill | tid;
|
||||
+ const kernel_ulong_t arg2 = fill | sig;
|
||||
+ const long rc = syscall(__NR_tkill, arg1, arg2, bad, bad, bad, bad);
|
||||
+ errstr = sprintrc(rc);
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main(void)
|
||||
+{
|
||||
+ const int pid = getpid();
|
||||
+ const int bad_pid = -1;
|
||||
+ const int bad_sig = 0xface;
|
||||
+
|
||||
+ k_tkill(pid, 0);
|
||||
+ printf("tkill(%d, 0) = %s\n", pid, errstr);
|
||||
+
|
||||
+ k_tkill(pid, SIGCONT);
|
||||
+ printf("tkill(%d, SIGCONT) = %s\n", pid, errstr);
|
||||
+
|
||||
+ k_tkill(bad_pid, bad_sig);
|
||||
+ printf("tkill(%d, %d) = %s\n", bad_pid, bad_sig, errstr);
|
||||
+
|
||||
+ k_tkill(bad_pid, -bad_sig);
|
||||
+ printf("tkill(%d, %d) = %s\n", bad_pid, -bad_sig, errstr);
|
||||
+
|
||||
+ puts("+++ exited with 0 +++");
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#else
|
||||
+
|
||||
+SKIP_MAIN_UNDEFINED("__NR_tkill")
|
||||
+
|
||||
+#endif
|
||||
Index: strace-5.7/tests-mx32/gen_tests.in
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/gen_tests.in 2020-09-09 15:47:07.671767616 +0200
|
||||
+++ strace-5.7/tests-mx32/gen_tests.in 2020-09-09 19:30:36.780885588 +0200
|
||||
@@ -668,6 +668,7 @@
|
||||
timerfd_xettime -e trace=timerfd_create,timerfd_settime,timerfd_gettime
|
||||
times -esignal=none
|
||||
times-fail -a12 -e trace=times
|
||||
+tkill -a12 --signal='!cont'
|
||||
trace_clock test_trace_expr 'clock_nanosleep|times' -e%clock
|
||||
trace_creds test_trace_expr '([gs]et[^p]*([gu]id|groups)|caps|prctl|[fl]?chown|print(path-umovestr|strn-umoven)-undumpable|ptrace|quotactl|rt_sigtimedwait|rt_(tg)?sigqueueinfo).*' -e%creds
|
||||
trace_fstat test_trace_expr '' -e%fstat -v -P stat.sample -P /dev/full
|
||||
Index: strace-5.7/tests-mx32/pure_executables.list
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/pure_executables.list 2020-09-09 15:47:07.671767616 +0200
|
||||
+++ strace-5.7/tests-mx32/pure_executables.list 2020-09-09 19:30:36.780885588 +0200
|
||||
@@ -589,6 +589,7 @@
|
||||
timerfd_xettime
|
||||
times
|
||||
times-fail
|
||||
+tkill
|
||||
truncate
|
||||
truncate64
|
||||
ugetrlimit
|
||||
Index: strace-5.7/tests-mx32/tkill.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ strace-5.7/tests-mx32/tkill.c 2020-09-09 19:21:10.469548041 +0200
|
||||
@@ -0,0 +1,60 @@
|
||||
+/*
|
||||
+ * Check decoding of tkill syscall.
|
||||
+ *
|
||||
+ * Copyright (c) 2020 Dmitry V. Levin <ldv@altlinux.org>
|
||||
+ * All rights reserved.
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: GPL-2.0-or-later
|
||||
+ */
|
||||
+
|
||||
+#include "tests.h"
|
||||
+#include "scno.h"
|
||||
+
|
||||
+#ifdef __NR_tkill
|
||||
+
|
||||
+# include <signal.h>
|
||||
+# include <stdio.h>
|
||||
+# include <unistd.h>
|
||||
+
|
||||
+static const char *errstr;
|
||||
+
|
||||
+static long
|
||||
+k_tkill(const unsigned int tid, const unsigned int sig)
|
||||
+{
|
||||
+ const kernel_ulong_t fill = (kernel_ulong_t) 0xdefaced00000000ULL;
|
||||
+ const kernel_ulong_t bad = (kernel_ulong_t) 0xbadc0dedbadc0dedULL;
|
||||
+ const kernel_ulong_t arg1 = fill | tid;
|
||||
+ const kernel_ulong_t arg2 = fill | sig;
|
||||
+ const long rc = syscall(__NR_tkill, arg1, arg2, bad, bad, bad, bad);
|
||||
+ errstr = sprintrc(rc);
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main(void)
|
||||
+{
|
||||
+ const int pid = getpid();
|
||||
+ const int bad_pid = -1;
|
||||
+ const int bad_sig = 0xface;
|
||||
+
|
||||
+ k_tkill(pid, 0);
|
||||
+ printf("tkill(%d, 0) = %s\n", pid, errstr);
|
||||
+
|
||||
+ k_tkill(pid, SIGCONT);
|
||||
+ printf("tkill(%d, SIGCONT) = %s\n", pid, errstr);
|
||||
+
|
||||
+ k_tkill(bad_pid, bad_sig);
|
||||
+ printf("tkill(%d, %d) = %s\n", bad_pid, bad_sig, errstr);
|
||||
+
|
||||
+ k_tkill(bad_pid, -bad_sig);
|
||||
+ printf("tkill(%d, %d) = %s\n", bad_pid, -bad_sig, errstr);
|
||||
+
|
||||
+ puts("+++ exited with 0 +++");
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#else
|
||||
+
|
||||
+SKIP_MAIN_UNDEFINED("__NR_tkill")
|
||||
+
|
||||
+#endif
|
||||
Index: strace-5.7/tests-m32/Makefile.in
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/Makefile.in 2020-09-09 15:47:07.671767616 +0200
|
||||
+++ strace-5.7/tests-m32/Makefile.in 2020-09-09 19:32:14.800944013 +0200
|
||||
@@ -496,14 +496,15 @@
|
||||
sysinfo$(EXEEXT) syslog$(EXEEXT) tee$(EXEEXT) time$(EXEEXT) \
|
||||
timer_create$(EXEEXT) timer_xettime$(EXEEXT) \
|
||||
timerfd_xettime$(EXEEXT) times$(EXEEXT) times-fail$(EXEEXT) \
|
||||
- truncate$(EXEEXT) truncate64$(EXEEXT) ugetrlimit$(EXEEXT) \
|
||||
- uio$(EXEEXT) umask$(EXEEXT) umount$(EXEEXT) umount2$(EXEEXT) \
|
||||
- umoven-illptr$(EXEEXT) umovestr$(EXEEXT) \
|
||||
- umovestr-illptr$(EXEEXT) umovestr2$(EXEEXT) umovestr3$(EXEEXT) \
|
||||
- umovestr_cached$(EXEEXT) umovestr_cached_adjacent$(EXEEXT) \
|
||||
- uname$(EXEEXT) unlink$(EXEEXT) unlinkat$(EXEEXT) \
|
||||
- unshare$(EXEEXT) userfaultfd$(EXEEXT) ustat$(EXEEXT) \
|
||||
- utime$(EXEEXT) utimensat$(EXEEXT) utimensat-Xabbrev$(EXEEXT) \
|
||||
+ tkill$(EXEEXT) truncate$(EXEEXT) truncate64$(EXEEXT) \
|
||||
+ ugetrlimit$(EXEEXT) uio$(EXEEXT) umask$(EXEEXT) \
|
||||
+ umount$(EXEEXT) umount2$(EXEEXT) umoven-illptr$(EXEEXT) \
|
||||
+ umovestr$(EXEEXT) umovestr-illptr$(EXEEXT) umovestr2$(EXEEXT) \
|
||||
+ umovestr3$(EXEEXT) umovestr_cached$(EXEEXT) \
|
||||
+ umovestr_cached_adjacent$(EXEEXT) uname$(EXEEXT) \
|
||||
+ unlink$(EXEEXT) unlinkat$(EXEEXT) unshare$(EXEEXT) \
|
||||
+ userfaultfd$(EXEEXT) ustat$(EXEEXT) utime$(EXEEXT) \
|
||||
+ utimensat$(EXEEXT) utimensat-Xabbrev$(EXEEXT) \
|
||||
utimensat-Xraw$(EXEEXT) utimensat-Xverbose$(EXEEXT) \
|
||||
utimes$(EXEEXT) vhangup$(EXEEXT) vmsplice$(EXEEXT) \
|
||||
wait4$(EXEEXT) waitid$(EXEEXT) waitpid$(EXEEXT) xattr$(EXEEXT) \
|
||||
@@ -3484,6 +3485,10 @@
|
||||
times_fail_OBJECTS = times-fail.$(OBJEXT)
|
||||
times_fail_LDADD = $(LDADD)
|
||||
times_fail_DEPENDENCIES = libtests.a
|
||||
+tkill_SOURCES = tkill.c
|
||||
+tkill_OBJECTS = tkill.$(OBJEXT)
|
||||
+tkill_LDADD = $(LDADD)
|
||||
+tkill_DEPENDENCIES = libtests.a
|
||||
tracer_ppid_pgid_sid_SOURCES = tracer_ppid_pgid_sid.c
|
||||
tracer_ppid_pgid_sid_OBJECTS = tracer_ppid_pgid_sid.$(OBJEXT)
|
||||
tracer_ppid_pgid_sid_LDADD = $(LDADD)
|
||||
@@ -4184,7 +4189,7 @@
|
||||
./$(DEPDIR)/threads-execve.Po ./$(DEPDIR)/time.Po \
|
||||
./$(DEPDIR)/timer_create.Po ./$(DEPDIR)/timer_xettime.Po \
|
||||
./$(DEPDIR)/timerfd_xettime.Po ./$(DEPDIR)/times-fail.Po \
|
||||
- ./$(DEPDIR)/times.Po ./$(DEPDIR)/tracer_ppid_pgid_sid.Po \
|
||||
+ ./$(DEPDIR)/times.Po ./$(DEPDIR)/tkill.Po ./$(DEPDIR)/tracer_ppid_pgid_sid.Po \
|
||||
./$(DEPDIR)/truncate.Po ./$(DEPDIR)/truncate64-truncate64.Po \
|
||||
./$(DEPDIR)/ugetrlimit.Po ./$(DEPDIR)/uio-uio.Po \
|
||||
./$(DEPDIR)/umask.Po ./$(DEPDIR)/umount.Po \
|
||||
@@ -4441,7 +4446,7 @@
|
||||
syslog-success.c tee.c threads-execve.c \
|
||||
threads-execve--quiet-thread-execve.c threads-execve-q.c \
|
||||
threads-execve-qq.c threads-execve-qqq.c time.c timer_create.c \
|
||||
- timer_xettime.c timerfd_xettime.c times.c times-fail.c \
|
||||
+ timer_xettime.c timerfd_xettime.c times.c times-fail.c tkill.c \
|
||||
tracer_ppid_pgid_sid.c truncate.c truncate64.c ugetrlimit.c \
|
||||
uio.c umask.c umount.c umount2.c umoven-illptr.c umovestr.c \
|
||||
umovestr-illptr.c umovestr2.c umovestr3.c umovestr_cached.c \
|
||||
@@ -4667,7 +4672,7 @@
|
||||
syslog-success.c tee.c threads-execve.c \
|
||||
threads-execve--quiet-thread-execve.c threads-execve-q.c \
|
||||
threads-execve-qq.c threads-execve-qqq.c time.c timer_create.c \
|
||||
- timer_xettime.c timerfd_xettime.c times.c times-fail.c \
|
||||
+ timer_xettime.c timerfd_xettime.c times.c times-fail.c tkill.c \
|
||||
tracer_ppid_pgid_sid.c truncate.c truncate64.c ugetrlimit.c \
|
||||
uio.c umask.c umount.c umount2.c umoven-illptr.c umovestr.c \
|
||||
umovestr-illptr.c umovestr2.c umovestr3.c umovestr_cached.c \
|
||||
@@ -5725,6 +5730,7 @@
|
||||
timerfd_xettime \
|
||||
times \
|
||||
times-fail \
|
||||
+ tkill \
|
||||
truncate \
|
||||
truncate64 \
|
||||
ugetrlimit \
|
||||
@@ -6133,9 +6139,10 @@
|
||||
threads-execve-qqq.gen.test time.gen.test \
|
||||
timer_create.gen.test timer_xettime.gen.test \
|
||||
timerfd_xettime.gen.test times.gen.test times-fail.gen.test \
|
||||
- trace_clock.gen.test trace_creds.gen.test trace_fstat.gen.test \
|
||||
- trace_fstatfs.gen.test trace_lstat.gen.test \
|
||||
- trace_personality_32.gen.test trace_personality_64.gen.test \
|
||||
+ tkill.gen.test trace_clock.gen.test trace_creds.gen.test \
|
||||
+ trace_fstat.gen.test trace_fstatfs.gen.test \
|
||||
+ trace_lstat.gen.test trace_personality_32.gen.test \
|
||||
+ trace_personality_64.gen.test \
|
||||
trace_personality_regex_32.gen.test \
|
||||
trace_personality_regex_64.gen.test \
|
||||
trace_personality_regex_x32.gen.test \
|
||||
@@ -9392,6 +9399,10 @@
|
||||
@rm -f times-fail$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(times_fail_OBJECTS) $(times_fail_LDADD) $(LIBS)
|
||||
|
||||
+tkill$(EXEEXT): $(tkill_OBJECTS) $(tkill_DEPENDENCIES) $(EXTRA_tkill_DEPENDENCIES)
|
||||
+ @rm -f tkill$(EXEEXT)
|
||||
+ $(AM_V_CCLD)$(LINK) $(tkill_OBJECTS) $(tkill_LDADD) $(LIBS)
|
||||
+
|
||||
tracer_ppid_pgid_sid$(EXEEXT): $(tracer_ppid_pgid_sid_OBJECTS) $(tracer_ppid_pgid_sid_DEPENDENCIES) $(EXTRA_tracer_ppid_pgid_sid_DEPENDENCIES)
|
||||
@rm -f tracer_ppid_pgid_sid$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(tracer_ppid_pgid_sid_OBJECTS) $(tracer_ppid_pgid_sid_LDADD) $(LIBS)
|
||||
@@ -10349,6 +10360,7 @@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timerfd_xettime.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/times-fail.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/times.Po@am__quote@ # am--include-marker
|
||||
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tkill.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tracer_ppid_pgid_sid.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/truncate.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/truncate64-truncate64.Po@am__quote@ # am--include-marker
|
||||
@@ -12169,6 +12181,7 @@
|
||||
-rm -f ./$(DEPDIR)/timerfd_xettime.Po
|
||||
-rm -f ./$(DEPDIR)/times-fail.Po
|
||||
-rm -f ./$(DEPDIR)/times.Po
|
||||
+ -rm -f ./$(DEPDIR)/tkill.Po
|
||||
-rm -f ./$(DEPDIR)/tracer_ppid_pgid_sid.Po
|
||||
-rm -f ./$(DEPDIR)/truncate.Po
|
||||
-rm -f ./$(DEPDIR)/truncate64-truncate64.Po
|
||||
@@ -13024,6 +13037,7 @@
|
||||
-rm -f ./$(DEPDIR)/timerfd_xettime.Po
|
||||
-rm -f ./$(DEPDIR)/times-fail.Po
|
||||
-rm -f ./$(DEPDIR)/times.Po
|
||||
+ -rm -f ./$(DEPDIR)/tkill.Po
|
||||
-rm -f ./$(DEPDIR)/tracer_ppid_pgid_sid.Po
|
||||
-rm -f ./$(DEPDIR)/truncate.Po
|
||||
-rm -f ./$(DEPDIR)/truncate64-truncate64.Po
|
||||
@@ -15101,6 +15115,9 @@
|
||||
$(srcdir)/times-fail.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
|
||||
$(AM_V_GEN) $^ $@
|
||||
|
||||
+$(srcdir)/tkill.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
|
||||
+ $(AM_V_GEN) $^ $@
|
||||
+
|
||||
$(srcdir)/trace_clock.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
|
||||
$(AM_V_GEN) $^ $@
|
||||
|
||||
Index: strace-5.7/tests-mx32/Makefile.in
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/Makefile.in 2020-09-09 15:47:07.671767616 +0200
|
||||
+++ strace-5.7/tests-mx32/Makefile.in 2020-09-09 19:32:39.854958946 +0200
|
||||
@@ -496,14 +496,15 @@
|
||||
sysinfo$(EXEEXT) syslog$(EXEEXT) tee$(EXEEXT) time$(EXEEXT) \
|
||||
timer_create$(EXEEXT) timer_xettime$(EXEEXT) \
|
||||
timerfd_xettime$(EXEEXT) times$(EXEEXT) times-fail$(EXEEXT) \
|
||||
- truncate$(EXEEXT) truncate64$(EXEEXT) ugetrlimit$(EXEEXT) \
|
||||
- uio$(EXEEXT) umask$(EXEEXT) umount$(EXEEXT) umount2$(EXEEXT) \
|
||||
- umoven-illptr$(EXEEXT) umovestr$(EXEEXT) \
|
||||
- umovestr-illptr$(EXEEXT) umovestr2$(EXEEXT) umovestr3$(EXEEXT) \
|
||||
- umovestr_cached$(EXEEXT) umovestr_cached_adjacent$(EXEEXT) \
|
||||
- uname$(EXEEXT) unlink$(EXEEXT) unlinkat$(EXEEXT) \
|
||||
- unshare$(EXEEXT) userfaultfd$(EXEEXT) ustat$(EXEEXT) \
|
||||
- utime$(EXEEXT) utimensat$(EXEEXT) utimensat-Xabbrev$(EXEEXT) \
|
||||
+ tkill$(EXEEXT) truncate$(EXEEXT) truncate64$(EXEEXT) \
|
||||
+ ugetrlimit$(EXEEXT) uio$(EXEEXT) umask$(EXEEXT) \
|
||||
+ umount$(EXEEXT) umount2$(EXEEXT) umoven-illptr$(EXEEXT) \
|
||||
+ umovestr$(EXEEXT) umovestr-illptr$(EXEEXT) umovestr2$(EXEEXT) \
|
||||
+ umovestr3$(EXEEXT) umovestr_cached$(EXEEXT) \
|
||||
+ umovestr_cached_adjacent$(EXEEXT) uname$(EXEEXT) \
|
||||
+ unlink$(EXEEXT) unlinkat$(EXEEXT) unshare$(EXEEXT) \
|
||||
+ userfaultfd$(EXEEXT) ustat$(EXEEXT) utime$(EXEEXT) \
|
||||
+ utimensat$(EXEEXT) utimensat-Xabbrev$(EXEEXT) \
|
||||
utimensat-Xraw$(EXEEXT) utimensat-Xverbose$(EXEEXT) \
|
||||
utimes$(EXEEXT) vhangup$(EXEEXT) vmsplice$(EXEEXT) \
|
||||
wait4$(EXEEXT) waitid$(EXEEXT) waitpid$(EXEEXT) xattr$(EXEEXT) \
|
||||
@@ -3484,6 +3485,10 @@
|
||||
times_fail_OBJECTS = times-fail.$(OBJEXT)
|
||||
times_fail_LDADD = $(LDADD)
|
||||
times_fail_DEPENDENCIES = libtests.a
|
||||
+tkill_SOURCES = tkill.c
|
||||
+tkill_OBJECTS = tkill.$(OBJEXT)
|
||||
+tkill_LDADD = $(LDADD)
|
||||
+tkill_DEPENDENCIES = libtests.a
|
||||
tracer_ppid_pgid_sid_SOURCES = tracer_ppid_pgid_sid.c
|
||||
tracer_ppid_pgid_sid_OBJECTS = tracer_ppid_pgid_sid.$(OBJEXT)
|
||||
tracer_ppid_pgid_sid_LDADD = $(LDADD)
|
||||
@@ -4184,7 +4189,7 @@
|
||||
./$(DEPDIR)/threads-execve.Po ./$(DEPDIR)/time.Po \
|
||||
./$(DEPDIR)/timer_create.Po ./$(DEPDIR)/timer_xettime.Po \
|
||||
./$(DEPDIR)/timerfd_xettime.Po ./$(DEPDIR)/times-fail.Po \
|
||||
- ./$(DEPDIR)/times.Po ./$(DEPDIR)/tracer_ppid_pgid_sid.Po \
|
||||
+ ./$(DEPDIR)/times.Po ./$(DEPDIR)/tkill.Po ./$(DEPDIR)/tracer_ppid_pgid_sid.Po \
|
||||
./$(DEPDIR)/truncate.Po ./$(DEPDIR)/truncate64-truncate64.Po \
|
||||
./$(DEPDIR)/ugetrlimit.Po ./$(DEPDIR)/uio-uio.Po \
|
||||
./$(DEPDIR)/umask.Po ./$(DEPDIR)/umount.Po \
|
||||
@@ -4441,7 +4446,7 @@
|
||||
syslog-success.c tee.c threads-execve.c \
|
||||
threads-execve--quiet-thread-execve.c threads-execve-q.c \
|
||||
threads-execve-qq.c threads-execve-qqq.c time.c timer_create.c \
|
||||
- timer_xettime.c timerfd_xettime.c times.c times-fail.c \
|
||||
+ timer_xettime.c timerfd_xettime.c times.c times-fail.c tkill.c \
|
||||
tracer_ppid_pgid_sid.c truncate.c truncate64.c ugetrlimit.c \
|
||||
uio.c umask.c umount.c umount2.c umoven-illptr.c umovestr.c \
|
||||
umovestr-illptr.c umovestr2.c umovestr3.c umovestr_cached.c \
|
||||
@@ -4667,7 +4672,7 @@
|
||||
syslog-success.c tee.c threads-execve.c \
|
||||
threads-execve--quiet-thread-execve.c threads-execve-q.c \
|
||||
threads-execve-qq.c threads-execve-qqq.c time.c timer_create.c \
|
||||
- timer_xettime.c timerfd_xettime.c times.c times-fail.c \
|
||||
+ timer_xettime.c timerfd_xettime.c times.c times-fail.c tkill.c \
|
||||
tracer_ppid_pgid_sid.c truncate.c truncate64.c ugetrlimit.c \
|
||||
uio.c umask.c umount.c umount2.c umoven-illptr.c umovestr.c \
|
||||
umovestr-illptr.c umovestr2.c umovestr3.c umovestr_cached.c \
|
||||
@@ -5725,6 +5730,7 @@
|
||||
timerfd_xettime \
|
||||
times \
|
||||
times-fail \
|
||||
+ tkill \
|
||||
truncate \
|
||||
truncate64 \
|
||||
ugetrlimit \
|
||||
@@ -6133,9 +6139,10 @@
|
||||
threads-execve-qqq.gen.test time.gen.test \
|
||||
timer_create.gen.test timer_xettime.gen.test \
|
||||
timerfd_xettime.gen.test times.gen.test times-fail.gen.test \
|
||||
- trace_clock.gen.test trace_creds.gen.test trace_fstat.gen.test \
|
||||
- trace_fstatfs.gen.test trace_lstat.gen.test \
|
||||
- trace_personality_32.gen.test trace_personality_64.gen.test \
|
||||
+ tkill.gen.test trace_clock.gen.test trace_creds.gen.test \
|
||||
+ trace_fstat.gen.test trace_fstatfs.gen.test \
|
||||
+ trace_lstat.gen.test trace_personality_32.gen.test \
|
||||
+ trace_personality_64.gen.test \
|
||||
trace_personality_regex_32.gen.test \
|
||||
trace_personality_regex_64.gen.test \
|
||||
trace_personality_regex_x32.gen.test \
|
||||
@@ -9392,6 +9399,10 @@
|
||||
@rm -f times-fail$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(times_fail_OBJECTS) $(times_fail_LDADD) $(LIBS)
|
||||
|
||||
+tkill$(EXEEXT): $(tkill_OBJECTS) $(tkill_DEPENDENCIES) $(EXTRA_tkill_DEPENDENCIES)
|
||||
+ @rm -f tkill$(EXEEXT)
|
||||
+ $(AM_V_CCLD)$(LINK) $(tkill_OBJECTS) $(tkill_LDADD) $(LIBS)
|
||||
+
|
||||
tracer_ppid_pgid_sid$(EXEEXT): $(tracer_ppid_pgid_sid_OBJECTS) $(tracer_ppid_pgid_sid_DEPENDENCIES) $(EXTRA_tracer_ppid_pgid_sid_DEPENDENCIES)
|
||||
@rm -f tracer_ppid_pgid_sid$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(tracer_ppid_pgid_sid_OBJECTS) $(tracer_ppid_pgid_sid_LDADD) $(LIBS)
|
||||
@@ -10349,6 +10360,7 @@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timerfd_xettime.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/times-fail.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/times.Po@am__quote@ # am--include-marker
|
||||
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tkill.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tracer_ppid_pgid_sid.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/truncate.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/truncate64-truncate64.Po@am__quote@ # am--include-marker
|
||||
@@ -12169,6 +12181,7 @@
|
||||
-rm -f ./$(DEPDIR)/timerfd_xettime.Po
|
||||
-rm -f ./$(DEPDIR)/times-fail.Po
|
||||
-rm -f ./$(DEPDIR)/times.Po
|
||||
+ -rm -f ./$(DEPDIR)/tkill.Po
|
||||
-rm -f ./$(DEPDIR)/tracer_ppid_pgid_sid.Po
|
||||
-rm -f ./$(DEPDIR)/truncate.Po
|
||||
-rm -f ./$(DEPDIR)/truncate64-truncate64.Po
|
||||
@@ -13024,6 +13037,7 @@
|
||||
-rm -f ./$(DEPDIR)/timerfd_xettime.Po
|
||||
-rm -f ./$(DEPDIR)/times-fail.Po
|
||||
-rm -f ./$(DEPDIR)/times.Po
|
||||
+ -rm -f ./$(DEPDIR)/tkill.Po
|
||||
-rm -f ./$(DEPDIR)/tracer_ppid_pgid_sid.Po
|
||||
-rm -f ./$(DEPDIR)/truncate.Po
|
||||
-rm -f ./$(DEPDIR)/truncate64-truncate64.Po
|
||||
@@ -15101,6 +15115,9 @@
|
||||
$(srcdir)/times-fail.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
|
||||
$(AM_V_GEN) $^ $@
|
||||
|
||||
+$(srcdir)/tkill.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
|
||||
+ $(AM_V_GEN) $^ $@
|
||||
+
|
||||
$(srcdir)/trace_clock.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
|
||||
$(AM_V_GEN) $^ $@
|
||||
|
||||
Index: strace-5.7/tests/Makefile.in
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/Makefile.in 2020-09-09 15:47:07.671767616 +0200
|
||||
+++ strace-5.7/tests/Makefile.in 2020-09-09 19:30:36.780885588 +0200
|
||||
@@ -496,14 +496,15 @@
|
||||
sysinfo$(EXEEXT) syslog$(EXEEXT) tee$(EXEEXT) time$(EXEEXT) \
|
||||
timer_create$(EXEEXT) timer_xettime$(EXEEXT) \
|
||||
timerfd_xettime$(EXEEXT) times$(EXEEXT) times-fail$(EXEEXT) \
|
||||
- truncate$(EXEEXT) truncate64$(EXEEXT) ugetrlimit$(EXEEXT) \
|
||||
- uio$(EXEEXT) umask$(EXEEXT) umount$(EXEEXT) umount2$(EXEEXT) \
|
||||
- umoven-illptr$(EXEEXT) umovestr$(EXEEXT) \
|
||||
- umovestr-illptr$(EXEEXT) umovestr2$(EXEEXT) umovestr3$(EXEEXT) \
|
||||
- umovestr_cached$(EXEEXT) umovestr_cached_adjacent$(EXEEXT) \
|
||||
- uname$(EXEEXT) unlink$(EXEEXT) unlinkat$(EXEEXT) \
|
||||
- unshare$(EXEEXT) userfaultfd$(EXEEXT) ustat$(EXEEXT) \
|
||||
- utime$(EXEEXT) utimensat$(EXEEXT) utimensat-Xabbrev$(EXEEXT) \
|
||||
+ tkill$(EXEEXT) truncate$(EXEEXT) truncate64$(EXEEXT) \
|
||||
+ ugetrlimit$(EXEEXT) uio$(EXEEXT) umask$(EXEEXT) \
|
||||
+ umount$(EXEEXT) umount2$(EXEEXT) umoven-illptr$(EXEEXT) \
|
||||
+ umovestr$(EXEEXT) umovestr-illptr$(EXEEXT) umovestr2$(EXEEXT) \
|
||||
+ umovestr3$(EXEEXT) umovestr_cached$(EXEEXT) \
|
||||
+ umovestr_cached_adjacent$(EXEEXT) uname$(EXEEXT) \
|
||||
+ unlink$(EXEEXT) unlinkat$(EXEEXT) unshare$(EXEEXT) \
|
||||
+ userfaultfd$(EXEEXT) ustat$(EXEEXT) utime$(EXEEXT) \
|
||||
+ utimensat$(EXEEXT) utimensat-Xabbrev$(EXEEXT) \
|
||||
utimensat-Xraw$(EXEEXT) utimensat-Xverbose$(EXEEXT) \
|
||||
utimes$(EXEEXT) vhangup$(EXEEXT) vmsplice$(EXEEXT) \
|
||||
wait4$(EXEEXT) waitid$(EXEEXT) waitpid$(EXEEXT) xattr$(EXEEXT) \
|
||||
@@ -3484,6 +3485,10 @@
|
||||
times_fail_OBJECTS = times-fail.$(OBJEXT)
|
||||
times_fail_LDADD = $(LDADD)
|
||||
times_fail_DEPENDENCIES = libtests.a
|
||||
+tkill_SOURCES = tkill.c
|
||||
+tkill_OBJECTS = tkill.$(OBJEXT)
|
||||
+tkill_LDADD = $(LDADD)
|
||||
+tkill_DEPENDENCIES = libtests.a
|
||||
tracer_ppid_pgid_sid_SOURCES = tracer_ppid_pgid_sid.c
|
||||
tracer_ppid_pgid_sid_OBJECTS = tracer_ppid_pgid_sid.$(OBJEXT)
|
||||
tracer_ppid_pgid_sid_LDADD = $(LDADD)
|
||||
@@ -4184,7 +4189,7 @@
|
||||
./$(DEPDIR)/threads-execve.Po ./$(DEPDIR)/time.Po \
|
||||
./$(DEPDIR)/timer_create.Po ./$(DEPDIR)/timer_xettime.Po \
|
||||
./$(DEPDIR)/timerfd_xettime.Po ./$(DEPDIR)/times-fail.Po \
|
||||
- ./$(DEPDIR)/times.Po ./$(DEPDIR)/tracer_ppid_pgid_sid.Po \
|
||||
+ ./$(DEPDIR)/times.Po ./$(DEPDIR)/tkill.Po ./$(DEPDIR)/tracer_ppid_pgid_sid.Po \
|
||||
./$(DEPDIR)/truncate.Po ./$(DEPDIR)/truncate64-truncate64.Po \
|
||||
./$(DEPDIR)/ugetrlimit.Po ./$(DEPDIR)/uio-uio.Po \
|
||||
./$(DEPDIR)/umask.Po ./$(DEPDIR)/umount.Po \
|
||||
@@ -4441,7 +4446,7 @@
|
||||
syslog-success.c tee.c threads-execve.c \
|
||||
threads-execve--quiet-thread-execve.c threads-execve-q.c \
|
||||
threads-execve-qq.c threads-execve-qqq.c time.c timer_create.c \
|
||||
- timer_xettime.c timerfd_xettime.c times.c times-fail.c \
|
||||
+ timer_xettime.c timerfd_xettime.c times.c times-fail.c tkill.c \
|
||||
tracer_ppid_pgid_sid.c truncate.c truncate64.c ugetrlimit.c \
|
||||
uio.c umask.c umount.c umount2.c umoven-illptr.c umovestr.c \
|
||||
umovestr-illptr.c umovestr2.c umovestr3.c umovestr_cached.c \
|
||||
@@ -4667,7 +4672,7 @@
|
||||
syslog-success.c tee.c threads-execve.c \
|
||||
threads-execve--quiet-thread-execve.c threads-execve-q.c \
|
||||
threads-execve-qq.c threads-execve-qqq.c time.c timer_create.c \
|
||||
- timer_xettime.c timerfd_xettime.c times.c times-fail.c \
|
||||
+ timer_xettime.c timerfd_xettime.c times.c times-fail.c tkill.c \
|
||||
tracer_ppid_pgid_sid.c truncate.c truncate64.c ugetrlimit.c \
|
||||
uio.c umask.c umount.c umount2.c umoven-illptr.c umovestr.c \
|
||||
umovestr-illptr.c umovestr2.c umovestr3.c umovestr_cached.c \
|
||||
@@ -5725,6 +5730,7 @@
|
||||
timerfd_xettime \
|
||||
times \
|
||||
times-fail \
|
||||
+ tkill \
|
||||
truncate \
|
||||
truncate64 \
|
||||
ugetrlimit \
|
||||
@@ -6133,9 +6139,10 @@
|
||||
threads-execve-qqq.gen.test time.gen.test \
|
||||
timer_create.gen.test timer_xettime.gen.test \
|
||||
timerfd_xettime.gen.test times.gen.test times-fail.gen.test \
|
||||
- trace_clock.gen.test trace_creds.gen.test trace_fstat.gen.test \
|
||||
- trace_fstatfs.gen.test trace_lstat.gen.test \
|
||||
- trace_personality_32.gen.test trace_personality_64.gen.test \
|
||||
+ tkill.gen.test trace_clock.gen.test trace_creds.gen.test \
|
||||
+ trace_fstat.gen.test trace_fstatfs.gen.test \
|
||||
+ trace_lstat.gen.test trace_personality_32.gen.test \
|
||||
+ trace_personality_64.gen.test \
|
||||
trace_personality_regex_32.gen.test \
|
||||
trace_personality_regex_64.gen.test \
|
||||
trace_personality_regex_x32.gen.test \
|
||||
@@ -9392,6 +9399,10 @@
|
||||
@rm -f times-fail$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(times_fail_OBJECTS) $(times_fail_LDADD) $(LIBS)
|
||||
|
||||
+tkill$(EXEEXT): $(tkill_OBJECTS) $(tkill_DEPENDENCIES) $(EXTRA_tkill_DEPENDENCIES)
|
||||
+ @rm -f tkill$(EXEEXT)
|
||||
+ $(AM_V_CCLD)$(LINK) $(tkill_OBJECTS) $(tkill_LDADD) $(LIBS)
|
||||
+
|
||||
tracer_ppid_pgid_sid$(EXEEXT): $(tracer_ppid_pgid_sid_OBJECTS) $(tracer_ppid_pgid_sid_DEPENDENCIES) $(EXTRA_tracer_ppid_pgid_sid_DEPENDENCIES)
|
||||
@rm -f tracer_ppid_pgid_sid$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(tracer_ppid_pgid_sid_OBJECTS) $(tracer_ppid_pgid_sid_LDADD) $(LIBS)
|
||||
@@ -10349,6 +10360,7 @@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timerfd_xettime.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/times-fail.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/times.Po@am__quote@ # am--include-marker
|
||||
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tkill.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tracer_ppid_pgid_sid.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/truncate.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/truncate64-truncate64.Po@am__quote@ # am--include-marker
|
||||
@@ -12169,6 +12181,7 @@
|
||||
-rm -f ./$(DEPDIR)/timerfd_xettime.Po
|
||||
-rm -f ./$(DEPDIR)/times-fail.Po
|
||||
-rm -f ./$(DEPDIR)/times.Po
|
||||
+ -rm -f ./$(DEPDIR)/tkill.Po
|
||||
-rm -f ./$(DEPDIR)/tracer_ppid_pgid_sid.Po
|
||||
-rm -f ./$(DEPDIR)/truncate.Po
|
||||
-rm -f ./$(DEPDIR)/truncate64-truncate64.Po
|
||||
@@ -13024,6 +13037,7 @@
|
||||
-rm -f ./$(DEPDIR)/timerfd_xettime.Po
|
||||
-rm -f ./$(DEPDIR)/times-fail.Po
|
||||
-rm -f ./$(DEPDIR)/times.Po
|
||||
+ -rm -f ./$(DEPDIR)/tkill.Po
|
||||
-rm -f ./$(DEPDIR)/tracer_ppid_pgid_sid.Po
|
||||
-rm -f ./$(DEPDIR)/truncate.Po
|
||||
-rm -f ./$(DEPDIR)/truncate64-truncate64.Po
|
||||
@@ -15101,6 +15115,9 @@
|
||||
$(srcdir)/times-fail.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
|
||||
$(AM_V_GEN) $^ $@
|
||||
|
||||
+$(srcdir)/tkill.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
|
||||
+ $(AM_V_GEN) $^ $@
|
||||
+
|
||||
$(srcdir)/trace_clock.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
|
||||
$(AM_V_GEN) $^ $@
|
||||
|
@ -1,656 +0,0 @@
|
||||
From 9d4d64f6fdfcae908aec455888e92a69c9c81c64 Mon Sep 17 00:00:00 2001
|
||||
From: "Dmitry V. Levin" <ldv@altlinux.org>
|
||||
Date: Sat, 1 Aug 2020 08:00:00 +0000
|
||||
Subject: [PATCH 133/138] tests: check decoding of tgkill syscall
|
||||
|
||||
* tests/tgkill.c: New file.
|
||||
* tests/gen_tests.in (tgkill): New entry.
|
||||
* tests/pure_executables.list: Add tgkill.
|
||||
* tests/.gitignore: Likewise.
|
||||
---
|
||||
tests/.gitignore | 1 +
|
||||
tests/gen_tests.in | 1 +
|
||||
tests/pure_executables.list | 1 +
|
||||
tests/tgkill.c | 69 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
4 files changed, 72 insertions(+)
|
||||
create mode 100644 tests/tgkill.c
|
||||
|
||||
Index: strace-5.7/tests/gen_tests.in
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/gen_tests.in 2020-09-09 19:30:36.780885588 +0200
|
||||
+++ strace-5.7/tests/gen_tests.in 2020-09-09 19:32:50.740965435 +0200
|
||||
@@ -658,6 +658,7 @@
|
||||
sysinfo -a14
|
||||
syslog -a35
|
||||
tee
|
||||
+tgkill -a15 --signal='!cont'
|
||||
threads-execve--quiet-thread-execve +threads-execve.test -s40 --quiet=personality,thread-execve
|
||||
threads-execve-q +threads-execve.test -q
|
||||
threads-execve-qq +threads-execve.test -qq
|
||||
Index: strace-5.7/tests/pure_executables.list
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/pure_executables.list 2020-09-09 19:30:36.780885588 +0200
|
||||
+++ strace-5.7/tests/pure_executables.list 2020-09-09 19:32:45.308962197 +0200
|
||||
@@ -583,6 +583,7 @@
|
||||
sysinfo
|
||||
syslog
|
||||
tee
|
||||
+tgkill
|
||||
time
|
||||
timer_create
|
||||
timer_xettime
|
||||
Index: strace-5.7/tests/tgkill.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ strace-5.7/tests/tgkill.c 2020-09-09 19:32:50.740965435 +0200
|
||||
@@ -0,0 +1,69 @@
|
||||
+/*
|
||||
+ * Check decoding of tgkill syscall.
|
||||
+ *
|
||||
+ * Copyright (c) 2020 Dmitry V. Levin <ldv@altlinux.org>
|
||||
+ * All rights reserved.
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: GPL-2.0-or-later
|
||||
+ */
|
||||
+
|
||||
+#include "tests.h"
|
||||
+#include "scno.h"
|
||||
+
|
||||
+#ifdef __NR_tgkill
|
||||
+
|
||||
+# include <signal.h>
|
||||
+# include <stdio.h>
|
||||
+# include <unistd.h>
|
||||
+
|
||||
+static const char *errstr;
|
||||
+
|
||||
+static long
|
||||
+k_tgkill(const unsigned int tgid,
|
||||
+ const unsigned int tid,
|
||||
+ const unsigned int sig)
|
||||
+{
|
||||
+ const kernel_ulong_t fill = (kernel_ulong_t) 0xdefaced00000000ULL;
|
||||
+ const kernel_ulong_t bad = (kernel_ulong_t) 0xbadc0dedbadc0dedULL;
|
||||
+ const kernel_ulong_t arg1 = fill | tgid;
|
||||
+ const kernel_ulong_t arg2 = fill | tid;
|
||||
+ const kernel_ulong_t arg3 = fill | sig;
|
||||
+ const long rc = syscall(__NR_tgkill, arg1, arg2, arg3, bad, bad, bad);
|
||||
+ errstr = sprintrc(rc);
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main(void)
|
||||
+{
|
||||
+ const int pid = getpid();
|
||||
+ const int bad_pid = -1;
|
||||
+ const int bad_sig = 0xface;
|
||||
+
|
||||
+ k_tgkill(pid, pid, 0);
|
||||
+ printf("tgkill(%d, %d, 0) = %s\n", pid, pid, errstr);
|
||||
+
|
||||
+ k_tgkill(pid, bad_pid, 0);
|
||||
+ printf("tgkill(%d, %d, 0) = %s\n", pid, bad_pid, errstr);
|
||||
+
|
||||
+ k_tgkill(bad_pid, pid, 0);
|
||||
+ printf("tgkill(%d, %d, 0) = %s\n", bad_pid, pid, errstr);
|
||||
+
|
||||
+ k_tgkill(pid, pid, SIGCONT);
|
||||
+ printf("tgkill(%d, %d, SIGCONT) = %s\n", pid, pid, errstr);
|
||||
+
|
||||
+ k_tgkill(pid, pid, bad_sig);
|
||||
+ printf("tgkill(%d, %d, %d) = %s\n", pid, pid, bad_sig, errstr);
|
||||
+
|
||||
+ k_tgkill(pid, pid, -bad_sig);
|
||||
+ printf("tgkill(%d, %d, %d) = %s\n", pid, pid, -bad_sig, errstr);
|
||||
+
|
||||
+ puts("+++ exited with 0 +++");
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#else
|
||||
+
|
||||
+SKIP_MAIN_UNDEFINED("__NR_tgkill")
|
||||
+
|
||||
+#endif
|
||||
Index: strace-5.7/tests-m32/gen_tests.in
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/gen_tests.in 2020-09-09 19:30:36.780885588 +0200
|
||||
+++ strace-5.7/tests-m32/gen_tests.in 2020-09-09 19:32:50.740965435 +0200
|
||||
@@ -658,6 +658,7 @@
|
||||
sysinfo -a14
|
||||
syslog -a35
|
||||
tee
|
||||
+tgkill -a15 --signal='!cont'
|
||||
threads-execve--quiet-thread-execve +threads-execve.test -s40 --quiet=personality,thread-execve
|
||||
threads-execve-q +threads-execve.test -q
|
||||
threads-execve-qq +threads-execve.test -qq
|
||||
Index: strace-5.7/tests-m32/pure_executables.list
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/pure_executables.list 2020-09-09 19:30:36.780885588 +0200
|
||||
+++ strace-5.7/tests-m32/pure_executables.list 2020-09-09 19:32:45.309962197 +0200
|
||||
@@ -583,6 +583,7 @@
|
||||
sysinfo
|
||||
syslog
|
||||
tee
|
||||
+tgkill
|
||||
time
|
||||
timer_create
|
||||
timer_xettime
|
||||
Index: strace-5.7/tests-m32/tgkill.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ strace-5.7/tests-m32/tgkill.c 2020-09-09 19:32:50.740965435 +0200
|
||||
@@ -0,0 +1,69 @@
|
||||
+/*
|
||||
+ * Check decoding of tgkill syscall.
|
||||
+ *
|
||||
+ * Copyright (c) 2020 Dmitry V. Levin <ldv@altlinux.org>
|
||||
+ * All rights reserved.
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: GPL-2.0-or-later
|
||||
+ */
|
||||
+
|
||||
+#include "tests.h"
|
||||
+#include "scno.h"
|
||||
+
|
||||
+#ifdef __NR_tgkill
|
||||
+
|
||||
+# include <signal.h>
|
||||
+# include <stdio.h>
|
||||
+# include <unistd.h>
|
||||
+
|
||||
+static const char *errstr;
|
||||
+
|
||||
+static long
|
||||
+k_tgkill(const unsigned int tgid,
|
||||
+ const unsigned int tid,
|
||||
+ const unsigned int sig)
|
||||
+{
|
||||
+ const kernel_ulong_t fill = (kernel_ulong_t) 0xdefaced00000000ULL;
|
||||
+ const kernel_ulong_t bad = (kernel_ulong_t) 0xbadc0dedbadc0dedULL;
|
||||
+ const kernel_ulong_t arg1 = fill | tgid;
|
||||
+ const kernel_ulong_t arg2 = fill | tid;
|
||||
+ const kernel_ulong_t arg3 = fill | sig;
|
||||
+ const long rc = syscall(__NR_tgkill, arg1, arg2, arg3, bad, bad, bad);
|
||||
+ errstr = sprintrc(rc);
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main(void)
|
||||
+{
|
||||
+ const int pid = getpid();
|
||||
+ const int bad_pid = -1;
|
||||
+ const int bad_sig = 0xface;
|
||||
+
|
||||
+ k_tgkill(pid, pid, 0);
|
||||
+ printf("tgkill(%d, %d, 0) = %s\n", pid, pid, errstr);
|
||||
+
|
||||
+ k_tgkill(pid, bad_pid, 0);
|
||||
+ printf("tgkill(%d, %d, 0) = %s\n", pid, bad_pid, errstr);
|
||||
+
|
||||
+ k_tgkill(bad_pid, pid, 0);
|
||||
+ printf("tgkill(%d, %d, 0) = %s\n", bad_pid, pid, errstr);
|
||||
+
|
||||
+ k_tgkill(pid, pid, SIGCONT);
|
||||
+ printf("tgkill(%d, %d, SIGCONT) = %s\n", pid, pid, errstr);
|
||||
+
|
||||
+ k_tgkill(pid, pid, bad_sig);
|
||||
+ printf("tgkill(%d, %d, %d) = %s\n", pid, pid, bad_sig, errstr);
|
||||
+
|
||||
+ k_tgkill(pid, pid, -bad_sig);
|
||||
+ printf("tgkill(%d, %d, %d) = %s\n", pid, pid, -bad_sig, errstr);
|
||||
+
|
||||
+ puts("+++ exited with 0 +++");
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#else
|
||||
+
|
||||
+SKIP_MAIN_UNDEFINED("__NR_tgkill")
|
||||
+
|
||||
+#endif
|
||||
Index: strace-5.7/tests-mx32/gen_tests.in
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/gen_tests.in 2020-09-09 19:30:36.780885588 +0200
|
||||
+++ strace-5.7/tests-mx32/gen_tests.in 2020-09-09 19:32:50.740965435 +0200
|
||||
@@ -658,6 +658,7 @@
|
||||
sysinfo -a14
|
||||
syslog -a35
|
||||
tee
|
||||
+tgkill -a15 --signal='!cont'
|
||||
threads-execve--quiet-thread-execve +threads-execve.test -s40 --quiet=personality,thread-execve
|
||||
threads-execve-q +threads-execve.test -q
|
||||
threads-execve-qq +threads-execve.test -qq
|
||||
Index: strace-5.7/tests-mx32/pure_executables.list
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/pure_executables.list 2020-09-09 19:30:36.780885588 +0200
|
||||
+++ strace-5.7/tests-mx32/pure_executables.list 2020-09-09 19:32:45.310962198 +0200
|
||||
@@ -583,6 +583,7 @@
|
||||
sysinfo
|
||||
syslog
|
||||
tee
|
||||
+tgkill
|
||||
time
|
||||
timer_create
|
||||
timer_xettime
|
||||
Index: strace-5.7/tests-mx32/tgkill.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ strace-5.7/tests-mx32/tgkill.c 2020-09-09 19:32:50.740965435 +0200
|
||||
@@ -0,0 +1,69 @@
|
||||
+/*
|
||||
+ * Check decoding of tgkill syscall.
|
||||
+ *
|
||||
+ * Copyright (c) 2020 Dmitry V. Levin <ldv@altlinux.org>
|
||||
+ * All rights reserved.
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: GPL-2.0-or-later
|
||||
+ */
|
||||
+
|
||||
+#include "tests.h"
|
||||
+#include "scno.h"
|
||||
+
|
||||
+#ifdef __NR_tgkill
|
||||
+
|
||||
+# include <signal.h>
|
||||
+# include <stdio.h>
|
||||
+# include <unistd.h>
|
||||
+
|
||||
+static const char *errstr;
|
||||
+
|
||||
+static long
|
||||
+k_tgkill(const unsigned int tgid,
|
||||
+ const unsigned int tid,
|
||||
+ const unsigned int sig)
|
||||
+{
|
||||
+ const kernel_ulong_t fill = (kernel_ulong_t) 0xdefaced00000000ULL;
|
||||
+ const kernel_ulong_t bad = (kernel_ulong_t) 0xbadc0dedbadc0dedULL;
|
||||
+ const kernel_ulong_t arg1 = fill | tgid;
|
||||
+ const kernel_ulong_t arg2 = fill | tid;
|
||||
+ const kernel_ulong_t arg3 = fill | sig;
|
||||
+ const long rc = syscall(__NR_tgkill, arg1, arg2, arg3, bad, bad, bad);
|
||||
+ errstr = sprintrc(rc);
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main(void)
|
||||
+{
|
||||
+ const int pid = getpid();
|
||||
+ const int bad_pid = -1;
|
||||
+ const int bad_sig = 0xface;
|
||||
+
|
||||
+ k_tgkill(pid, pid, 0);
|
||||
+ printf("tgkill(%d, %d, 0) = %s\n", pid, pid, errstr);
|
||||
+
|
||||
+ k_tgkill(pid, bad_pid, 0);
|
||||
+ printf("tgkill(%d, %d, 0) = %s\n", pid, bad_pid, errstr);
|
||||
+
|
||||
+ k_tgkill(bad_pid, pid, 0);
|
||||
+ printf("tgkill(%d, %d, 0) = %s\n", bad_pid, pid, errstr);
|
||||
+
|
||||
+ k_tgkill(pid, pid, SIGCONT);
|
||||
+ printf("tgkill(%d, %d, SIGCONT) = %s\n", pid, pid, errstr);
|
||||
+
|
||||
+ k_tgkill(pid, pid, bad_sig);
|
||||
+ printf("tgkill(%d, %d, %d) = %s\n", pid, pid, bad_sig, errstr);
|
||||
+
|
||||
+ k_tgkill(pid, pid, -bad_sig);
|
||||
+ printf("tgkill(%d, %d, %d) = %s\n", pid, pid, -bad_sig, errstr);
|
||||
+
|
||||
+ puts("+++ exited with 0 +++");
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#else
|
||||
+
|
||||
+SKIP_MAIN_UNDEFINED("__NR_tgkill")
|
||||
+
|
||||
+#endif
|
||||
Index: strace-5.7/tests-m32/Makefile.in
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-m32/Makefile.in 2020-09-09 19:32:14.800944013 +0200
|
||||
+++ strace-5.7/tests-m32/Makefile.in 2020-09-09 19:49:34.530563739 +0200
|
||||
@@ -493,8 +493,8 @@
|
||||
strace-xx$(EXEEXT) swap$(EXEEXT) sxetmask$(EXEEXT) \
|
||||
symlink$(EXEEXT) symlinkat$(EXEEXT) sync$(EXEEXT) \
|
||||
sync_file_range$(EXEEXT) sync_file_range2$(EXEEXT) \
|
||||
- sysinfo$(EXEEXT) syslog$(EXEEXT) tee$(EXEEXT) time$(EXEEXT) \
|
||||
- timer_create$(EXEEXT) timer_xettime$(EXEEXT) \
|
||||
+ sysinfo$(EXEEXT) syslog$(EXEEXT) tee$(EXEEXT) tgkill$(EXEEXT) \
|
||||
+ time$(EXEEXT) timer_create$(EXEEXT) timer_xettime$(EXEEXT) \
|
||||
timerfd_xettime$(EXEEXT) times$(EXEEXT) times-fail$(EXEEXT) \
|
||||
tkill$(EXEEXT) truncate$(EXEEXT) truncate64$(EXEEXT) \
|
||||
ugetrlimit$(EXEEXT) uio$(EXEEXT) umask$(EXEEXT) \
|
||||
@@ -3444,6 +3444,10 @@
|
||||
tee_OBJECTS = tee.$(OBJEXT)
|
||||
tee_LDADD = $(LDADD)
|
||||
tee_DEPENDENCIES = libtests.a
|
||||
+tgkill_SOURCES = tgkill.c
|
||||
+tgkill_OBJECTS = tgkill.$(OBJEXT)
|
||||
+tgkill_LDADD = $(LDADD)
|
||||
+tgkill_DEPENDENCIES = libtests.a
|
||||
threads_execve_SOURCES = threads-execve.c
|
||||
threads_execve_OBJECTS = threads-execve.$(OBJEXT)
|
||||
threads_execve_DEPENDENCIES = $(am__DEPENDENCIES_1) $(LDADD)
|
||||
@@ -4181,7 +4185,7 @@
|
||||
./$(DEPDIR)/symlinkat.Po ./$(DEPDIR)/sync.Po \
|
||||
./$(DEPDIR)/sync_file_range.Po ./$(DEPDIR)/sync_file_range2.Po \
|
||||
./$(DEPDIR)/sysinfo.Po ./$(DEPDIR)/syslog-success.Po \
|
||||
- ./$(DEPDIR)/syslog.Po ./$(DEPDIR)/tee.Po \
|
||||
+ ./$(DEPDIR)/syslog.Po ./$(DEPDIR)/tee.Po ./$(DEPDIR)/tgkill.Po \
|
||||
./$(DEPDIR)/threads-execve--quiet-thread-execve.Po \
|
||||
./$(DEPDIR)/threads-execve-q.Po \
|
||||
./$(DEPDIR)/threads-execve-qq.Po \
|
||||
@@ -4443,7 +4447,7 @@
|
||||
strace--strings-in-hex-non-ascii.c strace-x.c strace-xx.c \
|
||||
swap.c sxetmask.c symlink.c symlinkat.c sync.c \
|
||||
sync_file_range.c sync_file_range2.c sysinfo.c syslog.c \
|
||||
- syslog-success.c tee.c threads-execve.c \
|
||||
+ syslog-success.c tee.c tgkill.c threads-execve.c \
|
||||
threads-execve--quiet-thread-execve.c threads-execve-q.c \
|
||||
threads-execve-qq.c threads-execve-qqq.c time.c timer_create.c \
|
||||
timer_xettime.c timerfd_xettime.c times.c times-fail.c tkill.c \
|
||||
@@ -4669,7 +4673,7 @@
|
||||
strace--strings-in-hex-non-ascii.c strace-x.c strace-xx.c \
|
||||
swap.c sxetmask.c symlink.c symlinkat.c sync.c \
|
||||
sync_file_range.c sync_file_range2.c sysinfo.c syslog.c \
|
||||
- syslog-success.c tee.c threads-execve.c \
|
||||
+ syslog-success.c tee.c tgkill.c threads-execve.c \
|
||||
threads-execve--quiet-thread-execve.c threads-execve-q.c \
|
||||
threads-execve-qq.c threads-execve-qqq.c time.c timer_create.c \
|
||||
timer_xettime.c timerfd_xettime.c times.c times-fail.c tkill.c \
|
||||
@@ -5724,6 +5728,7 @@
|
||||
sysinfo \
|
||||
syslog \
|
||||
tee \
|
||||
+ tgkill \
|
||||
time \
|
||||
timer_create \
|
||||
timer_xettime \
|
||||
@@ -6133,7 +6138,7 @@
|
||||
strace-xx.gen.test swap.gen.test sxetmask.gen.test \
|
||||
symlink.gen.test symlinkat.gen.test sync.gen.test \
|
||||
sync_file_range.gen.test sync_file_range2.gen.test \
|
||||
- sysinfo.gen.test syslog.gen.test tee.gen.test \
|
||||
+ sysinfo.gen.test syslog.gen.test tee.gen.test tgkill.gen.test \
|
||||
threads-execve--quiet-thread-execve.gen.test \
|
||||
threads-execve-q.gen.test threads-execve-qq.gen.test \
|
||||
threads-execve-qqq.gen.test time.gen.test \
|
||||
@@ -9355,6 +9360,10 @@
|
||||
@rm -f tee$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(tee_OBJECTS) $(tee_LDADD) $(LIBS)
|
||||
|
||||
+tgkill$(EXEEXT): $(tgkill_OBJECTS) $(tgkill_DEPENDENCIES) $(EXTRA_tgkill_DEPENDENCIES)
|
||||
+ @rm -f tgkill$(EXEEXT)
|
||||
+ $(AM_V_CCLD)$(LINK) $(tgkill_OBJECTS) $(tgkill_LDADD) $(LIBS)
|
||||
+
|
||||
threads-execve$(EXEEXT): $(threads_execve_OBJECTS) $(threads_execve_DEPENDENCIES) $(EXTRA_threads_execve_DEPENDENCIES)
|
||||
@rm -f threads-execve$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(threads_execve_OBJECTS) $(threads_execve_LDADD) $(LIBS)
|
||||
@@ -10349,6 +10358,7 @@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syslog-success.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syslog.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tee.Po@am__quote@ # am--include-marker
|
||||
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tgkill.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/threads-execve--quiet-thread-execve.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/threads-execve-q.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/threads-execve-qq.Po@am__quote@ # am--include-marker
|
||||
@@ -12170,6 +12180,7 @@
|
||||
-rm -f ./$(DEPDIR)/syslog-success.Po
|
||||
-rm -f ./$(DEPDIR)/syslog.Po
|
||||
-rm -f ./$(DEPDIR)/tee.Po
|
||||
+ -rm -f ./$(DEPDIR)/tgkill.Po
|
||||
-rm -f ./$(DEPDIR)/threads-execve--quiet-thread-execve.Po
|
||||
-rm -f ./$(DEPDIR)/threads-execve-q.Po
|
||||
-rm -f ./$(DEPDIR)/threads-execve-qq.Po
|
||||
@@ -13026,6 +13037,7 @@
|
||||
-rm -f ./$(DEPDIR)/syslog-success.Po
|
||||
-rm -f ./$(DEPDIR)/syslog.Po
|
||||
-rm -f ./$(DEPDIR)/tee.Po
|
||||
+ -rm -f ./$(DEPDIR)/tgkill.Po
|
||||
-rm -f ./$(DEPDIR)/threads-execve--quiet-thread-execve.Po
|
||||
-rm -f ./$(DEPDIR)/threads-execve-q.Po
|
||||
-rm -f ./$(DEPDIR)/threads-execve-qq.Po
|
||||
@@ -15085,6 +15097,9 @@
|
||||
$(srcdir)/tee.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
|
||||
$(AM_V_GEN) $^ $@
|
||||
|
||||
+$(srcdir)/tgkill.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
|
||||
+ $(AM_V_GEN) $^ $@
|
||||
+
|
||||
$(srcdir)/threads-execve--quiet-thread-execve.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
|
||||
$(AM_V_GEN) $^ $@
|
||||
|
||||
Index: strace-5.7/tests-mx32/Makefile.in
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests-mx32/Makefile.in 2020-09-09 19:32:39.854958946 +0200
|
||||
+++ strace-5.7/tests-mx32/Makefile.in 2020-09-09 19:49:39.557566736 +0200
|
||||
@@ -493,8 +493,8 @@
|
||||
strace-xx$(EXEEXT) swap$(EXEEXT) sxetmask$(EXEEXT) \
|
||||
symlink$(EXEEXT) symlinkat$(EXEEXT) sync$(EXEEXT) \
|
||||
sync_file_range$(EXEEXT) sync_file_range2$(EXEEXT) \
|
||||
- sysinfo$(EXEEXT) syslog$(EXEEXT) tee$(EXEEXT) time$(EXEEXT) \
|
||||
- timer_create$(EXEEXT) timer_xettime$(EXEEXT) \
|
||||
+ sysinfo$(EXEEXT) syslog$(EXEEXT) tee$(EXEEXT) tgkill$(EXEEXT) \
|
||||
+ time$(EXEEXT) timer_create$(EXEEXT) timer_xettime$(EXEEXT) \
|
||||
timerfd_xettime$(EXEEXT) times$(EXEEXT) times-fail$(EXEEXT) \
|
||||
tkill$(EXEEXT) truncate$(EXEEXT) truncate64$(EXEEXT) \
|
||||
ugetrlimit$(EXEEXT) uio$(EXEEXT) umask$(EXEEXT) \
|
||||
@@ -3444,6 +3444,10 @@
|
||||
tee_OBJECTS = tee.$(OBJEXT)
|
||||
tee_LDADD = $(LDADD)
|
||||
tee_DEPENDENCIES = libtests.a
|
||||
+tgkill_SOURCES = tgkill.c
|
||||
+tgkill_OBJECTS = tgkill.$(OBJEXT)
|
||||
+tgkill_LDADD = $(LDADD)
|
||||
+tgkill_DEPENDENCIES = libtests.a
|
||||
threads_execve_SOURCES = threads-execve.c
|
||||
threads_execve_OBJECTS = threads-execve.$(OBJEXT)
|
||||
threads_execve_DEPENDENCIES = $(am__DEPENDENCIES_1) $(LDADD)
|
||||
@@ -4181,7 +4185,7 @@
|
||||
./$(DEPDIR)/symlinkat.Po ./$(DEPDIR)/sync.Po \
|
||||
./$(DEPDIR)/sync_file_range.Po ./$(DEPDIR)/sync_file_range2.Po \
|
||||
./$(DEPDIR)/sysinfo.Po ./$(DEPDIR)/syslog-success.Po \
|
||||
- ./$(DEPDIR)/syslog.Po ./$(DEPDIR)/tee.Po \
|
||||
+ ./$(DEPDIR)/syslog.Po ./$(DEPDIR)/tee.Po ./$(DEPDIR)/tgkill.Po \
|
||||
./$(DEPDIR)/threads-execve--quiet-thread-execve.Po \
|
||||
./$(DEPDIR)/threads-execve-q.Po \
|
||||
./$(DEPDIR)/threads-execve-qq.Po \
|
||||
@@ -4443,7 +4447,7 @@
|
||||
strace--strings-in-hex-non-ascii.c strace-x.c strace-xx.c \
|
||||
swap.c sxetmask.c symlink.c symlinkat.c sync.c \
|
||||
sync_file_range.c sync_file_range2.c sysinfo.c syslog.c \
|
||||
- syslog-success.c tee.c threads-execve.c \
|
||||
+ syslog-success.c tee.c tgkill.c threads-execve.c \
|
||||
threads-execve--quiet-thread-execve.c threads-execve-q.c \
|
||||
threads-execve-qq.c threads-execve-qqq.c time.c timer_create.c \
|
||||
timer_xettime.c timerfd_xettime.c times.c times-fail.c tkill.c \
|
||||
@@ -4669,7 +4673,7 @@
|
||||
strace--strings-in-hex-non-ascii.c strace-x.c strace-xx.c \
|
||||
swap.c sxetmask.c symlink.c symlinkat.c sync.c \
|
||||
sync_file_range.c sync_file_range2.c sysinfo.c syslog.c \
|
||||
- syslog-success.c tee.c threads-execve.c \
|
||||
+ syslog-success.c tee.c tgkill.c threads-execve.c \
|
||||
threads-execve--quiet-thread-execve.c threads-execve-q.c \
|
||||
threads-execve-qq.c threads-execve-qqq.c time.c timer_create.c \
|
||||
timer_xettime.c timerfd_xettime.c times.c times-fail.c tkill.c \
|
||||
@@ -5724,6 +5728,7 @@
|
||||
sysinfo \
|
||||
syslog \
|
||||
tee \
|
||||
+ tgkill \
|
||||
time \
|
||||
timer_create \
|
||||
timer_xettime \
|
||||
@@ -6133,7 +6138,7 @@
|
||||
strace-xx.gen.test swap.gen.test sxetmask.gen.test \
|
||||
symlink.gen.test symlinkat.gen.test sync.gen.test \
|
||||
sync_file_range.gen.test sync_file_range2.gen.test \
|
||||
- sysinfo.gen.test syslog.gen.test tee.gen.test \
|
||||
+ sysinfo.gen.test syslog.gen.test tee.gen.test tgkill.gen.test \
|
||||
threads-execve--quiet-thread-execve.gen.test \
|
||||
threads-execve-q.gen.test threads-execve-qq.gen.test \
|
||||
threads-execve-qqq.gen.test time.gen.test \
|
||||
@@ -9355,6 +9360,10 @@
|
||||
@rm -f tee$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(tee_OBJECTS) $(tee_LDADD) $(LIBS)
|
||||
|
||||
+tgkill$(EXEEXT): $(tgkill_OBJECTS) $(tgkill_DEPENDENCIES) $(EXTRA_tgkill_DEPENDENCIES)
|
||||
+ @rm -f tgkill$(EXEEXT)
|
||||
+ $(AM_V_CCLD)$(LINK) $(tgkill_OBJECTS) $(tgkill_LDADD) $(LIBS)
|
||||
+
|
||||
threads-execve$(EXEEXT): $(threads_execve_OBJECTS) $(threads_execve_DEPENDENCIES) $(EXTRA_threads_execve_DEPENDENCIES)
|
||||
@rm -f threads-execve$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(threads_execve_OBJECTS) $(threads_execve_LDADD) $(LIBS)
|
||||
@@ -10349,6 +10358,7 @@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syslog-success.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syslog.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tee.Po@am__quote@ # am--include-marker
|
||||
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tgkill.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/threads-execve--quiet-thread-execve.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/threads-execve-q.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/threads-execve-qq.Po@am__quote@ # am--include-marker
|
||||
@@ -12170,6 +12180,7 @@
|
||||
-rm -f ./$(DEPDIR)/syslog-success.Po
|
||||
-rm -f ./$(DEPDIR)/syslog.Po
|
||||
-rm -f ./$(DEPDIR)/tee.Po
|
||||
+ -rm -f ./$(DEPDIR)/tgkill.Po
|
||||
-rm -f ./$(DEPDIR)/threads-execve--quiet-thread-execve.Po
|
||||
-rm -f ./$(DEPDIR)/threads-execve-q.Po
|
||||
-rm -f ./$(DEPDIR)/threads-execve-qq.Po
|
||||
@@ -13026,6 +13037,7 @@
|
||||
-rm -f ./$(DEPDIR)/syslog-success.Po
|
||||
-rm -f ./$(DEPDIR)/syslog.Po
|
||||
-rm -f ./$(DEPDIR)/tee.Po
|
||||
+ -rm -f ./$(DEPDIR)/tgkill.Po
|
||||
-rm -f ./$(DEPDIR)/threads-execve--quiet-thread-execve.Po
|
||||
-rm -f ./$(DEPDIR)/threads-execve-q.Po
|
||||
-rm -f ./$(DEPDIR)/threads-execve-qq.Po
|
||||
@@ -15085,6 +15097,9 @@
|
||||
$(srcdir)/tee.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
|
||||
$(AM_V_GEN) $^ $@
|
||||
|
||||
+$(srcdir)/tgkill.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
|
||||
+ $(AM_V_GEN) $^ $@
|
||||
+
|
||||
$(srcdir)/threads-execve--quiet-thread-execve.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
|
||||
$(AM_V_GEN) $^ $@
|
||||
|
||||
Index: strace-5.7/tests/Makefile.in
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/Makefile.in 2020-09-09 19:30:36.780885588 +0200
|
||||
+++ strace-5.7/tests/Makefile.in 2020-09-09 19:46:24.904450714 +0200
|
||||
@@ -493,8 +493,8 @@
|
||||
strace-xx$(EXEEXT) swap$(EXEEXT) sxetmask$(EXEEXT) \
|
||||
symlink$(EXEEXT) symlinkat$(EXEEXT) sync$(EXEEXT) \
|
||||
sync_file_range$(EXEEXT) sync_file_range2$(EXEEXT) \
|
||||
- sysinfo$(EXEEXT) syslog$(EXEEXT) tee$(EXEEXT) time$(EXEEXT) \
|
||||
- timer_create$(EXEEXT) timer_xettime$(EXEEXT) \
|
||||
+ sysinfo$(EXEEXT) syslog$(EXEEXT) tee$(EXEEXT) tgkill$(EXEEXT) \
|
||||
+ time$(EXEEXT) timer_create$(EXEEXT) timer_xettime$(EXEEXT) \
|
||||
timerfd_xettime$(EXEEXT) times$(EXEEXT) times-fail$(EXEEXT) \
|
||||
tkill$(EXEEXT) truncate$(EXEEXT) truncate64$(EXEEXT) \
|
||||
ugetrlimit$(EXEEXT) uio$(EXEEXT) umask$(EXEEXT) \
|
||||
@@ -3444,6 +3444,10 @@
|
||||
tee_OBJECTS = tee.$(OBJEXT)
|
||||
tee_LDADD = $(LDADD)
|
||||
tee_DEPENDENCIES = libtests.a
|
||||
+tgkill_SOURCES = tgkill.c
|
||||
+tgkill_OBJECTS = tgkill.$(OBJEXT)
|
||||
+tgkill_LDADD = $(LDADD)
|
||||
+tgkill_DEPENDENCIES = libtests.a
|
||||
threads_execve_SOURCES = threads-execve.c
|
||||
threads_execve_OBJECTS = threads-execve.$(OBJEXT)
|
||||
threads_execve_DEPENDENCIES = $(am__DEPENDENCIES_1) $(LDADD)
|
||||
@@ -4181,7 +4185,7 @@
|
||||
./$(DEPDIR)/symlinkat.Po ./$(DEPDIR)/sync.Po \
|
||||
./$(DEPDIR)/sync_file_range.Po ./$(DEPDIR)/sync_file_range2.Po \
|
||||
./$(DEPDIR)/sysinfo.Po ./$(DEPDIR)/syslog-success.Po \
|
||||
- ./$(DEPDIR)/syslog.Po ./$(DEPDIR)/tee.Po \
|
||||
+ ./$(DEPDIR)/syslog.Po ./$(DEPDIR)/tee.Po ./$(DEPDIR)/tgkill.Po \
|
||||
./$(DEPDIR)/threads-execve--quiet-thread-execve.Po \
|
||||
./$(DEPDIR)/threads-execve-q.Po \
|
||||
./$(DEPDIR)/threads-execve-qq.Po \
|
||||
@@ -4443,7 +4447,7 @@
|
||||
strace--strings-in-hex-non-ascii.c strace-x.c strace-xx.c \
|
||||
swap.c sxetmask.c symlink.c symlinkat.c sync.c \
|
||||
sync_file_range.c sync_file_range2.c sysinfo.c syslog.c \
|
||||
- syslog-success.c tee.c threads-execve.c \
|
||||
+ syslog-success.c tee.c tgkill.c threads-execve.c \
|
||||
threads-execve--quiet-thread-execve.c threads-execve-q.c \
|
||||
threads-execve-qq.c threads-execve-qqq.c time.c timer_create.c \
|
||||
timer_xettime.c timerfd_xettime.c times.c times-fail.c tkill.c \
|
||||
@@ -4669,7 +4673,7 @@
|
||||
strace--strings-in-hex-non-ascii.c strace-x.c strace-xx.c \
|
||||
swap.c sxetmask.c symlink.c symlinkat.c sync.c \
|
||||
sync_file_range.c sync_file_range2.c sysinfo.c syslog.c \
|
||||
- syslog-success.c tee.c threads-execve.c \
|
||||
+ syslog-success.c tee.c tgkill.c threads-execve.c \
|
||||
threads-execve--quiet-thread-execve.c threads-execve-q.c \
|
||||
threads-execve-qq.c threads-execve-qqq.c time.c timer_create.c \
|
||||
timer_xettime.c timerfd_xettime.c times.c times-fail.c tkill.c \
|
||||
@@ -5724,6 +5728,7 @@
|
||||
sysinfo \
|
||||
syslog \
|
||||
tee \
|
||||
+ tgkill \
|
||||
time \
|
||||
timer_create \
|
||||
timer_xettime \
|
||||
@@ -6133,7 +6138,7 @@
|
||||
strace-xx.gen.test swap.gen.test sxetmask.gen.test \
|
||||
symlink.gen.test symlinkat.gen.test sync.gen.test \
|
||||
sync_file_range.gen.test sync_file_range2.gen.test \
|
||||
- sysinfo.gen.test syslog.gen.test tee.gen.test \
|
||||
+ sysinfo.gen.test syslog.gen.test tee.gen.test tgkill.gen.test \
|
||||
threads-execve--quiet-thread-execve.gen.test \
|
||||
threads-execve-q.gen.test threads-execve-qq.gen.test \
|
||||
threads-execve-qqq.gen.test time.gen.test \
|
||||
@@ -9355,6 +9360,10 @@
|
||||
@rm -f tee$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(tee_OBJECTS) $(tee_LDADD) $(LIBS)
|
||||
|
||||
+tgkill$(EXEEXT): $(tgkill_OBJECTS) $(tgkill_DEPENDENCIES) $(EXTRA_tgkill_DEPENDENCIES)
|
||||
+ @rm -f tgkill$(EXEEXT)
|
||||
+ $(AM_V_CCLD)$(LINK) $(tgkill_OBJECTS) $(tgkill_LDADD) $(LIBS)
|
||||
+
|
||||
threads-execve$(EXEEXT): $(threads_execve_OBJECTS) $(threads_execve_DEPENDENCIES) $(EXTRA_threads_execve_DEPENDENCIES)
|
||||
@rm -f threads-execve$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(threads_execve_OBJECTS) $(threads_execve_LDADD) $(LIBS)
|
||||
@@ -10349,6 +10358,7 @@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syslog-success.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syslog.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tee.Po@am__quote@ # am--include-marker
|
||||
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tgkill.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/threads-execve--quiet-thread-execve.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/threads-execve-q.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/threads-execve-qq.Po@am__quote@ # am--include-marker
|
||||
@@ -12170,6 +12180,7 @@
|
||||
-rm -f ./$(DEPDIR)/syslog-success.Po
|
||||
-rm -f ./$(DEPDIR)/syslog.Po
|
||||
-rm -f ./$(DEPDIR)/tee.Po
|
||||
+ -rm -f ./$(DEPDIR)/tgkill.Po
|
||||
-rm -f ./$(DEPDIR)/threads-execve--quiet-thread-execve.Po
|
||||
-rm -f ./$(DEPDIR)/threads-execve-q.Po
|
||||
-rm -f ./$(DEPDIR)/threads-execve-qq.Po
|
||||
@@ -13026,6 +13037,7 @@
|
||||
-rm -f ./$(DEPDIR)/syslog-success.Po
|
||||
-rm -f ./$(DEPDIR)/syslog.Po
|
||||
-rm -f ./$(DEPDIR)/tee.Po
|
||||
+ -rm -f ./$(DEPDIR)/tgkill.Po
|
||||
-rm -f ./$(DEPDIR)/threads-execve--quiet-thread-execve.Po
|
||||
-rm -f ./$(DEPDIR)/threads-execve-q.Po
|
||||
-rm -f ./$(DEPDIR)/threads-execve-qq.Po
|
||||
@@ -15085,6 +15097,9 @@
|
||||
$(srcdir)/tee.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
|
||||
$(AM_V_GEN) $^ $@
|
||||
|
||||
+$(srcdir)/tgkill.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
|
||||
+ $(AM_V_GEN) $^ $@
|
||||
+
|
||||
$(srcdir)/threads-execve--quiet-thread-execve.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in
|
||||
$(AM_V_GEN) $^ $@
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,93 +0,0 @@
|
||||
From bba566504901b2c07885ecf325829875a96381a7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81kos=20Uzonyi?= <uzonyi.akos@gmail.com>
|
||||
Date: Tue, 30 Jun 2020 17:20:12 +0200
|
||||
Subject: [PATCH 136/138] Use get_proc_pid for /proc paths
|
||||
|
||||
* mmap_cache.c (mmap_cache_rebuild_if_invalid): Use proc pid instead of
|
||||
tcp->pid for /proc path.
|
||||
* util.c (getfdproto): Likewise.
|
||||
(pidfd_get_pid): Likewise.
|
||||
* pathtrace.c (getfdpath_pid): Likewise.
|
||||
* strace.c (attach_tcb): Likewise.
|
||||
---
|
||||
mmap_cache.c | 2 +-
|
||||
pathtrace.c | 7 ++++++-
|
||||
strace.c | 2 +-
|
||||
util.c | 9 +++++++--
|
||||
4 files changed, 15 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/mmap_cache.c b/mmap_cache.c
|
||||
index 89c6225..9825df2 100644
|
||||
--- a/mmap_cache.c
|
||||
+++ b/mmap_cache.c
|
||||
@@ -84,7 +84,7 @@ mmap_cache_rebuild_if_invalid(struct tcb *tcp, const char *caller)
|
||||
return MMAP_CACHE_REBUILD_READY;
|
||||
|
||||
char filename[sizeof("/proc/4294967296/maps")];
|
||||
- xsprintf(filename, "/proc/%u/maps", tcp->pid);
|
||||
+ xsprintf(filename, "/proc/%u/maps", get_proc_pid(tcp));
|
||||
|
||||
FILE *fp = fopen_stream(filename, "r");
|
||||
if (!fp) {
|
||||
diff --git a/pathtrace.c b/pathtrace.c
|
||||
index f85cf14..87dc64b 100644
|
||||
--- a/pathtrace.c
|
||||
+++ b/pathtrace.c
|
||||
@@ -87,7 +87,12 @@ getfdpath_pid(pid_t pid, int fd, char *buf, unsigned bufsize)
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
|
||||
- xsprintf(linkpath, "/proc/%u/fd/%u", pid, fd);
|
||||
+ int proc_pid = 0;
|
||||
+ translate_pid(NULL, pid, PT_TID, &proc_pid);
|
||||
+ if (!proc_pid)
|
||||
+ return -1;
|
||||
+
|
||||
+ xsprintf(linkpath, "/proc/%u/fd/%u", proc_pid, fd);
|
||||
n = readlink(linkpath, buf, bufsize - 1);
|
||||
/*
|
||||
* NB: if buf is too small, readlink doesn't fail,
|
||||
diff --git a/strace.c b/strace.c
|
||||
index 249533e..ef23f08 100644
|
||||
--- a/strace.c
|
||||
+++ b/strace.c
|
||||
@@ -1196,7 +1196,7 @@ attach_tcb(struct tcb *const tcp)
|
||||
unsigned int ntid = 0, nerr = 0;
|
||||
|
||||
if (followfork && tcp->pid != strace_child &&
|
||||
- xsprintf(procdir, task_path, tcp->pid) > 0 &&
|
||||
+ xsprintf(procdir, task_path, get_proc_pid(tcp)) > 0 &&
|
||||
(dir = opendir(procdir)) != NULL) {
|
||||
struct_dirent *de;
|
||||
|
||||
diff --git a/util.c b/util.c
|
||||
index 2568021..481144b 100644
|
||||
--- a/util.c
|
||||
+++ b/util.c
|
||||
@@ -501,7 +501,7 @@ getfdproto(struct tcb *tcp, int fd)
|
||||
if (fd < 0)
|
||||
return SOCK_PROTO_UNKNOWN;
|
||||
|
||||
- xsprintf(path, "/proc/%u/fd/%u", tcp->pid, fd);
|
||||
+ xsprintf(path, "/proc/%u/fd/%u", get_proc_pid(tcp), fd);
|
||||
r = getxattr(path, "system.sockprotoname", buf, bufsize - 1);
|
||||
if (r <= 0)
|
||||
return SOCK_PROTO_UNKNOWN;
|
||||
@@ -582,8 +582,13 @@ printdev(struct tcb *tcp, int fd, const char *path)
|
||||
pid_t
|
||||
pidfd_get_pid(pid_t pid_of_fd, int fd)
|
||||
{
|
||||
+ int proc_pid = 0;
|
||||
+ translate_pid(NULL, pid_of_fd, PT_TID, &proc_pid);
|
||||
+ if (!proc_pid)
|
||||
+ return -1;
|
||||
+
|
||||
char fdi_path[sizeof("/proc/%u/fdinfo/%u") + 2 * sizeof(int) * 3];
|
||||
- xsprintf(fdi_path, "/proc/%u/fdinfo/%u", pid_of_fd, fd);
|
||||
+ xsprintf(fdi_path, "/proc/%u/fdinfo/%u", proc_pid, fd);
|
||||
|
||||
FILE *f = fopen_stream(fdi_path, "r");
|
||||
if (!f)
|
||||
--
|
||||
2.1.4
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,58 @@
|
||||
From 2bf069698a384ff2bc62d2a10544d49d766b4d7f Mon Sep 17 00:00:00 2001
|
||||
From: Eugene Syromyatnikov <evgsyr@gmail.com>
|
||||
Date: Mon, 27 Jun 2022 18:00:17 +0200
|
||||
Subject: [PATCH] src/xlat: remove remnants of unnecessary idx usage in xlookup
|
||||
|
||||
As there is no idx saving between calls anymore, there's no need to use
|
||||
(and update) idx in the XT_SORTED case. Reported by clang as a dead store:
|
||||
|
||||
Error: CLANG_WARNING:
|
||||
strace-5.18/src/xlat.c:84:4: warning[deadcode.DeadStores]: Value stored to 'idx' is never read
|
||||
|
||||
* src/xlat.c (xlookup): Remove idx declaration; declare idx inside
|
||||
of the for loop in the XT_NORMAL case; do not offset x->data and x->size
|
||||
by offs in the XT_SORTED case and do not update idx upon successful
|
||||
lookup.
|
||||
|
||||
Complements: v5.15~164 "xlat: no longer interpret NULL xlat as continuation"
|
||||
---
|
||||
src/xlat.c | 10 +++-------
|
||||
1 file changed, 3 insertions(+), 7 deletions(-)
|
||||
|
||||
Index: strace-5.18/src/xlat.c
|
||||
===================================================================
|
||||
--- strace-5.18.orig/src/xlat.c 2022-07-12 17:11:52.660927011 +0200
|
||||
+++ strace-5.18/src/xlat.c 2022-07-12 17:16:18.116794139 +0200
|
||||
@@ -61,7 +61,6 @@
|
||||
const char *
|
||||
xlookup(const struct xlat *x, const uint64_t val)
|
||||
{
|
||||
- size_t idx = 0;
|
||||
const struct xlat_data *e;
|
||||
|
||||
if (!x || !x->data)
|
||||
@@ -69,21 +68,18 @@
|
||||
|
||||
switch (x->type) {
|
||||
case XT_NORMAL:
|
||||
- for (; idx < x->size; idx++)
|
||||
+ for (size_t idx = 0; idx < x->size; idx++)
|
||||
if (x->data[idx].val == val)
|
||||
return x->data[idx].str;
|
||||
break;
|
||||
|
||||
case XT_SORTED:
|
||||
e = bsearch((const void *) &val,
|
||||
- x->data + idx,
|
||||
- x->size - idx,
|
||||
+ x->data, x->size,
|
||||
sizeof(x->data[0]),
|
||||
xlat_bsearch_compare);
|
||||
- if (e) {
|
||||
- idx = e - x->data;
|
||||
+ if (e)
|
||||
return e->str;
|
||||
- }
|
||||
break;
|
||||
|
||||
case XT_INDEXED:
|
@ -0,0 +1,56 @@
|
||||
From e604d7bfd18cf5f29e6723091cc1db2945c918c9 Mon Sep 17 00:00:00 2001
|
||||
From: Eugene Syromyatnikov <evgsyr@gmail.com>
|
||||
Date: Tue, 28 Jun 2022 16:46:53 +0200
|
||||
Subject: [PATCH] strauss: tips whitespace and phrasing cleanups
|
||||
|
||||
* src/strauss.c (tips_tricks_tweaks): Fix some whitespace and phrasing
|
||||
issues.
|
||||
---
|
||||
src/strauss.c | 13 +++++++------
|
||||
1 file changed, 7 insertions(+), 6 deletions(-)
|
||||
|
||||
Index: strace-5.18/src/strauss.c
|
||||
===================================================================
|
||||
--- strace-5.18.orig/src/strauss.c 2022-07-12 17:17:08.712197019 +0200
|
||||
+++ strace-5.18/src/strauss.c 2022-07-12 17:17:20.685055717 +0200
|
||||
@@ -128,8 +128,8 @@
|
||||
{ "strace is about as old as the Linux kernel.",
|
||||
"It has been originally written for SunOS",
|
||||
"by Paul Kranenburg in 1991. The support",
|
||||
- "for all OSes except Linux has been dropped",
|
||||
- "since 2012, though, in strace 4.7." },
|
||||
+ "for all OSes except Linux was dropped"
|
||||
+ "in 2012, though, in strace 4.7." },
|
||||
{ "strace is able to decode netlink messages.",
|
||||
"It does so automatically for I/O performed",
|
||||
"on netlink sockets. Try it yourself:", "",
|
||||
@@ -187,7 +187,7 @@
|
||||
"want to try --seccomp-bpf option, maybe you",
|
||||
"will feel better." },
|
||||
{ "-v is a shorthand for -e abbrev=none and not",
|
||||
- " for -e verbose=all. It is idiosyncratic,",
|
||||
+ "for -e verbose=all. It is idiosyncratic,",
|
||||
"but it is the historic behaviour." },
|
||||
{ "strace uses netlink for printing",
|
||||
"protocol-specific information about socket",
|
||||
@@ -254,7 +254,7 @@
|
||||
"by invoking it with the following options:", "",
|
||||
" strace -DDDqqq -enone --signal=none" },
|
||||
{ "Historically, supplying -o option to strace",
|
||||
- "led to silencing of messages about tracee",
|
||||
+ "leads to silencing of messages about tracee",
|
||||
"attach/detach and personality changes.",
|
||||
"It can be now overridden with --quiet=none",
|
||||
"option." },
|
||||
@@ -285,8 +285,9 @@
|
||||
"will trace all syscalls related to accessing",
|
||||
"and modifying process's user/group IDs",
|
||||
"and capability sets. Other pre-defined",
|
||||
- "syscall classes include %clock, %desc,%file,",
|
||||
- "%ipc,%memory, %net,%process, and %signal." },
|
||||
+ "syscall classes include %clock, %desc,"
|
||||
+ "%file, %ipc, %memory, %net, %process,"
|
||||
+ "and %signal." },
|
||||
{ "Trying to figure out communication between",
|
||||
"tracees inside a different PID namespace",
|
||||
"(in so-called \"containers\", for example)?",
|
@ -0,0 +1,48 @@
|
||||
From 968789d5426442ac43b96eabd65f3e5c0c141e62 Mon Sep 17 00:00:00 2001
|
||||
From: Eugene Syromyatnikov <evgsyr@gmail.com>
|
||||
Date: Tue, 28 Jun 2022 16:47:56 +0200
|
||||
Subject: [PATCH] strauss: fix off-by-one error in strauss array access
|
||||
|
||||
It has to be limited with strauss_lines - 1, not strauss_lines.
|
||||
Reported by covscan:
|
||||
|
||||
Error: OVERRUN (CWE-119):
|
||||
strace-5.18/src/strauss.c:380: cond_at_least: Checking "4UL + i < 37UL"
|
||||
implies that "i" is at least 33 on the false branch.
|
||||
strace-5.18/src/strauss.c:380: overrun-local: Overrunning array "strauss"
|
||||
of 37 8-byte elements at element index 37 (byte offset 303) using index
|
||||
"(4UL + i < 37UL) ? 4UL + i : 37UL" (which evaluates to 37).
|
||||
|
||||
* src/strauss.c (print_totd): Limit strauss array accesses to
|
||||
strauss_lines - 1 instead of strauss_lines.
|
||||
---
|
||||
src/strauss.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/strauss.c b/src/strauss.c
|
||||
index 98af183..b22ab6a 100644
|
||||
--- a/src/strauss.c
|
||||
+++ b/src/strauss.c
|
||||
@@ -373,16 +373,16 @@ print_totd(void)
|
||||
tip_left[MIN(i + 1, ARRAY_SIZE(tip_left) - 1)],
|
||||
w, w, tips_tricks_tweaks[id][i] ?: "",
|
||||
tip_right[MIN(i + 1, ARRAY_SIZE(tip_right) - 1)],
|
||||
- strauss[MIN(3 + i, strauss_lines)]);
|
||||
+ strauss[MIN(3 + i, strauss_lines - 1)]);
|
||||
}
|
||||
fprintf(stderr, "%s%s\n",
|
||||
- tip_bottom, strauss[MIN(3 + i, strauss_lines)]);
|
||||
+ tip_bottom, strauss[MIN(3 + i, strauss_lines - 1)]);
|
||||
do {
|
||||
fprintf(stderr, "%*s%*s%*s%s\n",
|
||||
(int) strlen(tip_left[0]), "",
|
||||
w, "",
|
||||
(int) strlen(tip_right[0]), "",
|
||||
- strauss[MIN(4 + i, strauss_lines)]);
|
||||
+ strauss[MIN(4 + i, strauss_lines - 1)]);
|
||||
} while ((show_tips == TIPS_FULL) && (4 + ++i < strauss_lines));
|
||||
|
||||
printed = true;
|
||||
--
|
||||
2.1.4
|
||||
|
@ -0,0 +1,62 @@
|
||||
From 6d3e97e83a7d61cbb2f5109efb4b519383a55712 Mon Sep 17 00:00:00 2001
|
||||
From: Eugene Syromyatnikov <evgsyr@gmail.com>
|
||||
Date: Tue, 28 Jun 2022 16:55:49 +0200
|
||||
Subject: [PATCH] util: add offs sanity check to print_clock_t
|
||||
|
||||
While it is not strictly needed right now, the code that uses
|
||||
the calculated offs value lacks any checks for possible buf overruns,
|
||||
which is not defensive enough, so let's add them. Reported by covscan:
|
||||
|
||||
Error: OVERRUN (CWE-119):
|
||||
strace-5.18/src/util.c:248: assignment: Assigning:
|
||||
"offs" = "ilog10(val / clk_tck)". The value of "offs" is now between
|
||||
16 and 31 (inclusive).
|
||||
strace-5.18/src/util.c:249: overrun-local: Overrunning array of 30 bytes
|
||||
at byte offset 31 by dereferencing pointer "buf + offs". [Note: The source
|
||||
code implementation of the function has been overridden by a builtin model.]
|
||||
|
||||
Error: OVERRUN (CWE-119):
|
||||
strace-5.18/src/util.c:248: assignment: Assigning:
|
||||
"offs" = "ilog10(val / clk_tck)". The value of "offs" is now between
|
||||
16 and 31 (inclusive).
|
||||
strace-5.18/src/util.c:253: overrun-buffer-arg: Overrunning array "buf"
|
||||
of 30 bytes by passing it to a function which accesses it at byte offset
|
||||
32 using argument "offs + 2UL" (which evaluates to 33). [Note: The source
|
||||
code implementation of the function has been overridden by a builtin model.]
|
||||
|
||||
Error: OVERRUN (CWE-119):
|
||||
strace-5.18/src/util.c:248: assignment: Assigning:
|
||||
"offs" = "ilog10(val / clk_tck)". The value of "offs" is now between
|
||||
16 and 31 (inclusive).
|
||||
strace-5.18/src/util.c:254: overrun-local: Overrunning array "buf"
|
||||
of 30 bytes at byte offset 32 using index "offs + 1UL" (which evaluates
|
||||
to 32).
|
||||
|
||||
* src/util.c (print_clock_t): Add check that offs is small enough
|
||||
for it and "offs + 2" not to overrun buf.
|
||||
---
|
||||
src/util.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/src/util.c b/src/util.c
|
||||
index 5f87acb..93aa7b3 100644
|
||||
--- a/src/util.c
|
||||
+++ b/src/util.c
|
||||
@@ -246,6 +246,14 @@ print_clock_t(uint64_t val)
|
||||
*/
|
||||
char buf[sizeof(uint64_t) * 3 + sizeof("0.0 s")];
|
||||
size_t offs = ilog10(val / clk_tck);
|
||||
+ /*
|
||||
+ * This check is mostly to appease covscan, which thinks
|
||||
+ * that offs can go as high as 31 (it cannot), but since
|
||||
+ * there is no proper sanity checks against offs overrunning
|
||||
+ * buf down the code, it may as well be here.
|
||||
+ */
|
||||
+ if (offs > (sizeof(buf) - sizeof("0.0 s")))
|
||||
+ return;
|
||||
int ret = snprintf(buf + offs, sizeof(buf) - offs, "%.*f s",
|
||||
frac_width,
|
||||
(double) (val % clk_tck) / clk_tck);
|
||||
--
|
||||
2.1.4
|
||||
|
@ -0,0 +1,882 @@
|
||||
From 960e78f208b4f6d48962bbc9cad45588cc8c90ad Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Renaud=20M=C3=A9trich?= <rmetrich@redhat.com>
|
||||
Date: Tue, 21 Jun 2022 08:43:00 +0200
|
||||
Subject: [PATCH] secontext: print context of Unix socket's sun_path field
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
|
||||
|
||||
* src/sockaddr.c: Include "secontext.h".
|
||||
(print_sockaddr_data_un): Print the SELinux context of sun_path field
|
||||
using selinux_printfilecon.
|
||||
* NEWS: Mention this change.
|
||||
* tests/secontext.c (raw_secontext_full_fd, get_secontext_field_fd,
|
||||
raw_secontext_short_fd, secontext_full_fd, secontext_short_fd): New
|
||||
functions.
|
||||
* tests/secontext.h (secontext_full_fd, secontext_short_fd,
|
||||
get_secontext_field_fd): New prototypes.
|
||||
(SECONTEXT_FD): New macro.
|
||||
* tests/sockname.c: Include "secontext.h".
|
||||
(test_sockname_syscall): Update expected output.
|
||||
* tests/gen_tests.in (getsockname--secontext,
|
||||
getsockname--secontext_full, getsockname--secontext_full_mismatch,
|
||||
getsockname--secontext_mismatch): New tests.
|
||||
|
||||
Resolves: https://github.com/strace/strace/pull/214
|
||||
---
|
||||
NEWS | 1 +
|
||||
src/sockaddr.c | 3 +++
|
||||
tests/gen_tests.in | 4 ++++
|
||||
tests/secontext.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
tests/secontext.h | 12 ++++++++++++
|
||||
tests/sockname.c | 54 +++++++++++++++++++++++++++++++++++-------------------
|
||||
6 files changed, 104 insertions(+), 19 deletions(-)
|
||||
|
||||
Index: strace-5.18/NEWS
|
||||
===================================================================
|
||||
--- strace-5.18.orig/NEWS 2022-07-12 18:20:18.495470531 +0200
|
||||
+++ strace-5.18/NEWS 2022-07-12 18:20:44.531163262 +0200
|
||||
@@ -5,6 +5,7 @@
|
||||
* Added an interface of raising des Strausses awareness.
|
||||
* Added --tips option to print strace tips, tricks, and tweaks
|
||||
at the end of the tracing session.
|
||||
+ * Implemented printing of Unix socket sun_path field's SELinux context.
|
||||
* Enhanced decoding of bpf and io_uring_register syscalls.
|
||||
* Implemented decoding of COUNTER_*, RTC_PARAM_GET, and RTC_PARAM_SET ioctl
|
||||
commands.
|
||||
Index: strace-5.18/src/sockaddr.c
|
||||
===================================================================
|
||||
--- strace-5.18.orig/src/sockaddr.c 2022-07-12 18:17:36.745379483 +0200
|
||||
+++ strace-5.18/src/sockaddr.c 2022-07-12 18:20:18.495470531 +0200
|
||||
@@ -63,6 +63,8 @@
|
||||
#include "xlat/mctp_addrs.h"
|
||||
#include "xlat/mctp_nets.h"
|
||||
|
||||
+#include "secontext.h"
|
||||
+
|
||||
#define SIZEOF_SA_FAMILY sizeof_field(struct sockaddr, sa_family)
|
||||
|
||||
struct sockaddr_rxrpc {
|
||||
@@ -115,6 +117,7 @@
|
||||
if (sa_un->sun_path[0]) {
|
||||
print_quoted_string(sa_un->sun_path, path_len + 1,
|
||||
QUOTE_0_TERMINATED);
|
||||
+ selinux_printfilecon(tcp, sa_un->sun_path);
|
||||
} else {
|
||||
tprints("@");
|
||||
print_quoted_string(sa_un->sun_path + 1, path_len - 1, 0);
|
||||
Index: strace-5.18/tests/gen_tests.in
|
||||
===================================================================
|
||||
--- strace-5.18.orig/tests/gen_tests.in 2022-07-12 18:17:36.746379471 +0200
|
||||
+++ strace-5.18/tests/gen_tests.in 2022-07-12 18:20:18.496470519 +0200
|
||||
@@ -225,6 +225,10 @@
|
||||
getsid -a10
|
||||
getsid--pidns-translation test_pidns -e trace=getsid -a10
|
||||
getsockname -a27
|
||||
+getsockname--secontext -a27 --secontext -e trace=getsockname
|
||||
+getsockname--secontext_full -a27 --secontext=full -e trace=getsockname
|
||||
+getsockname--secontext_full_mismatch -a27 --secontext=full,mismatch -e trace=getsockname
|
||||
+getsockname--secontext_mismatch -a27 --secontext=mismatch -e trace=getsockname
|
||||
gettid -a9
|
||||
getuid-creds +getuid.test
|
||||
getuid32 +getuid.test
|
||||
Index: strace-5.18/tests/secontext.c
|
||||
===================================================================
|
||||
--- strace-5.18.orig/tests/secontext.c 2022-07-12 18:17:36.747379459 +0200
|
||||
+++ strace-5.18/tests/secontext.c 2022-07-12 18:20:18.496470519 +0200
|
||||
@@ -141,6 +141,21 @@
|
||||
return full_secontext;
|
||||
}
|
||||
|
||||
+static char *
|
||||
+raw_secontext_full_fd(int fd)
|
||||
+{
|
||||
+ int saved_errno = errno;
|
||||
+ char *full_secontext = NULL;
|
||||
+ char *secontext;
|
||||
+
|
||||
+ if (fgetfilecon(fd, &secontext) >= 0) {
|
||||
+ full_secontext = strip_trailing_newlines(xstrdup(secontext));
|
||||
+ freecon(secontext);
|
||||
+ }
|
||||
+ errno = saved_errno;
|
||||
+ return full_secontext;
|
||||
+}
|
||||
+
|
||||
char *
|
||||
get_secontext_field_file(const char *file, enum secontext_field field)
|
||||
{
|
||||
@@ -151,6 +166,16 @@
|
||||
return type;
|
||||
}
|
||||
|
||||
+char *
|
||||
+get_secontext_field_fd(int fd, enum secontext_field field)
|
||||
+{
|
||||
+ char *ctx = raw_secontext_full_fd(fd);
|
||||
+ char *type = get_secontext_field(ctx, field);
|
||||
+ free(ctx);
|
||||
+
|
||||
+ return type;
|
||||
+}
|
||||
+
|
||||
static char *
|
||||
raw_secontext_short_file(const char *filename)
|
||||
{
|
||||
@@ -158,6 +183,12 @@
|
||||
}
|
||||
|
||||
static char *
|
||||
+raw_secontext_short_fd(int fd)
|
||||
+{
|
||||
+ return get_secontext_field_fd(fd, SECONTEXT_TYPE);
|
||||
+}
|
||||
+
|
||||
+static char *
|
||||
raw_secontext_full_pid(pid_t pid)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
@@ -205,6 +236,15 @@
|
||||
}
|
||||
|
||||
char *
|
||||
+secontext_full_fd(int fd)
|
||||
+{
|
||||
+ int saved_errno = errno;
|
||||
+ char *context = raw_secontext_full_fd(fd);
|
||||
+ errno = saved_errno;
|
||||
+ return FORMAT_SPACE_BEFORE(context);
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
secontext_full_pid(pid_t pid)
|
||||
{
|
||||
return FORMAT_SPACE_AFTER(raw_secontext_full_pid(pid));
|
||||
@@ -228,6 +268,15 @@
|
||||
errno = saved_errno;
|
||||
return FORMAT_SPACE_BEFORE(context);
|
||||
}
|
||||
+
|
||||
+char *
|
||||
+secontext_short_fd(int fd)
|
||||
+{
|
||||
+ int saved_errno = errno;
|
||||
+ char *context = raw_secontext_short_fd(fd);
|
||||
+ errno = saved_errno;
|
||||
+ return FORMAT_SPACE_BEFORE(context);
|
||||
+}
|
||||
|
||||
char *
|
||||
secontext_short_pid(pid_t pid)
|
||||
Index: strace-5.18/tests/secontext.h
|
||||
===================================================================
|
||||
--- strace-5.18.orig/tests/secontext.h 2022-07-12 18:17:36.747379459 +0200
|
||||
+++ strace-5.18/tests/secontext.h 2022-07-12 18:20:18.496470519 +0200
|
||||
@@ -9,9 +9,11 @@
|
||||
#include "xmalloc.h"
|
||||
#include <unistd.h>
|
||||
|
||||
+char *secontext_full_fd(int) ATTRIBUTE_MALLOC;
|
||||
char *secontext_full_file(const char *, bool) ATTRIBUTE_MALLOC;
|
||||
char *secontext_full_pid(pid_t) ATTRIBUTE_MALLOC;
|
||||
|
||||
+char *secontext_short_fd(int) ATTRIBUTE_MALLOC;
|
||||
char *secontext_short_file(const char *, bool) ATTRIBUTE_MALLOC;
|
||||
char *secontext_short_pid(pid_t) ATTRIBUTE_MALLOC;
|
||||
|
||||
@@ -30,6 +32,7 @@
|
||||
*/
|
||||
char *get_secontext_field(const char *full_context, enum secontext_field field);
|
||||
|
||||
+char *get_secontext_field_fd(int fd, enum secontext_field field);
|
||||
char *get_secontext_field_file(const char *file, enum secontext_field field);
|
||||
|
||||
void reset_secontext_file(const char *file);
|
||||
@@ -44,6 +47,7 @@
|
||||
# else
|
||||
# define SECONTEXT_FILE(filename) secontext_full_file(filename, false)
|
||||
# endif
|
||||
+# define SECONTEXT_FD(fd) secontext_full_fd(fd)
|
||||
# define SECONTEXT_PID(pid) secontext_full_pid(pid)
|
||||
|
||||
# else
|
||||
@@ -53,6 +57,7 @@
|
||||
# else
|
||||
# define SECONTEXT_FILE(filename) secontext_short_file(filename, false)
|
||||
# endif
|
||||
+# define SECONTEXT_FD(fd) secontext_short_fd(fd)
|
||||
# define SECONTEXT_PID(pid) secontext_short_pid(pid)
|
||||
|
||||
# endif
|
||||
@@ -65,6 +70,12 @@
|
||||
return NULL;
|
||||
}
|
||||
static inline char *
|
||||
+get_secontext_field_fd(int fd, enum secontext_field field)
|
||||
+{
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static inline char *
|
||||
get_secontext_field_file(const char *file, enum secontext_field field)
|
||||
{
|
||||
return NULL;
|
||||
@@ -81,6 +92,7 @@
|
||||
{
|
||||
}
|
||||
|
||||
+# define SECONTEXT_FD(fd) xstrdup("")
|
||||
# define SECONTEXT_FILE(filename) xstrdup("")
|
||||
# define SECONTEXT_PID(pid) xstrdup("")
|
||||
|
||||
Index: strace-5.18/tests/sockname.c
|
||||
===================================================================
|
||||
--- strace-5.18.orig/tests/sockname.c 2022-07-12 18:17:36.748379448 +0200
|
||||
+++ strace-5.18/tests/sockname.c 2022-07-12 18:20:18.496470519 +0200
|
||||
@@ -18,6 +18,8 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
+#include "secontext.h"
|
||||
+
|
||||
#ifndef TEST_SYSCALL_NAME
|
||||
# error TEST_SYSCALL_NAME must be defined
|
||||
#endif
|
||||
@@ -59,14 +61,19 @@
|
||||
*plen = sizeof(struct sockaddr_un);
|
||||
struct sockaddr_un *addr = tail_alloc(*plen);
|
||||
|
||||
+ char *my_secontext = SECONTEXT_PID_MY();
|
||||
+ char *fd_secontext = SECONTEXT_FD(fd);
|
||||
+
|
||||
PREPARE_TEST_SYSCALL_INVOCATION;
|
||||
int rc = TEST_SYSCALL_NAME(fd PREFIX_S_ARGS, (void *) addr,
|
||||
plen SUFFIX_ARGS);
|
||||
if (rc < 0)
|
||||
perror_msg_and_skip(TEST_SYSCALL_STR);
|
||||
- printf("%s(%d%s, {sa_family=AF_UNIX, sun_path=\"%s\"}"
|
||||
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX, sun_path=\"%s\"%s}"
|
||||
", [%d => %d]%s) = %d\n",
|
||||
- TEST_SYSCALL_STR, fd, PREFIX_S_STR, addr->sun_path,
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
|
||||
+ addr->sun_path, SECONTEXT_FILE(addr->sun_path),
|
||||
(int) sizeof(struct sockaddr_un), (int) *plen, SUFFIX_STR, rc);
|
||||
|
||||
memset(addr, 0, sizeof(*addr));
|
||||
@@ -75,28 +82,34 @@
|
||||
plen SUFFIX_ARGS);
|
||||
if (rc < 0)
|
||||
perror_msg_and_skip(TEST_SYSCALL_STR);
|
||||
- printf("%s(%d%s, {sa_family=AF_UNIX, sun_path=\"%s\"}"
|
||||
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX, sun_path=\"%s\"%s}"
|
||||
", [%d]%s) = %d\n",
|
||||
- TEST_SYSCALL_STR, fd, PREFIX_S_STR, addr->sun_path,
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
|
||||
+ addr->sun_path, SECONTEXT_FILE(addr->sun_path),
|
||||
(int) *plen, SUFFIX_STR, rc);
|
||||
|
||||
PREPARE_TEST_SYSCALL_INVOCATION;
|
||||
rc = TEST_SYSCALL_NAME(fd PREFIX_F_ARGS, (void *) addr, 0 SUFFIX_ARGS);
|
||||
- printf("%s(%d%s, %p, NULL%s) = %s\n",
|
||||
- TEST_SYSCALL_STR, fd, PREFIX_F_STR, addr, SUFFIX_STR,
|
||||
- sprintrc(rc));
|
||||
+ printf("%s%s(%d%s%s, %p, NULL%s) = %s\n",
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_F_STR,
|
||||
+ addr, SUFFIX_STR, sprintrc(rc));
|
||||
|
||||
PREPARE_TEST_SYSCALL_INVOCATION;
|
||||
rc = TEST_SYSCALL_NAME(fd PREFIX_S_ARGS, 0, 0 SUFFIX_ARGS);
|
||||
- printf("%s(%d%s, NULL, NULL%s) = %s\n",
|
||||
- TEST_SYSCALL_STR, fd, rc == -1 ? PREFIX_F_STR : PREFIX_S_STR,
|
||||
+ printf("%s%s(%d%s%s, NULL, NULL%s) = %s\n",
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext,
|
||||
+ rc == -1 ? PREFIX_F_STR : PREFIX_S_STR,
|
||||
SUFFIX_STR, sprintrc(rc));
|
||||
|
||||
PREPARE_TEST_SYSCALL_INVOCATION;
|
||||
rc = TEST_SYSCALL_NAME(fd PREFIX_F_ARGS, (void *) addr,
|
||||
plen + 1 SUFFIX_ARGS);
|
||||
- printf("%s(%d%s, %p, %p%s) = %s\n",
|
||||
- TEST_SYSCALL_STR, fd, PREFIX_F_STR, addr,
|
||||
+ printf("%s%s(%d%s%s, %p, %p%s) = %s\n",
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_F_STR, addr,
|
||||
plen + 1, SUFFIX_STR, sprintrc(rc));
|
||||
|
||||
const size_t offsetof_sun_path = offsetof(struct sockaddr_un, sun_path);
|
||||
@@ -108,8 +121,9 @@
|
||||
plen SUFFIX_ARGS);
|
||||
if (rc < 0)
|
||||
perror_msg_and_skip(TEST_SYSCALL_STR);
|
||||
- printf("%s(%d%s, {sa_family=AF_UNIX}, [%d => %d]%s) = %d\n",
|
||||
- TEST_SYSCALL_STR, fd, PREFIX_S_STR,
|
||||
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX}, [%d => %d]%s) = %d\n",
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
|
||||
(int) offsetof_sun_path, (int) *plen, SUFFIX_STR, rc);
|
||||
|
||||
++addr;
|
||||
@@ -121,17 +135,19 @@
|
||||
plen SUFFIX_ARGS);
|
||||
if (rc < 0)
|
||||
perror_msg_and_skip(TEST_SYSCALL_STR);
|
||||
- printf("%s(%d%s, {sa_family=AF_UNIX, sun_path=\"%.*s\"}"
|
||||
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX, sun_path=\"%.*s\"%s}"
|
||||
", [%d => %d]%s) = %d\n",
|
||||
- TEST_SYSCALL_STR, fd, PREFIX_S_STR,
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
|
||||
(int) (sizeof(struct sockaddr) - offsetof_sun_path),
|
||||
- addr->sun_path, (int) sizeof(struct sockaddr),
|
||||
- (int) *plen, SUFFIX_STR, rc);
|
||||
+ addr->sun_path, SECONTEXT_FILE(addr->sun_path),
|
||||
+ (int) sizeof(struct sockaddr), (int) *plen, SUFFIX_STR, rc);
|
||||
|
||||
PREPARE_TEST_SYSCALL_INVOCATION;
|
||||
rc = TEST_SYSCALL_NAME(fd PREFIX_F_ARGS, (void *) addr,
|
||||
plen SUFFIX_ARGS);
|
||||
- printf("%s(%d%s, %p, [%d]%s) = %s\n",
|
||||
- TEST_SYSCALL_STR, fd, PREFIX_F_STR, addr,
|
||||
+ printf("%s%s(%d%s%s, %p, [%d]%s) = %s\n",
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_F_STR, addr,
|
||||
*plen, SUFFIX_STR, sprintrc(rc));
|
||||
}
|
||||
Index: strace-5.18/tests-m32/secontext.c
|
||||
===================================================================
|
||||
--- strace-5.18.orig/tests-m32/secontext.c 2022-07-12 18:17:36.747379459 +0200
|
||||
+++ strace-5.18/tests-m32/secontext.c 2022-07-12 18:20:18.496470519 +0200
|
||||
@@ -141,6 +141,21 @@
|
||||
return full_secontext;
|
||||
}
|
||||
|
||||
+static char *
|
||||
+raw_secontext_full_fd(int fd)
|
||||
+{
|
||||
+ int saved_errno = errno;
|
||||
+ char *full_secontext = NULL;
|
||||
+ char *secontext;
|
||||
+
|
||||
+ if (fgetfilecon(fd, &secontext) >= 0) {
|
||||
+ full_secontext = strip_trailing_newlines(xstrdup(secontext));
|
||||
+ freecon(secontext);
|
||||
+ }
|
||||
+ errno = saved_errno;
|
||||
+ return full_secontext;
|
||||
+}
|
||||
+
|
||||
char *
|
||||
get_secontext_field_file(const char *file, enum secontext_field field)
|
||||
{
|
||||
@@ -151,6 +166,16 @@
|
||||
return type;
|
||||
}
|
||||
|
||||
+char *
|
||||
+get_secontext_field_fd(int fd, enum secontext_field field)
|
||||
+{
|
||||
+ char *ctx = raw_secontext_full_fd(fd);
|
||||
+ char *type = get_secontext_field(ctx, field);
|
||||
+ free(ctx);
|
||||
+
|
||||
+ return type;
|
||||
+}
|
||||
+
|
||||
static char *
|
||||
raw_secontext_short_file(const char *filename)
|
||||
{
|
||||
@@ -158,6 +183,12 @@
|
||||
}
|
||||
|
||||
static char *
|
||||
+raw_secontext_short_fd(int fd)
|
||||
+{
|
||||
+ return get_secontext_field_fd(fd, SECONTEXT_TYPE);
|
||||
+}
|
||||
+
|
||||
+static char *
|
||||
raw_secontext_full_pid(pid_t pid)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
@@ -205,6 +236,15 @@
|
||||
}
|
||||
|
||||
char *
|
||||
+secontext_full_fd(int fd)
|
||||
+{
|
||||
+ int saved_errno = errno;
|
||||
+ char *context = raw_secontext_full_fd(fd);
|
||||
+ errno = saved_errno;
|
||||
+ return FORMAT_SPACE_BEFORE(context);
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
secontext_full_pid(pid_t pid)
|
||||
{
|
||||
return FORMAT_SPACE_AFTER(raw_secontext_full_pid(pid));
|
||||
@@ -228,6 +268,15 @@
|
||||
errno = saved_errno;
|
||||
return FORMAT_SPACE_BEFORE(context);
|
||||
}
|
||||
+
|
||||
+char *
|
||||
+secontext_short_fd(int fd)
|
||||
+{
|
||||
+ int saved_errno = errno;
|
||||
+ char *context = raw_secontext_short_fd(fd);
|
||||
+ errno = saved_errno;
|
||||
+ return FORMAT_SPACE_BEFORE(context);
|
||||
+}
|
||||
|
||||
char *
|
||||
secontext_short_pid(pid_t pid)
|
||||
Index: strace-5.18/tests-m32/secontext.h
|
||||
===================================================================
|
||||
--- strace-5.18.orig/tests-m32/secontext.h 2022-07-12 18:17:36.747379459 +0200
|
||||
+++ strace-5.18/tests-m32/secontext.h 2022-07-12 18:20:18.496470519 +0200
|
||||
@@ -9,9 +9,11 @@
|
||||
#include "xmalloc.h"
|
||||
#include <unistd.h>
|
||||
|
||||
+char *secontext_full_fd(int) ATTRIBUTE_MALLOC;
|
||||
char *secontext_full_file(const char *, bool) ATTRIBUTE_MALLOC;
|
||||
char *secontext_full_pid(pid_t) ATTRIBUTE_MALLOC;
|
||||
|
||||
+char *secontext_short_fd(int) ATTRIBUTE_MALLOC;
|
||||
char *secontext_short_file(const char *, bool) ATTRIBUTE_MALLOC;
|
||||
char *secontext_short_pid(pid_t) ATTRIBUTE_MALLOC;
|
||||
|
||||
@@ -30,6 +32,7 @@
|
||||
*/
|
||||
char *get_secontext_field(const char *full_context, enum secontext_field field);
|
||||
|
||||
+char *get_secontext_field_fd(int fd, enum secontext_field field);
|
||||
char *get_secontext_field_file(const char *file, enum secontext_field field);
|
||||
|
||||
void reset_secontext_file(const char *file);
|
||||
@@ -44,6 +47,7 @@
|
||||
# else
|
||||
# define SECONTEXT_FILE(filename) secontext_full_file(filename, false)
|
||||
# endif
|
||||
+# define SECONTEXT_FD(fd) secontext_full_fd(fd)
|
||||
# define SECONTEXT_PID(pid) secontext_full_pid(pid)
|
||||
|
||||
# else
|
||||
@@ -53,6 +57,7 @@
|
||||
# else
|
||||
# define SECONTEXT_FILE(filename) secontext_short_file(filename, false)
|
||||
# endif
|
||||
+# define SECONTEXT_FD(fd) secontext_short_fd(fd)
|
||||
# define SECONTEXT_PID(pid) secontext_short_pid(pid)
|
||||
|
||||
# endif
|
||||
@@ -65,6 +70,12 @@
|
||||
return NULL;
|
||||
}
|
||||
static inline char *
|
||||
+get_secontext_field_fd(int fd, enum secontext_field field)
|
||||
+{
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static inline char *
|
||||
get_secontext_field_file(const char *file, enum secontext_field field)
|
||||
{
|
||||
return NULL;
|
||||
@@ -81,6 +92,7 @@
|
||||
{
|
||||
}
|
||||
|
||||
+# define SECONTEXT_FD(fd) xstrdup("")
|
||||
# define SECONTEXT_FILE(filename) xstrdup("")
|
||||
# define SECONTEXT_PID(pid) xstrdup("")
|
||||
|
||||
Index: strace-5.18/tests-m32/sockname.c
|
||||
===================================================================
|
||||
--- strace-5.18.orig/tests-m32/sockname.c 2022-07-12 18:17:36.748379448 +0200
|
||||
+++ strace-5.18/tests-m32/sockname.c 2022-07-12 18:20:18.496470519 +0200
|
||||
@@ -18,6 +18,8 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
+#include "secontext.h"
|
||||
+
|
||||
#ifndef TEST_SYSCALL_NAME
|
||||
# error TEST_SYSCALL_NAME must be defined
|
||||
#endif
|
||||
@@ -59,14 +61,19 @@
|
||||
*plen = sizeof(struct sockaddr_un);
|
||||
struct sockaddr_un *addr = tail_alloc(*plen);
|
||||
|
||||
+ char *my_secontext = SECONTEXT_PID_MY();
|
||||
+ char *fd_secontext = SECONTEXT_FD(fd);
|
||||
+
|
||||
PREPARE_TEST_SYSCALL_INVOCATION;
|
||||
int rc = TEST_SYSCALL_NAME(fd PREFIX_S_ARGS, (void *) addr,
|
||||
plen SUFFIX_ARGS);
|
||||
if (rc < 0)
|
||||
perror_msg_and_skip(TEST_SYSCALL_STR);
|
||||
- printf("%s(%d%s, {sa_family=AF_UNIX, sun_path=\"%s\"}"
|
||||
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX, sun_path=\"%s\"%s}"
|
||||
", [%d => %d]%s) = %d\n",
|
||||
- TEST_SYSCALL_STR, fd, PREFIX_S_STR, addr->sun_path,
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
|
||||
+ addr->sun_path, SECONTEXT_FILE(addr->sun_path),
|
||||
(int) sizeof(struct sockaddr_un), (int) *plen, SUFFIX_STR, rc);
|
||||
|
||||
memset(addr, 0, sizeof(*addr));
|
||||
@@ -75,28 +82,34 @@
|
||||
plen SUFFIX_ARGS);
|
||||
if (rc < 0)
|
||||
perror_msg_and_skip(TEST_SYSCALL_STR);
|
||||
- printf("%s(%d%s, {sa_family=AF_UNIX, sun_path=\"%s\"}"
|
||||
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX, sun_path=\"%s\"%s}"
|
||||
", [%d]%s) = %d\n",
|
||||
- TEST_SYSCALL_STR, fd, PREFIX_S_STR, addr->sun_path,
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
|
||||
+ addr->sun_path, SECONTEXT_FILE(addr->sun_path),
|
||||
(int) *plen, SUFFIX_STR, rc);
|
||||
|
||||
PREPARE_TEST_SYSCALL_INVOCATION;
|
||||
rc = TEST_SYSCALL_NAME(fd PREFIX_F_ARGS, (void *) addr, 0 SUFFIX_ARGS);
|
||||
- printf("%s(%d%s, %p, NULL%s) = %s\n",
|
||||
- TEST_SYSCALL_STR, fd, PREFIX_F_STR, addr, SUFFIX_STR,
|
||||
- sprintrc(rc));
|
||||
+ printf("%s%s(%d%s%s, %p, NULL%s) = %s\n",
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_F_STR,
|
||||
+ addr, SUFFIX_STR, sprintrc(rc));
|
||||
|
||||
PREPARE_TEST_SYSCALL_INVOCATION;
|
||||
rc = TEST_SYSCALL_NAME(fd PREFIX_S_ARGS, 0, 0 SUFFIX_ARGS);
|
||||
- printf("%s(%d%s, NULL, NULL%s) = %s\n",
|
||||
- TEST_SYSCALL_STR, fd, rc == -1 ? PREFIX_F_STR : PREFIX_S_STR,
|
||||
+ printf("%s%s(%d%s%s, NULL, NULL%s) = %s\n",
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext,
|
||||
+ rc == -1 ? PREFIX_F_STR : PREFIX_S_STR,
|
||||
SUFFIX_STR, sprintrc(rc));
|
||||
|
||||
PREPARE_TEST_SYSCALL_INVOCATION;
|
||||
rc = TEST_SYSCALL_NAME(fd PREFIX_F_ARGS, (void *) addr,
|
||||
plen + 1 SUFFIX_ARGS);
|
||||
- printf("%s(%d%s, %p, %p%s) = %s\n",
|
||||
- TEST_SYSCALL_STR, fd, PREFIX_F_STR, addr,
|
||||
+ printf("%s%s(%d%s%s, %p, %p%s) = %s\n",
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_F_STR, addr,
|
||||
plen + 1, SUFFIX_STR, sprintrc(rc));
|
||||
|
||||
const size_t offsetof_sun_path = offsetof(struct sockaddr_un, sun_path);
|
||||
@@ -108,8 +121,9 @@
|
||||
plen SUFFIX_ARGS);
|
||||
if (rc < 0)
|
||||
perror_msg_and_skip(TEST_SYSCALL_STR);
|
||||
- printf("%s(%d%s, {sa_family=AF_UNIX}, [%d => %d]%s) = %d\n",
|
||||
- TEST_SYSCALL_STR, fd, PREFIX_S_STR,
|
||||
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX}, [%d => %d]%s) = %d\n",
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
|
||||
(int) offsetof_sun_path, (int) *plen, SUFFIX_STR, rc);
|
||||
|
||||
++addr;
|
||||
@@ -121,17 +135,19 @@
|
||||
plen SUFFIX_ARGS);
|
||||
if (rc < 0)
|
||||
perror_msg_and_skip(TEST_SYSCALL_STR);
|
||||
- printf("%s(%d%s, {sa_family=AF_UNIX, sun_path=\"%.*s\"}"
|
||||
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX, sun_path=\"%.*s\"%s}"
|
||||
", [%d => %d]%s) = %d\n",
|
||||
- TEST_SYSCALL_STR, fd, PREFIX_S_STR,
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
|
||||
(int) (sizeof(struct sockaddr) - offsetof_sun_path),
|
||||
- addr->sun_path, (int) sizeof(struct sockaddr),
|
||||
- (int) *plen, SUFFIX_STR, rc);
|
||||
+ addr->sun_path, SECONTEXT_FILE(addr->sun_path),
|
||||
+ (int) sizeof(struct sockaddr), (int) *plen, SUFFIX_STR, rc);
|
||||
|
||||
PREPARE_TEST_SYSCALL_INVOCATION;
|
||||
rc = TEST_SYSCALL_NAME(fd PREFIX_F_ARGS, (void *) addr,
|
||||
plen SUFFIX_ARGS);
|
||||
- printf("%s(%d%s, %p, [%d]%s) = %s\n",
|
||||
- TEST_SYSCALL_STR, fd, PREFIX_F_STR, addr,
|
||||
+ printf("%s%s(%d%s%s, %p, [%d]%s) = %s\n",
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_F_STR, addr,
|
||||
*plen, SUFFIX_STR, sprintrc(rc));
|
||||
}
|
||||
Index: strace-5.18/tests-mx32/secontext.c
|
||||
===================================================================
|
||||
--- strace-5.18.orig/tests-mx32/secontext.c 2022-07-12 18:17:36.747379459 +0200
|
||||
+++ strace-5.18/tests-mx32/secontext.c 2022-07-12 18:20:18.496470519 +0200
|
||||
@@ -141,6 +141,21 @@
|
||||
return full_secontext;
|
||||
}
|
||||
|
||||
+static char *
|
||||
+raw_secontext_full_fd(int fd)
|
||||
+{
|
||||
+ int saved_errno = errno;
|
||||
+ char *full_secontext = NULL;
|
||||
+ char *secontext;
|
||||
+
|
||||
+ if (fgetfilecon(fd, &secontext) >= 0) {
|
||||
+ full_secontext = strip_trailing_newlines(xstrdup(secontext));
|
||||
+ freecon(secontext);
|
||||
+ }
|
||||
+ errno = saved_errno;
|
||||
+ return full_secontext;
|
||||
+}
|
||||
+
|
||||
char *
|
||||
get_secontext_field_file(const char *file, enum secontext_field field)
|
||||
{
|
||||
@@ -151,6 +166,16 @@
|
||||
return type;
|
||||
}
|
||||
|
||||
+char *
|
||||
+get_secontext_field_fd(int fd, enum secontext_field field)
|
||||
+{
|
||||
+ char *ctx = raw_secontext_full_fd(fd);
|
||||
+ char *type = get_secontext_field(ctx, field);
|
||||
+ free(ctx);
|
||||
+
|
||||
+ return type;
|
||||
+}
|
||||
+
|
||||
static char *
|
||||
raw_secontext_short_file(const char *filename)
|
||||
{
|
||||
@@ -158,6 +183,12 @@
|
||||
}
|
||||
|
||||
static char *
|
||||
+raw_secontext_short_fd(int fd)
|
||||
+{
|
||||
+ return get_secontext_field_fd(fd, SECONTEXT_TYPE);
|
||||
+}
|
||||
+
|
||||
+static char *
|
||||
raw_secontext_full_pid(pid_t pid)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
@@ -205,6 +236,15 @@
|
||||
}
|
||||
|
||||
char *
|
||||
+secontext_full_fd(int fd)
|
||||
+{
|
||||
+ int saved_errno = errno;
|
||||
+ char *context = raw_secontext_full_fd(fd);
|
||||
+ errno = saved_errno;
|
||||
+ return FORMAT_SPACE_BEFORE(context);
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
secontext_full_pid(pid_t pid)
|
||||
{
|
||||
return FORMAT_SPACE_AFTER(raw_secontext_full_pid(pid));
|
||||
@@ -228,6 +268,15 @@
|
||||
errno = saved_errno;
|
||||
return FORMAT_SPACE_BEFORE(context);
|
||||
}
|
||||
+
|
||||
+char *
|
||||
+secontext_short_fd(int fd)
|
||||
+{
|
||||
+ int saved_errno = errno;
|
||||
+ char *context = raw_secontext_short_fd(fd);
|
||||
+ errno = saved_errno;
|
||||
+ return FORMAT_SPACE_BEFORE(context);
|
||||
+}
|
||||
|
||||
char *
|
||||
secontext_short_pid(pid_t pid)
|
||||
Index: strace-5.18/tests-mx32/secontext.h
|
||||
===================================================================
|
||||
--- strace-5.18.orig/tests-mx32/secontext.h 2022-07-12 18:17:36.747379459 +0200
|
||||
+++ strace-5.18/tests-mx32/secontext.h 2022-07-12 18:20:18.496470519 +0200
|
||||
@@ -9,9 +9,11 @@
|
||||
#include "xmalloc.h"
|
||||
#include <unistd.h>
|
||||
|
||||
+char *secontext_full_fd(int) ATTRIBUTE_MALLOC;
|
||||
char *secontext_full_file(const char *, bool) ATTRIBUTE_MALLOC;
|
||||
char *secontext_full_pid(pid_t) ATTRIBUTE_MALLOC;
|
||||
|
||||
+char *secontext_short_fd(int) ATTRIBUTE_MALLOC;
|
||||
char *secontext_short_file(const char *, bool) ATTRIBUTE_MALLOC;
|
||||
char *secontext_short_pid(pid_t) ATTRIBUTE_MALLOC;
|
||||
|
||||
@@ -30,6 +32,7 @@
|
||||
*/
|
||||
char *get_secontext_field(const char *full_context, enum secontext_field field);
|
||||
|
||||
+char *get_secontext_field_fd(int fd, enum secontext_field field);
|
||||
char *get_secontext_field_file(const char *file, enum secontext_field field);
|
||||
|
||||
void reset_secontext_file(const char *file);
|
||||
@@ -44,6 +47,7 @@
|
||||
# else
|
||||
# define SECONTEXT_FILE(filename) secontext_full_file(filename, false)
|
||||
# endif
|
||||
+# define SECONTEXT_FD(fd) secontext_full_fd(fd)
|
||||
# define SECONTEXT_PID(pid) secontext_full_pid(pid)
|
||||
|
||||
# else
|
||||
@@ -53,6 +57,7 @@
|
||||
# else
|
||||
# define SECONTEXT_FILE(filename) secontext_short_file(filename, false)
|
||||
# endif
|
||||
+# define SECONTEXT_FD(fd) secontext_short_fd(fd)
|
||||
# define SECONTEXT_PID(pid) secontext_short_pid(pid)
|
||||
|
||||
# endif
|
||||
@@ -65,6 +70,12 @@
|
||||
return NULL;
|
||||
}
|
||||
static inline char *
|
||||
+get_secontext_field_fd(int fd, enum secontext_field field)
|
||||
+{
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static inline char *
|
||||
get_secontext_field_file(const char *file, enum secontext_field field)
|
||||
{
|
||||
return NULL;
|
||||
@@ -81,6 +92,7 @@
|
||||
{
|
||||
}
|
||||
|
||||
+# define SECONTEXT_FD(fd) xstrdup("")
|
||||
# define SECONTEXT_FILE(filename) xstrdup("")
|
||||
# define SECONTEXT_PID(pid) xstrdup("")
|
||||
|
||||
Index: strace-5.18/tests-mx32/sockname.c
|
||||
===================================================================
|
||||
--- strace-5.18.orig/tests-mx32/sockname.c 2022-07-12 18:17:36.748379448 +0200
|
||||
+++ strace-5.18/tests-mx32/sockname.c 2022-07-12 18:20:18.496470519 +0200
|
||||
@@ -18,6 +18,8 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
+#include "secontext.h"
|
||||
+
|
||||
#ifndef TEST_SYSCALL_NAME
|
||||
# error TEST_SYSCALL_NAME must be defined
|
||||
#endif
|
||||
@@ -59,14 +61,19 @@
|
||||
*plen = sizeof(struct sockaddr_un);
|
||||
struct sockaddr_un *addr = tail_alloc(*plen);
|
||||
|
||||
+ char *my_secontext = SECONTEXT_PID_MY();
|
||||
+ char *fd_secontext = SECONTEXT_FD(fd);
|
||||
+
|
||||
PREPARE_TEST_SYSCALL_INVOCATION;
|
||||
int rc = TEST_SYSCALL_NAME(fd PREFIX_S_ARGS, (void *) addr,
|
||||
plen SUFFIX_ARGS);
|
||||
if (rc < 0)
|
||||
perror_msg_and_skip(TEST_SYSCALL_STR);
|
||||
- printf("%s(%d%s, {sa_family=AF_UNIX, sun_path=\"%s\"}"
|
||||
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX, sun_path=\"%s\"%s}"
|
||||
", [%d => %d]%s) = %d\n",
|
||||
- TEST_SYSCALL_STR, fd, PREFIX_S_STR, addr->sun_path,
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
|
||||
+ addr->sun_path, SECONTEXT_FILE(addr->sun_path),
|
||||
(int) sizeof(struct sockaddr_un), (int) *plen, SUFFIX_STR, rc);
|
||||
|
||||
memset(addr, 0, sizeof(*addr));
|
||||
@@ -75,28 +82,34 @@
|
||||
plen SUFFIX_ARGS);
|
||||
if (rc < 0)
|
||||
perror_msg_and_skip(TEST_SYSCALL_STR);
|
||||
- printf("%s(%d%s, {sa_family=AF_UNIX, sun_path=\"%s\"}"
|
||||
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX, sun_path=\"%s\"%s}"
|
||||
", [%d]%s) = %d\n",
|
||||
- TEST_SYSCALL_STR, fd, PREFIX_S_STR, addr->sun_path,
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
|
||||
+ addr->sun_path, SECONTEXT_FILE(addr->sun_path),
|
||||
(int) *plen, SUFFIX_STR, rc);
|
||||
|
||||
PREPARE_TEST_SYSCALL_INVOCATION;
|
||||
rc = TEST_SYSCALL_NAME(fd PREFIX_F_ARGS, (void *) addr, 0 SUFFIX_ARGS);
|
||||
- printf("%s(%d%s, %p, NULL%s) = %s\n",
|
||||
- TEST_SYSCALL_STR, fd, PREFIX_F_STR, addr, SUFFIX_STR,
|
||||
- sprintrc(rc));
|
||||
+ printf("%s%s(%d%s%s, %p, NULL%s) = %s\n",
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_F_STR,
|
||||
+ addr, SUFFIX_STR, sprintrc(rc));
|
||||
|
||||
PREPARE_TEST_SYSCALL_INVOCATION;
|
||||
rc = TEST_SYSCALL_NAME(fd PREFIX_S_ARGS, 0, 0 SUFFIX_ARGS);
|
||||
- printf("%s(%d%s, NULL, NULL%s) = %s\n",
|
||||
- TEST_SYSCALL_STR, fd, rc == -1 ? PREFIX_F_STR : PREFIX_S_STR,
|
||||
+ printf("%s%s(%d%s%s, NULL, NULL%s) = %s\n",
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext,
|
||||
+ rc == -1 ? PREFIX_F_STR : PREFIX_S_STR,
|
||||
SUFFIX_STR, sprintrc(rc));
|
||||
|
||||
PREPARE_TEST_SYSCALL_INVOCATION;
|
||||
rc = TEST_SYSCALL_NAME(fd PREFIX_F_ARGS, (void *) addr,
|
||||
plen + 1 SUFFIX_ARGS);
|
||||
- printf("%s(%d%s, %p, %p%s) = %s\n",
|
||||
- TEST_SYSCALL_STR, fd, PREFIX_F_STR, addr,
|
||||
+ printf("%s%s(%d%s%s, %p, %p%s) = %s\n",
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_F_STR, addr,
|
||||
plen + 1, SUFFIX_STR, sprintrc(rc));
|
||||
|
||||
const size_t offsetof_sun_path = offsetof(struct sockaddr_un, sun_path);
|
||||
@@ -108,8 +121,9 @@
|
||||
plen SUFFIX_ARGS);
|
||||
if (rc < 0)
|
||||
perror_msg_and_skip(TEST_SYSCALL_STR);
|
||||
- printf("%s(%d%s, {sa_family=AF_UNIX}, [%d => %d]%s) = %d\n",
|
||||
- TEST_SYSCALL_STR, fd, PREFIX_S_STR,
|
||||
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX}, [%d => %d]%s) = %d\n",
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
|
||||
(int) offsetof_sun_path, (int) *plen, SUFFIX_STR, rc);
|
||||
|
||||
++addr;
|
||||
@@ -121,17 +135,19 @@
|
||||
plen SUFFIX_ARGS);
|
||||
if (rc < 0)
|
||||
perror_msg_and_skip(TEST_SYSCALL_STR);
|
||||
- printf("%s(%d%s, {sa_family=AF_UNIX, sun_path=\"%.*s\"}"
|
||||
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX, sun_path=\"%.*s\"%s}"
|
||||
", [%d => %d]%s) = %d\n",
|
||||
- TEST_SYSCALL_STR, fd, PREFIX_S_STR,
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
|
||||
(int) (sizeof(struct sockaddr) - offsetof_sun_path),
|
||||
- addr->sun_path, (int) sizeof(struct sockaddr),
|
||||
- (int) *plen, SUFFIX_STR, rc);
|
||||
+ addr->sun_path, SECONTEXT_FILE(addr->sun_path),
|
||||
+ (int) sizeof(struct sockaddr), (int) *plen, SUFFIX_STR, rc);
|
||||
|
||||
PREPARE_TEST_SYSCALL_INVOCATION;
|
||||
rc = TEST_SYSCALL_NAME(fd PREFIX_F_ARGS, (void *) addr,
|
||||
plen SUFFIX_ARGS);
|
||||
- printf("%s(%d%s, %p, [%d]%s) = %s\n",
|
||||
- TEST_SYSCALL_STR, fd, PREFIX_F_STR, addr,
|
||||
+ printf("%s%s(%d%s%s, %p, [%d]%s) = %s\n",
|
||||
+ my_secontext,
|
||||
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_F_STR, addr,
|
||||
*plen, SUFFIX_STR, sprintrc(rc));
|
||||
}
|
@ -0,0 +1,374 @@
|
||||
From 676979fa9cc7920e5e4d547814f9c0edb597fa0d Mon Sep 17 00:00:00 2001
|
||||
From: Eugene Syromyatnikov <evgsyr@gmail.com>
|
||||
Date: Thu, 30 Jun 2022 16:01:05 +0200
|
||||
Subject: [PATCH] pathtrace, util: do not print " (deleted)" as part of the
|
||||
path
|
||||
|
||||
In order to allow to discern the unlinked paths from the paths that
|
||||
do indeed end with " (deleted)".
|
||||
|
||||
* src/defs.h (getfdpath_pid): Add deleted parameter.
|
||||
(getfdpath): Pass NULL as deleted parameter to getfdpath_pid.
|
||||
* src/largefile_wrappers.h (lstat_file): New macro.
|
||||
* src/pathtrace.c: Include <sys/stat.h>, <sys/types.h>, <unistd.h>,
|
||||
and "largefile_wrappers.h".
|
||||
(getfdpath_pid): Add deleted parameter, check if path ends with
|
||||
" (deleted)", and if it is, try to figure out if it is a part
|
||||
of the path by comparing device/inode numbers of the file procfs
|
||||
link resolves into and the file pointed by the path read; strip
|
||||
" (deleted)"; set deleted (if it is non-NULL) to true if the fd
|
||||
is turned out to be deleted and to false otherwise.
|
||||
* src/util.c (print_quoted_string_in_angle_brackets): Add deleted
|
||||
parameter, print "(deleted)" after the closing angle bracket if it is
|
||||
non-NULL.
|
||||
(printfd_pid): Add deleted local variable, pass it to getfdpath_pid
|
||||
and print_quoted_string_in_angle_brackets calls.
|
||||
* tests/fchmod.c: Add checks for a file with " (deleted)" in the path,
|
||||
update expected output.
|
||||
* NEWS: Mention the change.
|
||||
---
|
||||
NEWS | 5 +++++
|
||||
src/defs.h | 5 +++--
|
||||
src/largefile_wrappers.h | 2 ++
|
||||
src/pathtrace.c | 48 +++++++++++++++++++++++++++++++++++++++++++++---
|
||||
src/util.c | 10 +++++++---
|
||||
tests/fchmod.c | 47 +++++++++++++++++++++++++++++++++++++++++++----
|
||||
6 files changed, 105 insertions(+), 12 deletions(-)
|
||||
|
||||
Index: strace-5.18/NEWS
|
||||
===================================================================
|
||||
--- strace-5.18.orig/NEWS 2022-07-13 12:52:48.219784860 +0200
|
||||
+++ strace-5.18/NEWS 2022-07-13 12:52:48.451782122 +0200
|
||||
@@ -1,6 +1,11 @@
|
||||
Noteworthy changes in release 5.18 (2022-06-18)
|
||||
===============================================
|
||||
|
||||
+* Changes in behaviour
|
||||
+ * The "(deleted)" marker for unlinked paths of file descriptors is now printed
|
||||
+ outside angle brackets; the matching of unlinked paths of file descriptors
|
||||
+ no longer includes the " (deleted)" part into consideration.
|
||||
+
|
||||
* Improvements
|
||||
* Added an interface of raising des Strausses awareness.
|
||||
* Added --tips option to print strace tips, tricks, and tweaks
|
||||
Index: strace-5.18/src/defs.h
|
||||
===================================================================
|
||||
--- strace-5.18.orig/src/defs.h 2022-07-13 12:52:29.405006910 +0200
|
||||
+++ strace-5.18/src/defs.h 2022-07-13 12:52:54.532710356 +0200
|
||||
@@ -785,12 +785,13 @@
|
||||
return pathtrace_match_set(tcp, &global_path_set);
|
||||
}
|
||||
|
||||
-extern int getfdpath_pid(pid_t pid, int fd, char *buf, unsigned bufsize);
|
||||
+extern int getfdpath_pid(pid_t pid, int fd, char *buf, unsigned bufsize,
|
||||
+ bool *deleted);
|
||||
|
||||
static inline int
|
||||
getfdpath(struct tcb *tcp, int fd, char *buf, unsigned bufsize)
|
||||
{
|
||||
- return getfdpath_pid(tcp->pid, fd, buf, bufsize);
|
||||
+ return getfdpath_pid(tcp->pid, fd, buf, bufsize, NULL);
|
||||
}
|
||||
|
||||
extern unsigned long getfdinode(struct tcb *, int);
|
||||
Index: strace-5.18/src/largefile_wrappers.h
|
||||
===================================================================
|
||||
--- strace-5.18.orig/src/largefile_wrappers.h 2022-07-13 12:52:29.405006910 +0200
|
||||
+++ strace-5.18/src/largefile_wrappers.h 2022-07-13 12:52:48.451782122 +0200
|
||||
@@ -31,6 +31,7 @@
|
||||
# endif
|
||||
# define fstat_fd fstat64
|
||||
# define strace_stat_t struct stat64
|
||||
+# define lstat_file lstat64
|
||||
# define stat_file stat64
|
||||
# define struct_dirent struct dirent64
|
||||
# define read_dir readdir64
|
||||
@@ -42,6 +43,7 @@
|
||||
# define fcntl_fd fcntl
|
||||
# define fstat_fd fstat
|
||||
# define strace_stat_t struct stat
|
||||
+# define lstat_file lstat
|
||||
# define stat_file stat
|
||||
# define struct_dirent struct dirent
|
||||
# define read_dir readdir
|
||||
Index: strace-5.18/src/pathtrace.c
|
||||
===================================================================
|
||||
--- strace-5.18.orig/src/pathtrace.c 2022-07-13 12:52:29.405006910 +0200
|
||||
+++ strace-5.18/src/pathtrace.c 2022-07-13 12:52:54.532710356 +0200
|
||||
@@ -10,7 +10,11 @@
|
||||
#include "defs.h"
|
||||
#include <limits.h>
|
||||
#include <poll.h>
|
||||
+#include <sys/stat.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <unistd.h>
|
||||
|
||||
+#include "largefile_wrappers.h"
|
||||
#include "number_set.h"
|
||||
#include "sen.h"
|
||||
#include "xstring.h"
|
||||
@@ -77,7 +81,7 @@
|
||||
* Get path associated with fd of a process with pid.
|
||||
*/
|
||||
int
|
||||
-getfdpath_pid(pid_t pid, int fd, char *buf, unsigned bufsize)
|
||||
+getfdpath_pid(pid_t pid, int fd, char *buf, unsigned bufsize, bool *deleted)
|
||||
{
|
||||
char linkpath[sizeof("/proc/%u/fd/%u") + 2 * sizeof(int)*3];
|
||||
ssize_t n;
|
||||
@@ -91,12 +95,50 @@
|
||||
|
||||
xsprintf(linkpath, "/proc/%u/fd/%u", proc_pid, fd);
|
||||
n = readlink(linkpath, buf, bufsize - 1);
|
||||
+ if (n < 0)
|
||||
+ goto end;
|
||||
+
|
||||
/*
|
||||
* NB: if buf is too small, readlink doesn't fail,
|
||||
* it returns truncated result (IOW: n == bufsize - 1).
|
||||
*/
|
||||
- if (n >= 0)
|
||||
- buf[n] = '\0';
|
||||
+ buf[n] = '\0';
|
||||
+ if (deleted)
|
||||
+ *deleted = false;
|
||||
+
|
||||
+ /*
|
||||
+ * Try to figure out if the kernel has appended " (deleted)"
|
||||
+ * to the end of a potentially unlinked path and set deleted
|
||||
+ * if it is the case.
|
||||
+ */
|
||||
+ static const char del_sfx[] = " (deleted)";
|
||||
+ if ((size_t) n <= sizeof(del_sfx))
|
||||
+ goto end;
|
||||
+
|
||||
+ char *del = buf + n + 1 - sizeof(del_sfx);
|
||||
+
|
||||
+ if (memcmp(del, del_sfx, sizeof(del_sfx)))
|
||||
+ goto end;
|
||||
+
|
||||
+ strace_stat_t st_link;
|
||||
+ strace_stat_t st_path;
|
||||
+ int rc = stat_file(linkpath, &st_link);
|
||||
+
|
||||
+ if (rc)
|
||||
+ goto end;
|
||||
+
|
||||
+ rc = lstat_file(buf, &st_path);
|
||||
+
|
||||
+ if (rc ||
|
||||
+ (st_link.st_ino != st_path.st_ino) ||
|
||||
+ (st_link.st_dev != st_path.st_dev)) {
|
||||
+ *del = '\0';
|
||||
+ n = del - buf + 1;
|
||||
+ if (deleted)
|
||||
+ *deleted = true;
|
||||
+ }
|
||||
+
|
||||
+end:
|
||||
return n;
|
||||
}
|
||||
|
||||
Index: strace-5.18/src/util.c
|
||||
===================================================================
|
||||
--- strace-5.18.orig/src/util.c 2022-07-13 12:52:47.989787575 +0200
|
||||
+++ strace-5.18/src/util.c 2022-07-13 12:52:48.452782111 +0200
|
||||
@@ -735,12 +735,15 @@
|
||||
}
|
||||
|
||||
static void
|
||||
-print_quoted_string_in_angle_brackets(const char *str)
|
||||
+print_quoted_string_in_angle_brackets(const char *str, const bool deleted)
|
||||
{
|
||||
tprints("<");
|
||||
print_quoted_string_ex(str, strlen(str),
|
||||
QUOTE_OMIT_LEADING_TRAILING_QUOTES, "<>");
|
||||
tprints(">");
|
||||
+
|
||||
+ if (deleted)
|
||||
+ tprints("(deleted)");
|
||||
}
|
||||
|
||||
void
|
||||
@@ -749,8 +752,9 @@
|
||||
PRINT_VAL_D(fd);
|
||||
|
||||
char path[PATH_MAX + 1];
|
||||
+ bool deleted;
|
||||
if (pid > 0 && !number_set_array_is_empty(decode_fd_set, 0)
|
||||
- && getfdpath_pid(pid, fd, path, sizeof(path)) >= 0) {
|
||||
+ && getfdpath_pid(pid, fd, path, sizeof(path), &deleted) >= 0) {
|
||||
if (is_number_in_set(DECODE_FD_SOCKET, decode_fd_set) &&
|
||||
printsocket(tcp, fd, path))
|
||||
goto printed;
|
||||
@@ -761,7 +765,7 @@
|
||||
printpidfd(pid, fd, path))
|
||||
goto printed;
|
||||
if (is_number_in_set(DECODE_FD_PATH, decode_fd_set))
|
||||
- print_quoted_string_in_angle_brackets(path);
|
||||
+ print_quoted_string_in_angle_brackets(path, deleted);
|
||||
printed: ;
|
||||
}
|
||||
|
||||
Index: strace-5.18/tests/fchmod.c
|
||||
===================================================================
|
||||
--- strace-5.18.orig/tests/fchmod.c 2022-07-13 12:52:29.405006910 +0200
|
||||
+++ strace-5.18/tests/fchmod.c 2022-07-13 12:52:48.452782111 +0200
|
||||
@@ -35,10 +35,17 @@
|
||||
(void) unlink(sample);
|
||||
int fd = open(sample, O_CREAT|O_RDONLY, 0400);
|
||||
if (fd == -1)
|
||||
- perror_msg_and_fail("open");
|
||||
+ perror_msg_and_fail("open(\"%s\")", sample);
|
||||
+
|
||||
+ static const char sample_del[] = "fchmod_sample_file (deleted)";
|
||||
+ (void) unlink(sample_del);
|
||||
+ int fd_del = open(sample_del, O_CREAT|O_RDONLY, 0400);
|
||||
+ if (fd_del == -1)
|
||||
+ perror_msg_and_fail("open(\"%s\")", sample);
|
||||
|
||||
# ifdef YFLAG
|
||||
char *sample_realpath = get_fd_path(fd);
|
||||
+ char *sample_del_realpath = get_fd_path(fd_del);
|
||||
# endif
|
||||
|
||||
const char *sample_secontext = SECONTEXT_FILE(sample);
|
||||
@@ -56,12 +63,27 @@
|
||||
sample_secontext,
|
||||
sprintrc(rc));
|
||||
|
||||
+ const char *sample_del_secontext = SECONTEXT_FILE(sample_del);
|
||||
+ rc = syscall(__NR_fchmod, fd_del, 0600);
|
||||
+# ifdef YFLAG
|
||||
+ printf("%s%s(%d<%s>%s, 0600) = %s\n",
|
||||
+# else
|
||||
+ printf("%s%s(%d%s, 0600) = %s\n",
|
||||
+# endif
|
||||
+ my_secontext, "fchmod",
|
||||
+ fd_del,
|
||||
+# ifdef YFLAG
|
||||
+ sample_del_realpath,
|
||||
+# endif
|
||||
+ sample_del_secontext,
|
||||
+ sprintrc(rc));
|
||||
+
|
||||
if (unlink(sample))
|
||||
- perror_msg_and_fail("unlink");
|
||||
+ perror_msg_and_fail("unlink(\"%s\")", sample);
|
||||
|
||||
rc = syscall(__NR_fchmod, fd, 051);
|
||||
# ifdef YFLAG
|
||||
- printf("%s%s(%d<%s (deleted)>%s, 051) = %s\n",
|
||||
+ printf("%s%s(%d<%s>(deleted)%s, 051) = %s\n",
|
||||
# else
|
||||
printf("%s%s(%d%s, 051) = %s\n",
|
||||
# endif
|
||||
@@ -73,9 +95,26 @@
|
||||
sample_secontext,
|
||||
sprintrc(rc));
|
||||
|
||||
+ if (unlink(sample_del))
|
||||
+ perror_msg_and_fail("unlink(\"%s\")", sample_del);
|
||||
+
|
||||
+ rc = syscall(__NR_fchmod, fd_del, 051);
|
||||
+# ifdef YFLAG
|
||||
+ printf("%s%s(%d<%s>(deleted)%s, 051) = %s\n",
|
||||
+# else
|
||||
+ printf("%s%s(%d%s, 051) = %s\n",
|
||||
+# endif
|
||||
+ my_secontext, "fchmod",
|
||||
+ fd_del,
|
||||
+# ifdef YFLAG
|
||||
+ sample_del_realpath,
|
||||
+# endif
|
||||
+ sample_del_secontext,
|
||||
+ sprintrc(rc));
|
||||
+
|
||||
rc = syscall(__NR_fchmod, fd, 004);
|
||||
# ifdef YFLAG
|
||||
- printf("%s%s(%d<%s (deleted)>%s, 004) = %s\n",
|
||||
+ printf("%s%s(%d<%s>(deleted)%s, 004) = %s\n",
|
||||
# else
|
||||
printf("%s%s(%d%s, 004) = %s\n",
|
||||
# endif
|
||||
Index: strace-5.18/tests-m32/fchmod.c
|
||||
===================================================================
|
||||
--- strace-5.18.orig/tests-m32/fchmod.c 2022-07-13 12:52:29.405006910 +0200
|
||||
+++ strace-5.18/tests-m32/fchmod.c 2022-07-13 12:52:48.452782111 +0200
|
||||
@@ -35,10 +35,17 @@
|
||||
(void) unlink(sample);
|
||||
int fd = open(sample, O_CREAT|O_RDONLY, 0400);
|
||||
if (fd == -1)
|
||||
- perror_msg_and_fail("open");
|
||||
+ perror_msg_and_fail("open(\"%s\")", sample);
|
||||
+
|
||||
+ static const char sample_del[] = "fchmod_sample_file (deleted)";
|
||||
+ (void) unlink(sample_del);
|
||||
+ int fd_del = open(sample_del, O_CREAT|O_RDONLY, 0400);
|
||||
+ if (fd_del == -1)
|
||||
+ perror_msg_and_fail("open(\"%s\")", sample);
|
||||
|
||||
# ifdef YFLAG
|
||||
char *sample_realpath = get_fd_path(fd);
|
||||
+ char *sample_del_realpath = get_fd_path(fd_del);
|
||||
# endif
|
||||
|
||||
const char *sample_secontext = SECONTEXT_FILE(sample);
|
||||
@@ -56,12 +63,27 @@
|
||||
sample_secontext,
|
||||
sprintrc(rc));
|
||||
|
||||
+ const char *sample_del_secontext = SECONTEXT_FILE(sample_del);
|
||||
+ rc = syscall(__NR_fchmod, fd_del, 0600);
|
||||
+# ifdef YFLAG
|
||||
+ printf("%s%s(%d<%s>%s, 0600) = %s\n",
|
||||
+# else
|
||||
+ printf("%s%s(%d%s, 0600) = %s\n",
|
||||
+# endif
|
||||
+ my_secontext, "fchmod",
|
||||
+ fd_del,
|
||||
+# ifdef YFLAG
|
||||
+ sample_del_realpath,
|
||||
+# endif
|
||||
+ sample_del_secontext,
|
||||
+ sprintrc(rc));
|
||||
+
|
||||
if (unlink(sample))
|
||||
- perror_msg_and_fail("unlink");
|
||||
+ perror_msg_and_fail("unlink(\"%s\")", sample);
|
||||
|
||||
rc = syscall(__NR_fchmod, fd, 051);
|
||||
# ifdef YFLAG
|
||||
- printf("%s%s(%d<%s (deleted)>%s, 051) = %s\n",
|
||||
+ printf("%s%s(%d<%s>(deleted)%s, 051) = %s\n",
|
||||
# else
|
||||
printf("%s%s(%d%s, 051) = %s\n",
|
||||
# endif
|
||||
@@ -73,9 +95,26 @@
|
||||
sample_secontext,
|
||||
sprintrc(rc));
|
||||
|
||||
+ if (unlink(sample_del))
|
||||
+ perror_msg_and_fail("unlink(\"%s\")", sample_del);
|
||||
+
|
||||
+ rc = syscall(__NR_fchmod, fd_del, 051);
|
||||
+# ifdef YFLAG
|
||||
+ printf("%s%s(%d<%s>(deleted)%s, 051) = %s\n",
|
||||
+# else
|
||||
+ printf("%s%s(%d%s, 051) = %s\n",
|
||||
+# endif
|
||||
+ my_secontext, "fchmod",
|
||||
+ fd_del,
|
||||
+# ifdef YFLAG
|
||||
+ sample_del_realpath,
|
||||
+# endif
|
||||
+ sample_del_secontext,
|
||||
+ sprintrc(rc));
|
||||
+
|
||||
rc = syscall(__NR_fchmod, fd, 004);
|
||||
# ifdef YFLAG
|
||||
- printf("%s%s(%d<%s (deleted)>%s, 004) = %s\n",
|
||||
+ printf("%s%s(%d<%s>(deleted)%s, 004) = %s\n",
|
||||
# else
|
||||
printf("%s%s(%d%s, 004) = %s\n",
|
||||
# endif
|
@ -0,0 +1,209 @@
|
||||
From 3f0e5340b651da98251a58cc7923525d69f96032 Mon Sep 17 00:00:00 2001
|
||||
From: Eugene Syromyatnikov <evgsyr@gmail.com>
|
||||
Date: Fri, 1 Jul 2022 10:45:48 +0200
|
||||
Subject: [PATCH] secontext: fix expected SELinux context check for unlinked
|
||||
FDs
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
selinux_getfdcon open-coded a part of getfdpath_pid since it tries
|
||||
to do the same job, figure out a path associated with an FD, for slightly
|
||||
different purpose: to get the expected SELinux context for it. As the previous
|
||||
commit shows, it's a bit more complicated in cases when the path ends
|
||||
with the " (deleted)" string, which is also used for designated unlinked paths
|
||||
in procfs. Otherwise, it may manifest in test failures such as this:
|
||||
|
||||
[unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023] fchmod(4</root/rpmbuild/BUILD/strace-5.13/tests/fchmod-y--secontext_full_mismatch.dir/fchmod_subdir/fchmod_sample_file> [unconfined_u:object_r:admin_home_t:s0!!system_u:object_r:admin_home_t:s0], 0600) = 0
|
||||
-[unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023] fchmod(4</root/rpmbuild/BUILD/strace-5.13/tests/fchmod-y--secontext_full_mismatch.dir/fchmod_subdir/fchmod_sample_file (deleted)> [unconfined_u:object_r:admin_home_t:s0!!system_u:object_r:admin_home_t:s0], 051) = 0
|
||||
-[unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023] fchmod(4</root/rpmbuild/BUILD/strace-5.13/tests/fchmod-y--secontext_full_mismatch.dir/fchmod_subdir/fchmod_sample_file (deleted)> [unconfined_u:object_r:admin_home_t:s0!!system_u:object_r:admin_home_t:s0], 004) = 0
|
||||
+[unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023] fchmod(4</root/rpmbuild/BUILD/strace-5.13/tests/fchmod-y--secontext_full_mismatch.dir/fchmod_subdir/fchmod_sample_file (deleted)> [unconfined_u:object_r:admin_home_t:s0], 051) = 0
|
||||
+[unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023] fchmod(4</root/rpmbuild/BUILD/strace-5.13/tests/fchmod-y--secontext_full_mismatch.dir/fchmod_subdir/fchmod_sample_file (deleted)> [unconfined_u:object_r:admin_home_t:s0], 004) = 0
|
||||
+++ exited with 0 +++
|
||||
+ fail_ '../../src/strace -a15 -y --secontext=full,mismatch -e trace=fchmod ../fchmod-y--secontext_full_mismatch output mismatch'
|
||||
+ warn_ 'fchmod-y--secontext_full_mismatch.gen.test: failed test: ../../src/strace -a15 -y --secontext=full,mismatch -e trace=fchmod ../fchmod-y--secontext_full_mismatch output mismatch'
|
||||
+ printf '%s\n' 'fchmod-y--secontext_full_mismatch.gen.test: failed test: ../../src/strace -a15 -y --secontext=full,mismatch -e trace=fchmod ../fchmod-y--secontext_full_mismatch output mismatch'
|
||||
fchmod-y--secontext_full_mismatch.gen.test: failed test: ../../src/strace -a15 -y --secontext=full,mismatch -e trace=fchmod ../fchmod-y--secontext_full_mismatch output mismatch
|
||||
+ exit 1
|
||||
FAIL fchmod-y--secontext_full_mismatch.gen.test (exit status: 1)
|
||||
|
||||
that happens due to the fact that the get_expected_filecontext() call
|
||||
is made against the path with the " (deleted)" part, which is wrong (it
|
||||
is more wrong than shown above when a file with the path that ends with
|
||||
" (deleted)" exists). Moreover, it would be incorrect to call stat()
|
||||
on that path.
|
||||
|
||||
Let's factor out the common part of the code and simply call it
|
||||
from selinux_getfdcon, then use the st_mode from the procfs link.
|
||||
|
||||
* src/defs.h (get_proc_pid_fd_path): New declaration.
|
||||
* src/pathtrace.c (get)proc_pid_fd_path): New function, part
|
||||
of getfdpath_pid that performs link resolution and processing
|
||||
of the result.
|
||||
(getfdpath_pid): Call get_proc_pid_fd_path after PID resolution.
|
||||
* src/secontext.c (get_expected_filecontext): Add mode parameter, use
|
||||
it in selabel_lookup call instead of retrieveing file mode using stat()
|
||||
if it is not -1.
|
||||
(selinux_getfdcon): Call get_proc_pid_fd_path instead
|
||||
of open-coding path resolution code, call stat() on the procfs link
|
||||
and pass the retrieved st_mode to the get_expected_filecontext call.
|
||||
(selinux_getfilecon): Pass -1 as mode in the get_expected_filecontext
|
||||
call.
|
||||
|
||||
Reported-by: Václav Kadlčík <vkadlcik@redhat.com>
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2087693
|
||||
---
|
||||
src/defs.h | 15 +++++++++++++++
|
||||
src/pathtrace.c | 26 ++++++++++++++++++--------
|
||||
src/secontext.c | 35 +++++++++++++++++++++--------------
|
||||
3 files changed, 54 insertions(+), 22 deletions(-)
|
||||
|
||||
Index: strace-5.18/src/defs.h
|
||||
===================================================================
|
||||
--- strace-5.18.orig/src/defs.h 2022-07-12 18:22:01.563254140 +0200
|
||||
+++ strace-5.18/src/defs.h 2022-07-12 18:22:06.202199392 +0200
|
||||
@@ -785,6 +785,21 @@
|
||||
return pathtrace_match_set(tcp, &global_path_set);
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * Resolves a path for a fd procfs PID proc_pid (the one got from
|
||||
+ * get_proc_pid()).
|
||||
+ *
|
||||
+ * @param proc_pid PID number in /proc, obtained with get_proc_pid().
|
||||
+ * @param fd FD to resolve path for.
|
||||
+ * @param buf Buffer to store the resolved path in.
|
||||
+ * @param bufsize The size of buf.
|
||||
+ * @param deleted If non-NULL, set to true if the path associated with the FD
|
||||
+ * seems to have been unlinked and to false otherwise.
|
||||
+ * @return Number of bytes written including terminating '\0'.
|
||||
+ */
|
||||
+extern int get_proc_pid_fd_path(int proc_pid, int fd, char *buf,
|
||||
+ unsigned bufsize, bool *deleted);
|
||||
+
|
||||
extern int getfdpath_pid(pid_t pid, int fd, char *buf, unsigned bufsize,
|
||||
bool *deleted);
|
||||
|
||||
Index: strace-5.18/src/pathtrace.c
|
||||
===================================================================
|
||||
--- strace-5.18.orig/src/pathtrace.c 2022-07-12 18:22:01.532254506 +0200
|
||||
+++ strace-5.18/src/pathtrace.c 2022-07-12 18:22:06.202199392 +0200
|
||||
@@ -77,11 +77,9 @@
|
||||
set->paths_selected[set->num_selected++] = path;
|
||||
}
|
||||
|
||||
-/*
|
||||
- * Get path associated with fd of a process with pid.
|
||||
- */
|
||||
int
|
||||
-getfdpath_pid(pid_t pid, int fd, char *buf, unsigned bufsize, bool *deleted)
|
||||
+get_proc_pid_fd_path(int proc_pid, int fd, char *buf, unsigned bufsize,
|
||||
+ bool *deleted)
|
||||
{
|
||||
char linkpath[sizeof("/proc/%u/fd/%u") + 2 * sizeof(int)*3];
|
||||
ssize_t n;
|
||||
@@ -89,10 +87,6 @@
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
|
||||
- int proc_pid = get_proc_pid(pid);
|
||||
- if (!proc_pid)
|
||||
- return -1;
|
||||
-
|
||||
xsprintf(linkpath, "/proc/%u/fd/%u", proc_pid, fd);
|
||||
n = readlink(linkpath, buf, bufsize - 1);
|
||||
if (n < 0)
|
||||
@@ -143,6 +137,22 @@
|
||||
}
|
||||
|
||||
/*
|
||||
+ * Get path associated with fd of a process with pid.
|
||||
+ */
|
||||
+int
|
||||
+getfdpath_pid(pid_t pid, int fd, char *buf, unsigned bufsize, bool *deleted)
|
||||
+{
|
||||
+ if (fd < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ int proc_pid = get_proc_pid(pid);
|
||||
+ if (!proc_pid)
|
||||
+ return -1;
|
||||
+
|
||||
+ return get_proc_pid_fd_path(proc_pid, fd, buf, bufsize, deleted);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* Add a path to the set we're tracing. Also add the canonicalized
|
||||
* version of the path. Specifying NULL will delete all paths.
|
||||
*/
|
||||
Index: strace-5.18/src/secontext.c
|
||||
===================================================================
|
||||
--- strace-5.18.orig/src/secontext.c 2022-07-12 18:22:01.564254128 +0200
|
||||
+++ strace-5.18/src/secontext.c 2022-07-12 18:22:06.203199380 +0200
|
||||
@@ -62,7 +62,7 @@
|
||||
}
|
||||
|
||||
static int
|
||||
-get_expected_filecontext(const char *path, char **secontext)
|
||||
+get_expected_filecontext(const char *path, char **secontext, int mode)
|
||||
{
|
||||
static struct selabel_handle *hdl;
|
||||
|
||||
@@ -80,12 +80,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- strace_stat_t stb;
|
||||
- if (stat_file(path, &stb) < 0) {
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- return selabel_lookup(hdl, secontext, path, stb.st_mode);
|
||||
+ return selabel_lookup(hdl, secontext, path, mode);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -130,16 +125,22 @@
|
||||
|
||||
/*
|
||||
* We need to resolve the path, because selabel_lookup() doesn't
|
||||
- * resolve anything. Using readlink() is sufficient here.
|
||||
+ * resolve anything.
|
||||
*/
|
||||
+ char buf[PATH_MAX + 1];
|
||||
+ ssize_t n = get_proc_pid_fd_path(proc_pid, fd, buf, sizeof(buf), NULL);
|
||||
+ if ((size_t) n >= (sizeof(buf) - 1))
|
||||
+ return 0;
|
||||
|
||||
- char buf[PATH_MAX];
|
||||
- ssize_t n = readlink(linkpath, buf, sizeof(buf));
|
||||
- if ((size_t) n >= sizeof(buf))
|
||||
+ /*
|
||||
+ * We retrieve stat() here since the path the procfs link resolves into
|
||||
+ * may be reused by a different file with different context.
|
||||
+ */
|
||||
+ strace_stat_t st;
|
||||
+ if (stat_file(linkpath, &st))
|
||||
return 0;
|
||||
- buf[n] = '\0';
|
||||
|
||||
- get_expected_filecontext(buf, expected);
|
||||
+ get_expected_filecontext(buf, expected, st.st_mode);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -190,7 +191,13 @@
|
||||
if (!resolved)
|
||||
return 0;
|
||||
|
||||
- get_expected_filecontext(resolved, expected);
|
||||
+ strace_stat_t st;
|
||||
+ if (stat_file(resolved, &st) < 0)
|
||||
+ goto out;
|
||||
+
|
||||
+ get_expected_filecontext(resolved, expected, st.st_mode);
|
||||
+
|
||||
+out:
|
||||
free(resolved);
|
||||
|
||||
return 0;
|
70
SOURCES/0182-tests-bpf-fix-sloppy-low-FD-number-usage.patch
Normal file
70
SOURCES/0182-tests-bpf-fix-sloppy-low-FD-number-usage.patch
Normal file
@ -0,0 +1,70 @@
|
||||
From 5338636cd9ae7f53ed73f1a7909db03189ea2ff3 Mon Sep 17 00:00:00 2001
|
||||
From: Eugene Syromyatnikov <evgsyr@gmail.com>
|
||||
Date: Mon, 4 Jul 2022 12:29:22 +0200
|
||||
Subject: [PATCH] tests/bpf: fix sloppy low FD number usage
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
FD 42 can already be opened, so close it. Otherwise, it may lead
|
||||
to the following test failure:
|
||||
|
||||
-bpf(BPF_LINK_CREATE, {link_create={prog_fd=0</dev/full>, target_fd=0</dev/full>, attach_type=BPF_TRACE_ITER, flags=0, iter_info=[{map={map_fd=0</dev/full>}}, {map={map_fd=42}}, {map={map_fd=314159265}}, {map={map_fd=-1159983635}}, {map={map_fd=-1}}], iter_info_len=5}}, 28) = 841540765612359407 (INJECTED)
|
||||
+bpf(BPF_LINK_CREATE, {link_create={prog_fd=0</dev/full>, target_fd=0</dev/full>, attach_type=BPF_TRACE_ITER, flags=0, iter_info=[{map={map_fd=0</dev/full>}}, {map={map_fd=42</var/tmp/restraintd/logs/146893626/task.log>}}, {map={map_fd=314159265}}, {map={map_fd=-1159983635}}, {map={map_fd=-1}}], iter_info_len=5}}, 28) = 841540765612359407 (INJECTED)
|
||||
bpf(BPF_LINK_CREATE, 0x3ff95574fe5, 28) = 841540765612359407 (INJECTED)
|
||||
-bpf(BPF_LINK_CREATE, {link_create={prog_fd=0</dev/full>, target_fd=0</dev/full>, attach_type=BPF_TRACE_ITER, flags=0, iter_info=[{map={map_fd=0</dev/full>}}, {map={map_fd=42}}, {map={map_fd=314159265}}, {map={map_fd=-1159983635}}, {map={map_fd=-1}}, ... /* 0x3ff9555d000 */], iter_info_len=6}}, 28) = 841540765612359407 (INJECTED)
|
||||
+bpf(BPF_LINK_CREATE, {link_create={prog_fd=0</dev/full>, target_fd=0</dev/full>, attach_type=BPF_TRACE_ITER, flags=0, iter_info=[{map={map_fd=0</dev/full>}}, {map={map_fd=42</var/tmp/restraintd/logs/146893626/task.log>}}, {map={map_fd=314159265}}, {map={map_fd=-1159983635}}, {map={map_fd=-1}}, ... /* 0x3ff9555d000 */], iter_info_len=6}}, 28) = 841540765612359407 (INJECTED)
|
||||
[...]
|
||||
FAIL bpf-success-long-y.test (exit status: 1)
|
||||
|
||||
* tests/bpf.c (init_BPF_LINK_CREATE_attr7): Close iter_info_data[1] fd.
|
||||
|
||||
Fixes: v5.18~18 "bpf: improve bpf(BPF_LINK_CREATE) decoding"
|
||||
Reported-by: Lenka Špačková <lkuprova@redhat.com>
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103137
|
||||
---
|
||||
tests/bpf.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/tests/bpf.c b/tests/bpf.c
|
||||
index 82d870e..6c1ffd4 100644
|
||||
--- a/tests/bpf.c
|
||||
+++ b/tests/bpf.c
|
||||
@@ -1557,6 +1557,8 @@ init_BPF_LINK_CREATE_attr7(struct bpf_attr_check *check, size_t idx)
|
||||
{
|
||||
struct BPF_LINK_CREATE_struct *attr = &check->data.BPF_LINK_CREATE_data;
|
||||
|
||||
+ close(iter_info_data[1]);
|
||||
+
|
||||
if (!iter_info_data_p) {
|
||||
iter_info_data_p = tail_memdup(iter_info_data,
|
||||
sizeof(iter_info_data));
|
||||
diff --git a/tests-m32/bpf.c b/tests-m32/bpf.c
|
||||
index 82d870e..6c1ffd4 100644
|
||||
--- a/tests-m32/bpf.c
|
||||
+++ b/tests-m32/bpf.c
|
||||
@@ -1557,6 +1557,8 @@ init_BPF_LINK_CREATE_attr7(struct bpf_attr_check *check, size_t idx)
|
||||
{
|
||||
struct BPF_LINK_CREATE_struct *attr = &check->data.BPF_LINK_CREATE_data;
|
||||
|
||||
+ close(iter_info_data[1]);
|
||||
+
|
||||
if (!iter_info_data_p) {
|
||||
iter_info_data_p = tail_memdup(iter_info_data,
|
||||
sizeof(iter_info_data));
|
||||
diff --git a/tests-mx32/bpf.c b/tests-mx32/bpf.c
|
||||
index 82d870e..6c1ffd4 100644
|
||||
--- a/tests-mx32/bpf.c
|
||||
+++ b/tests-mx32/bpf.c
|
||||
@@ -1557,6 +1557,8 @@ init_BPF_LINK_CREATE_attr7(struct bpf_attr_check *check, size_t idx)
|
||||
{
|
||||
struct BPF_LINK_CREATE_struct *attr = &check->data.BPF_LINK_CREATE_data;
|
||||
|
||||
+ close(iter_info_data[1]);
|
||||
+
|
||||
if (!iter_info_data_p) {
|
||||
iter_info_data_p = tail_memdup(iter_info_data,
|
||||
sizeof(iter_info_data));
|
||||
--
|
||||
2.1.4
|
||||
|
@ -0,0 +1,102 @@
|
||||
From c7e0ea6d712eb214dafe7e9eae57661d9a427ea7 Mon Sep 17 00:00:00 2001
|
||||
From: "Dmitry V. Levin" <ldv@strace.io>
|
||||
Date: Mon, 28 Oct 2024 08:00:00 +0000
|
||||
Subject: [PATCH 183/185] syscall: do not use uninitialized parts of struct
|
||||
ptrace_syscall_info
|
||||
|
||||
* src/syscall.c (ptrace_syscall_info_is_entry,
|
||||
ptrace_syscall_info_is_exit): New functions.
|
||||
(get_scno): Replace ptrace_syscall_info_is_valid() with
|
||||
ptrace_syscall_info_is_entry().
|
||||
(get_error): Replace ptrace_syscall_info_is_valid() with
|
||||
ptrace_syscall_info_is_exit().
|
||||
(get_syscall_regs): Fall back to get_regs() if strace_get_syscall_info()
|
||||
succeeded but couldn't obtain the necessary data.
|
||||
|
||||
Resolves: https://github.com/strace/strace/issues/322
|
||||
---
|
||||
src/syscall.c | 40 +++++++++++++++++++++++++++++++++++-----
|
||||
1 file changed, 35 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/syscall.c b/src/syscall.c
|
||||
index a6692721a..1f4d86dc1 100644
|
||||
--- a/src/syscall.c
|
||||
+++ b/src/syscall.c
|
||||
@@ -1082,6 +1082,21 @@ ptrace_syscall_info_is_valid(void)
|
||||
ptrace_sci.op <= PTRACE_SYSCALL_INFO_SECCOMP;
|
||||
}
|
||||
|
||||
+static bool
|
||||
+ptrace_syscall_info_is_entry(void)
|
||||
+{
|
||||
+ return ptrace_get_syscall_info_supported &&
|
||||
+ (ptrace_sci.op == PTRACE_SYSCALL_INFO_ENTRY ||
|
||||
+ ptrace_sci.op == PTRACE_SYSCALL_INFO_SECCOMP);
|
||||
+}
|
||||
+
|
||||
+static bool
|
||||
+ptrace_syscall_info_is_exit(void)
|
||||
+{
|
||||
+ return ptrace_get_syscall_info_supported &&
|
||||
+ ptrace_sci.op == PTRACE_SYSCALL_INFO_EXIT;
|
||||
+}
|
||||
+
|
||||
#define XLAT_MACROS_ONLY
|
||||
#include "xlat/nt_descriptor_types.h"
|
||||
#undef XLAT_MACROS_ONLY
|
||||
@@ -1376,8 +1391,23 @@ get_syscall_regs(struct tcb *tcp)
|
||||
if (get_regs_error != -1)
|
||||
return get_regs_error;
|
||||
|
||||
- if (ptrace_get_syscall_info_supported)
|
||||
- return strace_get_syscall_info(tcp) ? 0 : get_regs_error;
|
||||
+ if (ptrace_get_syscall_info_supported) {
|
||||
+ if (!strace_get_syscall_info(tcp))
|
||||
+ return get_regs_error;
|
||||
+
|
||||
+ if ((entering(tcp) && ptrace_syscall_info_is_entry()) ||
|
||||
+ (exiting(tcp) && ptrace_syscall_info_is_exit()))
|
||||
+ return 0;
|
||||
+
|
||||
+ /*
|
||||
+ * PTRACE_GET_SYSCALL_INFO succeeded but didn't help,
|
||||
+ * falling back to get_regs().
|
||||
+ *
|
||||
+ * This can happen when get_syscall_regs() is called
|
||||
+ * from startup_tcb() via get_scno().
|
||||
+ */
|
||||
+ debug_func_msg("ptrace_sci.op = %d", ptrace_sci.op);
|
||||
+ }
|
||||
|
||||
return get_regs(tcp);
|
||||
}
|
||||
@@ -1408,7 +1438,7 @@ get_scno(struct tcb *tcp)
|
||||
if (get_syscall_regs(tcp) < 0)
|
||||
return -1;
|
||||
|
||||
- if (ptrace_syscall_info_is_valid()) {
|
||||
+ if (ptrace_syscall_info_is_entry()) {
|
||||
/* Apply arch-specific workarounds. */
|
||||
int rc = arch_check_scno(tcp);
|
||||
if (rc != 1)
|
||||
@@ -1456,7 +1486,7 @@ get_scno(struct tcb *tcp)
|
||||
static int
|
||||
get_syscall_args(struct tcb *tcp)
|
||||
{
|
||||
- if (ptrace_syscall_info_is_valid()) {
|
||||
+ if (ptrace_syscall_info_is_entry()) {
|
||||
const unsigned int n =
|
||||
MIN(ARRAY_SIZE(tcp->u_arg),
|
||||
ARRAY_SIZE(ptrace_sci.entry.args));
|
||||
@@ -1507,7 +1537,7 @@ get_syscall_result(struct tcb *tcp)
|
||||
static void
|
||||
get_error(struct tcb *tcp, const bool check_errno)
|
||||
{
|
||||
- if (ptrace_syscall_info_is_valid()) {
|
||||
+ if (ptrace_syscall_info_is_exit()) {
|
||||
if (ptrace_sci.exit.is_error) {
|
||||
tcp->u_rval = -1;
|
||||
tcp->u_error = -ptrace_sci.exit.rval;
|
||||
--
|
||||
2.13.6
|
||||
|
37
SOURCES/0184-startup_tcb-add-a-comment.patch
Normal file
37
SOURCES/0184-startup_tcb-add-a-comment.patch
Normal file
@ -0,0 +1,37 @@
|
||||
From 2048c136ba6edc4282dbc976c499e038d5b60c03 Mon Sep 17 00:00:00 2001
|
||||
From: "Dmitry V. Levin" <ldv@strace.io>
|
||||
Date: Mon, 28 Oct 2024 08:00:00 +0000
|
||||
Subject: [PATCH 184/185] startup_tcb: add a comment
|
||||
|
||||
* src/strace.c (startup_tcb): Add a comment explaining why it is safe
|
||||
to call get_scno().
|
||||
---
|
||||
src/strace.c | 12 ++++++++++--
|
||||
1 file changed, 10 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/strace.c b/src/strace.c
|
||||
index 45ab48c43..1a9d53bc8 100644
|
||||
--- a/src/strace.c
|
||||
+++ b/src/strace.c
|
||||
@@ -3549,8 +3549,16 @@ startup_tcb(struct tcb *tcp)
|
||||
}
|
||||
}
|
||||
|
||||
- if ((tcp->flags & TCB_GRABBED) && (get_scno(tcp) == 1))
|
||||
- tcp->s_prev_ent = tcp->s_ent;
|
||||
+ if (tcp->flags & TCB_GRABBED) {
|
||||
+ /*
|
||||
+ * There is no guarantee the state of the tracee is such that
|
||||
+ * would allow get_scno() to obtain meaningful information.
|
||||
+ * However, if the tracee is not in a syscall, then the garbage
|
||||
+ * obtained by get_scno() is not going to be used.
|
||||
+ */
|
||||
+ if (get_scno(tcp) == 1)
|
||||
+ tcp->s_prev_ent = tcp->s_ent;
|
||||
+ }
|
||||
|
||||
if (cflag) {
|
||||
tcp->atime = tcp->stime;
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,129 @@
|
||||
From 3bf08cbb388a89014252bdfe5143324bdaa4dc46 Mon Sep 17 00:00:00 2001
|
||||
From: "Dmitry V. Levin" <ldv@strace.io>
|
||||
Date: Mon, 28 Oct 2024 08:00:00 +0000
|
||||
Subject: [PATCH 185/185] tests: add another test of restart_syscall decoding
|
||||
|
||||
* tests/restart_syscall-p.test: New test.
|
||||
* tests/restart_syscall-p.expected: New file.
|
||||
* tests/Makefile.am (DECODER_TESTS): Add restart_syscall-p.test.
|
||||
(check_DATA): Add restart_syscall-p.expected.
|
||||
---
|
||||
tests/Makefile.am | 2 ++
|
||||
tests/restart_syscall-p.expected | 2 ++
|
||||
tests/restart_syscall-p.test | 20 ++++++++++++++++++++
|
||||
3 files changed, 24 insertions(+)
|
||||
create mode 100644 tests/restart_syscall-p.expected
|
||||
create mode 100755 tests/restart_syscall-p.test
|
||||
|
||||
Index: strace-5.18/tests/Makefile.am
|
||||
===================================================================
|
||||
--- strace-5.18.orig/tests/Makefile.am 2022-06-17 13:45:22.000000000 +0200
|
||||
+++ strace-5.18/tests/Makefile.am 2024-11-01 14:29:01.292879707 +0100
|
||||
@@ -499,6 +499,7 @@
|
||||
prctl-seccomp-strict.test \
|
||||
qual_fault-exit_group.test \
|
||||
readv.test \
|
||||
+ restart_syscall-p.test \
|
||||
rt_sigaction.test \
|
||||
scm_rights-fd.test \
|
||||
seccomp-strict.test \
|
||||
@@ -675,6 +676,7 @@
|
||||
qualify_personality_empty.in \
|
||||
quotactl.h \
|
||||
regex.in \
|
||||
+ restart_syscall-p.expected \
|
||||
rt_sigaction.awk \
|
||||
run.sh \
|
||||
sched.in \
|
||||
Index: strace-5.18/tests/restart_syscall-p.expected
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ strace-5.18/tests/restart_syscall-p.expected 2024-11-01 14:29:01.292879707 +0100
|
||||
@@ -0,0 +1,2 @@
|
||||
+restart_syscall(<... resuming interrupted nanosleep ...>) = 0
|
||||
+exit_group(0) = ?
|
||||
Index: strace-5.18/tests/restart_syscall-p.test
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ strace-5.18/tests/restart_syscall-p.test 2024-11-01 14:29:01.292879707 +0100
|
||||
@@ -0,0 +1,20 @@
|
||||
+#!/bin/sh
|
||||
+#
|
||||
+# Check restart_syscall decoding.
|
||||
+#
|
||||
+# Copyright (c) 2015-2024 The strace developers.
|
||||
+# All rights reserved.
|
||||
+#
|
||||
+# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
+
|
||||
+. "${srcdir=.}/init.sh"
|
||||
+
|
||||
+run_prog ../sleep 0
|
||||
+
|
||||
+../set_ptracer_any ../sleep 2 > /dev/null &
|
||||
+tracee_pid=$!
|
||||
+
|
||||
+../sleep 1
|
||||
+
|
||||
+run_strace -qq -a14 -p $tracee_pid
|
||||
+match_diff
|
||||
Index: strace-5.18/tests-m32/Makefile.in
|
||||
===================================================================
|
||||
--- strace-5.18.orig/tests-m32/Makefile.in 2022-06-18 20:33:58.000000000 +0200
|
||||
+++ strace-5.18/tests-m32/Makefile.in 2024-11-01 14:29:01.295879673 +0100
|
||||
@@ -9232,6 +9232,7 @@
|
||||
prctl-seccomp-strict.test \
|
||||
qual_fault-exit_group.test \
|
||||
readv.test \
|
||||
+ restart_syscall-p.test \
|
||||
rt_sigaction.test \
|
||||
scm_rights-fd.test \
|
||||
seccomp-strict.test \
|
||||
@@ -9403,6 +9404,7 @@
|
||||
qualify_personality_empty.in \
|
||||
quotactl.h \
|
||||
regex.in \
|
||||
+ restart_syscall-p.expected \
|
||||
rt_sigaction.awk \
|
||||
run.sh \
|
||||
sched.in \
|
||||
Index: strace-5.18/tests-mx32/Makefile.in
|
||||
===================================================================
|
||||
--- strace-5.18.orig/tests-mx32/Makefile.in 2022-06-18 20:33:58.000000000 +0200
|
||||
+++ strace-5.18/tests-mx32/Makefile.in 2024-11-01 14:29:01.297879650 +0100
|
||||
@@ -9232,6 +9232,7 @@
|
||||
prctl-seccomp-strict.test \
|
||||
qual_fault-exit_group.test \
|
||||
readv.test \
|
||||
+ restart_syscall-p.test \
|
||||
rt_sigaction.test \
|
||||
scm_rights-fd.test \
|
||||
seccomp-strict.test \
|
||||
@@ -9403,6 +9404,7 @@
|
||||
qualify_personality_empty.in \
|
||||
quotactl.h \
|
||||
regex.in \
|
||||
+ restart_syscall-p.expected \
|
||||
rt_sigaction.awk \
|
||||
run.sh \
|
||||
sched.in \
|
||||
Index: strace-5.18/tests/Makefile.in
|
||||
===================================================================
|
||||
--- strace-5.18.orig/tests/Makefile.in 2022-06-18 20:33:59.000000000 +0200
|
||||
+++ strace-5.18/tests/Makefile.in 2024-11-01 14:29:01.299879628 +0100
|
||||
@@ -9231,6 +9231,7 @@
|
||||
prctl-seccomp-strict.test \
|
||||
qual_fault-exit_group.test \
|
||||
readv.test \
|
||||
+ restart_syscall-p.test \
|
||||
rt_sigaction.test \
|
||||
scm_rights-fd.test \
|
||||
seccomp-strict.test \
|
||||
@@ -9402,6 +9403,7 @@
|
||||
qualify_personality_empty.in \
|
||||
quotactl.h \
|
||||
regex.in \
|
||||
+ restart_syscall-p.expected \
|
||||
rt_sigaction.awk \
|
||||
run.sh \
|
||||
sched.in \
|
108
SOURCES/0186-tests-workaround-net-yy-inet-for-new-kernels.patch
Normal file
108
SOURCES/0186-tests-workaround-net-yy-inet-for-new-kernels.patch
Normal file
@ -0,0 +1,108 @@
|
||||
From e9d784ecd3ef0c5af9f8c74a830e797d773d71cb Mon Sep 17 00:00:00 2001
|
||||
From: "Dmitry V. Levin" <ldv@strace.io>
|
||||
Date: Sun, 21 Apr 2024 08:00:00 +0000
|
||||
Subject: [PATCH] tests: workaround net-yy-inet* for new kernels
|
||||
|
||||
Starting with Linux kernel commit v6.8-rc1~131^2~223, NETLINK_INET_DIAG
|
||||
works also for bound-only sockets. As there is no easy way to tell
|
||||
whether the running kernel contains that commit, the test cannot easily
|
||||
predict the kernel behavior in case of sockets in bound-only state.
|
||||
Workaround this by skipping the corresponding part of the test.
|
||||
|
||||
* tests/net-yy-inet.test: Filter out listen() calls.
|
||||
* tests/net-yy-inet.c (main): Do not print expected output for listen()
|
||||
syscall.
|
||||
|
||||
Resolves: https://github.com/strace/strace/issues/299
|
||||
---
|
||||
tests/net-yy-inet.c | 2 --
|
||||
tests/net-yy-inet.test | 6 +++++-
|
||||
2 files changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/tests/net-yy-inet.c b/tests/net-yy-inet.c
|
||||
index 1a83548bf..7f8e05783 100644
|
||||
--- a/tests/net-yy-inet.c
|
||||
+++ b/tests/net-yy-inet.c
|
||||
@@ -63,8 +63,6 @@ main(void)
|
||||
|
||||
if (listen(listen_fd, 1))
|
||||
perror_msg_and_skip("listen");
|
||||
- printf("listen(%d<" TCP_STR ":[%lu]>, 1) = 0\n",
|
||||
- listen_fd, listen_inode);
|
||||
|
||||
memset(listen_sa, 0, sizeof(addr));
|
||||
*len = sizeof(addr);
|
||||
diff --git a/tests/net-yy-inet.test b/tests/net-yy-inet.test
|
||||
index 9a3f851bf..d45414bcb 100755
|
||||
--- a/tests/net-yy-inet.test
|
||||
+++ b/tests/net-yy-inet.test
|
||||
@@ -17,5 +17,9 @@ run_prog > /dev/null
|
||||
run_strace -a22 -yy -eclose,network $args > "$EXP"
|
||||
|
||||
# Filter out close() calls made by ld.so and libc.
|
||||
-sed -n '/socket/,$p' < "$LOG" > "$OUT"
|
||||
+#
|
||||
+# Filter out listen() call as we cannot easily predict the kernel
|
||||
+# behaviour because there is no easy way to tell whether the Linux kernel
|
||||
+# contains commit v6.8-rc1~131^2~223.
|
||||
+sed -n '/^listen/d;/^socket/,$p' < "$LOG" > "$OUT"
|
||||
match_diff "$OUT" "$EXP"
|
||||
diff --git a/tests-m32/net-yy-inet.c b/tests-m32/net-yy-inet.c
|
||||
index 1a83548bf..7f8e05783 100644
|
||||
--- a/tests-m32/net-yy-inet.c
|
||||
+++ b/tests-m32/net-yy-inet.c
|
||||
@@ -63,8 +63,6 @@ main(void)
|
||||
|
||||
if (listen(listen_fd, 1))
|
||||
perror_msg_and_skip("listen");
|
||||
- printf("listen(%d<" TCP_STR ":[%lu]>, 1) = 0\n",
|
||||
- listen_fd, listen_inode);
|
||||
|
||||
memset(listen_sa, 0, sizeof(addr));
|
||||
*len = sizeof(addr);
|
||||
diff --git a/tests-m32/net-yy-inet.test b/tests-m32/net-yy-inet.test
|
||||
index 9a3f851bf..d45414bcb 100755
|
||||
--- a/tests-m32/net-yy-inet.test
|
||||
+++ b/tests-m32/net-yy-inet.test
|
||||
@@ -17,5 +17,9 @@ run_prog > /dev/null
|
||||
run_strace -a22 -yy -eclose,network $args > "$EXP"
|
||||
|
||||
# Filter out close() calls made by ld.so and libc.
|
||||
-sed -n '/socket/,$p' < "$LOG" > "$OUT"
|
||||
+#
|
||||
+# Filter out listen() call as we cannot easily predict the kernel
|
||||
+# behaviour because there is no easy way to tell whether the Linux kernel
|
||||
+# contains commit v6.8-rc1~131^2~223.
|
||||
+sed -n '/^listen/d;/^socket/,$p' < "$LOG" > "$OUT"
|
||||
match_diff "$OUT" "$EXP"
|
||||
diff --git a/tests-mx32/net-yy-inet.c b/tests-mx32/net-yy-inet.c
|
||||
index 1a83548bf..7f8e05783 100644
|
||||
--- a/tests-mx32/net-yy-inet.c
|
||||
+++ b/tests-mx32/net-yy-inet.c
|
||||
@@ -63,8 +63,6 @@ main(void)
|
||||
|
||||
if (listen(listen_fd, 1))
|
||||
perror_msg_and_skip("listen");
|
||||
- printf("listen(%d<" TCP_STR ":[%lu]>, 1) = 0\n",
|
||||
- listen_fd, listen_inode);
|
||||
|
||||
memset(listen_sa, 0, sizeof(addr));
|
||||
*len = sizeof(addr);
|
||||
diff --git a/tests-mx32/net-yy-inet.test b/tests-mx32/net-yy-inet.test
|
||||
index 9a3f851bf..d45414bcb 100755
|
||||
--- a/tests-mx32/net-yy-inet.test
|
||||
+++ b/tests-mx32/net-yy-inet.test
|
||||
@@ -17,5 +17,9 @@ run_prog > /dev/null
|
||||
run_strace -a22 -yy -eclose,network $args > "$EXP"
|
||||
|
||||
# Filter out close() calls made by ld.so and libc.
|
||||
-sed -n '/socket/,$p' < "$LOG" > "$OUT"
|
||||
+#
|
||||
+# Filter out listen() call as we cannot easily predict the kernel
|
||||
+# behaviour because there is no easy way to tell whether the Linux kernel
|
||||
+# contains commit v6.8-rc1~131^2~223.
|
||||
+sed -n '/^listen/d;/^socket/,$p' < "$LOG" > "$OUT"
|
||||
match_diff "$OUT" "$EXP"
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,530 @@
|
||||
From 660186018897b386fb05d7951aec57a81211a1a4 Mon Sep 17 00:00:00 2001
|
||||
From: Eugene Syromyatnikov <evgsyr@gmail.com>
|
||||
Date: Wed, 21 Aug 2024 15:32:42 +0200
|
||||
Subject: [PATCH] tests: avoid linkat--secontext_mismatch failures on
|
||||
setfilecon errors
|
||||
|
||||
linkat--secontext_mismatch can fail if setfilecon cannot update SELinux
|
||||
context (for example, that happens when the test is run under
|
||||
an unprivileged user and tries to change the type to unconfined_t).
|
||||
Avoid it by actually checking the return code and skipping the test
|
||||
if there are errors reported by reset_secontext_file
|
||||
or update_secontext_field calls.
|
||||
|
||||
* tests/secontext.h: Include <errno.h>.
|
||||
(reset_secontext_file, update_secontext_field): Change the return type
|
||||
from void to int.
|
||||
[!(TEST_SECONTEXT && HAVE_SELINUX_RUNTIME)] (reset_secontext_file,
|
||||
update_secontext_field): Return -ENOSYS.
|
||||
* tests/secontext.c: (reset_secontext_file): Change the return type
|
||||
to int; save the setfilecon return value to ret and reset it to -errno
|
||||
if the latter is non-zero; return ret.
|
||||
(update_secontext_field): Change the return type to int; return -1
|
||||
if ctx is NULL; save the setfilecon return value to ret and reset
|
||||
it to -errno if the latter is non-zero; return ret.
|
||||
* tests/linkat.c: Include "xlat.h".
|
||||
(secontext_types_data, secontext_types): New constants.
|
||||
(mangle_secontext_field): Store the new field value in the new variable;
|
||||
store the update_secontext_field return value to the ret variable, error
|
||||
and skip if it is non-zero.
|
||||
(main): Error and skip if reset_secontext_file returns non-zero.
|
||||
|
||||
Reported-by: Edjunior Machado <emachado@redhat.com>
|
||||
---
|
||||
tests/linkat.c | 34 ++++++++++++++++++++++++++++++----
|
||||
tests/secontext.c | 19 ++++++++++++++-----
|
||||
tests/secontext.h | 14 +++++++++-----
|
||||
3 files changed, 53 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/tests/linkat.c b/tests/linkat.c
|
||||
index 1d0ee3c9f..832392ca0 100644
|
||||
--- a/tests/linkat.c
|
||||
+++ b/tests/linkat.c
|
||||
@@ -19,8 +19,20 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "secontext.h"
|
||||
+#include "xlat.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
+struct xlat_data secontext_types_data[] = {
|
||||
+ [SECONTEXT_USER] = XLAT_PAIR(SECONTEXT_USER, "user"),
|
||||
+ [SECONTEXT_ROLE] = XLAT_PAIR(SECONTEXT_ROLE, "role"),
|
||||
+ [SECONTEXT_TYPE] = XLAT_PAIR(SECONTEXT_TYPE, "type"),
|
||||
+};
|
||||
+struct xlat secontext_types = {
|
||||
+ .data = secontext_types_data,
|
||||
+ .size = ARRAY_SIZE(secontext_types_data),
|
||||
+ .type = XT_INDEXED,
|
||||
+};
|
||||
+
|
||||
static void
|
||||
mangle_secontext_field(const char *path, enum secontext_field field,
|
||||
const char *new_val, const char *fallback_val)
|
||||
@@ -29,10 +41,18 @@ mangle_secontext_field(const char *path, enum secontext_field field,
|
||||
if (!orig)
|
||||
return;
|
||||
|
||||
- update_secontext_field(path, field,
|
||||
- strcmp(new_val, orig) ? new_val : fallback_val);
|
||||
+ const char *new = strcmp(new_val, orig) ? new_val : fallback_val;
|
||||
|
||||
free(orig);
|
||||
+
|
||||
+ int ret = update_secontext_field(path, field, new);
|
||||
+ if (ret) {
|
||||
+ error_msg_and_skip("Failed to mangle secontext %s for "
|
||||
+ "'%s' to %s: %d",
|
||||
+ sprintxval_abbrev(&secontext_types, field,
|
||||
+ "SECONTEXT_???"),
|
||||
+ path, new, ret);
|
||||
+ }
|
||||
}
|
||||
|
||||
int
|
||||
@@ -103,8 +123,14 @@ main(void)
|
||||
if (close(fd_sample_2))
|
||||
perror_msg_and_fail("close");
|
||||
|
||||
- if (*sample_1_secontext && strstr(sample_1_secontext, "!!"))
|
||||
- reset_secontext_file(sample_1);
|
||||
+ if (*sample_1_secontext && strstr(sample_1_secontext, "!!")) {
|
||||
+ int ret;
|
||||
+ if ((ret = reset_secontext_file(sample_1))) {
|
||||
+ errno = -ret;
|
||||
+ perror_msg_and_skip("Reset secontext for '%s'",
|
||||
+ sample_1);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
free(sample_1_secontext);
|
||||
|
||||
diff --git a/tests/secontext.c b/tests/secontext.c
|
||||
index 84c682869..a0463c467 100644
|
||||
--- a/tests/secontext.c
|
||||
+++ b/tests/secontext.c
|
||||
@@ -284,14 +284,19 @@ secontext_short_pid(pid_t pid)
|
||||
return FORMAT_SPACE_AFTER(raw_secontext_short_pid(pid));
|
||||
}
|
||||
|
||||
-void reset_secontext_file(const char *file)
|
||||
+int
|
||||
+reset_secontext_file(const char *file)
|
||||
{
|
||||
char *proper_ctx = raw_expected_secontext_full_file(file);
|
||||
- (void) setfilecon(file, proper_ctx);
|
||||
+ int ret = setfilecon(file, proper_ctx);
|
||||
+ if (ret && errno)
|
||||
+ ret = -errno;
|
||||
free(proper_ctx);
|
||||
+
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
-void
|
||||
+int
|
||||
update_secontext_field(const char *file, enum secontext_field field,
|
||||
const char *newvalue)
|
||||
{
|
||||
@@ -300,7 +305,7 @@ update_secontext_field(const char *file, enum secontext_field field,
|
||||
|
||||
char *ctx = raw_secontext_full_file(file);
|
||||
if (ctx == NULL)
|
||||
- return;
|
||||
+ return -1;
|
||||
|
||||
char *saveptr = NULL;
|
||||
char *token;
|
||||
@@ -319,11 +324,15 @@ update_secontext_field(const char *file, enum secontext_field field,
|
||||
char *newcontext = xasprintf("%s:%s:%s:%s", split[0], split[1],
|
||||
split[2], split[3]);
|
||||
|
||||
- (void) setfilecon(file, newcontext);
|
||||
+ int ret = setfilecon(file, newcontext);
|
||||
+ if (ret && errno)
|
||||
+ ret = -errno;
|
||||
|
||||
free(newcontext);
|
||||
free(ctx);
|
||||
errno = saved_errno;
|
||||
+
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
#endif /* HAVE_SELINUX_RUNTIME */
|
||||
diff --git a/tests/secontext.h b/tests/secontext.h
|
||||
index b5bba2272..dab33e6a5 100644
|
||||
--- a/tests/secontext.h
|
||||
+++ b/tests/secontext.h
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "tests.h"
|
||||
#include "xmalloc.h"
|
||||
+
|
||||
+#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
char *secontext_full_fd(int) ATTRIBUTE_MALLOC;
|
||||
@@ -35,10 +37,10 @@ char *get_secontext_field(const char *full_context, enum secontext_field field);
|
||||
char *get_secontext_field_fd(int fd, enum secontext_field field);
|
||||
char *get_secontext_field_file(const char *file, enum secontext_field field);
|
||||
|
||||
-void reset_secontext_file(const char *file);
|
||||
+int reset_secontext_file(const char *file);
|
||||
|
||||
-void update_secontext_field(const char *file, enum secontext_field field,
|
||||
- const char *newvalue);
|
||||
+int update_secontext_field(const char *file, enum secontext_field field,
|
||||
+ const char *newvalue);
|
||||
|
||||
# ifdef PRINT_SECONTEXT_FULL
|
||||
|
||||
@@ -81,15 +83,17 @@ get_secontext_field_file(const char *file, enum secontext_field field)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-static inline void
|
||||
+static inline int
|
||||
reset_secontext_file(const char *file)
|
||||
{
|
||||
+ return -ENOSYS;
|
||||
}
|
||||
|
||||
-static inline void
|
||||
+static inline int
|
||||
update_secontext_field(const char *file, enum secontext_field field,
|
||||
const char *newvalue)
|
||||
{
|
||||
+ return -ENOSYS;
|
||||
}
|
||||
|
||||
# define SECONTEXT_FD(fd) xstrdup("")
|
||||
diff --git a/tests-m32/linkat.c b/tests-m32/linkat.c
|
||||
index 1d0ee3c9f..832392ca0 100644
|
||||
--- a/tests-m32/linkat.c
|
||||
+++ b/tests-m32/linkat.c
|
||||
@@ -19,8 +19,20 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "secontext.h"
|
||||
+#include "xlat.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
+struct xlat_data secontext_types_data[] = {
|
||||
+ [SECONTEXT_USER] = XLAT_PAIR(SECONTEXT_USER, "user"),
|
||||
+ [SECONTEXT_ROLE] = XLAT_PAIR(SECONTEXT_ROLE, "role"),
|
||||
+ [SECONTEXT_TYPE] = XLAT_PAIR(SECONTEXT_TYPE, "type"),
|
||||
+};
|
||||
+struct xlat secontext_types = {
|
||||
+ .data = secontext_types_data,
|
||||
+ .size = ARRAY_SIZE(secontext_types_data),
|
||||
+ .type = XT_INDEXED,
|
||||
+};
|
||||
+
|
||||
static void
|
||||
mangle_secontext_field(const char *path, enum secontext_field field,
|
||||
const char *new_val, const char *fallback_val)
|
||||
@@ -29,10 +41,18 @@ mangle_secontext_field(const char *path, enum secontext_field field,
|
||||
if (!orig)
|
||||
return;
|
||||
|
||||
- update_secontext_field(path, field,
|
||||
- strcmp(new_val, orig) ? new_val : fallback_val);
|
||||
+ const char *new = strcmp(new_val, orig) ? new_val : fallback_val;
|
||||
|
||||
free(orig);
|
||||
+
|
||||
+ int ret = update_secontext_field(path, field, new);
|
||||
+ if (ret) {
|
||||
+ error_msg_and_skip("Failed to mangle secontext %s for "
|
||||
+ "'%s' to %s: %d",
|
||||
+ sprintxval_abbrev(&secontext_types, field,
|
||||
+ "SECONTEXT_???"),
|
||||
+ path, new, ret);
|
||||
+ }
|
||||
}
|
||||
|
||||
int
|
||||
@@ -103,8 +123,14 @@ main(void)
|
||||
if (close(fd_sample_2))
|
||||
perror_msg_and_fail("close");
|
||||
|
||||
- if (*sample_1_secontext && strstr(sample_1_secontext, "!!"))
|
||||
- reset_secontext_file(sample_1);
|
||||
+ if (*sample_1_secontext && strstr(sample_1_secontext, "!!")) {
|
||||
+ int ret;
|
||||
+ if ((ret = reset_secontext_file(sample_1))) {
|
||||
+ errno = -ret;
|
||||
+ perror_msg_and_skip("Reset secontext for '%s'",
|
||||
+ sample_1);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
free(sample_1_secontext);
|
||||
|
||||
diff --git a/tests-m32/secontext.c b/tests-m32/secontext.c
|
||||
index 84c682869..a0463c467 100644
|
||||
--- a/tests-m32/secontext.c
|
||||
+++ b/tests-m32/secontext.c
|
||||
@@ -284,14 +284,19 @@ secontext_short_pid(pid_t pid)
|
||||
return FORMAT_SPACE_AFTER(raw_secontext_short_pid(pid));
|
||||
}
|
||||
|
||||
-void reset_secontext_file(const char *file)
|
||||
+int
|
||||
+reset_secontext_file(const char *file)
|
||||
{
|
||||
char *proper_ctx = raw_expected_secontext_full_file(file);
|
||||
- (void) setfilecon(file, proper_ctx);
|
||||
+ int ret = setfilecon(file, proper_ctx);
|
||||
+ if (ret && errno)
|
||||
+ ret = -errno;
|
||||
free(proper_ctx);
|
||||
+
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
-void
|
||||
+int
|
||||
update_secontext_field(const char *file, enum secontext_field field,
|
||||
const char *newvalue)
|
||||
{
|
||||
@@ -300,7 +305,7 @@ update_secontext_field(const char *file, enum secontext_field field,
|
||||
|
||||
char *ctx = raw_secontext_full_file(file);
|
||||
if (ctx == NULL)
|
||||
- return;
|
||||
+ return -1;
|
||||
|
||||
char *saveptr = NULL;
|
||||
char *token;
|
||||
@@ -319,11 +324,15 @@ update_secontext_field(const char *file, enum secontext_field field,
|
||||
char *newcontext = xasprintf("%s:%s:%s:%s", split[0], split[1],
|
||||
split[2], split[3]);
|
||||
|
||||
- (void) setfilecon(file, newcontext);
|
||||
+ int ret = setfilecon(file, newcontext);
|
||||
+ if (ret && errno)
|
||||
+ ret = -errno;
|
||||
|
||||
free(newcontext);
|
||||
free(ctx);
|
||||
errno = saved_errno;
|
||||
+
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
#endif /* HAVE_SELINUX_RUNTIME */
|
||||
diff --git a/tests-m32/secontext.h b/tests-m32/secontext.h
|
||||
index b5bba2272..dab33e6a5 100644
|
||||
--- a/tests-m32/secontext.h
|
||||
+++ b/tests-m32/secontext.h
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "tests.h"
|
||||
#include "xmalloc.h"
|
||||
+
|
||||
+#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
char *secontext_full_fd(int) ATTRIBUTE_MALLOC;
|
||||
@@ -35,10 +37,10 @@ char *get_secontext_field(const char *full_context, enum secontext_field field);
|
||||
char *get_secontext_field_fd(int fd, enum secontext_field field);
|
||||
char *get_secontext_field_file(const char *file, enum secontext_field field);
|
||||
|
||||
-void reset_secontext_file(const char *file);
|
||||
+int reset_secontext_file(const char *file);
|
||||
|
||||
-void update_secontext_field(const char *file, enum secontext_field field,
|
||||
- const char *newvalue);
|
||||
+int update_secontext_field(const char *file, enum secontext_field field,
|
||||
+ const char *newvalue);
|
||||
|
||||
# ifdef PRINT_SECONTEXT_FULL
|
||||
|
||||
@@ -81,15 +83,17 @@ get_secontext_field_file(const char *file, enum secontext_field field)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-static inline void
|
||||
+static inline int
|
||||
reset_secontext_file(const char *file)
|
||||
{
|
||||
+ return -ENOSYS;
|
||||
}
|
||||
|
||||
-static inline void
|
||||
+static inline int
|
||||
update_secontext_field(const char *file, enum secontext_field field,
|
||||
const char *newvalue)
|
||||
{
|
||||
+ return -ENOSYS;
|
||||
}
|
||||
|
||||
# define SECONTEXT_FD(fd) xstrdup("")
|
||||
diff --git a/tests-mx32/linkat.c b/tests-mx32/linkat.c
|
||||
index 1d0ee3c9f..832392ca0 100644
|
||||
--- a/tests-mx32/linkat.c
|
||||
+++ b/tests-mx32/linkat.c
|
||||
@@ -19,8 +19,20 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "secontext.h"
|
||||
+#include "xlat.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
+struct xlat_data secontext_types_data[] = {
|
||||
+ [SECONTEXT_USER] = XLAT_PAIR(SECONTEXT_USER, "user"),
|
||||
+ [SECONTEXT_ROLE] = XLAT_PAIR(SECONTEXT_ROLE, "role"),
|
||||
+ [SECONTEXT_TYPE] = XLAT_PAIR(SECONTEXT_TYPE, "type"),
|
||||
+};
|
||||
+struct xlat secontext_types = {
|
||||
+ .data = secontext_types_data,
|
||||
+ .size = ARRAY_SIZE(secontext_types_data),
|
||||
+ .type = XT_INDEXED,
|
||||
+};
|
||||
+
|
||||
static void
|
||||
mangle_secontext_field(const char *path, enum secontext_field field,
|
||||
const char *new_val, const char *fallback_val)
|
||||
@@ -29,10 +41,18 @@ mangle_secontext_field(const char *path, enum secontext_field field,
|
||||
if (!orig)
|
||||
return;
|
||||
|
||||
- update_secontext_field(path, field,
|
||||
- strcmp(new_val, orig) ? new_val : fallback_val);
|
||||
+ const char *new = strcmp(new_val, orig) ? new_val : fallback_val;
|
||||
|
||||
free(orig);
|
||||
+
|
||||
+ int ret = update_secontext_field(path, field, new);
|
||||
+ if (ret) {
|
||||
+ error_msg_and_skip("Failed to mangle secontext %s for "
|
||||
+ "'%s' to %s: %d",
|
||||
+ sprintxval_abbrev(&secontext_types, field,
|
||||
+ "SECONTEXT_???"),
|
||||
+ path, new, ret);
|
||||
+ }
|
||||
}
|
||||
|
||||
int
|
||||
@@ -103,8 +123,14 @@ main(void)
|
||||
if (close(fd_sample_2))
|
||||
perror_msg_and_fail("close");
|
||||
|
||||
- if (*sample_1_secontext && strstr(sample_1_secontext, "!!"))
|
||||
- reset_secontext_file(sample_1);
|
||||
+ if (*sample_1_secontext && strstr(sample_1_secontext, "!!")) {
|
||||
+ int ret;
|
||||
+ if ((ret = reset_secontext_file(sample_1))) {
|
||||
+ errno = -ret;
|
||||
+ perror_msg_and_skip("Reset secontext for '%s'",
|
||||
+ sample_1);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
free(sample_1_secontext);
|
||||
|
||||
diff --git a/tests-mx32/secontext.c b/tests-mx32/secontext.c
|
||||
index 84c682869..a0463c467 100644
|
||||
--- a/tests-mx32/secontext.c
|
||||
+++ b/tests-mx32/secontext.c
|
||||
@@ -284,14 +284,19 @@ secontext_short_pid(pid_t pid)
|
||||
return FORMAT_SPACE_AFTER(raw_secontext_short_pid(pid));
|
||||
}
|
||||
|
||||
-void reset_secontext_file(const char *file)
|
||||
+int
|
||||
+reset_secontext_file(const char *file)
|
||||
{
|
||||
char *proper_ctx = raw_expected_secontext_full_file(file);
|
||||
- (void) setfilecon(file, proper_ctx);
|
||||
+ int ret = setfilecon(file, proper_ctx);
|
||||
+ if (ret && errno)
|
||||
+ ret = -errno;
|
||||
free(proper_ctx);
|
||||
+
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
-void
|
||||
+int
|
||||
update_secontext_field(const char *file, enum secontext_field field,
|
||||
const char *newvalue)
|
||||
{
|
||||
@@ -300,7 +305,7 @@ update_secontext_field(const char *file, enum secontext_field field,
|
||||
|
||||
char *ctx = raw_secontext_full_file(file);
|
||||
if (ctx == NULL)
|
||||
- return;
|
||||
+ return -1;
|
||||
|
||||
char *saveptr = NULL;
|
||||
char *token;
|
||||
@@ -319,11 +324,15 @@ update_secontext_field(const char *file, enum secontext_field field,
|
||||
char *newcontext = xasprintf("%s:%s:%s:%s", split[0], split[1],
|
||||
split[2], split[3]);
|
||||
|
||||
- (void) setfilecon(file, newcontext);
|
||||
+ int ret = setfilecon(file, newcontext);
|
||||
+ if (ret && errno)
|
||||
+ ret = -errno;
|
||||
|
||||
free(newcontext);
|
||||
free(ctx);
|
||||
errno = saved_errno;
|
||||
+
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
#endif /* HAVE_SELINUX_RUNTIME */
|
||||
diff --git a/tests-mx32/secontext.h b/tests-mx32/secontext.h
|
||||
index b5bba2272..dab33e6a5 100644
|
||||
--- a/tests-mx32/secontext.h
|
||||
+++ b/tests-mx32/secontext.h
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "tests.h"
|
||||
#include "xmalloc.h"
|
||||
+
|
||||
+#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
char *secontext_full_fd(int) ATTRIBUTE_MALLOC;
|
||||
@@ -35,10 +37,10 @@ char *get_secontext_field(const char *full_context, enum secontext_field field);
|
||||
char *get_secontext_field_fd(int fd, enum secontext_field field);
|
||||
char *get_secontext_field_file(const char *file, enum secontext_field field);
|
||||
|
||||
-void reset_secontext_file(const char *file);
|
||||
+int reset_secontext_file(const char *file);
|
||||
|
||||
-void update_secontext_field(const char *file, enum secontext_field field,
|
||||
- const char *newvalue);
|
||||
+int update_secontext_field(const char *file, enum secontext_field field,
|
||||
+ const char *newvalue);
|
||||
|
||||
# ifdef PRINT_SECONTEXT_FULL
|
||||
|
||||
@@ -81,15 +83,17 @@ get_secontext_field_file(const char *file, enum secontext_field field)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-static inline void
|
||||
+static inline int
|
||||
reset_secontext_file(const char *file)
|
||||
{
|
||||
+ return -ENOSYS;
|
||||
}
|
||||
|
||||
-static inline void
|
||||
+static inline int
|
||||
update_secontext_field(const char *file, enum secontext_field field,
|
||||
const char *newvalue)
|
||||
{
|
||||
+ return -ENOSYS;
|
||||
}
|
||||
|
||||
# define SECONTEXT_FD(fd) xstrdup("")
|
||||
--
|
||||
2.13.6
|
||||
|
@ -0,0 +1,76 @@
|
||||
From d08dfdebb381427cbd8565994868926ba9bc4b40 Mon Sep 17 00:00:00 2001
|
||||
From: Eugene Syromyatnikov <evgsyr@gmail.com>
|
||||
Date: Wed, 30 Oct 2024 15:16:47 +0100
|
||||
Subject: [PATCH 188/190] linux/s390/get_scno.c: use NT_S390_SYSTEM_CALL if
|
||||
gprs[2] is clobbered
|
||||
|
||||
The way the syscall number is retrieved currently relies on the kernel
|
||||
propagating it properly into gprs[2], which is not however always the case;
|
||||
apart of the situation where scno > NR_syscalls, there is also an issue
|
||||
of inspecting it during syscall restart (as it happens on attach, for
|
||||
example), when it is already clobbered by a ERESTART* errno. Luckily
|
||||
for strace, this issue has been already foreseen by the kernel
|
||||
developers, and support for retrieving syscall number on s390
|
||||
via a separate ptrace regset has been added by the Linux commit
|
||||
v3.2-rc1~109^2~34; 13 years later, it is time for it to fulfill
|
||||
its purpose and finally get utilised.
|
||||
|
||||
* src/linux/s390/get_scno.c (arch_get_scno): Try to retrieve the syscall
|
||||
number by querying NT_S390_SYSTEM_CALL regset if gprs[2] contains an errno.
|
||||
|
||||
Complements: v6.11-21-gc7e0ea6d712e "syscall: do not use uninitialized parts of struct ptrace_syscall_info"
|
||||
---
|
||||
src/linux/s390/get_scno.c | 34 ++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 32 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/linux/s390/get_scno.c b/src/linux/s390/get_scno.c
|
||||
index f0863e26d701..fdc94d025280 100644
|
||||
--- a/src/linux/s390/get_scno.c
|
||||
+++ b/src/linux/s390/get_scno.c
|
||||
@@ -9,11 +9,41 @@
|
||||
# define ARCH_REGSET s390_regset
|
||||
#endif
|
||||
|
||||
+#ifndef NT_ARM_SYSTEM_CALL
|
||||
+# define NT_S390_SYSTEM_CALL 0x307
|
||||
+#endif
|
||||
+
|
||||
/* Return codes: 1 - ok, 0 - ignore, other - error. */
|
||||
static int
|
||||
arch_get_scno(struct tcb *tcp)
|
||||
{
|
||||
- tcp->scno = ARCH_REGSET.gprs[2] ?
|
||||
- ARCH_REGSET.gprs[2] : ARCH_REGSET.gprs[1];
|
||||
+ typeof(ARCH_REGSET.gprs[2]) gpr2 = ARCH_REGSET.gprs[2];
|
||||
+
|
||||
+ if (gpr2 > (typeof(gpr2)) (-4095ULL)) {
|
||||
+ /*
|
||||
+ * We are in restart_syscall and gprs[2] is clobbered
|
||||
+ * by the errno, using pulling the syscall number
|
||||
+ * via NT_S390_SYSTEM_CALL regset.
|
||||
+ */
|
||||
+ unsigned int scno;
|
||||
+ const struct iovec io = {
|
||||
+ .iov_base = &scno,
|
||||
+ .iov_len = sizeof(scno)
|
||||
+ };
|
||||
+ int rc = ptrace(PTRACE_GETREGSET, tcp->pid, NT_S390_SYSTEM_CALL,
|
||||
+ &io);
|
||||
+ if (rc && errno != ESRCH) {
|
||||
+ perror_func_msg("NT_S390_SYSTEM_CALL pid:%d", tcp->pid);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ /*
|
||||
+ * The ptrace call returns thread.system_call, that stores raw
|
||||
+ * int_code, and the syscall number part is the lowest 16 bits
|
||||
+ * of it.
|
||||
+ */
|
||||
+ tcp->scno = scno & 0xffff;
|
||||
+ } else {
|
||||
+ tcp->scno = gpr2 ?: ARCH_REGSET.gprs[1];
|
||||
+ }
|
||||
return 1;
|
||||
}
|
||||
--
|
||||
2.28.0
|
||||
|
89
SOURCES/0191-prctl-improve-PR_SVE_-SG-ET_VL-decoding.patch
Normal file
89
SOURCES/0191-prctl-improve-PR_SVE_-SG-ET_VL-decoding.patch
Normal file
@ -0,0 +1,89 @@
|
||||
From 1663bf8582b7187d04225105a62bbab9ebbb8109 Mon Sep 17 00:00:00 2001
|
||||
From: Eugene Syromyatnikov <evgsyr@gmail.com>
|
||||
Date: Thu, 4 Aug 2022 18:46:41 +0200
|
||||
Subject: [PATCH] prctl: improve PR_SVE_[SG]ET_VL decoding
|
||||
|
||||
* src/prctl.c (sprint_sve_val): Add aux parameter, handle printing based
|
||||
on it.
|
||||
(SYS_FUNC(prctl)): <case PR_SVE_SET_VL>: Pass false as aux
|
||||
to sprint_sve_val.
|
||||
(SYS_FUNC(prctl)): <case PR_SVE_GET_VL>: Pass true as aux
|
||||
to sprint_sve_val; return RVAL_HEX flag.
|
||||
* NEWS: Mention it.
|
||||
---
|
||||
NEWS | 1 +
|
||||
src/prctl.c | 38 +++++++++++++++++++++++++++++---------
|
||||
2 files changed, 30 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/src/prctl.c b/src/prctl.c
|
||||
index f3bc1a34821d..2611baa5588d 100644
|
||||
--- a/src/prctl.c
|
||||
+++ b/src/prctl.c
|
||||
@@ -64,17 +64,37 @@ print_prctl_args(struct tcb *tcp, const unsigned int first)
|
||||
}
|
||||
|
||||
static char *
|
||||
-sprint_sve_val(kernel_ulong_t arg)
|
||||
+sprint_sve_val(kernel_ulong_t arg, bool aux)
|
||||
{
|
||||
- static char out[sizeof("PR_SVE_SET_VL_ONEXEC|PR_SVE_VL_INHERIT|0x") +
|
||||
- sizeof(kernel_ulong_t) * 2];
|
||||
+ static char out[sizeof("0x /* PR_SVE_SET_VL_ONEXEC|PR_SVE_VL_INHERIT"
|
||||
+ "|0x|0x */") + sizeof(kernel_ulong_t) * 2 * 3];
|
||||
+
|
||||
+ if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW) {
|
||||
+ if (aux)
|
||||
+ return NULL;
|
||||
+
|
||||
+ xsprintf(out, "%#" PRI_klx, arg);
|
||||
+
|
||||
+ return out;
|
||||
+ }
|
||||
|
||||
kernel_ulong_t vl = arg & PR_SVE_VL_LEN_MASK;
|
||||
kernel_ulong_t flags = arg & ~PR_SVE_VL_LEN_MASK;
|
||||
- const char *flags_str = sprintflags("", pr_sve_vl_flags, flags);
|
||||
|
||||
- xsprintf(out, "%s%s%#" PRI_klx,
|
||||
- flags_str ?: "", flags_str ? "|" : "", vl);
|
||||
+ if (!flags && aux)
|
||||
+ return NULL;
|
||||
+
|
||||
+ const char *flags_str = sprintflags_ex("", pr_sve_vl_flags, flags, '\0',
|
||||
+ XLAT_STYLE_ABBREV);
|
||||
+
|
||||
+ if (!aux && flags && xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE)
|
||||
+ {
|
||||
+ xsprintf(out, "%#" PRI_klx " /* %s%s%#" PRI_klx " */",
|
||||
+ arg, flags_str ?: "", flags_str ? "|" : "", vl);
|
||||
+ } else {
|
||||
+ xsprintf(out, "%s%s%#" PRI_klx,
|
||||
+ flags_str ?: "", flags_str ? "|" : "", vl);
|
||||
+ }
|
||||
|
||||
return out;
|
||||
}
|
||||
@@ -229,7 +249,7 @@ SYS_FUNC(prctl)
|
||||
case PR_SVE_SET_VL:
|
||||
if (entering(tcp)) {
|
||||
tprint_arg_next();
|
||||
- tprints(sprint_sve_val(arg2));
|
||||
+ tprints(sprint_sve_val(arg2, false));
|
||||
return 0;
|
||||
}
|
||||
ATTRIBUTE_FALLTHROUGH;
|
||||
@@ -240,9 +260,9 @@ SYS_FUNC(prctl)
|
||||
if (syserror(tcp) || tcp->u_rval == 0)
|
||||
return 0;
|
||||
|
||||
- tcp->auxstr = sprint_sve_val(tcp->u_rval);
|
||||
+ tcp->auxstr = sprint_sve_val(tcp->u_rval, true);
|
||||
|
||||
- return RVAL_STR;
|
||||
+ return RVAL_HEX | RVAL_STR;
|
||||
|
||||
case PR_GET_SPECULATION_CTRL:
|
||||
if (entering(tcp)) {
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,130 @@
|
||||
From 3ed268876dd5b65263449f9aeb18a1cc2604c707 Mon Sep 17 00:00:00 2001
|
||||
From: Eugene Syromyatnikov <evgsyr@gmail.com>
|
||||
Date: Tue, 25 Apr 2023 18:11:21 +0200
|
||||
Subject: [PATCH] tests/prctl-sve: fix prctl(PR_SVE_GET_VL) return expected
|
||||
value printing
|
||||
|
||||
* tests/prctl-sve.c: Print the expected return value string based
|
||||
on the value returned, similarly to the way it is done
|
||||
in tests/prctl-sme.c:print_sme_vl_arg().
|
||||
|
||||
Fixes: v5.13~8 "tests: improve test coverage of prctl syscall decoder"
|
||||
Closes: https://github.com/strace/strace/issues/251
|
||||
---
|
||||
tests/prctl-sve.c | 24 ++++++++++++++++++++----
|
||||
1 file changed, 20 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/tests/prctl-sve.c b/tests/prctl-sve.c
|
||||
index 4cef149cfec6..216ebfc3f92c 100644
|
||||
--- a/tests/prctl-sve.c
|
||||
+++ b/tests/prctl-sve.c
|
||||
@@ -43,12 +43,28 @@ main(void)
|
||||
(unsigned long) 0xff, sprintrc(rc));
|
||||
|
||||
rc = syscall(__NR_prctl, PR_SVE_GET_VL);
|
||||
- printf("prctl(PR_SVE_GET_VL) = %s", sprintrc(rc));
|
||||
+ printf("prctl(PR_SVE_GET_VL) = ");
|
||||
if (rc >= 0) {
|
||||
- printf(" (PR_SVE_SET_VL_ONEXEC|PR_SVE_VL_INHERIT|%#lx)",
|
||||
- (unsigned long) 0xff);
|
||||
+ printf("%#lx", rc);
|
||||
+ if (rc > 0xffff) {
|
||||
+ printf(" (");
|
||||
+ if (rc & PR_SVE_SET_VL_ONEXEC)
|
||||
+ printf("PR_SVE_SET_VL_ONEXEC");
|
||||
+ if (rc & PR_SVE_VL_INHERIT) {
|
||||
+ printf("%sPR_SVE_VL_INHERIT",
|
||||
+ rc & PR_SVE_SET_VL_ONEXEC ? "|" : "");
|
||||
+ }
|
||||
+ if (rc & ~0x6ffffU) {
|
||||
+ printf("%s%#lx",
|
||||
+ rc & 0x60000 ? "|" : "", rc & ~0x6ffffU);
|
||||
+ }
|
||||
+ printf("|%#lx)\n", rc & 0xffffU);
|
||||
+ } else {
|
||||
+ puts("");
|
||||
+ }
|
||||
+ } else {
|
||||
+ puts(sprintrc(rc));
|
||||
}
|
||||
- puts("");
|
||||
|
||||
puts("+++ exited with 0 +++");
|
||||
return 0;
|
||||
diff --git a/tests-m32/prctl-sve.c b/tests-m32/prctl-sve.c
|
||||
index 4cef149cfec6..216ebfc3f92c 100644
|
||||
--- a/tests-m32/prctl-sve.c
|
||||
+++ b/tests-m32/prctl-sve.c
|
||||
@@ -43,12 +43,28 @@ main(void)
|
||||
(unsigned long) 0xff, sprintrc(rc));
|
||||
|
||||
rc = syscall(__NR_prctl, PR_SVE_GET_VL);
|
||||
- printf("prctl(PR_SVE_GET_VL) = %s", sprintrc(rc));
|
||||
+ printf("prctl(PR_SVE_GET_VL) = ");
|
||||
if (rc >= 0) {
|
||||
- printf(" (PR_SVE_SET_VL_ONEXEC|PR_SVE_VL_INHERIT|%#lx)",
|
||||
- (unsigned long) 0xff);
|
||||
+ printf("%#lx", rc);
|
||||
+ if (rc > 0xffff) {
|
||||
+ printf(" (");
|
||||
+ if (rc & PR_SVE_SET_VL_ONEXEC)
|
||||
+ printf("PR_SVE_SET_VL_ONEXEC");
|
||||
+ if (rc & PR_SVE_VL_INHERIT) {
|
||||
+ printf("%sPR_SVE_VL_INHERIT",
|
||||
+ rc & PR_SVE_SET_VL_ONEXEC ? "|" : "");
|
||||
+ }
|
||||
+ if (rc & ~0x6ffffU) {
|
||||
+ printf("%s%#lx",
|
||||
+ rc & 0x60000 ? "|" : "", rc & ~0x6ffffU);
|
||||
+ }
|
||||
+ printf("|%#lx)\n", rc & 0xffffU);
|
||||
+ } else {
|
||||
+ puts("");
|
||||
+ }
|
||||
+ } else {
|
||||
+ puts(sprintrc(rc));
|
||||
}
|
||||
- puts("");
|
||||
|
||||
puts("+++ exited with 0 +++");
|
||||
return 0;
|
||||
diff --git a/tests-mx32/prctl-sve.c b/tests-mx32/prctl-sve.c
|
||||
index 4cef149cfec6..216ebfc3f92c 100644
|
||||
--- a/tests-mx32/prctl-sve.c
|
||||
+++ b/tests-mx32/prctl-sve.c
|
||||
@@ -43,12 +43,28 @@ main(void)
|
||||
(unsigned long) 0xff, sprintrc(rc));
|
||||
|
||||
rc = syscall(__NR_prctl, PR_SVE_GET_VL);
|
||||
- printf("prctl(PR_SVE_GET_VL) = %s", sprintrc(rc));
|
||||
+ printf("prctl(PR_SVE_GET_VL) = ");
|
||||
if (rc >= 0) {
|
||||
- printf(" (PR_SVE_SET_VL_ONEXEC|PR_SVE_VL_INHERIT|%#lx)",
|
||||
- (unsigned long) 0xff);
|
||||
+ printf("%#lx", rc);
|
||||
+ if (rc > 0xffff) {
|
||||
+ printf(" (");
|
||||
+ if (rc & PR_SVE_SET_VL_ONEXEC)
|
||||
+ printf("PR_SVE_SET_VL_ONEXEC");
|
||||
+ if (rc & PR_SVE_VL_INHERIT) {
|
||||
+ printf("%sPR_SVE_VL_INHERIT",
|
||||
+ rc & PR_SVE_SET_VL_ONEXEC ? "|" : "");
|
||||
+ }
|
||||
+ if (rc & ~0x6ffffU) {
|
||||
+ printf("%s%#lx",
|
||||
+ rc & 0x60000 ? "|" : "", rc & ~0x6ffffU);
|
||||
+ }
|
||||
+ printf("|%#lx)\n", rc & 0xffffU);
|
||||
+ } else {
|
||||
+ puts("");
|
||||
+ }
|
||||
+ } else {
|
||||
+ puts(sprintrc(rc));
|
||||
}
|
||||
- puts("");
|
||||
|
||||
puts("+++ exited with 0 +++");
|
||||
return 0;
|
||||
--
|
||||
2.28.0
|
||||
|
@ -1,27 +1,26 @@
|
||||
Limit the scope of qual_fault.tests on aarch64 as otherwise it takes
|
||||
unacceptable amount of time on available builders (more than an hour).
|
||||
Index: strace-5.7/tests/qual_fault.test
|
||||
Index: strace-5.17/tests/qual_fault.test
|
||||
===================================================================
|
||||
--- strace-5.7.orig/tests/qual_fault.test 2020-06-02 10:41:25.870177356 +0200
|
||||
+++ strace-5.7/tests/qual_fault.test 2020-06-02 10:48:33.284302800 +0200
|
||||
@@ -83,19 +83,35 @@
|
||||
--- strace-5.17.orig/tests/qual_fault.test 2022-06-09 15:47:28.871554186 +0200
|
||||
+++ strace-5.17/tests/qual_fault.test 2022-06-09 15:50:50.016108370 +0200
|
||||
@@ -83,19 +83,36 @@
|
||||
done
|
||||
}
|
||||
|
||||
-for err in '' ENOSYS 22 einval; do
|
||||
+
|
||||
+case "$STRACE_ARCH" in
|
||||
+ aarch64)
|
||||
+ ERRS='EnoSys 22'
|
||||
+ NUMBERS1='2'
|
||||
+ NUMBERS2='3'
|
||||
+ NUMBERS3='5'
|
||||
+ NUMBERS4='7'
|
||||
+ ;;
|
||||
+ *)
|
||||
+ ERRS='ENOSYS 22 einval'
|
||||
+ NUMBERS1='1 2 3 5 7 11'
|
||||
+ NUMBERS2='1 2 3 5 7 11'
|
||||
+ NUMBERS3='1 2 3 5 7 11'
|
||||
+ NUMBERS1='1 2 3 7'
|
||||
+ NUMBERS2='1 2 5 11'
|
||||
+ NUMBERS3='1 2 3 7'
|
||||
+ NUMBERS4='1 2 7 11'
|
||||
+ ;;
|
||||
+esac
|
||||
+
|
||||
@ -31,30 +30,30 @@ Index: strace-5.7/tests/qual_fault.test
|
||||
writev $fault "$err" '' '' '' 1 -efault=chdir
|
||||
check_fault_injection \
|
||||
writev $fault "$err" '' '' '' 1 -efault=chdir -efault=none
|
||||
- for F in 1 2 3 5 7 11; do
|
||||
- for F in 1 2 3 7; do
|
||||
+ for F in $(echo $NUMBERS1); do
|
||||
check_fault_injection \
|
||||
writev $fault "$err" $F '' '' 1
|
||||
check_fault_injection \
|
||||
writev $fault "$err" $F '' + 1
|
||||
|
||||
- for L in 1 2 3 5 7 11; do
|
||||
- for L in 1 2 5 11; do
|
||||
+ for L in $(echo $NUMBERS2); do
|
||||
[ "$L" -ge "$F" ] ||
|
||||
continue
|
||||
check_fault_injection \
|
||||
@@ -104,12 +119,12 @@
|
||||
@@ -104,12 +121,12 @@
|
||||
writev $fault "$err" $F $L + 1
|
||||
done
|
||||
|
||||
- for S in 1 2 3 5 7 11; do
|
||||
+ for S in $(echo $NUMBERS2); do
|
||||
- for S in 1 2 3 7; do
|
||||
+ for S in $(echo $NUMBERS3); do
|
||||
check_fault_injection \
|
||||
writev $fault "$err" $F '' $S 1
|
||||
check_fault_injection \
|
||||
writev $fault "$err" $F '' $S 4
|
||||
- for L in 1 2 3 5 7 11; do
|
||||
+ for L in $(echo $NUMBERS3); do
|
||||
- for L in 1 2 7 11; do
|
||||
+ for L in $(echo $NUMBERS4); do
|
||||
[ "$L" -ge "$F" ] ||
|
||||
continue
|
||||
check_fault_injection \
|
||||
|
@ -1,17 +0,0 @@
|
||||
Index: strace-5.7/unwind.c
|
||||
===================================================================
|
||||
--- strace-5.7.orig/unwind.c 2018-12-10 01:00:00.000000000 +0100
|
||||
+++ strace-5.7/unwind.c 2020-06-02 11:13:42.777871147 +0200
|
||||
@@ -9,6 +9,12 @@
|
||||
#include "unwind.h"
|
||||
|
||||
#ifdef USE_DEMANGLE
|
||||
+/*
|
||||
+ * demangle.h defines ARRAY_SIZE without proper guard, and its definition
|
||||
+ * is "good enough" for us.
|
||||
+ */
|
||||
+#undef ARRAY_SIZE
|
||||
+
|
||||
# if defined HAVE_DEMANGLE_H
|
||||
# include <demangle.h>
|
||||
# elif defined HAVE_LIBIBERTY_DEMANGLE_H
|
@ -1,16 +1,17 @@
|
||||
Summary: Tracks and displays system calls associated with a running process
|
||||
Name: strace
|
||||
Version: 5.7
|
||||
Release: 2%{?dist}
|
||||
Version: 5.18
|
||||
Release: 2.1%{?dist}
|
||||
# The test suite is GPLv2+, all the rest is LGPLv2.1+.
|
||||
License: LGPL-2.1+ and GPL-2.0+
|
||||
Group: Development/Debuggers
|
||||
URL: https://strace.io/
|
||||
Source: https://strace.io/files/%{version}/%{name}-%{version}.tar.xz
|
||||
|
||||
BuildRequires: libacl-devel time gcc gzip
|
||||
BuildRequires: libacl-devel time gcc gzip make
|
||||
BuildRequires: pkgconfig(bluez)
|
||||
BuildRequires: elfutils-devel binutils-devel
|
||||
BuildRequires: libselinux-devel
|
||||
|
||||
## Reported by covscan
|
||||
## v5.2-3-g7ada13f "evdev: avoid bit vector decoding on non-successful and 0 return codes"
|
||||
@ -143,63 +144,168 @@ BuildRequires: elfutils-devel binutils-devel
|
||||
#Patch111: 0111-xlat-update-uring_ops.patch
|
||||
## v5.7~68 "tests: correct error message in io_uring_register test"
|
||||
#Patch112: 0112-tests-correct-error-message-in-io_uring_register-tes.patch
|
||||
# v5.8~58 "io_uring: Remove struct io_cqring_offsets compile time asserts"
|
||||
Patch113: 0113-io_uring-Remove-struct-io_cqring_offsets-compile-tim.patch
|
||||
# v5.8~57 "io_uring: Add io_cqring_offset flags"
|
||||
Patch114: 0114-io_uring-Add-io_cqring_offset-flags.patch
|
||||
# v5.8~47 "xlat: update IORING_* constants"
|
||||
Patch115: 0115-xlat-update-IORING_-constants.patch
|
||||
## v5.8~58 "io_uring: Remove struct io_cqring_offsets compile time asserts"
|
||||
#Patch113: 0113-io_uring-Remove-struct-io_cqring_offsets-compile-tim.patch
|
||||
## v5.8~57 "io_uring: Add io_cqring_offset flags"
|
||||
#Patch114: 0114-io_uring-Add-io_cqring_offset-flags.patch
|
||||
## v5.8~47 "xlat: update IORING_* constants"
|
||||
#Patch115: 0115-xlat-update-IORING_-constants.patch
|
||||
## v5.5~71 "macros.h: introduce sizeof_field macro"
|
||||
#Patch116: 0116-macros.h-introduce-sizeof_field-macro.patch
|
||||
## v5.5~49 "types: new infrastructure for automatic checking of structure types"
|
||||
#Patch117: 0117-types-new-infrastructure-for-automatic-checking-of-s.patch
|
||||
# v5.8~59 "types: skip field lines that start with comments"
|
||||
Patch118: 0118-types-skip-field-lines-that-start-with-comments.patch
|
||||
## v5.8~59 "types: skip field lines that start with comments"
|
||||
#Patch118: 0118-types-skip-field-lines-that-start-with-comments.patch
|
||||
|
||||
## PID namespace translation support
|
||||
## https://bugzilla.redhat.com/1035434
|
||||
## https://bugzilla.redhat.com/1725113 https://bugzilla.redhat.com/1790836
|
||||
## https://bugzilla.redhat.com/1804334 https://bugzilla.redhat.com/1807458
|
||||
# v5.8~62 "print_fields.h: add PRINT_FIELD_LEN macro"
|
||||
Patch119: 0119-print_fields.h-add-PRINT_FIELD_LEN-macro.patch
|
||||
# v5.8~61 "Move ilog* functions from util.c to defs.h"
|
||||
Patch120: 0120-Move-ilog-functions-from-util.c-to-defs.h.patch
|
||||
#Patch119: 0119-print_fields.h-add-PRINT_FIELD_LEN-macro.patch
|
||||
## v5.8~61 "Move ilog* functions from util.c to defs.h"
|
||||
#Patch120: 0120-Move-ilog-functions-from-util.c-to-defs.h.patch
|
||||
## v5.8~59 "types: skip field lines that start with comments"
|
||||
#Patch121: 0121-types-skip-field-lines-that-start-with-comments.patch
|
||||
# v5.8~54 "tests/inject-nf.test: replace getpid with geteuid"
|
||||
Patch122: 0122-tests-inject-nf.test-replace-getpid-with-geteuid.patch
|
||||
# v5.8~18 "fcntl: use print_fields.h macros"
|
||||
Patch123: 0123-fcntl-use-print_fields.h-macros.patch
|
||||
# v5.8~17 "kcmp: fix KCMP_FILE decoding"
|
||||
Patch124: 0124-kcmp-fix-KCMP_FILE-decoding.patch
|
||||
# v5.8~15 "printsiginfo: fix printing of siginfo_t.si_pid and siginfo_t.si_uid"
|
||||
Patch125: 0125-printsiginfo-fix-printing-of-siginfo_t.si_pid-and-si.patch
|
||||
# v5.8~14 "Use PRINT_FIELD_UID instead of printuid where appropriate"
|
||||
Patch126: 0126-Use-PRINT_FIELD_UID-instead-of-printuid-where-approp.patch
|
||||
# v5.8~10 "Consistently print process ids as signed integers"
|
||||
Patch127: 0127-Consistently-print-process-ids-as-signed-integers.patch
|
||||
# v5.8~9 "Remove tcb parameter of read_int_from_file"
|
||||
Patch128: 0128-Remove-tcb-parameter-of-read_int_from_file.patch
|
||||
# v5.8~6 "Add "struct tcb *" parameters to various functions"
|
||||
Patch129: 0129-Add-struct-tcb-parameters-to-various-functions.patch
|
||||
# v5.8~53 "Modify %process class: trace syscalls associated with process lifecycle"
|
||||
Patch130: 0130-Modify-process-class-trace-syscalls-associated-with-.patch
|
||||
# v5.8~5 "Introduce SYS_FUNC(tkill)"
|
||||
Patch131: 0131-Introduce-SYS_FUNC-tkill.patch
|
||||
# v5.8~4 "tests: check decoding of tkill syscall"
|
||||
Patch132: 0132-tests-check-decoding-of-tkill-syscall.patch
|
||||
# v5.8~3 "tests: check decoding of tgkill syscall"
|
||||
Patch133: 0133-tests-check-decoding-of-tgkill-syscall.patch
|
||||
# v5.8-5-gdea0284 "PID namespace translation support"
|
||||
Patch134: 0134-PID-namespace-translation-support.patch
|
||||
# v5.8-6-g173257d "Use printpid in decoders"
|
||||
Patch135: 0135-Use-printpid-in-decoders.patch
|
||||
# v5.8-7-g18c2208 "Use get_proc_pid for /proc paths"
|
||||
Patch136: 0136-Use-get_proc_pid-for-proc-paths.patch
|
||||
# v5.8-8-g7ecee07 "Implement testing framework for pidns"
|
||||
Patch137: 0137-Implement-testing-framework-for-pidns.patch
|
||||
# v5.8-9-gf350ce0 "Add tests for PID namespace translation"
|
||||
Patch138: 0138-Add-tests-for-PID-namespace-translation.patch
|
||||
## v5.8~54 "tests/inject-nf.test: replace getpid with geteuid"
|
||||
#Patch122: 0122-tests-inject-nf.test-replace-getpid-with-geteuid.patch
|
||||
## v5.8~18 "fcntl: use print_fields.h macros"
|
||||
#Patch123: 0123-fcntl-use-print_fields.h-macros.patch
|
||||
## v5.8~17 "kcmp: fix KCMP_FILE decoding"
|
||||
#Patch124: 0124-kcmp-fix-KCMP_FILE-decoding.patch
|
||||
## v5.8~15 "printsiginfo: fix printing of siginfo_t.si_pid and siginfo_t.si_uid"
|
||||
#Patch125: 0125-printsiginfo-fix-printing-of-siginfo_t.si_pid-and-si.patch
|
||||
## v5.8~14 "Use PRINT_FIELD_UID instead of printuid where appropriate"
|
||||
#Patch126: 0126-Use-PRINT_FIELD_UID-instead-of-printuid-where-approp.patch
|
||||
## v5.8~10 "Consistently print process ids as signed integers"
|
||||
#Patch127: 0127-Consistently-print-process-ids-as-signed-integers.patch
|
||||
## v5.8~9 "Remove tcb parameter of read_int_from_file"
|
||||
#Patch128: 0128-Remove-tcb-parameter-of-read_int_from_file.patch
|
||||
## v5.8~6 "Add "struct tcb *" parameters to various functions"
|
||||
#Patch129: 0129-Add-struct-tcb-parameters-to-various-functions.patch
|
||||
## v5.8~53 "Modify %process class: trace syscalls associated with process lifecycle"
|
||||
#Patch130: 0130-Modify-process-class-trace-syscalls-associated-with-.patch
|
||||
## v5.8~5 "Introduce SYS_FUNC(tkill)"
|
||||
#Patch131: 0131-Introduce-SYS_FUNC-tkill.patch
|
||||
## v5.8~4 "tests: check decoding of tkill syscall"
|
||||
#Patch132: 0132-tests-check-decoding-of-tkill-syscall.patch
|
||||
## v5.8~3 "tests: check decoding of tgkill syscall"
|
||||
#Patch133: 0133-tests-check-decoding-of-tgkill-syscall.patch
|
||||
## v5.8-5-gdea0284 "PID namespace translation support"
|
||||
#Patch134: 0134-PID-namespace-translation-support.patch
|
||||
## v5.8-6-g173257d "Use printpid in decoders"
|
||||
#Patch135: 0135-Use-printpid-in-decoders.patch
|
||||
## v5.8-7-g18c2208 "Use get_proc_pid for /proc paths"
|
||||
#Patch136: 0136-Use-get_proc_pid-for-proc-paths.patch
|
||||
## v5.8-8-g7ecee07 "Implement testing framework for pidns"
|
||||
#Patch137: 0137-Implement-testing-framework-for-pidns.patch
|
||||
## v5.8-9-gf350ce0 "Add tests for PID namespace translation"
|
||||
#Patch138: 0138-Add-tests-for-PID-namespace-translation.patch
|
||||
|
||||
## v5.12~55 "tests: add fchmod-y test"
|
||||
#Patch142: 0142-tests-add-fchmod-y-test.patch
|
||||
## v5.12~54 "tests: introduce create_and_enter_subdir and leave_and_remove_subdir"
|
||||
#Patch143: 0143-tests-introduce-create_and_enter_subdir-and-leave_an.patch
|
||||
## v5.8~36 "tests: check decoding of faccessat syscall in -P, -y, and -yy modes"
|
||||
#Patch144: 0144-tests-check-decoding-of-faccessat-syscall-in-P-y-and.patch
|
||||
## v5.12~97 "xmalloc: introduce xasprintf"
|
||||
#Patch145: 0145-xmalloc-introduce-xasprintf.patch
|
||||
## v5.12~96 "tests: use xasprintf instead of asprintf"
|
||||
#Patch146: 0146-tests-use-xasprintf-instead-of-asprintf.patch
|
||||
## v5.12~156 "file_handle: print f_handle as a hexadecimal string"
|
||||
#Patch147: 0147-file_handle-print-f_handle-as-a-hexadecimal-string.patch
|
||||
## v5.10~47 "tests: fix execve test with fresh linux kernels"
|
||||
#Patch148: 0148-tests-fix-execve-test-with-fresh-linux-kernels.patch
|
||||
## v5.12~49 "Implement --secontext[=full] option to display SELinux contexts"
|
||||
#Patch149: 0149-Implement-secontext-full-option-to-display-SELinux-c.patch
|
||||
# v5.13-14-g9623154 "m4/mpers.m4: generate HAVE_*_SELINUX_RUNTIME config defines"
|
||||
#Patch155: 0155-m4-mpers.m4-generate-HAVE_-_SELINUX_RUNTIME-config-d.patch
|
||||
|
||||
## v5.9~28 "Introduce GLIBC_PREREQ_GE and GLIBC_PREREQ_LT macros"
|
||||
#Patch156: 0156-Introduce-GLIBC_PREREQ_GE-and-GLIBC_PREREQ_LT-macros.patch
|
||||
## v5.9~27 "tests/ipc_msg.c: disable TEST_MSGCTL_BOGUS_ADDR on glibc >= 2.32"
|
||||
#Patch157: 0157-tests-ipc_msg.c-disable-TEST_MSGCTL_BOGUS_ADDR-on-gl.patch
|
||||
## v5.10~46 "tests: disable TEST_MSGCTL_BOGUS_ADDR in ipc_msg test on glibc >= 2.31"
|
||||
#Patch158: 0158-tests-disable-TEST_MSGCTL_BOGUS_ADDR-in-ipc_msg-test.patch
|
||||
## v5.10~22 "tests: disable tests for invalid msgctl commands on glibc >= 2.32"
|
||||
#Patch159: 0159-tests-disable-tests-for-invalid-msgctl-commands-on-g.patch
|
||||
## v5.9~11 "tests: disable shmctl IPC_STAT test with a bogus address on glibc >= 2.32"
|
||||
#Patch160: 0160-tests-disable-shmctl-IPC_STAT-test-with-a-bogus-addr.patch
|
||||
## v5.9~10 "tests: disable tests for invalid shmctl commands on glibc >= 2.32"
|
||||
#Patch161: 0161-tests-disable-tests-for-invalid-shmctl-commands-on-g.patch
|
||||
## v5.9~12 "tests: disable tests for invalid semctl commands on glibc >= 2.32"
|
||||
#Patch162: 0162-tests-disable-tests-for-invalid-semctl-commands-on-g.patch
|
||||
|
||||
## v5.13-55-g6b2191f "filter_qualify: free allocated data on the error path exit of parse_poke_token"
|
||||
#Patch163: 0163-filter_qualify-free-allocated-data-on-the-error-path.patch
|
||||
## v5.13-56-g80dc60c "macros: expand BIT macros, add MASK macros; add *_SAFE macros"
|
||||
#Patch164: 0164-macros-expand-BIT-macros-add-MASK-macros-add-_SAFE-m.patch
|
||||
## v5.13-58-g94ae5c2 "trie: use BIT* and MASK* macros"
|
||||
#Patch165: 0165-trie-use-BIT-and-MASK-macros.patch
|
||||
## v5.13-65-g41b753e "tee: rewrite num_params access in tee_fetch_buf_data"
|
||||
#Patch166: 0166-tee-rewrite-num_params-access-in-tee_fetch_buf_data.patch
|
||||
|
||||
## v5.15~1 "print_ifindex: fix IFNAME_QUOTED_SZ definition"
|
||||
#Patch167: 0167-print_ifindex-fix-IFNAME_QUOTED_SZ-definition.patch
|
||||
|
||||
## v5.15~18 "m4: fix st_SELINUX check"
|
||||
#Patch168: 0168-m4-fix-st_SELINUX-check.patch
|
||||
## v5.16~31 "Implement displaying of expected context upon mismatch"
|
||||
#Patch169: 0169-Implement-displaying-of-expected-context-upon-mismat.patch
|
||||
#Patch170: 0170-tests-linkat-reset-errno-before-SELinux-context-mani.patch
|
||||
#Patch171: 0171-tests-secontext-add-secontext-field-getters.patch
|
||||
#Patch172: 0172-tests-linkat-provide-fallback-values-for-secontext-f.patch
|
||||
#Patch173: 0173-tests-secontext-eliminate-separate-secontext_format-.patch
|
||||
#Patch174: 0174-tests-linkat-reset-context-to-the-expected-one-if-a-.patch
|
||||
|
||||
## https://bugzilla.redhat.com/2103068 covscan fixes
|
||||
# v5.18-5-g2bf0696 "src/xlat: remove remnants of unnecessary idx usage in xlookup"
|
||||
Patch175: 0175-src-xlat-remove-remnants-of-unnecessary-idx-usage-in.patch
|
||||
# v5.18-7-ge604d7b "strauss: tips whitespace and phrasing cleanups"
|
||||
Patch176: 0176-strauss-tips-whitespace-and-phrasing-cleanups.patch
|
||||
# v5.18-8-g968789d "strauss: fix off-by-one error in strauss array access"
|
||||
Patch177: 0177-strauss-fix-off-by-one-error-in-strauss-array-access.patch
|
||||
# v5.18-9-g6d3e97e "util: add offs sanity check to print_clock_t"
|
||||
Patch178: 0178-util-add-offs-sanity-check-to-print_clock_t.patch
|
||||
|
||||
## https://bugzilla.redhat.com/2087693
|
||||
# v5.18-13-g960e78f "secontext: print context of Unix socket's sun_path field"
|
||||
Patch179: 0179-secontext-print-context-of-Unix-socket-s-sun_path-fi.patch
|
||||
# v5.18-18-g676979f "pathtrace, util: do not print " (deleted)" as part of the path"
|
||||
Patch180: 0180-pathtrace-util-do-not-print-deleted-as-part-of-the-p.patch
|
||||
# v5.18-19-g3f0e534 "secontext: fix expected SELinux context check for unlinked FDs"
|
||||
Patch181: 0181-secontext-fix-expected-SELinux-context-check-for-unl.patch
|
||||
|
||||
## https://bugzilla.redhat.com/2103137
|
||||
# v5.18-21-g5338636 "tests/bpf: fix sloppy low FD number usage"
|
||||
Patch182: 0182-tests-bpf-fix-sloppy-low-FD-number-usage.patch
|
||||
|
||||
## https://issues.redhat.com/browse/RHEL-8570
|
||||
# v6.11-21-gc7e0ea6d7 "syscall: do not use uninitialized parts of struct ptrace_syscall_info"
|
||||
Patch183: 0183-syscall-do-not-use-uninitialized-parts-of-struct-ptr.patch
|
||||
# v6.11-22-g2048c136b "startup_tcb: add a comment"
|
||||
Patch184: 0184-startup_tcb-add-a-comment.patch
|
||||
# v6.11-23-g3bf08cbb3 "tests: add another test of restart_syscall decoding"
|
||||
Patch185: 0185-tests-add-another-test-of-restart_syscall-decoding.patch
|
||||
|
||||
## kernel-5.14.0-417.el9~9 (RHEL 9.4+) has v6.8-rc1~131^2~223 "tcp: Dump bound-only sockets in inet_diag."
|
||||
# v6.9~27 "tests: workaround net-yy-inet* for new kernels"
|
||||
Patch186: 0186-tests-workaround-net-yy-inet-for-new-kernels.patch
|
||||
## Update linkat--secontext_mismatch test to fix the failures reported by QE
|
||||
# v6.11~4 "tests: avoid linkat--secontext_mismatch failures on setfilecon errors"
|
||||
Patch187: 0187-tests-avoid-linkat-secontext_mismatch-failures-on-se.patch
|
||||
# "linux/s390/get_scno.c: use NT_S390_SYSTEM_CALL if gprs[2] is clobbered"
|
||||
Patch188: 0188-linux-s390-get_scno.c-use-NT_S390_SYSTEM_CALL-if-gpr.patch
|
||||
### Skip these two patches present in RHEL 9/10 as sockopt-sol_socket test doesn't exist in strace-5.18
|
||||
## "tests: move k_setsockopt definition into a separate"
|
||||
#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
|
||||
|
||||
### Wire up rseq and kexec_file_load in order to avoid kexec_file_load
|
||||
### test failure on aarch64. Addresses https://bugzilla.redhat.com/1676045
|
||||
@ -215,8 +321,14 @@ Patch138: 0138-Add-tests-for-PID-namespace-translation.patch
|
||||
Patch2001: 2001-limit-qual_fault-scope-on-aarch64.patch
|
||||
### RHEL8.2-only: disable ksysent test due to missing rebase
|
||||
#Patch2002: 2002-disable-ksysent-on-8.2.patch
|
||||
## RHEL-only: avoid ARRAY_SIZE macro re-definition in libiberty.h
|
||||
Patch2003: 2003-undef-ARRAY_SIZE.patch
|
||||
### RHEL-only: avoid ARRAY_SIZE macro re-definition in libiberty.h
|
||||
## No longer needed, since upstream commit v5.14~14
|
||||
#Patch2003: 2003-undef-ARRAY_SIZE.patch
|
||||
### RHEL-only: glibc-2.32.9000-147-ga16d2abd496bd974a882,
|
||||
### glibc-2.32.9000-149-gbe9b0b9a012780a403a2 and
|
||||
### glibc-2.32.9000-207-g9ebaabeaac1a96b0d91f have been backported in RHEL.
|
||||
## No longer needed, since upstream commit v5.15~9
|
||||
#Patch2004: 2004-glibc-msgctl-semctl-shmctl-backport-workaround.patch
|
||||
|
||||
|
||||
# We no longer need to build a separate strace32 binary, but we don't want
|
||||
@ -231,6 +343,12 @@ Provides: strace32 = %{evr}
|
||||
Obsoletes: strace32 < 4.24
|
||||
%endif
|
||||
|
||||
# Fallback definitions for make_build/make_install macros
|
||||
%{?!__make: %global __make %_bindir/make}
|
||||
%{?!__install: %global __install %_bindir/install}
|
||||
%{?!make_build: %global make_build %__make %{?_smp_mflags}}
|
||||
%{?!make_install: %global make_install %__make install DESTDIR="%{?buildroot}" INSTALL="%__install -p"}
|
||||
|
||||
%description
|
||||
The strace program intercepts and records the system calls called and
|
||||
received by a running process. Strace can print a record of each
|
||||
@ -293,32 +411,81 @@ received by a process.
|
||||
#%patch110 -p1
|
||||
#%patch111 -p1
|
||||
#%patch112 -p1
|
||||
%patch113 -p1
|
||||
%patch114 -p1
|
||||
%patch115 -p1
|
||||
#%patch113 -p1
|
||||
#%patch114 -p1
|
||||
#%patch115 -p1
|
||||
#%patch116 -p1
|
||||
#%patch117 -p1
|
||||
%patch118 -p1
|
||||
%patch119 -p1
|
||||
%patch120 -p1
|
||||
#%patch118 -p1
|
||||
#%patch119 -p1
|
||||
#%patch120 -p1
|
||||
#%patch121 -p1
|
||||
%patch122 -p1
|
||||
%patch123 -p1
|
||||
%patch124 -p1
|
||||
%patch125 -p1
|
||||
%patch126 -p1
|
||||
%patch127 -p1
|
||||
%patch128 -p1
|
||||
%patch129 -p1
|
||||
%patch130 -p1
|
||||
%patch131 -p1
|
||||
%patch132 -p1
|
||||
%patch133 -p1
|
||||
%patch134 -p1
|
||||
%patch135 -p1
|
||||
%patch136 -p1
|
||||
%patch137 -p1
|
||||
%patch138 -p1
|
||||
#%patch122 -p1
|
||||
#%patch123 -p1
|
||||
#%patch124 -p1
|
||||
#%patch125 -p1
|
||||
#%patch126 -p1
|
||||
#%patch127 -p1
|
||||
#%patch128 -p1
|
||||
#%patch129 -p1
|
||||
#%patch130 -p1
|
||||
#%patch131 -p1
|
||||
#%patch132 -p1
|
||||
#%patch133 -p1
|
||||
#%patch134 -p1
|
||||
#%patch135 -p1
|
||||
#%patch136 -p1
|
||||
#%patch137 -p1
|
||||
#%patch138 -p1
|
||||
#%patch142 -p1
|
||||
#%patch143 -p1
|
||||
#%patch144 -p1
|
||||
#%patch145 -p1
|
||||
#%patch146 -p1
|
||||
#%patch147 -p1
|
||||
#%patch148 -p1
|
||||
#%patch149 -p1
|
||||
#%patch155 -p1
|
||||
#%patch156 -p1
|
||||
#%patch157 -p1
|
||||
#%patch158 -p1
|
||||
#%patch159 -p1
|
||||
#%patch160 -p1
|
||||
#%patch161 -p1
|
||||
#%patch162 -p1
|
||||
#%patch163 -p1
|
||||
#%patch164 -p1
|
||||
#%patch165 -p1
|
||||
#%patch166 -p1
|
||||
#%patch167 -p1
|
||||
#%patch168 -p1
|
||||
#%patch169 -p1
|
||||
#%patch170 -p1
|
||||
#%patch171 -p1
|
||||
#%patch172 -p1
|
||||
#%patch173 -p1
|
||||
#%patch174 -p1
|
||||
|
||||
%patch175 -p1
|
||||
%patch176 -p1
|
||||
%patch177 -p1
|
||||
%patch178 -p1
|
||||
%patch179 -p1
|
||||
%patch180 -p1
|
||||
%patch181 -p1
|
||||
%patch182 -p1
|
||||
|
||||
%patch183 -p1
|
||||
%patch184 -p1
|
||||
%patch185 -p1
|
||||
|
||||
%patch186 -p1
|
||||
%patch187 -p1
|
||||
%patch188 -p1
|
||||
#%patch189 -p1
|
||||
#%patch190 -p1
|
||||
%patch191 -p1
|
||||
%patch192 -p1
|
||||
|
||||
#%patch1000 -p1
|
||||
#%patch1001 -p1
|
||||
@ -326,14 +493,15 @@ received by a process.
|
||||
#%patch2000 -p1
|
||||
%patch2001 -p1
|
||||
#%patch2002 -p1
|
||||
%patch2003 -p1
|
||||
#%patch2003 -p1
|
||||
#%patch2004 -p1
|
||||
|
||||
chmod a+x tests/*.test
|
||||
|
||||
echo -n %version-%release > .tarball-version
|
||||
echo -n 2020 > .year
|
||||
echo -n 2020-04-30 > .strace.1.in.date
|
||||
|
||||
echo -n 2022 > .year
|
||||
echo -n 2022-06-22 > doc/.strace.1.in.date
|
||||
echo -n 2022-06-22 > doc/.strace-log-merge.1.in.date
|
||||
|
||||
%build
|
||||
echo 'BEGIN OF BUILD ENVIRONMENT INFORMATION'
|
||||
@ -352,18 +520,18 @@ CFLAGS=" $RPM_OPT_FLAGS $LDFLAGS "
|
||||
[ "x${CFLAGS#* -m64 }" = "x${CFLAGS}" ] || CFLAGS=$(echo "$CFLAGS" | sed 's/ -m64 / /g')
|
||||
export CFLAGS
|
||||
|
||||
CPPFLAGS=" -I%{_includedir} %{optflags} "
|
||||
CPPFLAGS=" -isystem %{_includedir} %{optflags} "
|
||||
# Removing explicit -m64 as it breaks mpers
|
||||
[ "x${CPPFLAGS#* -m64 }" = "x${CPPFLAGS}" ] || CPPFLAGS=$(echo "$CPPFLAGS" | sed 's/ -m64 / /g')
|
||||
export CPPFLAGS
|
||||
|
||||
CFLAGS_FOR_BUILD="$RPM_OPT_FLAGS"; export CFLAGS_FOR_BUILD
|
||||
%configure --enable-mpers=check --with-libdw --with-libiberty
|
||||
make %{?_smp_mflags}
|
||||
%make_build
|
||||
|
||||
|
||||
%install
|
||||
make DESTDIR=%{buildroot} install
|
||||
%make_install
|
||||
|
||||
%ifarch %{strace32_arches}
|
||||
ln -s ./strace %{buildroot}%{_bindir}/strace32
|
||||
@ -386,10 +554,9 @@ chmod u+x tests/*.test tests-m32/*.test tests-mx32/*.test
|
||||
|
||||
# We have to limit concurrent execution of tests as some time-sensitive tests
|
||||
# start to fail if the reported time is way too off from the expected one.
|
||||
make -j2 -k check VERBOSE=1 V=1 TIMEOUT_DURATION=5400
|
||||
%make_build -k check VERBOSE=1 V=1
|
||||
echo 'BEGIN OF TEST SUITE INFORMATION'
|
||||
tail -n 99999 -- tests*/test-suite.log
|
||||
tail -n 99999 -- tests*/ksysent.log ||:
|
||||
tail -n 99999 -- tests*/test-suite.log tests*/ksysent.gen.log
|
||||
find tests* -type f -name '*.log' -print0 |
|
||||
xargs -r0 grep -H '^KERNEL BUG:' -- ||:
|
||||
echo 'END OF TEST SUITE INFORMATION'
|
||||
@ -405,6 +572,36 @@ echo 'END OF TEST SUITE INFORMATION'
|
||||
%{_mandir}/man1/*
|
||||
|
||||
%changelog
|
||||
* Tue Oct 29 2024 Eugene Syromiatnikov <esyr@redhat.com> - 5.18-2.1
|
||||
- Fix incorrect syscall name reporting in restart_syscall() on attach when
|
||||
PTRACE_GET_SYSCALL_INFO is in use (RHEL-8570).
|
||||
- Update net-yy-inet*, linkat--secontext_mismatch, and prctl-sve tests.
|
||||
|
||||
* Mon Jul 11 2022 Eugene Syromiatnikov <esyr@redhat.com> - 5.18-2
|
||||
- Fix the issues reported by covscan (#2103068).
|
||||
- Fix SELinux context matching for the deleted paths (#2087693).
|
||||
- Fix sloppy FD usage in the bpf test (#2103137).
|
||||
|
||||
* Wed Jun 22 2022 Eugene Syromiatnikov <esyr@redhat.com> - 5.18-1
|
||||
- Rebase to v5.18; drop upstream patches on top of 5.13 (#2084000).
|
||||
|
||||
* Mon Feb 07 2022 Eugene Syromiatnikov <esyr@redhat.com> - 5.13-4
|
||||
- Update tests-m32 and tests-mx32 with --secontext=mismatch option support
|
||||
changes (#2046259).
|
||||
|
||||
* Wed Jan 19 2022 Eugene Syromiatnikov <esyr@redhat.com> - 5.13-3
|
||||
- Add --secontext=mismatch option support (#2038810).
|
||||
|
||||
* Wed Jan 05 2022 Eugene Syromiatnikov <esyr@redhat.com> - 5.13-2
|
||||
- Fix incorrect ifname printing buffer size (#2028158).
|
||||
|
||||
* Wed Oct 20 2021 Eugene Syromiatnikov <esyr@redhat.com> - 5.13-1
|
||||
- Rebase to v5.13; drop upstream patches on top of 5.7 (#2015917).
|
||||
- Address some issues reported by covscan.
|
||||
|
||||
* Mon Aug 09 2021 Eugene Syromiatnikov <esyr@redhat.com> - 5.7-3
|
||||
- Add SELnux context decoding support (#1946500).
|
||||
|
||||
* Mon Nov 09 2020 Eugene Syromiatnikov <esyr@redhat.com> - 5.7-2
|
||||
- Add PID namespace translation support (#1725113).
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user