Compare commits

...

No commits in common. "c10s" and "c8" have entirely different histories.
c10s ... c8

28 changed files with 9576 additions and 5 deletions

View File

@ -0,0 +1 @@
95c9d5aa664982d53ce1e5ab058d8fb73e200f0c SOURCES/strace-5.7.tar.xz

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/strace-5.7.tar.xz

View File

@ -1,3 +0,0 @@
# Package Not Available
This package is not available on CentOS Stream 10.
It may be available on another branch.

View File

@ -0,0 +1,155 @@
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

View File

@ -0,0 +1,157 @@
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

View File

@ -0,0 +1,30 @@
From 05747ff8f8a3533e4db69eb359be9ed1ae920ebd 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 121/138] 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(-)
diff --git a/types/find_last_type_fields.awk b/types/find_last_type_fields.awk
index 4c0da0f..d0cae0d 100644
--- a/types/find_last_type_fields.awk
+++ b/types/find_last_type_fields.awk
@@ -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
}
--
2.1.4

View File

@ -0,0 +1,235 @@
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"

View File

@ -0,0 +1,60 @@
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

View File

@ -0,0 +1,28 @@
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

View File

@ -0,0 +1,518 @@
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}",

View File

@ -0,0 +1,105 @@
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

View File

@ -0,0 +1,525 @@
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,

View File

@ -0,0 +1,56 @@
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

View File

@ -0,0 +1,417 @@
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

View File

@ -0,0 +1,415 @@
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

View File

@ -0,0 +1,683 @@
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) $^ $@

View File

@ -0,0 +1,656 @@
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

View File

@ -0,0 +1,93 @@
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

View File

@ -1 +0,0 @@
gcc-toolset-10-strace package is retired on branch c10s for CS-2551

View File

@ -1 +0,0 @@
SHA512 (strace-5.7.tar.xz) = aef481238196204495cf9507cd48ce30af799f79904478e6be57a267311a999c868f18540cc1e025f5e486730cfe9ccb256f528f6f796d204a7347ebdf2042f1