import strace-5.7-2.el8

This commit is contained in:
CentOS Sources 2021-05-18 02:33:18 -04:00 committed by Andrew Lukoshko
parent 7674056bb8
commit 884e5658e4
42 changed files with 30640 additions and 2684 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/strace-5.1.tar.xz
SOURCES/strace-5.7.tar.xz

View File

@ -1 +1 @@
6474260dcc66aa1f591acee31ae6a1a457b34656 SOURCES/strace-5.1.tar.xz
95c9d5aa664982d53ce1e5ab058d8fb73e200f0c SOURCES/strace-5.7.tar.xz

View File

@ -1,42 +0,0 @@
From 7ada13f3a40e2f58aea335cf910666378e7dd99a Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Fri, 12 Jul 2019 14:38:33 +0200
Subject: [PATCH 1/3] evdev: avoid bit vector decoding on non-successful and 0
return codes
Reported by Clang.
strace/evdev.c:157:3: note: The value 0 is assigned to 'size'
# size = tcp->u_rval * 8;
# ^~~~~~~~~~~~~~~~~~~~~~
strace/evdev.c:158:2: warning: Declared variable-length array (VLA)
has zero size
# char decoded_arg[size];
# ^
* evdev.c (decode_bitset_): Bail out before decoded_arg VLA definition.
---
evdev.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/evdev.c b/evdev.c
index e402d26e..4b811cf8 100644
--- a/evdev.c
+++ b/evdev.c
@@ -155,6 +155,13 @@ decode_bitset_(struct tcb *const tcp, const kernel_ulong_t arg,
size = max_nr;
else
size = tcp->u_rval * 8;
+
+ if (syserror(tcp) || !size) {
+ printaddr(arg);
+
+ return RVAL_IOCTL_DECODED;
+ }
+
char decoded_arg[size];
if (umove_or_printaddr(tcp, arg, &decoded_arg))
--
2.13.6

View File

@ -1,57 +0,0 @@
From 96194ed74158f0b9976fae43a910ad14eaea141e Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Fri, 12 Jul 2019 14:57:28 +0200
Subject: [PATCH 2/3] evdev: fix array size calculation in decode_bitset_
max_nr is in bits (as it is a number of flags), result is in bytes, and
the array allocation has to be in personality words.
There's still an open question, however, what to do on big-endian
architectures when a non-divisible-by-4 value is returned.
* evdev.c (decode_bitset_): Declare size_bits, initialise it and use it
later instead of size; round up size by personality's word boundary.
---
evdev.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/evdev.c b/evdev.c
index 4b811cf8..a3d9cb55 100644
--- a/evdev.c
+++ b/evdev.c
@@ -151,10 +151,14 @@ decode_bitset_(struct tcb *const tcp, const kernel_ulong_t arg,
tprints(", ");
unsigned int size;
+ unsigned int size_bits;
+
if ((kernel_ulong_t) tcp->u_rval > max_nr / 8)
- size = max_nr;
+ size_bits = max_nr;
else
- size = tcp->u_rval * 8;
+ size_bits = tcp->u_rval * 8;
+
+ size = ROUNDUP(ROUNDUP_DIV(size_bits, 8), current_wordsize);
if (syserror(tcp) || !size) {
printaddr(arg);
@@ -170,13 +174,13 @@ decode_bitset_(struct tcb *const tcp, const kernel_ulong_t arg,
tprints("[");
int bit_displayed = 0;
- int i = next_set_bit(decoded_arg, 0, size);
+ int i = next_set_bit(decoded_arg, 0, size_bits);
if (i < 0) {
tprints(" 0 ");
} else {
printxval_dispatch(decode_nr, decode_nr_size, i, dflt, xt);
- while ((i = next_set_bit(decoded_arg, i + 1, size)) > 0) {
+ while ((i = next_set_bit(decoded_arg, i + 1, size_bits)) > 0) {
if (abbrev(tcp) && bit_displayed >= 3) {
tprints(", ...");
break;
--
2.13.6

View File

@ -1,795 +0,0 @@
From cdd8206af74fcb961f0179e21eacf5d55d23f0ac Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Fri, 12 Jul 2019 14:31:44 +0200
Subject: [PATCH 3/3] tests: test evdev bitset decoding more thoroughly
* tests/ioctl_evdev-success-v.test: Inject various values.
* tests/ioctl_evdev-success.test: Likewise.
* tests/ioctl_evdev-success.c (NUM_WORDS): New macro.
(struct evdev_check): Constify arg_ptr and print_arg args.
(invoke_test_syscall, test_evdev, print_input_absinfo, print_input_id,
print_mtslots): Add const qualifiers.
(print_getbit): Add const qualifiers, rewrite to expect trailing NULL
in the string array instead of leading string count.
(main): Set size for ev_more, ev_less, ev_zero arrays; replace leading
count element in ev_more_str, ev_less_str, ev_zero_str with trailing
NULL; replace ev_more_str and ev_less_str with ev_more_str_2/ev_less_str_2
and ev_more_str_3/ev_less_str_3 that differ by presence of flags that reside
beyond first two bytes; add static and const qualifiers where possible;
add key/key_sts_8/key_str_16 values; update a to provide either ev_more_str_2
or ev_more_str_3 and either key_str_8 or key_str_16 depending on inject_retval
value.
---
tests/ioctl_evdev-success-v.test | 15 +++---
tests/ioctl_evdev-success.c | 100 ++++++++++++++++++++++++++-------------
tests/ioctl_evdev-success.test | 15 +++---
3 files changed, 84 insertions(+), 46 deletions(-)
Index: strace-4.24/tests/ioctl_evdev-success-v.test
===================================================================
--- strace-4.24.orig/tests/ioctl_evdev-success-v.test 2019-08-01 18:40:58.009521546 +0200
+++ strace-4.24/tests/ioctl_evdev-success-v.test 2019-08-01 19:21:32.297062218 +0200
@@ -3,11 +3,14 @@
. "${srcdir=.}/scno_tampering.sh"
: ${IOCTL_INJECT_START=256}
-: ${IOCTL_INJECT_RETVAL=8}
run_prog
-run_strace -a16 -v -e trace=ioctl \
- -e inject=ioctl:retval="${IOCTL_INJECT_RETVAL}":when="${IOCTL_INJECT_START}+" \
- ../ioctl_evdev-success-v "${IOCTL_INJECT_START}" "${IOCTL_INJECT_RETVAL}"> "$EXP"
-grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT"
-match_diff "$OUT" "$EXP"
+
+for ret in 0 2 8 15 16; do
+ run_strace -a16 -v -e trace=ioctl \
+ -e inject=ioctl:retval="${ret}":when="${IOCTL_INJECT_START}+" \
+ ../ioctl_evdev-success-v \
+ "${IOCTL_INJECT_START}" "${ret}"> "$EXP.$ret"
+ grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT.$ret"
+ match_diff "$OUT.$ret" "$EXP.$ret"
+done
Index: strace-4.24/tests/ioctl_evdev-success.c
===================================================================
--- strace-4.24.orig/tests/ioctl_evdev-success.c 2019-08-01 18:40:58.009521546 +0200
+++ strace-4.24/tests/ioctl_evdev-success.c 2019-08-01 19:21:32.297062218 +0200
@@ -2,6 +2,7 @@
#ifdef HAVE_LINUX_INPUT_H
+# include <assert.h>
# include <inttypes.h>
# include <stdio.h>
# include <stdlib.h>
@@ -9,17 +10,19 @@
# include <linux/input.h>
# include "print_fields.h"
+# define NUM_WORDS 4
+
static const char *errstr;
struct evdev_check {
unsigned long cmd;
const char *cmd_str;
- void *arg_ptr;
- void (*print_arg)(long rc, void *ptr, void *arg);
+ const void *arg_ptr;
+ void (*print_arg)(long rc, const void *ptr, const void *arg);
};
static long
-invoke_test_syscall(unsigned long cmd, void *p)
+invoke_test_syscall(unsigned long cmd, const void *p)
{
long rc = ioctl(-1, cmd, p);
errstr = sprintrc(rc);
@@ -31,7 +34,7 @@
}
static void
-test_evdev(struct evdev_check *check, void *arg)
+test_evdev(struct evdev_check *check, const void *arg)
{
long rc = invoke_test_syscall(check->cmd, check->arg_ptr);
printf("ioctl(-1, %s, ", check->cmd_str);
@@ -43,9 +46,9 @@
}
static void
-print_input_absinfo(long rc, void *ptr, void *arg)
+print_input_absinfo(long rc, const void *ptr, const void *arg)
{
- struct input_absinfo *absinfo = ptr;
+ const struct input_absinfo *absinfo = ptr;
if (rc < 0) {
printf("%p", absinfo);
@@ -67,9 +70,9 @@
}
static void
-print_input_id(long rc, void *ptr, void *arg)
+print_input_id(long rc, const void *ptr, const void *arg)
{
- struct input_id *id = ptr;
+ const struct input_id *id = ptr;
if (rc < 0) {
printf("%p", id);
@@ -84,10 +87,10 @@
# ifdef EVIOCGMTSLOTS
static void
-print_mtslots(long rc, void *ptr, void *arg)
+print_mtslots(long rc, const void *ptr, const void *arg)
{
- int *buffer = ptr;
- const char **str = arg;
+ const int *buffer = ptr;
+ const char * const * str = arg;
int num = atoi(*(str + 1));
if (rc < 0) {
@@ -104,27 +107,26 @@
# endif
static void
-print_getbit(long rc, void *ptr, void *arg)
+print_getbit(long rc, const void *ptr, const void *arg)
{
- const char **str = arg;
- int num = atoi(*str);
+ const char * const *str = arg;
- if (rc < 0) {
+ if (rc <= 0) {
printf("%p", ptr);
return;
}
printf("[");
- printf("%s", *(str + 1));
- for (unsigned int i = 2; i <= (unsigned) num; i++) {
+ for (unsigned long i = 0; str[i]; i++) {
# if ! VERBOSE
- if (i > 4) {
+ if (i >= 4) {
printf(", ...");
break;
}
# endif
- printf(", ");
- printf("%s", *(str + i));
+ if (i)
+ printf(", ");
+ printf("%s", str[i]);
}
printf("]");
}
@@ -170,6 +172,7 @@
TAIL_ALLOC_OBJECT_CONST_PTR(struct input_id, id);
TAIL_ALLOC_OBJECT_CONST_PTR(struct input_absinfo, absinfo);
TAIL_ALLOC_OBJECT_CONST_PTR(int, bad_addr_slot);
+
# ifdef EVIOCGMTSLOTS
int mtslots[] = { ABS_MT_SLOT, 1, 3 };
/* we use the second element to indicate the number of values */
@@ -183,36 +186,65 @@
const char *invalid_mtslot_str[] = { invalid_str, "1", "1" };
# endif
+ enum { ULONG_BIT = sizeof(unsigned long) * 8 };
+
/* set more than 4 bits */
- unsigned long ev_more[] = { 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED | 1 << EV_SND | 1 << EV_PWR };
- /* we use the first element to indicate the number of set bits */
- /* ev_more_str[0] is "5" so the number of set bits is 5 */
- const char *ev_more_str[] = { "5", "EV_ABS", "EV_MSC", "EV_LED", "EV_SND", "EV_PWR" };
+ static const unsigned long ev_more[NUM_WORDS] = {
+ 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED | 1 << EV_SND
+ | 1 << EV_PWR };
+ static const char * const ev_more_str_2[] = {
+ "EV_ABS", "EV_MSC", NULL };
+ static const char * const ev_more_str_3[] = {
+ "EV_ABS", "EV_MSC", "EV_LED", "EV_SND", "EV_PWR", NULL };
/* set less than 4 bits */
- unsigned long ev_less[] = { 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED };
- const char *ev_less_str[] = { "3", "EV_ABS", "EV_MSC", "EV_LED" };
+ static const unsigned long ev_less[NUM_WORDS] = {
+ 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED };
+ static const char * const ev_less_str_2[] = {
+ "EV_ABS", "EV_MSC", NULL };
+ static const char * const ev_less_str_3[] = {
+ "EV_ABS", "EV_MSC", "EV_LED", NULL };
/* set zero bit */
- unsigned long ev_zero[] = { 0x0 };
- const char *ev_zero_str[] = { "0", " 0 " };
+ static const unsigned long ev_zero[NUM_WORDS] = { 0x0 };
+ static const char * const ev_zero_str[] = { " 0 ", NULL };
/* KEY_MAX is 0x2ff which is greater than retval * 8 */
- unsigned long key[] = { 1 << KEY_1 | 1 << KEY_2, 0 };
- const char *key_str[] = { "2", "KEY_1", "KEY_2" };
+ static const unsigned long key[NUM_WORDS] = {
+ 1 << KEY_1 | 1 << KEY_2,
+ [ KEY_F12 / ULONG_BIT ] = 1 << (KEY_F12 % ULONG_BIT) };
+
+ static const char * const key_str_8[] = {
+ "KEY_1", "KEY_2", NULL };
+ static const char * const key_str_16[] = {
+ "KEY_1", "KEY_2", "KEY_F12", NULL };
+
+ assert(sizeof(ev_more) >= (unsigned long) inject_retval);
+ assert(sizeof(ev_less) >= (unsigned long) inject_retval);
+ assert(sizeof(ev_zero) >= (unsigned long) inject_retval);
+ assert(sizeof(key) >= (unsigned long) inject_retval);
struct {
struct evdev_check check;
- void *ptr;
+ const void *ptr;
} a[] = {
{ { ARG_STR(EVIOCGID), id, print_input_id }, NULL },
{ { ARG_STR(EVIOCGABS(ABS_X)), absinfo, print_input_absinfo }, NULL },
{ { ARG_STR(EVIOCGABS(ABS_Y)), absinfo, print_input_absinfo }, NULL },
{ { ARG_STR(EVIOCGABS(ABS_Y)), absinfo, print_input_absinfo }, NULL },
- { { ARG_STR(EVIOCGBIT(0, 0)), ev_more, print_getbit }, &ev_more_str },
- { { ARG_STR(EVIOCGBIT(0, 0)), ev_less, print_getbit }, &ev_less_str },
+ { { ARG_STR(EVIOCGBIT(0, 0)), ev_more, print_getbit },
+ inject_retval * 8 <= EV_LED
+ ? (const void *) &ev_more_str_2
+ : (const void *) &ev_more_str_3 },
+ { { ARG_STR(EVIOCGBIT(0, 0)), ev_less, print_getbit },
+ inject_retval * 8 <= EV_LED
+ ? (const void *) &ev_less_str_2
+ : (const void *) &ev_less_str_3 },
{ { ARG_STR(EVIOCGBIT(0, 0)), ev_zero, print_getbit }, &ev_zero_str },
- { { ARG_STR(EVIOCGBIT(EV_KEY, 0)), key, print_getbit }, &key_str},
+ { { ARG_STR(EVIOCGBIT(EV_KEY, 0)), key, print_getbit },
+ inject_retval * 8 <= KEY_F12
+ ? (const void *) &key_str_8
+ : (const void *) &key_str_16 },
# ifdef EVIOCGMTSLOTS
{ { ARG_STR(EVIOCGMTSLOTS(12)), mtslots, print_mtslots }, &mtslots_str },
{ { ARG_STR(EVIOCGMTSLOTS(8)), invalid_mtslot, print_mtslots }, &invalid_mtslot_str }
Index: strace-4.24/tests/ioctl_evdev-success.test
===================================================================
--- strace-4.24.orig/tests/ioctl_evdev-success.test 2019-08-01 18:40:58.009521546 +0200
+++ strace-4.24/tests/ioctl_evdev-success.test 2019-08-01 19:21:32.298062205 +0200
@@ -3,11 +3,14 @@
. "${srcdir=.}/scno_tampering.sh"
: ${IOCTL_INJECT_START=256}
-: ${IOCTL_INJECT_RETVAL=8}
run_prog
-run_strace -a16 -e trace=ioctl \
- -e inject=ioctl:retval="${IOCTL_INJECT_RETVAL}":when="${IOCTL_INJECT_START}+" \
- ../ioctl_evdev-success "${IOCTL_INJECT_START}" "${IOCTL_INJECT_RETVAL}"> "$EXP"
-grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT"
-match_diff "$OUT" "$EXP"
+
+for ret in 0 2 8 15 16; do
+ run_strace -a16 -e trace=ioctl \
+ -e inject=ioctl:retval="${ret}":when="${IOCTL_INJECT_START}+" \
+ ../ioctl_evdev-success \
+ "${IOCTL_INJECT_START}" "${ret}"> "$EXP.${ret}"
+ grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT.$ret"
+ match_diff "$OUT.$ret" "$EXP.$ret"
+done
Index: strace-4.24/tests-m32/ioctl_evdev-success-v.test
===================================================================
--- strace-4.24.orig/tests-m32/ioctl_evdev-success-v.test 2019-08-01 18:40:58.009521546 +0200
+++ strace-4.24/tests-m32/ioctl_evdev-success-v.test 2019-08-01 19:21:32.298062205 +0200
@@ -3,11 +3,14 @@
. "${srcdir=.}/scno_tampering.sh"
: ${IOCTL_INJECT_START=256}
-: ${IOCTL_INJECT_RETVAL=8}
run_prog
-run_strace -a16 -v -e trace=ioctl \
- -e inject=ioctl:retval="${IOCTL_INJECT_RETVAL}":when="${IOCTL_INJECT_START}+" \
- ../ioctl_evdev-success-v "${IOCTL_INJECT_START}" "${IOCTL_INJECT_RETVAL}"> "$EXP"
-grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT"
-match_diff "$OUT" "$EXP"
+
+for ret in 0 2 8 15 16; do
+ run_strace -a16 -v -e trace=ioctl \
+ -e inject=ioctl:retval="${ret}":when="${IOCTL_INJECT_START}+" \
+ ../ioctl_evdev-success-v \
+ "${IOCTL_INJECT_START}" "${ret}"> "$EXP.$ret"
+ grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT.$ret"
+ match_diff "$OUT.$ret" "$EXP.$ret"
+done
Index: strace-4.24/tests-m32/ioctl_evdev-success.test
===================================================================
--- strace-4.24.orig/tests-m32/ioctl_evdev-success.test 2019-08-01 18:40:58.009521546 +0200
+++ strace-4.24/tests-m32/ioctl_evdev-success.test 2019-08-01 19:21:32.298062205 +0200
@@ -3,11 +3,14 @@
. "${srcdir=.}/scno_tampering.sh"
: ${IOCTL_INJECT_START=256}
-: ${IOCTL_INJECT_RETVAL=8}
run_prog
-run_strace -a16 -e trace=ioctl \
- -e inject=ioctl:retval="${IOCTL_INJECT_RETVAL}":when="${IOCTL_INJECT_START}+" \
- ../ioctl_evdev-success "${IOCTL_INJECT_START}" "${IOCTL_INJECT_RETVAL}"> "$EXP"
-grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT"
-match_diff "$OUT" "$EXP"
+
+for ret in 0 2 8 15 16; do
+ run_strace -a16 -e trace=ioctl \
+ -e inject=ioctl:retval="${ret}":when="${IOCTL_INJECT_START}+" \
+ ../ioctl_evdev-success \
+ "${IOCTL_INJECT_START}" "${ret}"> "$EXP.${ret}"
+ grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT.$ret"
+ match_diff "$OUT.$ret" "$EXP.$ret"
+done
Index: strace-4.24/tests-mx32/ioctl_evdev-success-v.test
===================================================================
--- strace-4.24.orig/tests-mx32/ioctl_evdev-success-v.test 2019-08-01 18:40:58.009521546 +0200
+++ strace-4.24/tests-mx32/ioctl_evdev-success-v.test 2019-08-01 19:21:32.298062205 +0200
@@ -3,11 +3,14 @@
. "${srcdir=.}/scno_tampering.sh"
: ${IOCTL_INJECT_START=256}
-: ${IOCTL_INJECT_RETVAL=8}
run_prog
-run_strace -a16 -v -e trace=ioctl \
- -e inject=ioctl:retval="${IOCTL_INJECT_RETVAL}":when="${IOCTL_INJECT_START}+" \
- ../ioctl_evdev-success-v "${IOCTL_INJECT_START}" "${IOCTL_INJECT_RETVAL}"> "$EXP"
-grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT"
-match_diff "$OUT" "$EXP"
+
+for ret in 0 2 8 15 16; do
+ run_strace -a16 -v -e trace=ioctl \
+ -e inject=ioctl:retval="${ret}":when="${IOCTL_INJECT_START}+" \
+ ../ioctl_evdev-success-v \
+ "${IOCTL_INJECT_START}" "${ret}"> "$EXP.$ret"
+ grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT.$ret"
+ match_diff "$OUT.$ret" "$EXP.$ret"
+done
Index: strace-4.24/tests-mx32/ioctl_evdev-success.test
===================================================================
--- strace-4.24.orig/tests-mx32/ioctl_evdev-success.test 2019-08-01 18:40:58.009521546 +0200
+++ strace-4.24/tests-mx32/ioctl_evdev-success.test 2019-08-01 19:21:32.299062192 +0200
@@ -3,11 +3,14 @@
. "${srcdir=.}/scno_tampering.sh"
: ${IOCTL_INJECT_START=256}
-: ${IOCTL_INJECT_RETVAL=8}
run_prog
-run_strace -a16 -e trace=ioctl \
- -e inject=ioctl:retval="${IOCTL_INJECT_RETVAL}":when="${IOCTL_INJECT_START}+" \
- ../ioctl_evdev-success "${IOCTL_INJECT_START}" "${IOCTL_INJECT_RETVAL}"> "$EXP"
-grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT"
-match_diff "$OUT" "$EXP"
+
+for ret in 0 2 8 15 16; do
+ run_strace -a16 -e trace=ioctl \
+ -e inject=ioctl:retval="${ret}":when="${IOCTL_INJECT_START}+" \
+ ../ioctl_evdev-success \
+ "${IOCTL_INJECT_START}" "${ret}"> "$EXP.${ret}"
+ grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT.$ret"
+ match_diff "$OUT.$ret" "$EXP.$ret"
+done
Index: strace-4.24/tests-m32/ioctl_evdev-success.c
===================================================================
--- strace-4.24.orig/tests-m32/ioctl_evdev-success.c 2019-08-01 18:40:58.009521546 +0200
+++ strace-4.24/tests-m32/ioctl_evdev-success.c 2019-08-29 12:09:27.898700830 +0200
@@ -2,6 +2,7 @@
#ifdef HAVE_LINUX_INPUT_H
+# include <assert.h>
# include <inttypes.h>
# include <stdio.h>
# include <stdlib.h>
@@ -9,17 +10,19 @@
# include <linux/input.h>
# include "print_fields.h"
+# define NUM_WORDS 4
+
static const char *errstr;
struct evdev_check {
unsigned long cmd;
const char *cmd_str;
- void *arg_ptr;
- void (*print_arg)(long rc, void *ptr, void *arg);
+ const void *arg_ptr;
+ void (*print_arg)(long rc, const void *ptr, const void *arg);
};
static long
-invoke_test_syscall(unsigned long cmd, void *p)
+invoke_test_syscall(unsigned long cmd, const void *p)
{
long rc = ioctl(-1, cmd, p);
errstr = sprintrc(rc);
@@ -31,7 +34,7 @@
}
static void
-test_evdev(struct evdev_check *check, void *arg)
+test_evdev(struct evdev_check *check, const void *arg)
{
long rc = invoke_test_syscall(check->cmd, check->arg_ptr);
printf("ioctl(-1, %s, ", check->cmd_str);
@@ -43,9 +46,9 @@
}
static void
-print_input_absinfo(long rc, void *ptr, void *arg)
+print_input_absinfo(long rc, const void *ptr, const void *arg)
{
- struct input_absinfo *absinfo = ptr;
+ const struct input_absinfo *absinfo = ptr;
if (rc < 0) {
printf("%p", absinfo);
@@ -67,9 +70,9 @@
}
static void
-print_input_id(long rc, void *ptr, void *arg)
+print_input_id(long rc, const void *ptr, const void *arg)
{
- struct input_id *id = ptr;
+ const struct input_id *id = ptr;
if (rc < 0) {
printf("%p", id);
@@ -84,10 +87,10 @@
# ifdef EVIOCGMTSLOTS
static void
-print_mtslots(long rc, void *ptr, void *arg)
+print_mtslots(long rc, const void *ptr, const void *arg)
{
- int *buffer = ptr;
- const char **str = arg;
+ const int *buffer = ptr;
+ const char * const * str = arg;
int num = atoi(*(str + 1));
if (rc < 0) {
@@ -104,27 +107,26 @@
# endif
static void
-print_getbit(long rc, void *ptr, void *arg)
+print_getbit(long rc, const void *ptr, const void *arg)
{
- const char **str = arg;
- int num = atoi(*str);
+ const char * const *str = arg;
- if (rc < 0) {
+ if (rc <= 0) {
printf("%p", ptr);
return;
}
printf("[");
- printf("%s", *(str + 1));
- for (unsigned int i = 2; i <= (unsigned) num; i++) {
+ for (unsigned long i = 0; str[i]; i++) {
# if ! VERBOSE
- if (i > 4) {
+ if (i >= 4) {
printf(", ...");
break;
}
# endif
- printf(", ");
- printf("%s", *(str + i));
+ if (i)
+ printf(", ");
+ printf("%s", str[i]);
}
printf("]");
}
@@ -170,6 +172,7 @@
TAIL_ALLOC_OBJECT_CONST_PTR(struct input_id, id);
TAIL_ALLOC_OBJECT_CONST_PTR(struct input_absinfo, absinfo);
TAIL_ALLOC_OBJECT_CONST_PTR(int, bad_addr_slot);
+
# ifdef EVIOCGMTSLOTS
int mtslots[] = { ABS_MT_SLOT, 1, 3 };
/* we use the second element to indicate the number of values */
@@ -183,36 +186,65 @@
const char *invalid_mtslot_str[] = { invalid_str, "1", "1" };
# endif
+ enum { ULONG_BIT = sizeof(unsigned long) * 8 };
+
/* set more than 4 bits */
- unsigned long ev_more[] = { 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED | 1 << EV_SND | 1 << EV_PWR };
- /* we use the first element to indicate the number of set bits */
- /* ev_more_str[0] is "5" so the number of set bits is 5 */
- const char *ev_more_str[] = { "5", "EV_ABS", "EV_MSC", "EV_LED", "EV_SND", "EV_PWR" };
+ static const unsigned long ev_more[NUM_WORDS] = {
+ 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED | 1 << EV_SND
+ | 1 << EV_PWR };
+ static const char * const ev_more_str_2[] = {
+ "EV_ABS", "EV_MSC", NULL };
+ static const char * const ev_more_str_3[] = {
+ "EV_ABS", "EV_MSC", "EV_LED", "EV_SND", "EV_PWR", NULL };
/* set less than 4 bits */
- unsigned long ev_less[] = { 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED };
- const char *ev_less_str[] = { "3", "EV_ABS", "EV_MSC", "EV_LED" };
+ static const unsigned long ev_less[NUM_WORDS] = {
+ 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED };
+ static const char * const ev_less_str_2[] = {
+ "EV_ABS", "EV_MSC", NULL };
+ static const char * const ev_less_str_3[] = {
+ "EV_ABS", "EV_MSC", "EV_LED", NULL };
/* set zero bit */
- unsigned long ev_zero[] = { 0x0 };
- const char *ev_zero_str[] = { "0", " 0 " };
+ static const unsigned long ev_zero[NUM_WORDS] = { 0x0 };
+ static const char * const ev_zero_str[] = { " 0 ", NULL };
/* KEY_MAX is 0x2ff which is greater than retval * 8 */
- unsigned long key[] = { 1 << KEY_1 | 1 << KEY_2, 0 };
- const char *key_str[] = { "2", "KEY_1", "KEY_2" };
+ static const unsigned long key[NUM_WORDS] = {
+ 1 << KEY_1 | 1 << KEY_2,
+ [ KEY_F12 / ULONG_BIT ] = 1 << (KEY_F12 % ULONG_BIT) };
+
+ static const char * const key_str_8[] = {
+ "KEY_1", "KEY_2", NULL };
+ static const char * const key_str_16[] = {
+ "KEY_1", "KEY_2", "KEY_F12", NULL };
+
+ assert(sizeof(ev_more) >= (unsigned long) inject_retval);
+ assert(sizeof(ev_less) >= (unsigned long) inject_retval);
+ assert(sizeof(ev_zero) >= (unsigned long) inject_retval);
+ assert(sizeof(key) >= (unsigned long) inject_retval);
struct {
struct evdev_check check;
- void *ptr;
+ const void *ptr;
} a[] = {
{ { ARG_STR(EVIOCGID), id, print_input_id }, NULL },
{ { ARG_STR(EVIOCGABS(ABS_X)), absinfo, print_input_absinfo }, NULL },
{ { ARG_STR(EVIOCGABS(ABS_Y)), absinfo, print_input_absinfo }, NULL },
{ { ARG_STR(EVIOCGABS(ABS_Y)), absinfo, print_input_absinfo }, NULL },
- { { ARG_STR(EVIOCGBIT(0, 0)), ev_more, print_getbit }, &ev_more_str },
- { { ARG_STR(EVIOCGBIT(0, 0)), ev_less, print_getbit }, &ev_less_str },
+ { { ARG_STR(EVIOCGBIT(0, 0)), ev_more, print_getbit },
+ inject_retval * 8 <= EV_LED
+ ? (const void *) &ev_more_str_2
+ : (const void *) &ev_more_str_3 },
+ { { ARG_STR(EVIOCGBIT(0, 0)), ev_less, print_getbit },
+ inject_retval * 8 <= EV_LED
+ ? (const void *) &ev_less_str_2
+ : (const void *) &ev_less_str_3 },
{ { ARG_STR(EVIOCGBIT(0, 0)), ev_zero, print_getbit }, &ev_zero_str },
- { { ARG_STR(EVIOCGBIT(EV_KEY, 0)), key, print_getbit }, &key_str},
+ { { ARG_STR(EVIOCGBIT(EV_KEY, 0)), key, print_getbit },
+ inject_retval * 8 <= KEY_F12
+ ? (const void *) &key_str_8
+ : (const void *) &key_str_16 },
# ifdef EVIOCGMTSLOTS
{ { ARG_STR(EVIOCGMTSLOTS(12)), mtslots, print_mtslots }, &mtslots_str },
{ { ARG_STR(EVIOCGMTSLOTS(8)), invalid_mtslot, print_mtslots }, &invalid_mtslot_str }
Index: strace-4.24/tests-mx32/ioctl_evdev-success.c
===================================================================
--- strace-4.24.orig/tests-mx32/ioctl_evdev-success.c 2019-08-01 18:40:58.009521546 +0200
+++ strace-4.24/tests-mx32/ioctl_evdev-success.c 2019-08-29 12:09:30.350669261 +0200
@@ -2,6 +2,7 @@
#ifdef HAVE_LINUX_INPUT_H
+# include <assert.h>
# include <inttypes.h>
# include <stdio.h>
# include <stdlib.h>
@@ -9,17 +10,19 @@
# include <linux/input.h>
# include "print_fields.h"
+# define NUM_WORDS 4
+
static const char *errstr;
struct evdev_check {
unsigned long cmd;
const char *cmd_str;
- void *arg_ptr;
- void (*print_arg)(long rc, void *ptr, void *arg);
+ const void *arg_ptr;
+ void (*print_arg)(long rc, const void *ptr, const void *arg);
};
static long
-invoke_test_syscall(unsigned long cmd, void *p)
+invoke_test_syscall(unsigned long cmd, const void *p)
{
long rc = ioctl(-1, cmd, p);
errstr = sprintrc(rc);
@@ -31,7 +34,7 @@
}
static void
-test_evdev(struct evdev_check *check, void *arg)
+test_evdev(struct evdev_check *check, const void *arg)
{
long rc = invoke_test_syscall(check->cmd, check->arg_ptr);
printf("ioctl(-1, %s, ", check->cmd_str);
@@ -43,9 +46,9 @@
}
static void
-print_input_absinfo(long rc, void *ptr, void *arg)
+print_input_absinfo(long rc, const void *ptr, const void *arg)
{
- struct input_absinfo *absinfo = ptr;
+ const struct input_absinfo *absinfo = ptr;
if (rc < 0) {
printf("%p", absinfo);
@@ -67,9 +70,9 @@
}
static void
-print_input_id(long rc, void *ptr, void *arg)
+print_input_id(long rc, const void *ptr, const void *arg)
{
- struct input_id *id = ptr;
+ const struct input_id *id = ptr;
if (rc < 0) {
printf("%p", id);
@@ -84,10 +87,10 @@
# ifdef EVIOCGMTSLOTS
static void
-print_mtslots(long rc, void *ptr, void *arg)
+print_mtslots(long rc, const void *ptr, const void *arg)
{
- int *buffer = ptr;
- const char **str = arg;
+ const int *buffer = ptr;
+ const char * const * str = arg;
int num = atoi(*(str + 1));
if (rc < 0) {
@@ -104,27 +107,26 @@
# endif
static void
-print_getbit(long rc, void *ptr, void *arg)
+print_getbit(long rc, const void *ptr, const void *arg)
{
- const char **str = arg;
- int num = atoi(*str);
+ const char * const *str = arg;
- if (rc < 0) {
+ if (rc <= 0) {
printf("%p", ptr);
return;
}
printf("[");
- printf("%s", *(str + 1));
- for (unsigned int i = 2; i <= (unsigned) num; i++) {
+ for (unsigned long i = 0; str[i]; i++) {
# if ! VERBOSE
- if (i > 4) {
+ if (i >= 4) {
printf(", ...");
break;
}
# endif
- printf(", ");
- printf("%s", *(str + i));
+ if (i)
+ printf(", ");
+ printf("%s", str[i]);
}
printf("]");
}
@@ -170,6 +172,7 @@
TAIL_ALLOC_OBJECT_CONST_PTR(struct input_id, id);
TAIL_ALLOC_OBJECT_CONST_PTR(struct input_absinfo, absinfo);
TAIL_ALLOC_OBJECT_CONST_PTR(int, bad_addr_slot);
+
# ifdef EVIOCGMTSLOTS
int mtslots[] = { ABS_MT_SLOT, 1, 3 };
/* we use the second element to indicate the number of values */
@@ -183,36 +186,65 @@
const char *invalid_mtslot_str[] = { invalid_str, "1", "1" };
# endif
+ enum { ULONG_BIT = sizeof(unsigned long) * 8 };
+
/* set more than 4 bits */
- unsigned long ev_more[] = { 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED | 1 << EV_SND | 1 << EV_PWR };
- /* we use the first element to indicate the number of set bits */
- /* ev_more_str[0] is "5" so the number of set bits is 5 */
- const char *ev_more_str[] = { "5", "EV_ABS", "EV_MSC", "EV_LED", "EV_SND", "EV_PWR" };
+ static const unsigned long ev_more[NUM_WORDS] = {
+ 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED | 1 << EV_SND
+ | 1 << EV_PWR };
+ static const char * const ev_more_str_2[] = {
+ "EV_ABS", "EV_MSC", NULL };
+ static const char * const ev_more_str_3[] = {
+ "EV_ABS", "EV_MSC", "EV_LED", "EV_SND", "EV_PWR", NULL };
/* set less than 4 bits */
- unsigned long ev_less[] = { 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED };
- const char *ev_less_str[] = { "3", "EV_ABS", "EV_MSC", "EV_LED" };
+ static const unsigned long ev_less[NUM_WORDS] = {
+ 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED };
+ static const char * const ev_less_str_2[] = {
+ "EV_ABS", "EV_MSC", NULL };
+ static const char * const ev_less_str_3[] = {
+ "EV_ABS", "EV_MSC", "EV_LED", NULL };
/* set zero bit */
- unsigned long ev_zero[] = { 0x0 };
- const char *ev_zero_str[] = { "0", " 0 " };
+ static const unsigned long ev_zero[NUM_WORDS] = { 0x0 };
+ static const char * const ev_zero_str[] = { " 0 ", NULL };
/* KEY_MAX is 0x2ff which is greater than retval * 8 */
- unsigned long key[] = { 1 << KEY_1 | 1 << KEY_2, 0 };
- const char *key_str[] = { "2", "KEY_1", "KEY_2" };
+ static const unsigned long key[NUM_WORDS] = {
+ 1 << KEY_1 | 1 << KEY_2,
+ [ KEY_F12 / ULONG_BIT ] = 1 << (KEY_F12 % ULONG_BIT) };
+
+ static const char * const key_str_8[] = {
+ "KEY_1", "KEY_2", NULL };
+ static const char * const key_str_16[] = {
+ "KEY_1", "KEY_2", "KEY_F12", NULL };
+
+ assert(sizeof(ev_more) >= (unsigned long) inject_retval);
+ assert(sizeof(ev_less) >= (unsigned long) inject_retval);
+ assert(sizeof(ev_zero) >= (unsigned long) inject_retval);
+ assert(sizeof(key) >= (unsigned long) inject_retval);
struct {
struct evdev_check check;
- void *ptr;
+ const void *ptr;
} a[] = {
{ { ARG_STR(EVIOCGID), id, print_input_id }, NULL },
{ { ARG_STR(EVIOCGABS(ABS_X)), absinfo, print_input_absinfo }, NULL },
{ { ARG_STR(EVIOCGABS(ABS_Y)), absinfo, print_input_absinfo }, NULL },
{ { ARG_STR(EVIOCGABS(ABS_Y)), absinfo, print_input_absinfo }, NULL },
- { { ARG_STR(EVIOCGBIT(0, 0)), ev_more, print_getbit }, &ev_more_str },
- { { ARG_STR(EVIOCGBIT(0, 0)), ev_less, print_getbit }, &ev_less_str },
+ { { ARG_STR(EVIOCGBIT(0, 0)), ev_more, print_getbit },
+ inject_retval * 8 <= EV_LED
+ ? (const void *) &ev_more_str_2
+ : (const void *) &ev_more_str_3 },
+ { { ARG_STR(EVIOCGBIT(0, 0)), ev_less, print_getbit },
+ inject_retval * 8 <= EV_LED
+ ? (const void *) &ev_less_str_2
+ : (const void *) &ev_less_str_3 },
{ { ARG_STR(EVIOCGBIT(0, 0)), ev_zero, print_getbit }, &ev_zero_str },
- { { ARG_STR(EVIOCGBIT(EV_KEY, 0)), key, print_getbit }, &key_str},
+ { { ARG_STR(EVIOCGBIT(EV_KEY, 0)), key, print_getbit },
+ inject_retval * 8 <= KEY_F12
+ ? (const void *) &key_str_8
+ : (const void *) &key_str_16 },
# ifdef EVIOCGMTSLOTS
{ { ARG_STR(EVIOCGMTSLOTS(12)), mtslots, print_mtslots }, &mtslots_str },
{ { ARG_STR(EVIOCGMTSLOTS(8)), invalid_mtslot, print_mtslots }, &invalid_mtslot_str }

View File

@ -1,32 +0,0 @@
From 91281fec7823f1cd3df3374fbcbd14af52a3fa1b Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Wed, 14 Aug 2019 17:15:47 +0200
Subject: [PATCH] v4l2: avoid shifting left a signed number by 31 bit
cppcheck warns about it with the following diagnostics:
error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is
undefined behaviour
* v4l2.c [!v4l2_fourcc_be] (v4l2_fourcc_be): Shift left 1U and not 1 in
order to get 0x80000000.
---
v4l2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/v4l2.c b/v4l2.c
index 5da457c..505e7b8 100644
--- a/v4l2.c
+++ b/v4l2.c
@@ -47,7 +47,7 @@ typedef struct v4l2_standard struct_v4l2_standard;
/* v4l2_fourcc_be was added by Linux commit v3.18-rc1~101^2^2~127 */
#ifndef v4l2_fourcc_be
-# define v4l2_fourcc_be(a, b, c, d) (v4l2_fourcc(a, b, c, d) | (1 << 31))
+# define v4l2_fourcc_be(a, b, c, d) (v4l2_fourcc(a, b, c, d) | (1U << 31))
#endif
#define FMT_FRACT "%u/%u"
--
2.1.4

View File

@ -1,55 +0,0 @@
From 522ad3a0e73148dadd2480cd9cec84d9112b2e57 Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Tue, 4 Sep 2018 14:48:13 +0200
Subject: [PATCH] syscall.c: avoid infinite loop in subcalls parsing
clang complains about it, so it might be a good reason to refactor it
into something more linear.
* syscall.c (syscall_entering_decode): Put syscall subcall decoding
before ipc/socket subcall decoding, remove the loop.
---
syscall.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/syscall.c b/syscall.c
index bae7343..a67d744 100644
--- a/syscall.c
+++ b/syscall.c
@@ -579,11 +579,13 @@ syscall_entering_decode(struct tcb *tcp)
return res;
}
+# ifdef SYS_syscall_subcall
+ if (tcp_sysent(tcp)->sen == SEN_syscall)
+ decode_syscall_subcall(tcp);
+# endif
#if defined SYS_ipc_subcall \
- || defined SYS_socket_subcall \
- || defined SYS_syscall_subcall
- for (;;) {
- switch (tcp_sysent(tcp)->sen) {
+ || defined SYS_socket_subcall
+ switch (tcp_sysent(tcp)->sen) {
# ifdef SYS_ipc_subcall
case SEN_ipc:
decode_ipc_subcall(tcp);
@@ -594,15 +596,6 @@ syscall_entering_decode(struct tcb *tcp)
decode_socket_subcall(tcp);
break;
# endif
-# ifdef SYS_syscall_subcall
- case SEN_syscall:
- decode_syscall_subcall(tcp);
- if (tcp_sysent(tcp)->sen != SEN_syscall)
- continue;
- break;
-# endif
- }
- break;
}
#endif
--
2.1.4

View File

@ -1,36 +0,0 @@
From 9446038e9face3313373ca5f7539476789fd4660 Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Tue, 18 Dec 2018 05:37:30 +0100
Subject: [PATCH] kvm: avoid bogus vcpu_info assignment in vcpu_register
Also reformat code a bit to make nesting a bit clearer.
Reported by Clang.
* kvm.c (vcpu_register): Do not assign vcpu_alloc result to vcpu_info
as this value is not used afterwards in the function.
---
kvm.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/kvm.c b/kvm.c
index 984a75e..8bdf1cc 100644
--- a/kvm.c
+++ b/kvm.c
@@ -76,10 +76,9 @@ vcpu_register(struct tcb *const tcp, int fd, int cpuid)
struct vcpu_info *vcpu_info = vcpu_find(tcp, fd);
- if (!vcpu_info)
- vcpu_info = vcpu_alloc(tcp, fd, cpuid);
- else if (vcpu_info->cpuid != cpuid)
- {
+ if (!vcpu_info) {
+ vcpu_alloc(tcp, fd, cpuid);
+ } else if (vcpu_info->cpuid != cpuid) {
vcpu_info->cpuid = cpuid;
vcpu_info->resolved = false;
}
--
2.1.4

View File

@ -1,365 +0,0 @@
From c26541c73c3b4be2977e719d77287255eb346cdf Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Thu, 17 Oct 2019 13:13:45 +0200
Subject: [PATCH] xlat: use unsgined type for mount_flags fallback values
Reported by cppcheck:
strace/xlat/mount_flags.h:256: error[shiftTooManyBitsSigned]:
Shifting signed 32-bit value by 31 bits is undefined behaviour
# 254| XLAT(MS_BORN),
# 255| XLAT(MS_ACTIVE),
# 256|-> XLAT(MS_NOUSER),
# 257| XLAT_END
# 258| };
* xlat/mount_flags.in: Use 1U instead of 1 as a bit shifting operand.
References: https://bugzilla.redhat.com/show_bug.cgi?id=1747524
---
xlat/mount_flags.in | 60 ++++++++++++++++++++++++++---------------------------
1 file changed, 30 insertions(+), 30 deletions(-)
Index: strace-4.24/xlat/mount_flags.in
===================================================================
--- strace-4.24.orig/xlat/mount_flags.in 2018-04-24 02:35:27.000000000 +0200
+++ strace-4.24/xlat/mount_flags.in 2019-12-02 18:37:39.403710911 +0100
@@ -1,30 +1,30 @@
-MS_RDONLY 1
-MS_NOSUID 2
-MS_NODEV 4
-MS_NOEXEC 8
-MS_SYNCHRONOUS 16
-MS_REMOUNT 32
-MS_MANDLOCK 64
-MS_DIRSYNC 128
-MS_NOATIME 1024
-MS_NODIRATIME 2048
-MS_BIND 4096
-MS_MOVE 8192
-MS_REC 16384
-MS_SILENT 32768
-MS_POSIXACL (1<<16)
-MS_UNBINDABLE (1<<17)
-MS_PRIVATE (1<<18)
-MS_SLAVE (1<<19)
-MS_SHARED (1<<20)
-MS_RELATIME (1<<21)
-MS_KERNMOUNT (1<<22)
-MS_I_VERSION (1<<23)
-MS_STRICTATIME (1<<24)
-MS_LAZYTIME (1<<25)
-MS_SUBMOUNT (1<<26)
-MS_NOREMOTELOCK (1<<27)
-MS_NOSEC (1<<28)
-MS_BORN (1<<29)
-MS_ACTIVE (1<<30)
-MS_NOUSER (1<<31)
+MS_RDONLY (1U<<0)
+MS_NOSUID (1U<<1)
+MS_NODEV (1U<<2)
+MS_NOEXEC (1U<<3)
+MS_SYNCHRONOUS (1U<<4)
+MS_REMOUNT (1U<<5)
+MS_MANDLOCK (1U<<6)
+MS_DIRSYNC (1U<<7)
+MS_NOATIME (1U<<10)
+MS_NODIRATIME (1U<<11)
+MS_BIND (1U<<12)
+MS_MOVE (1U<<13)
+MS_REC (1U<<14)
+MS_SILENT (1U<<15)
+MS_POSIXACL (1U<<16)
+MS_UNBINDABLE (1U<<17)
+MS_PRIVATE (1U<<18)
+MS_SLAVE (1U<<19)
+MS_SHARED (1U<<20)
+MS_RELATIME (1U<<21)
+MS_KERNMOUNT (1U<<22)
+MS_I_VERSION (1U<<23)
+MS_STRICTATIME (1U<<24)
+MS_LAZYTIME (1U<<25)
+MS_SUBMOUNT (1U<<26)
+MS_NOREMOTELOCK (1U<<27)
+MS_NOSEC (1U<<28)
+MS_BORN (1U<<29)
+MS_ACTIVE (1U<<30)
+MS_NOUSER (1U<<31)
Index: strace-4.24/xlat/mount_flags.h
===================================================================
--- strace-4.24.orig/xlat/mount_flags.h 2018-08-14 02:44:19.000000000 +0200
+++ strace-4.24/xlat/mount_flags.h 2019-12-02 18:38:36.102900164 +0100
@@ -5,213 +5,213 @@
#if defined(MS_RDONLY) || (defined(HAVE_DECL_MS_RDONLY) && HAVE_DECL_MS_RDONLY)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_RDONLY) == (1), "MS_RDONLY != 1");
+static_assert((MS_RDONLY) == ((1U<<0)), "MS_RDONLY != (1U<<0)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_RDONLY 1
+# define MS_RDONLY (1U<<0)
#endif
#if defined(MS_NOSUID) || (defined(HAVE_DECL_MS_NOSUID) && HAVE_DECL_MS_NOSUID)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_NOSUID) == (2), "MS_NOSUID != 2");
+static_assert((MS_NOSUID) == ((1U<<1)), "MS_NOSUID != (1U<<1)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_NOSUID 2
+# define MS_NOSUID (1U<<1)
#endif
#if defined(MS_NODEV) || (defined(HAVE_DECL_MS_NODEV) && HAVE_DECL_MS_NODEV)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_NODEV) == (4), "MS_NODEV != 4");
+static_assert((MS_NODEV) == ((1U<<2)), "MS_NODEV != (1U<<2)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_NODEV 4
+# define MS_NODEV (1U<<2)
#endif
#if defined(MS_NOEXEC) || (defined(HAVE_DECL_MS_NOEXEC) && HAVE_DECL_MS_NOEXEC)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_NOEXEC) == (8), "MS_NOEXEC != 8");
+static_assert((MS_NOEXEC) == ((1U<<3)), "MS_NOEXEC != (1U<<3)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_NOEXEC 8
+# define MS_NOEXEC (1U<<3)
#endif
#if defined(MS_SYNCHRONOUS) || (defined(HAVE_DECL_MS_SYNCHRONOUS) && HAVE_DECL_MS_SYNCHRONOUS)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_SYNCHRONOUS) == (16), "MS_SYNCHRONOUS != 16");
+static_assert((MS_SYNCHRONOUS) == ((1U<<4)), "MS_SYNCHRONOUS != (1U<<4)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_SYNCHRONOUS 16
+# define MS_SYNCHRONOUS (1U<<4)
#endif
#if defined(MS_REMOUNT) || (defined(HAVE_DECL_MS_REMOUNT) && HAVE_DECL_MS_REMOUNT)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_REMOUNT) == (32), "MS_REMOUNT != 32");
+static_assert((MS_REMOUNT) == ((1U<<5)), "MS_REMOUNT != (1U<<5)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_REMOUNT 32
+# define MS_REMOUNT (1U<<5)
#endif
#if defined(MS_MANDLOCK) || (defined(HAVE_DECL_MS_MANDLOCK) && HAVE_DECL_MS_MANDLOCK)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_MANDLOCK) == (64), "MS_MANDLOCK != 64");
+static_assert((MS_MANDLOCK) == ((1U<<6)), "MS_MANDLOCK != (1U<<6)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_MANDLOCK 64
+# define MS_MANDLOCK (1U<<6)
#endif
#if defined(MS_DIRSYNC) || (defined(HAVE_DECL_MS_DIRSYNC) && HAVE_DECL_MS_DIRSYNC)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_DIRSYNC) == (128), "MS_DIRSYNC != 128");
+static_assert((MS_DIRSYNC) == ((1U<<7)), "MS_DIRSYNC != (1U<<7)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_DIRSYNC 128
+# define MS_DIRSYNC (1U<<7)
#endif
#if defined(MS_NOATIME) || (defined(HAVE_DECL_MS_NOATIME) && HAVE_DECL_MS_NOATIME)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_NOATIME) == (1024), "MS_NOATIME != 1024");
+static_assert((MS_NOATIME) == ((1U<<10)), "MS_NOATIME != (1U<<10)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_NOATIME 1024
+# define MS_NOATIME (1U<<10)
#endif
#if defined(MS_NODIRATIME) || (defined(HAVE_DECL_MS_NODIRATIME) && HAVE_DECL_MS_NODIRATIME)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_NODIRATIME) == (2048), "MS_NODIRATIME != 2048");
+static_assert((MS_NODIRATIME) == ((1U<<11)), "MS_NODIRATIME != (1U<<11)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_NODIRATIME 2048
+# define MS_NODIRATIME (1U<<11)
#endif
#if defined(MS_BIND) || (defined(HAVE_DECL_MS_BIND) && HAVE_DECL_MS_BIND)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_BIND) == (4096), "MS_BIND != 4096");
+static_assert((MS_BIND) == ((1U<<12)), "MS_BIND != (1U<<12)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_BIND 4096
+# define MS_BIND (1U<<12)
#endif
#if defined(MS_MOVE) || (defined(HAVE_DECL_MS_MOVE) && HAVE_DECL_MS_MOVE)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_MOVE) == (8192), "MS_MOVE != 8192");
+static_assert((MS_MOVE) == ((1U<<13)), "MS_MOVE != (1U<<13)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_MOVE 8192
+# define MS_MOVE (1U<<13)
#endif
#if defined(MS_REC) || (defined(HAVE_DECL_MS_REC) && HAVE_DECL_MS_REC)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_REC) == (16384), "MS_REC != 16384");
+static_assert((MS_REC) == ((1U<<14)), "MS_REC != (1U<<14)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_REC 16384
+# define MS_REC (1U<<14)
#endif
#if defined(MS_SILENT) || (defined(HAVE_DECL_MS_SILENT) && HAVE_DECL_MS_SILENT)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_SILENT) == (32768), "MS_SILENT != 32768");
+static_assert((MS_SILENT) == ((1U<<15)), "MS_SILENT != (1U<<15)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_SILENT 32768
+# define MS_SILENT (1U<<15)
#endif
#if defined(MS_POSIXACL) || (defined(HAVE_DECL_MS_POSIXACL) && HAVE_DECL_MS_POSIXACL)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_POSIXACL) == ((1<<16)), "MS_POSIXACL != (1<<16)");
+static_assert((MS_POSIXACL) == ((1U<<16)), "MS_POSIXACL != (1U<<16)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_POSIXACL (1<<16)
+# define MS_POSIXACL (1U<<16)
#endif
#if defined(MS_UNBINDABLE) || (defined(HAVE_DECL_MS_UNBINDABLE) && HAVE_DECL_MS_UNBINDABLE)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_UNBINDABLE) == ((1<<17)), "MS_UNBINDABLE != (1<<17)");
+static_assert((MS_UNBINDABLE) == ((1U<<17)), "MS_UNBINDABLE != (1U<<17)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_UNBINDABLE (1<<17)
+# define MS_UNBINDABLE (1U<<17)
#endif
#if defined(MS_PRIVATE) || (defined(HAVE_DECL_MS_PRIVATE) && HAVE_DECL_MS_PRIVATE)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_PRIVATE) == ((1<<18)), "MS_PRIVATE != (1<<18)");
+static_assert((MS_PRIVATE) == ((1U<<18)), "MS_PRIVATE != (1U<<18)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_PRIVATE (1<<18)
+# define MS_PRIVATE (1U<<18)
#endif
#if defined(MS_SLAVE) || (defined(HAVE_DECL_MS_SLAVE) && HAVE_DECL_MS_SLAVE)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_SLAVE) == ((1<<19)), "MS_SLAVE != (1<<19)");
+static_assert((MS_SLAVE) == ((1U<<19)), "MS_SLAVE != (1U<<19)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_SLAVE (1<<19)
+# define MS_SLAVE (1U<<19)
#endif
#if defined(MS_SHARED) || (defined(HAVE_DECL_MS_SHARED) && HAVE_DECL_MS_SHARED)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_SHARED) == ((1<<20)), "MS_SHARED != (1<<20)");
+static_assert((MS_SHARED) == ((1U<<20)), "MS_SHARED != (1U<<20)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_SHARED (1<<20)
+# define MS_SHARED (1U<<20)
#endif
#if defined(MS_RELATIME) || (defined(HAVE_DECL_MS_RELATIME) && HAVE_DECL_MS_RELATIME)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_RELATIME) == ((1<<21)), "MS_RELATIME != (1<<21)");
+static_assert((MS_RELATIME) == ((1U<<21)), "MS_RELATIME != (1U<<21)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_RELATIME (1<<21)
+# define MS_RELATIME (1U<<21)
#endif
#if defined(MS_KERNMOUNT) || (defined(HAVE_DECL_MS_KERNMOUNT) && HAVE_DECL_MS_KERNMOUNT)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_KERNMOUNT) == ((1<<22)), "MS_KERNMOUNT != (1<<22)");
+static_assert((MS_KERNMOUNT) == ((1U<<22)), "MS_KERNMOUNT != (1U<<22)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_KERNMOUNT (1<<22)
+# define MS_KERNMOUNT (1U<<22)
#endif
#if defined(MS_I_VERSION) || (defined(HAVE_DECL_MS_I_VERSION) && HAVE_DECL_MS_I_VERSION)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_I_VERSION) == ((1<<23)), "MS_I_VERSION != (1<<23)");
+static_assert((MS_I_VERSION) == ((1U<<23)), "MS_I_VERSION != (1U<<23)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_I_VERSION (1<<23)
+# define MS_I_VERSION (1U<<23)
#endif
#if defined(MS_STRICTATIME) || (defined(HAVE_DECL_MS_STRICTATIME) && HAVE_DECL_MS_STRICTATIME)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_STRICTATIME) == ((1<<24)), "MS_STRICTATIME != (1<<24)");
+static_assert((MS_STRICTATIME) == ((1U<<24)), "MS_STRICTATIME != (1U<<24)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_STRICTATIME (1<<24)
+# define MS_STRICTATIME (1U<<24)
#endif
#if defined(MS_LAZYTIME) || (defined(HAVE_DECL_MS_LAZYTIME) && HAVE_DECL_MS_LAZYTIME)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_LAZYTIME) == ((1<<25)), "MS_LAZYTIME != (1<<25)");
+static_assert((MS_LAZYTIME) == ((1U<<25)), "MS_LAZYTIME != (1U<<25)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_LAZYTIME (1<<25)
+# define MS_LAZYTIME (1U<<25)
#endif
#if defined(MS_SUBMOUNT) || (defined(HAVE_DECL_MS_SUBMOUNT) && HAVE_DECL_MS_SUBMOUNT)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_SUBMOUNT) == ((1<<26)), "MS_SUBMOUNT != (1<<26)");
+static_assert((MS_SUBMOUNT) == ((1U<<26)), "MS_SUBMOUNT != (1U<<26)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_SUBMOUNT (1<<26)
+# define MS_SUBMOUNT (1U<<26)
#endif
#if defined(MS_NOREMOTELOCK) || (defined(HAVE_DECL_MS_NOREMOTELOCK) && HAVE_DECL_MS_NOREMOTELOCK)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_NOREMOTELOCK) == ((1<<27)), "MS_NOREMOTELOCK != (1<<27)");
+static_assert((MS_NOREMOTELOCK) == ((1U<<27)), "MS_NOREMOTELOCK != (1U<<27)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_NOREMOTELOCK (1<<27)
+# define MS_NOREMOTELOCK (1U<<27)
#endif
#if defined(MS_NOSEC) || (defined(HAVE_DECL_MS_NOSEC) && HAVE_DECL_MS_NOSEC)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_NOSEC) == ((1<<28)), "MS_NOSEC != (1<<28)");
+static_assert((MS_NOSEC) == ((1U<<28)), "MS_NOSEC != (1U<<28)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_NOSEC (1<<28)
+# define MS_NOSEC (1U<<28)
#endif
#if defined(MS_BORN) || (defined(HAVE_DECL_MS_BORN) && HAVE_DECL_MS_BORN)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_BORN) == ((1<<29)), "MS_BORN != (1<<29)");
+static_assert((MS_BORN) == ((1U<<29)), "MS_BORN != (1U<<29)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_BORN (1<<29)
+# define MS_BORN (1U<<29)
#endif
#if defined(MS_ACTIVE) || (defined(HAVE_DECL_MS_ACTIVE) && HAVE_DECL_MS_ACTIVE)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_ACTIVE) == ((1<<30)), "MS_ACTIVE != (1<<30)");
+static_assert((MS_ACTIVE) == ((1U<<30)), "MS_ACTIVE != (1U<<30)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_ACTIVE (1<<30)
+# define MS_ACTIVE (1U<<30)
#endif
#if defined(MS_NOUSER) || (defined(HAVE_DECL_MS_NOUSER) && HAVE_DECL_MS_NOUSER)
DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
-static_assert((MS_NOUSER) == ((1<<31)), "MS_NOUSER != (1<<31)");
+static_assert((MS_NOUSER) == ((1U<<31)), "MS_NOUSER != (1U<<31)");
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
#else
-# define MS_NOUSER (1<<31)
+# define MS_NOUSER (1U<<31)
#endif
#ifndef XLAT_MACROS_ONLY

View File

@ -1,36 +0,0 @@
From 69b2c33a77fa687feb41fafdbe187013aa812384 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Tue, 7 Jan 2020 18:54:55 +0000
Subject: [PATCH] unwind-libdw: fix initialization of libdwfl cache
This fixes stack trace printing for early syscalls that precede
the first syscall from memory mapping or execve families.
* unwind-libdw.c (tcb_init): Set struct ctx.last_proc_updating
to a value different from mapping_generation so that libdwfl cache
is properly initialized before the first use.
* NEWS: Mention this fix.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1788636
---
Backport changes:
- NEWS hunk has been dropped.
---
NEWS | 2 ++
unwind-libdw.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
Index: strace-4.24/unwind-libdw.c
===================================================================
--- strace-4.24.orig/unwind-libdw.c 2020-01-23 12:55:01.922338273 +0100
+++ strace-4.24/unwind-libdw.c 2020-01-23 12:55:06.131299136 +0100
@@ -69,7 +69,7 @@
struct ctx *ctx = xmalloc(sizeof(*ctx));
ctx->dwfl = dwfl;
- ctx->last_proc_updating = 0;
+ ctx->last_proc_updating = mapping_generation - 1;
return ctx;
}

View File

@ -1,42 +0,0 @@
From 35e080ae319d25c1df82855cda3a1bb014e90ba6 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Wed, 8 Jan 2020 00:41:58 +0000
Subject: [PATCH] syscall: do not capture stack trace while the tracee executes
strace code
* syscall.c (syscall_entering_trace) [ENABLE_STACKTRACE]: Do not capture
stack trace when TCB_CHECK_EXEC_SYSCALL flag is set.
---
syscall.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/syscall.c b/syscall.c
index fadd3b5..a8fb4f1 100644
--- a/syscall.c
+++ b/syscall.c
@@ -620,7 +620,7 @@ syscall_entering_trace(struct tcb *tcp, unsigned int *sig)
if (hide_log(tcp)) {
/*
* Restrain from fault injection
- * while the trace executes strace code.
+ * while the tracee executes strace code.
*/
tcp->qual_flg &= ~QUAL_INJECT;
@@ -655,9 +655,10 @@ syscall_entering_trace(struct tcb *tcp, unsigned int *sig)
}
#ifdef ENABLE_STACKTRACE
- if (stack_trace_enabled) {
- if (tcp_sysent(tcp)->sys_flags & STACKTRACE_CAPTURE_ON_ENTER)
- unwind_tcb_capture(tcp);
+ if (stack_trace_enabled &&
+ !check_exec_syscall(tcp) &&
+ tcp_sysent(tcp)->sys_flags & STACKTRACE_CAPTURE_ON_ENTER) {
+ unwind_tcb_capture(tcp);
}
#endif
--
2.1.4

View File

@ -1,761 +0,0 @@
From 8e515c744935fe67e6a1b941f4c5414472c163b7 Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Mon, 20 Jan 2020 16:19:40 +0100
Subject: [PATCH] tests: add strace-k-p test
Add a check of the stack unwinding for attached processes.
* tests/stack-fcall-attach.c: New file.
* tests/strace-k-p.expected: Likewise.
* tests/strace-k-p.test: New test.
* tests/Makefile.am (EXTRA_DIST): Add strace-k-p.expected and strace-k-p.test.
(STACKTRACE_TESTS): Add strace-k-p.test
(check_PROGRAMS): Add stack-fcall-attach.
(stack_fcall_attach_SOURCES): New variable.
* tests/stack-fcall.c: Include "tests.h" and <unistd.h>.
[!ATTACH_MODE] (ATTACH_MODE): Define to 0.
(main) [ATTACH_MODE]: Wait a bit.
* tests/strace-k.test: Add attach mode.
Complements: v5.4-18-g69b2c33 "unwind-libdw: fix initialization of libdwfl cache"
---
Backport changes:
* "SIGURG" line has been removed from tests/strace-k-p.expected, as it requires
v4.25~22 "Print stack traces on signals" and v4.25~21 "tests: check stack
unwinding for signals".
* "chdir" usage in tests/strace-k-p.expected has been replaced with "getpid",
as it is the syscall that was used in the stack-fcall.c at the time.
* Added the respective changes to tests/Makefile.in file.
* The changes to tests/stack-fcall-attach.c, tests/strace-k-p.expected,
tests/strace-k-p.test, tests/Makefile.am, tests/stack-fcall.c,
and tests/strace-k.test have been copied over to tests-m32 and tests-mx32
directories.
---
tests/Makefile.am | 8 +++++++-
tests/stack-fcall-attach.c | 2 ++
tests/stack-fcall.c | 11 +++++++++++
tests/strace-k-p.expected | 2 ++
tests/strace-k-p.test | 13 +++++++++++++
tests/strace-k.test | 17 ++++++++++++++++-
6 files changed, 51 insertions(+), 2 deletions(-)
create mode 100644 tests/stack-fcall-attach.c
create mode 100644 tests/strace-k-p.expected
create mode 100755 tests/strace-k-p.test
Index: strace-5.1/tests/Makefile.am
===================================================================
--- strace-5.1.orig/tests/Makefile.am 2020-01-23 16:56:22.081268798 +0100
+++ strace-5.1/tests/Makefile.am 2020-01-23 17:03:50.786051167 +0100
@@ -156,6 +156,7 @@
signal_receive \
sleep \
stack-fcall \
+ stack-fcall-attach \
stack-fcall-mangled \
threads-execve \
unblock_reset_raise \
@@ -198,6 +199,9 @@
stack_fcall_SOURCES = stack-fcall.c \
stack-fcall-0.c stack-fcall-1.c stack-fcall-2.c stack-fcall-3.c
+stack_fcall_attach_SOURCES = stack-fcall-attach.c \
+ stack-fcall-0.c stack-fcall-1.c stack-fcall-2.c stack-fcall-3.c
+
stack_fcall_mangled_SOURCES = stack-fcall-mangled.c \
stack-fcall-mangled-0.c stack-fcall-mangled-1.c \
stack-fcall-mangled-2.c stack-fcall-mangled-3.c
@@ -205,7 +209,7 @@
include gen_tests.am
if ENABLE_STACKTRACE
-STACKTRACE_TESTS = strace-k.test
+STACKTRACE_TESTS = strace-k.test strace-k-p.test
if USE_DEMANGLE
STACKTRACE_TESTS += strace-k-demangle.test
endif
@@ -428,6 +432,8 @@
strace-ff.expected \
strace-k-demangle.expected \
strace-k-demangle.test \
+ strace-k-p.expected \
+ strace-k-p.test \
strace-k.expected \
strace-k.test \
strace-r.expected \
Index: strace-5.1/tests/stack-fcall-attach.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ strace-5.1/tests/stack-fcall-attach.c 2020-01-23 17:03:50.786051167 +0100
@@ -0,0 +1,2 @@
+#define ATTACH_MODE 1
+#include "stack-fcall.c"
Index: strace-5.1/tests/stack-fcall.c
===================================================================
--- strace-5.1.orig/tests/stack-fcall.c 2020-01-23 17:03:50.787051163 +0100
+++ strace-5.1/tests/stack-fcall.c 2020-01-23 17:04:34.525868669 +0100
@@ -5,10 +5,21 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+#include "tests.h"
+#include <unistd.h>
#include "stack-fcall.h"
+#ifndef ATTACH_MODE
+# define ATTACH_MODE 0
+#endif
+
int main(void)
{
+#if ATTACH_MODE
+ /* sleep a bit to let the tracer time to catch up */
+ sleep(1);
+#endif
+
f0(0);
f0(1);
return 0;
Index: strace-5.1/tests/strace-k-p.expected
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ strace-5.1/tests/strace-k-p.expected 2020-01-23 17:14:13.570831178 +0100
@@ -0,0 +1,2 @@
+^chdir .*(__kernel_vsyscaln )?(__)?chdir f3 f2 f1 f0 main
+^SIGURG .*(__kernel_vsyscaln )?(__)?kill f3 f2 f1 f0 main
Index: strace-5.1/tests/strace-k-p.test
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ strace-5.1/tests/strace-k-p.test 2020-01-23 17:03:50.787051163 +0100
@@ -0,0 +1,13 @@
+#!/bin/sh
+#
+# Check strace -k for attached tracees.
+#
+# Copyright (c) 2020 The strace developers.
+# All rights reserved.
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+ATTACH_MODE=1
+test_prog=../stack-fcall-attach
+
+. "${srcdir=.}"/strace-k.test
Index: strace-5.1/tests/strace-k.test
===================================================================
--- strace-5.1.orig/tests/strace-k.test 2020-01-23 16:56:22.081268798 +0100
+++ strace-5.1/tests/strace-k.test 2020-01-23 17:05:26.569651525 +0100
@@ -11,6 +11,8 @@
. "${srcdir=.}/init.sh"
+: "${ATTACH_MODE=0}"
+
# strace -k is implemented using /proc/$pid/maps
[ -f /proc/self/maps ] ||
framework_skip_ '/proc/self/maps is not available'
@@ -20,7 +22,19 @@
check_prog tr
run_prog "${test_prog=../stack-fcall}"
-run_strace -e chdir -k $args
+if [ "x${ATTACH_MODE}" = "x1" ]; then
+ ../set_ptracer_any "${test_prog}" >> "$EXP" &
+ tracee_pid=$!
+
+ while ! [ -s "$EXP" ]; do
+ kill -0 "$tracee_pid" 2> /dev/null ||
+ fail_ 'set_ptracer_any failed'
+ done
+
+ run_strace -e chdir -k -p "$tracee_pid"
+else
+ run_strace -e chdir -k $args
+fi
expected="$srcdir/$NAME.expected"
awk '
Index: strace-5.1/tests/Makefile.in
===================================================================
--- strace-5.1.orig/tests/Makefile.in 2020-01-23 16:56:22.086268802 +0100
+++ strace-5.1/tests/Makefile.in 2020-01-23 17:07:45.456135366 +0100
@@ -144,9 +144,9 @@
seccomp-strict$(EXEEXT) select-P$(EXEEXT) \
set_ptracer_any$(EXEEXT) set_sigblock$(EXEEXT) \
set_sigign$(EXEEXT) signal_receive$(EXEEXT) sleep$(EXEEXT) \
- stack-fcall$(EXEEXT) stack-fcall-mangled$(EXEEXT) \
- threads-execve$(EXEEXT) unblock_reset_raise$(EXEEXT) \
- unix-pair-send-recv$(EXEEXT) \
+ stack-fcall$(EXEEXT) stack-fcall-attach$(EXEEXT) \
+ stack-fcall-mangled$(EXEEXT) threads-execve$(EXEEXT) \
+ unblock_reset_raise$(EXEEXT) unix-pair-send-recv$(EXEEXT) \
unix-pair-sendto-recvfrom$(EXEEXT) vfork-f$(EXEEXT) \
wait4-v$(EXEEXT) waitid-v$(EXEEXT) zeroargc$(EXEEXT)
@ENABLE_STACKTRACE_TRUE@@USE_DEMANGLE_TRUE@am__append_1 = strace-k-demangle.test
@@ -2604,6 +2604,12 @@
stack_fcall_OBJECTS = $(am_stack_fcall_OBJECTS)
stack_fcall_LDADD = $(LDADD)
stack_fcall_DEPENDENCIES = libtests.a
+am_stack_fcall_attach_OBJECTS = stack-fcall-attach.$(OBJEXT) \
+ stack-fcall-0.$(OBJEXT) stack-fcall-1.$(OBJEXT) \
+ stack-fcall-2.$(OBJEXT) stack-fcall-3.$(OBJEXT)
+stack_fcall_attach_OBJECTS = $(am_stack_fcall_attach_OBJECTS)
+stack_fcall_attach_LDADD = $(LDADD)
+stack_fcall_attach_DEPENDENCIES = libtests.a
am_stack_fcall_mangled_OBJECTS = stack-fcall-mangled.$(OBJEXT) \
stack-fcall-mangled-0.$(OBJEXT) \
stack-fcall-mangled-1.$(OBJEXT) \
@@ -3453,7 +3459,7 @@
sock_filter-v-Xverbose.c sockaddr_xlat-Xabbrev.c \
sockaddr_xlat-Xraw.c sockaddr_xlat-Xverbose.c socketcall.c \
sockopt-sol_netlink.c sockopt-timestamp.c splice.c \
- $(stack_fcall_SOURCES) $(stack_fcall_mangled_SOURCES) stat.c \
+ $(stack_fcall_SOURCES) $(stack_fcall_attach_SOURCES) $(stack_fcall_mangled_SOURCES) stat.c \
stat64.c statfs.c statfs64.c statx.c swap.c sxetmask.c \
symlink.c symlinkat.c sync.c sync_file_range.c \
sync_file_range2.c sysinfo.c syslog.c tee.c threads-execve.c \
@@ -3620,7 +3626,7 @@
sock_filter-v-Xverbose.c sockaddr_xlat-Xabbrev.c \
sockaddr_xlat-Xraw.c sockaddr_xlat-Xverbose.c socketcall.c \
sockopt-sol_netlink.c sockopt-timestamp.c splice.c \
- $(stack_fcall_SOURCES) $(stack_fcall_mangled_SOURCES) stat.c \
+ $(stack_fcall_SOURCES) $(stack_fcall_attach_SOURCES) $(stack_fcall_mangled_SOURCES) stat.c \
stat64.c statfs.c statfs64.c statx.c swap.c sxetmask.c \
symlink.c symlinkat.c sync.c sync_file_range.c \
sync_file_range2.c sysinfo.c syslog.c tee.c threads-execve.c \
@@ -3848,7 +3854,8 @@
bases=`echo $$bases`
RECHECK_LOGS = $(TEST_LOGS)
AM_RECURSIVE_TARGETS = check recheck
-@ENABLE_STACKTRACE_TRUE@am__EXEEXT_2 = strace-k.test $(am__append_1)
+@ENABLE_STACKTRACE_TRUE@am__EXEEXT_2 = strace-k.test strace-k-p.test \
+@ENABLE_STACKTRACE_TRUE@ $(am__append_1)
TEST_SUITE_LOG = test-suite.log
TEST_EXTENSIONS = @EXEEXT@ .test
am__test_logs1 = $(TESTS:=.log)
@@ -4634,6 +4641,9 @@
stack_fcall_SOURCES = stack-fcall.c \
stack-fcall-0.c stack-fcall-1.c stack-fcall-2.c stack-fcall-3.c
+stack_fcall_attach_SOURCES = stack-fcall-attach.c \
+ stack-fcall-0.c stack-fcall-1.c stack-fcall-2.c stack-fcall-3.c
+
stack_fcall_mangled_SOURCES = stack-fcall-mangled.c \
stack-fcall-mangled-0.c stack-fcall-mangled-1.c \
stack-fcall-mangled-2.c stack-fcall-mangled-3.c
@@ -4863,7 +4873,7 @@
xettimeofday.gen.test
@ENABLE_STACKTRACE_FALSE@STACKTRACE_TESTS =
@ENABLE_STACKTRACE_TRUE@STACKTRACE_TESTS = strace-k.test \
-@ENABLE_STACKTRACE_TRUE@ $(am__append_1)
+@ENABLE_STACKTRACE_TRUE@ strace-k-p.test $(am__append_1)
DECODER_TESTS = \
bpf-success-v.test \
bpf-success.test \
@@ -5074,6 +5084,8 @@
strace-ff.expected \
strace-k-demangle.expected \
strace-k-demangle.test \
+ strace-k-p.expected \
+ strace-k-p.test \
strace-k.expected \
strace-k.test \
strace-r.expected \
@@ -7345,6 +7357,10 @@
@rm -f stack-fcall$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(stack_fcall_OBJECTS) $(stack_fcall_LDADD) $(LIBS)
+stack-fcall-attach$(EXEEXT): $(stack_fcall_attach_OBJECTS) $(stack_fcall_attach_DEPENDENCIES) $(EXTRA_stack_fcall_attach_DEPENDENCIES)
+ @rm -f stack-fcall-attach$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(stack_fcall_attach_OBJECTS) $(stack_fcall_attach_LDADD) $(LIBS)
+
stack-fcall-mangled$(EXEEXT): $(stack_fcall_mangled_OBJECTS) $(stack_fcall_mangled_DEPENDENCIES) $(EXTRA_stack_fcall_mangled_DEPENDENCIES)
@rm -f stack-fcall-mangled$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(stack_fcall_mangled_OBJECTS) $(stack_fcall_mangled_LDADD) $(LIBS)
@@ -8193,6 +8209,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-1.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-2.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-3.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-attach.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-0.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-1.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-2.Po@am__quote@ # am--include-marker
Index: strace-5.1/tests-m32/Makefile.am
===================================================================
--- strace-5.1.orig/tests-m32/Makefile.am 2020-01-23 16:56:22.087268803 +0100
+++ strace-5.1/tests-m32/Makefile.am 2020-01-23 17:03:50.790051150 +0100
@@ -156,6 +156,7 @@
signal_receive \
sleep \
stack-fcall \
+ stack-fcall-attach \
stack-fcall-mangled \
threads-execve \
unblock_reset_raise \
@@ -198,6 +199,9 @@
stack_fcall_SOURCES = stack-fcall.c \
stack-fcall-0.c stack-fcall-1.c stack-fcall-2.c stack-fcall-3.c
+stack_fcall_attach_SOURCES = stack-fcall-attach.c \
+ stack-fcall-0.c stack-fcall-1.c stack-fcall-2.c stack-fcall-3.c
+
stack_fcall_mangled_SOURCES = stack-fcall-mangled.c \
stack-fcall-mangled-0.c stack-fcall-mangled-1.c \
stack-fcall-mangled-2.c stack-fcall-mangled-3.c
@@ -205,7 +209,7 @@
include gen_tests.am
if ENABLE_STACKTRACE
-STACKTRACE_TESTS = strace-k.test
+STACKTRACE_TESTS = strace-k.test strace-k-p.test
if USE_DEMANGLE
STACKTRACE_TESTS += strace-k-demangle.test
endif
@@ -428,6 +432,8 @@
strace-ff.expected \
strace-k-demangle.expected \
strace-k-demangle.test \
+ strace-k-p.expected \
+ strace-k-p.test \
strace-k.expected \
strace-k.test \
strace-r.expected \
Index: strace-5.1/tests-m32/Makefile.in
===================================================================
--- strace-5.1.orig/tests-m32/Makefile.in 2020-01-23 16:56:22.089268805 +0100
+++ strace-5.1/tests-m32/Makefile.in 2020-01-23 18:24:15.534972421 +0100
@@ -144,9 +144,9 @@
seccomp-strict$(EXEEXT) select-P$(EXEEXT) \
set_ptracer_any$(EXEEXT) set_sigblock$(EXEEXT) \
set_sigign$(EXEEXT) signal_receive$(EXEEXT) sleep$(EXEEXT) \
- stack-fcall$(EXEEXT) stack-fcall-mangled$(EXEEXT) \
- threads-execve$(EXEEXT) unblock_reset_raise$(EXEEXT) \
- unix-pair-send-recv$(EXEEXT) \
+ stack-fcall$(EXEEXT) stack-fcall-attach$(EXEEXT) \
+ stack-fcall-mangled$(EXEEXT) threads-execve$(EXEEXT) \
+ unblock_reset_raise$(EXEEXT) unix-pair-send-recv$(EXEEXT) \
unix-pair-sendto-recvfrom$(EXEEXT) vfork-f$(EXEEXT) \
wait4-v$(EXEEXT) waitid-v$(EXEEXT) zeroargc$(EXEEXT)
@ENABLE_STACKTRACE_TRUE@@USE_DEMANGLE_TRUE@am__append_1 = strace-k-demangle.test
@@ -2604,6 +2604,12 @@
stack_fcall_OBJECTS = $(am_stack_fcall_OBJECTS)
stack_fcall_LDADD = $(LDADD)
stack_fcall_DEPENDENCIES = libtests.a
+am_stack_fcall_attach_OBJECTS = stack-fcall-attach.$(OBJEXT) \
+ stack-fcall-0.$(OBJEXT) stack-fcall-1.$(OBJEXT) \
+ stack-fcall-2.$(OBJEXT) stack-fcall-3.$(OBJEXT)
+stack_fcall_attach_OBJECTS = $(am_stack_fcall_attach_OBJECTS)
+stack_fcall_attach_LDADD = $(LDADD)
+stack_fcall_attach_DEPENDENCIES = libtests.a
am_stack_fcall_mangled_OBJECTS = stack-fcall-mangled.$(OBJEXT) \
stack-fcall-mangled-0.$(OBJEXT) \
stack-fcall-mangled-1.$(OBJEXT) \
@@ -3453,7 +3459,7 @@
sock_filter-v-Xverbose.c sockaddr_xlat-Xabbrev.c \
sockaddr_xlat-Xraw.c sockaddr_xlat-Xverbose.c socketcall.c \
sockopt-sol_netlink.c sockopt-timestamp.c splice.c \
- $(stack_fcall_SOURCES) $(stack_fcall_mangled_SOURCES) stat.c \
+ $(stack_fcall_SOURCES) $(stack_fcall_attach_SOURCES) $(stack_fcall_mangled_SOURCES) stat.c \
stat64.c statfs.c statfs64.c statx.c swap.c sxetmask.c \
symlink.c symlinkat.c sync.c sync_file_range.c \
sync_file_range2.c sysinfo.c syslog.c tee.c threads-execve.c \
@@ -3620,7 +3626,7 @@
sock_filter-v-Xverbose.c sockaddr_xlat-Xabbrev.c \
sockaddr_xlat-Xraw.c sockaddr_xlat-Xverbose.c socketcall.c \
sockopt-sol_netlink.c sockopt-timestamp.c splice.c \
- $(stack_fcall_SOURCES) $(stack_fcall_mangled_SOURCES) stat.c \
+ $(stack_fcall_SOURCES) $(stack_fcall_attach_SOURCES) $(stack_fcall_mangled_SOURCES) stat.c \
stat64.c statfs.c statfs64.c statx.c swap.c sxetmask.c \
symlink.c symlinkat.c sync.c sync_file_range.c \
sync_file_range2.c sysinfo.c syslog.c tee.c threads-execve.c \
@@ -3848,7 +3854,8 @@
bases=`echo $$bases`
RECHECK_LOGS = $(TEST_LOGS)
AM_RECURSIVE_TARGETS = check recheck
-@ENABLE_STACKTRACE_TRUE@am__EXEEXT_2 = strace-k.test $(am__append_1)
+@ENABLE_STACKTRACE_TRUE@am__EXEEXT_2 = strace-k.test strace-k-p.test \
+@ENABLE_STACKTRACE_TRUE@ $(am__append_1)
TEST_SUITE_LOG = test-suite.log
TEST_EXTENSIONS = @EXEEXT@ .test
am__test_logs1 = $(TESTS:=.log)
@@ -4634,6 +4641,9 @@
stack_fcall_SOURCES = stack-fcall.c \
stack-fcall-0.c stack-fcall-1.c stack-fcall-2.c stack-fcall-3.c
+stack_fcall_attach_SOURCES = stack-fcall-attach.c \
+ stack-fcall-0.c stack-fcall-1.c stack-fcall-2.c stack-fcall-3.c
+
stack_fcall_mangled_SOURCES = stack-fcall-mangled.c \
stack-fcall-mangled-0.c stack-fcall-mangled-1.c \
stack-fcall-mangled-2.c stack-fcall-mangled-3.c
@@ -4863,7 +4873,7 @@
xettimeofday.gen.test
@ENABLE_STACKTRACE_FALSE@STACKTRACE_TESTS =
@ENABLE_STACKTRACE_TRUE@STACKTRACE_TESTS = strace-k.test \
-@ENABLE_STACKTRACE_TRUE@ $(am__append_1)
+@ENABLE_STACKTRACE_TRUE@ strace-k-p.test $(am__append_1)
DECODER_TESTS = \
bpf-success-v.test \
bpf-success.test \
@@ -5074,6 +5084,8 @@
strace-ff.expected \
strace-k-demangle.expected \
strace-k-demangle.test \
+ strace-k-p.expected \
+ strace-k-p.test \
strace-k.expected \
strace-k.test \
strace-r.expected \
@@ -7345,6 +7357,10 @@
@rm -f stack-fcall$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(stack_fcall_OBJECTS) $(stack_fcall_LDADD) $(LIBS)
+stack-fcall-attach$(EXEEXT): $(stack_fcall_attach_OBJECTS) $(stack_fcall_attach_DEPENDENCIES) $(EXTRA_stack_fcall_attach_DEPENDENCIES)
+ @rm -f stack-fcall-attach$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(stack_fcall_attach_OBJECTS) $(stack_fcall_attach_LDADD) $(LIBS)
+
stack-fcall-mangled$(EXEEXT): $(stack_fcall_mangled_OBJECTS) $(stack_fcall_mangled_DEPENDENCIES) $(EXTRA_stack_fcall_mangled_DEPENDENCIES)
@rm -f stack-fcall-mangled$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(stack_fcall_mangled_OBJECTS) $(stack_fcall_mangled_LDADD) $(LIBS)
@@ -8193,6 +8209,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-1.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-2.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-3.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-attach.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-0.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-1.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-2.Po@am__quote@ # am--include-marker
@@ -9777,6 +9794,7 @@
-rm -f ./$(DEPDIR)/stack-fcall-1.Po
-rm -f ./$(DEPDIR)/stack-fcall-2.Po
-rm -f ./$(DEPDIR)/stack-fcall-3.Po
+ -rm -f ./$(DEPDIR)/stack-fcall-attach.Po
-rm -f ./$(DEPDIR)/stack-fcall-mangled-0.Po
-rm -f ./$(DEPDIR)/stack-fcall-mangled-1.Po
-rm -f ./$(DEPDIR)/stack-fcall-mangled-2.Po
@@ -10468,6 +10486,7 @@
-rm -f ./$(DEPDIR)/stack-fcall-1.Po
-rm -f ./$(DEPDIR)/stack-fcall-2.Po
-rm -f ./$(DEPDIR)/stack-fcall-3.Po
+ -rm -f ./$(DEPDIR)/stack-fcall-attach.Po
-rm -f ./$(DEPDIR)/stack-fcall-mangled-0.Po
-rm -f ./$(DEPDIR)/stack-fcall-mangled-1.Po
-rm -f ./$(DEPDIR)/stack-fcall-mangled-2.Po
Index: strace-5.1/tests-mx32/Makefile.am
===================================================================
--- strace-5.1.orig/tests-mx32/Makefile.am 2020-01-23 16:56:22.090268805 +0100
+++ strace-5.1/tests-mx32/Makefile.am 2020-01-23 17:03:50.793051138 +0100
@@ -156,6 +156,7 @@
signal_receive \
sleep \
stack-fcall \
+ stack-fcall-attach \
stack-fcall-mangled \
threads-execve \
unblock_reset_raise \
@@ -198,6 +199,9 @@
stack_fcall_SOURCES = stack-fcall.c \
stack-fcall-0.c stack-fcall-1.c stack-fcall-2.c stack-fcall-3.c
+stack_fcall_attach_SOURCES = stack-fcall-attach.c \
+ stack-fcall-0.c stack-fcall-1.c stack-fcall-2.c stack-fcall-3.c
+
stack_fcall_mangled_SOURCES = stack-fcall-mangled.c \
stack-fcall-mangled-0.c stack-fcall-mangled-1.c \
stack-fcall-mangled-2.c stack-fcall-mangled-3.c
@@ -205,7 +209,7 @@
include gen_tests.am
if ENABLE_STACKTRACE
-STACKTRACE_TESTS = strace-k.test
+STACKTRACE_TESTS = strace-k.test strace-k-p.test
if USE_DEMANGLE
STACKTRACE_TESTS += strace-k-demangle.test
endif
@@ -428,6 +432,8 @@
strace-ff.expected \
strace-k-demangle.expected \
strace-k-demangle.test \
+ strace-k-p.expected \
+ strace-k-p.test \
strace-k.expected \
strace-k.test \
strace-r.expected \
Index: strace-5.1/tests-mx32/Makefile.in
===================================================================
--- strace-5.1.orig/tests-mx32/Makefile.in 2020-01-23 16:56:22.092268807 +0100
+++ strace-5.1/tests-mx32/Makefile.in 2020-01-23 17:13:00.583709367 +0100
@@ -144,9 +144,9 @@
seccomp-strict$(EXEEXT) select-P$(EXEEXT) \
set_ptracer_any$(EXEEXT) set_sigblock$(EXEEXT) \
set_sigign$(EXEEXT) signal_receive$(EXEEXT) sleep$(EXEEXT) \
- stack-fcall$(EXEEXT) stack-fcall-mangled$(EXEEXT) \
- threads-execve$(EXEEXT) unblock_reset_raise$(EXEEXT) \
- unix-pair-send-recv$(EXEEXT) \
+ stack-fcall$(EXEEXT) stack-fcall-attach$(EXEEXT) \
+ stack-fcall-mangled$(EXEEXT) threads-execve$(EXEEXT) \
+ unblock_reset_raise$(EXEEXT) unix-pair-send-recv$(EXEEXT) \
unix-pair-sendto-recvfrom$(EXEEXT) vfork-f$(EXEEXT) \
wait4-v$(EXEEXT) waitid-v$(EXEEXT) zeroargc$(EXEEXT)
@ENABLE_STACKTRACE_TRUE@@USE_DEMANGLE_TRUE@am__append_1 = strace-k-demangle.test
@@ -2604,6 +2604,12 @@
stack_fcall_OBJECTS = $(am_stack_fcall_OBJECTS)
stack_fcall_LDADD = $(LDADD)
stack_fcall_DEPENDENCIES = libtests.a
+am_stack_fcall_attach_OBJECTS = stack-fcall-attach.$(OBJEXT) \
+ stack-fcall-0.$(OBJEXT) stack-fcall-1.$(OBJEXT) \
+ stack-fcall-2.$(OBJEXT) stack-fcall-3.$(OBJEXT)
+stack_fcall_attach_OBJECTS = $(am_stack_fcall_attach_OBJECTS)
+stack_fcall_attach_LDADD = $(LDADD)
+stack_fcall_attach_DEPENDENCIES = libtests.a
am_stack_fcall_mangled_OBJECTS = stack-fcall-mangled.$(OBJEXT) \
stack-fcall-mangled-0.$(OBJEXT) \
stack-fcall-mangled-1.$(OBJEXT) \
@@ -3453,7 +3459,7 @@
sock_filter-v-Xverbose.c sockaddr_xlat-Xabbrev.c \
sockaddr_xlat-Xraw.c sockaddr_xlat-Xverbose.c socketcall.c \
sockopt-sol_netlink.c sockopt-timestamp.c splice.c \
- $(stack_fcall_SOURCES) $(stack_fcall_mangled_SOURCES) stat.c \
+ $(stack_fcall_SOURCES) $(stack_fcall_attach_SOURCES) $(stack_fcall_mangled_SOURCES) stat.c \
stat64.c statfs.c statfs64.c statx.c swap.c sxetmask.c \
symlink.c symlinkat.c sync.c sync_file_range.c \
sync_file_range2.c sysinfo.c syslog.c tee.c threads-execve.c \
@@ -3620,7 +3626,7 @@
sock_filter-v-Xverbose.c sockaddr_xlat-Xabbrev.c \
sockaddr_xlat-Xraw.c sockaddr_xlat-Xverbose.c socketcall.c \
sockopt-sol_netlink.c sockopt-timestamp.c splice.c \
- $(stack_fcall_SOURCES) $(stack_fcall_mangled_SOURCES) stat.c \
+ $(stack_fcall_SOURCES) $(stack_fcall_attach_SOURCES) $(stack_fcall_mangled_SOURCES) stat.c \
stat64.c statfs.c statfs64.c statx.c swap.c sxetmask.c \
symlink.c symlinkat.c sync.c sync_file_range.c \
sync_file_range2.c sysinfo.c syslog.c tee.c threads-execve.c \
@@ -4634,6 +4640,10 @@
stack_fcall_SOURCES = stack-fcall.c \
stack-fcall-0.c stack-fcall-1.c stack-fcall-2.c stack-fcall-3.c
+stack_fcall_attach_SOURCES = stack-fcall-attach.c \
+ stack-fcall-0.c stack-fcall-1.c \
+ stack-fcall-2.c stack-fcall-3.c
+
stack_fcall_mangled_SOURCES = stack-fcall-mangled.c \
stack-fcall-mangled-0.c stack-fcall-mangled-1.c \
stack-fcall-mangled-2.c stack-fcall-mangled-3.c
@@ -7345,6 +7355,10 @@
@rm -f stack-fcall$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(stack_fcall_OBJECTS) $(stack_fcall_LDADD) $(LIBS)
+stack-fcall-attach$(EXEEXT): $(stack_fcall_attach_OBJECTS) $(stack_fcall_attach_DEPENDENCIES) $(EXTRA_stack_fcall_attach_DEPENDENCIES)
+ @rm -f stack-fcall$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(stack_fcall_attach_OBJECTS) $(stack_fcall_attach_LDADD) $(LIBS)
+
stack-fcall-mangled$(EXEEXT): $(stack_fcall_mangled_OBJECTS) $(stack_fcall_mangled_DEPENDENCIES) $(EXTRA_stack_fcall_mangled_DEPENDENCIES)
@rm -f stack-fcall-mangled$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(stack_fcall_mangled_OBJECTS) $(stack_fcall_mangled_LDADD) $(LIBS)
@@ -8193,6 +8207,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-1.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-2.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-3.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-attach.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-0.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-1.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-2.Po@am__quote@ # am--include-marker
@@ -9777,6 +9792,7 @@
-rm -f ./$(DEPDIR)/stack-fcall-1.Po
-rm -f ./$(DEPDIR)/stack-fcall-2.Po
-rm -f ./$(DEPDIR)/stack-fcall-3.Po
+ -rm -f ./$(DEPDIR)/stack-fcall-attach.Po
-rm -f ./$(DEPDIR)/stack-fcall-mangled-0.Po
-rm -f ./$(DEPDIR)/stack-fcall-mangled-1.Po
-rm -f ./$(DEPDIR)/stack-fcall-mangled-2.Po
@@ -10468,6 +10484,7 @@
-rm -f ./$(DEPDIR)/stack-fcall-1.Po
-rm -f ./$(DEPDIR)/stack-fcall-2.Po
-rm -f ./$(DEPDIR)/stack-fcall-3.Po
+ -rm -f ./$(DEPDIR)/stack-fcall-attach.Po
-rm -f ./$(DEPDIR)/stack-fcall-mangled-0.Po
-rm -f ./$(DEPDIR)/stack-fcall-mangled-1.Po
-rm -f ./$(DEPDIR)/stack-fcall-mangled-2.Po
Index: strace-5.1/tests-m32/stack-fcall-attach.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ strace-5.1/tests-m32/stack-fcall-attach.c 2020-01-23 17:03:50.796051125 +0100
@@ -0,0 +1,2 @@
+#define ATTACH_MODE 1
+#include "stack-fcall.c"
Index: strace-5.1/tests-m32/stack-fcall.c
===================================================================
--- strace-5.1.orig/tests-m32/stack-fcall.c 2020-01-23 17:03:50.796051125 +0100
+++ strace-5.1/tests-m32/stack-fcall.c 2020-01-23 17:08:04.027080020 +0100
@@ -5,10 +5,21 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+#include "tests.h"
+#include <unistd.h>
#include "stack-fcall.h"
+#ifndef ATTACH_MODE
+# define ATTACH_MODE 0
+#endif
+
int main(void)
{
+#if ATTACH_MODE
+ /* sleep a bit to let the tracer time to catch up */
+ sleep(1);
+#endif
+
f0(0);
f0(1);
return 0;
Index: strace-5.1/tests-m32/strace-k-p.expected
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ strace-5.1/tests-m32/strace-k-p.expected 2020-01-23 17:14:16.083835372 +0100
@@ -0,0 +1,2 @@
+^chdir .*(__kernel_vsyscaln )?(__)?chdir f3 f2 f1 f0 main
+^SIGURG .*(__kernel_vsyscaln )?(__)?kill f3 f2 f1 f0 main
Index: strace-5.1/tests-m32/strace-k-p.test
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ strace-5.1/tests-m32/strace-k-p.test 2020-01-23 17:03:50.796051125 +0100
@@ -0,0 +1,13 @@
+#!/bin/sh
+#
+# Check strace -k for attached tracees.
+#
+# Copyright (c) 2020 The strace developers.
+# All rights reserved.
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+ATTACH_MODE=1
+test_prog=../stack-fcall-attach
+
+. "${srcdir=.}"/strace-k.test
Index: strace-5.1/tests-m32/strace-k.test
===================================================================
--- strace-5.1.orig/tests-m32/strace-k.test 2020-01-23 17:03:50.797051121 +0100
+++ strace-5.1/tests-m32/strace-k.test 2020-01-23 17:13:44.509782677 +0100
@@ -11,6 +11,8 @@
. "${srcdir=.}/init.sh"
+: "${ATTACH_MODE=0}"
+
# strace -k is implemented using /proc/$pid/maps
[ -f /proc/self/maps ] ||
framework_skip_ '/proc/self/maps is not available'
@@ -20,7 +22,19 @@
check_prog tr
run_prog "${test_prog=../stack-fcall}"
-run_strace -e chdir -k $args
+if [ "x${ATTACH_MODE}" = "x1" ]; then
+ ../set_ptracer_any "${test_prog}" >> "$EXP" &
+ tracee_pid=$!
+
+ while ! [ -s "$EXP" ]; do
+ kill -0 "$tracee_pid" 2> /dev/null ||
+ fail_ 'set_ptracer_any failed'
+ done
+
+ run_strace -e chdir -k -p "$tracee_pid"
+else
+ run_strace -e chdir -k $args
+fi
expected="$srcdir/$NAME.expected"
awk '
Index: strace-5.1/tests-mx32/stack-fcall-attach.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ strace-5.1/tests-mx32/stack-fcall-attach.c 2020-01-23 17:03:50.797051121 +0100
@@ -0,0 +1,2 @@
+#define ATTACH_MODE 1
+#include "stack-fcall.c"
Index: strace-5.1/tests-mx32/stack-fcall.c
===================================================================
--- strace-5.1.orig/tests-mx32/stack-fcall.c 2020-01-23 17:03:50.797051121 +0100
+++ strace-5.1/tests-mx32/stack-fcall.c 2020-01-23 17:08:06.451072796 +0100
@@ -5,10 +5,21 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+#include "tests.h"
+#include <unistd.h>
#include "stack-fcall.h"
+#ifndef ATTACH_MODE
+# define ATTACH_MODE 0
+#endif
+
int main(void)
{
+#if ATTACH_MODE
+ /* sleep a bit to let the tracer time to catch up */
+ sleep(1);
+#endif
+
f0(0);
f0(1);
return 0;
Index: strace-5.1/tests-mx32/strace-k-p.expected
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ strace-5.1/tests-mx32/strace-k-p.expected 2020-01-23 17:14:17.786838214 +0100
@@ -0,0 +1,2 @@
+^chdir .*(__kernel_vsyscaln )?(__)?chdir f3 f2 f1 f0 main
+^SIGURG .*(__kernel_vsyscaln )?(__)?kill f3 f2 f1 f0 main
Index: strace-5.1/tests-mx32/strace-k-p.test
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ strace-5.1/tests-mx32/strace-k-p.test 2020-01-23 17:03:50.797051121 +0100
@@ -0,0 +1,13 @@
+#!/bin/sh
+#
+# Check strace -k for attached tracees.
+#
+# Copyright (c) 2020 The strace developers.
+# All rights reserved.
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+ATTACH_MODE=1
+test_prog=../stack-fcall-attach
+
+. "${srcdir=.}"/strace-k.test
Index: strace-5.1/tests-mx32/strace-k.test
===================================================================
--- strace-5.1.orig/tests-mx32/strace-k.test 2020-01-23 17:03:50.797051121 +0100
+++ strace-5.1/tests-mx32/strace-k.test 2020-01-23 17:13:41.793778144 +0100
@@ -11,6 +11,8 @@
. "${srcdir=.}/init.sh"
+: "${ATTACH_MODE=0}"
+
# strace -k is implemented using /proc/$pid/maps
[ -f /proc/self/maps ] ||
framework_skip_ '/proc/self/maps is not available'
@@ -20,7 +22,19 @@
check_prog tr
run_prog "${test_prog=../stack-fcall}"
-run_strace -e chdir -k $args
+if [ "x${ATTACH_MODE}" = "x1" ]; then
+ ../set_ptracer_any "${test_prog}" >> "$EXP" &
+ tracee_pid=$!
+
+ while ! [ -s "$EXP" ]; do
+ kill -0 "$tracee_pid" 2> /dev/null ||
+ fail_ 'set_ptracer_any failed'
+ done
+
+ run_strace -e chdir -k -p "$tracee_pid"
+else
+ run_strace -e chdir -k $args
+fi
expected="$srcdir/$NAME.expected"
awk '

View File

@ -1,225 +0,0 @@
From 5a9b0f1ef83300f853e77ada03515c8542c1cfe0 Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Thu, 29 Aug 2019 19:03:51 +0200
Subject: [PATCH] sockaddr: properly decode sockaddr_hci addresses without
hci_channel
Before Linux commit v2.6.38-rc1~476^2~14^2~3^2~43^2~9,
struct sockaddr_hci did not contain hci_channel field.
* configure.ac (AC_CHECK_HEADERS([bluetooth/bluetooth.h])): Add check
for struct sockaddr_hci.hci_channel.
* sockaddr.c (print_sockaddr_data_bt): Decode struct sockaddr_hci
without hci_channel field.
* tests/net-sockaddr.c (check_hci): Add check for struct sockaddr_hci
decoding without hci_channel field; guard hci_channel with #ifdef
HAVE_STRUCT_SOCKADDR_HCI_HCI_CHANNEL.
(check_raw): Remove "len++", as 4-byte AF_BLUETOOTH socket addresses are
interpreted as struct sockaddr_hci without hci_channel field.
---
configure.ac | 3 +++
sockaddr.c | 16 +++++++++++++---
tests/net-sockaddr.c | 18 ++++++++++++++----
3 files changed, 30 insertions(+), 7 deletions(-)
Index: strace-5.1/configure.ac
===================================================================
--- strace-5.1.orig/configure.ac 2019-08-29 19:10:22.380362280 +0200
+++ strace-5.1/configure.ac 2019-08-29 19:11:11.240744864 +0200
@@ -465,6 +465,9 @@
])
AC_CHECK_HEADERS([bluetooth/bluetooth.h], [
+ AC_CHECK_MEMBERS([struct sockaddr_hci.hci_channel],,,
+ [#include <bluetooth/bluetooth.h>
+ #include <bluetooth/hci.h>])
AC_CHECK_MEMBERS([struct sockaddr_l2.l2_bdaddr_type],,,
[#include <bluetooth/bluetooth.h>
#include <bluetooth/l2cap.h>])
Index: strace-5.1/sockaddr.c
===================================================================
--- strace-5.1.orig/sockaddr.c 2019-08-29 19:11:11.240744864 +0200
+++ strace-5.1/sockaddr.c 2019-08-29 19:13:01.275354429 +0200
@@ -599,12 +599,21 @@
};
switch (addrlen) {
+ case offsetofend(struct sockaddr_hci, hci_dev):
case sizeof(struct sockaddr_hci): {
const struct sockaddr_hci *const hci = buf;
- tprintf("hci_dev=htobs(%hu), hci_channel=",
- btohs(hci->hci_dev));
- printxval_index(hci_channels, hci->hci_channel,
- "HCI_CHANNEL_???");
+ tprintf("hci_dev=htobs(%hu)", btohs(hci->hci_dev));
+
+ /*
+ * hci_channel field has been introduced
+ * Linux commit in v2.6.38-rc1~476^2~14^2~3^2~43^2~9.
+ */
+ if (addrlen == sizeof(struct sockaddr_hci)) {
+ tprints(", hci_channel=");
+ printxval_index(hci_channels, hci->hci_channel,
+ "HCI_CHANNEL_???");
+ }
+
break;
}
case sizeof(struct sockaddr_sco): {
Index: strace-5.1/tests/net-sockaddr.c
===================================================================
--- strace-5.1.orig/tests/net-sockaddr.c 2019-08-29 19:10:22.380362280 +0200
+++ strace-5.1/tests/net-sockaddr.c 2019-08-29 19:11:11.240744864 +0200
@@ -543,11 +543,22 @@
TAIL_ALLOC_OBJECT_VAR_PTR(struct sockaddr_hci, hci);
hci->hci_family = AF_BLUETOOTH;
hci->hci_dev = htobs(h_port);
+# ifdef HAVE_STRUCT_SOCKADDR_HCI_HCI_CHANNEL
hci->hci_channel = HCI_CHANNEL_RAW;
+# endif
unsigned int len = sizeof(*hci);
- int ret = connect(-1, (void *) hci, len);
+
+ int ret = connect(-1, (void *) hci, 4);
+ printf("connect(-1, {sa_family=AF_BLUETOOTH, hci_dev=htobs(%hu)"
+ "}, 4) = %d EBADF (%m)\n",
+ h_port, ret);
+
+ ret = connect(-1, (void *) hci, len);
printf("connect(-1, {sa_family=AF_BLUETOOTH, hci_dev=htobs(%hu)"
- ", hci_channel=HCI_CHANNEL_RAW}, %u) = %d EBADF (%m)\n",
+# ifdef HAVE_STRUCT_SOCKADDR_HCI_HCI_CHANNEL
+ ", hci_channel=HCI_CHANNEL_RAW"
+# endif
+ "}, %u) = %d EBADF (%m)\n",
h_port, len, ret);
}
@@ -700,9 +711,8 @@
" = %d EBADF (%m)\n", len, ret);
u.sa->sa_family = AF_BLUETOOTH;
- ++len;
ret = connect(-1, (void *) u.st, len);
- printf("connect(-1, {sa_family=AF_BLUETOOTH, sa_data=\"00\"}, %u)"
+ printf("connect(-1, {sa_family=AF_BLUETOOTH, sa_data=\"0\"}, %u)"
" = %d EBADF (%m)\n", len, ret);
}
Index: strace-5.1/tests-m32/net-sockaddr.c
===================================================================
--- strace-5.1.orig/tests-m32/net-sockaddr.c 2019-03-18 03:40:16.000000000 +0100
+++ strace-5.1/tests-m32/net-sockaddr.c 2019-08-29 19:16:28.327738043 +0200
@@ -543,11 +543,22 @@
TAIL_ALLOC_OBJECT_VAR_PTR(struct sockaddr_hci, hci);
hci->hci_family = AF_BLUETOOTH;
hci->hci_dev = htobs(h_port);
+# ifdef HAVE_STRUCT_SOCKADDR_HCI_HCI_CHANNEL
hci->hci_channel = HCI_CHANNEL_RAW;
+# endif
unsigned int len = sizeof(*hci);
- int ret = connect(-1, (void *) hci, len);
+
+ int ret = connect(-1, (void *) hci, 4);
+ printf("connect(-1, {sa_family=AF_BLUETOOTH, hci_dev=htobs(%hu)"
+ "}, 4) = %d EBADF (%m)\n",
+ h_port, ret);
+
+ ret = connect(-1, (void *) hci, len);
printf("connect(-1, {sa_family=AF_BLUETOOTH, hci_dev=htobs(%hu)"
- ", hci_channel=HCI_CHANNEL_RAW}, %u) = %d EBADF (%m)\n",
+# ifdef HAVE_STRUCT_SOCKADDR_HCI_HCI_CHANNEL
+ ", hci_channel=HCI_CHANNEL_RAW"
+# endif
+ "}, %u) = %d EBADF (%m)\n",
h_port, len, ret);
}
@@ -700,9 +711,8 @@
" = %d EBADF (%m)\n", len, ret);
u.sa->sa_family = AF_BLUETOOTH;
- ++len;
ret = connect(-1, (void *) u.st, len);
- printf("connect(-1, {sa_family=AF_BLUETOOTH, sa_data=\"00\"}, %u)"
+ printf("connect(-1, {sa_family=AF_BLUETOOTH, sa_data=\"0\"}, %u)"
" = %d EBADF (%m)\n", len, ret);
}
Index: strace-5.1/tests-mx32/net-sockaddr.c
===================================================================
--- strace-5.1.orig/tests-mx32/net-sockaddr.c 2019-03-18 03:40:16.000000000 +0100
+++ strace-5.1/tests-mx32/net-sockaddr.c 2019-08-29 19:16:30.805706731 +0200
@@ -543,11 +543,22 @@
TAIL_ALLOC_OBJECT_VAR_PTR(struct sockaddr_hci, hci);
hci->hci_family = AF_BLUETOOTH;
hci->hci_dev = htobs(h_port);
+# ifdef HAVE_STRUCT_SOCKADDR_HCI_HCI_CHANNEL
hci->hci_channel = HCI_CHANNEL_RAW;
+# endif
unsigned int len = sizeof(*hci);
- int ret = connect(-1, (void *) hci, len);
+
+ int ret = connect(-1, (void *) hci, 4);
+ printf("connect(-1, {sa_family=AF_BLUETOOTH, hci_dev=htobs(%hu)"
+ "}, 4) = %d EBADF (%m)\n",
+ h_port, ret);
+
+ ret = connect(-1, (void *) hci, len);
printf("connect(-1, {sa_family=AF_BLUETOOTH, hci_dev=htobs(%hu)"
- ", hci_channel=HCI_CHANNEL_RAW}, %u) = %d EBADF (%m)\n",
+# ifdef HAVE_STRUCT_SOCKADDR_HCI_HCI_CHANNEL
+ ", hci_channel=HCI_CHANNEL_RAW"
+# endif
+ "}, %u) = %d EBADF (%m)\n",
h_port, len, ret);
}
@@ -700,9 +711,8 @@
" = %d EBADF (%m)\n", len, ret);
u.sa->sa_family = AF_BLUETOOTH;
- ++len;
ret = connect(-1, (void *) u.st, len);
- printf("connect(-1, {sa_family=AF_BLUETOOTH, sa_data=\"00\"}, %u)"
+ printf("connect(-1, {sa_family=AF_BLUETOOTH, sa_data=\"0\"}, %u)"
" = %d EBADF (%m)\n", len, ret);
}
Index: strace-5.1/configure
===================================================================
--- strace-5.1.orig/configure 2019-08-30 17:41:22.748513960 +0200
+++ strace-5.1/configure 2019-08-30 17:41:43.118251704 +0200
@@ -12037,6 +12037,18 @@
#define HAVE_BLUETOOTH_BLUETOOTH_H 1
_ACEOF
+ ac_fn_c_check_member "$LINENO" "struct sockaddr_hci" "hci_channel" "ac_cv_member_struct_sockaddr_hci_hci_channel" "#include <bluetooth/bluetooth.h>
+ #include <bluetooth/hci.h>
+"
+if test "x$ac_cv_member_struct_sockaddr_hci_hci_channel" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_SOCKADDR_HCI_HCI_CHANNEL 1
+_ACEOF
+
+
+fi
+
ac_fn_c_check_member "$LINENO" "struct sockaddr_l2" "l2_bdaddr_type" "ac_cv_member_struct_sockaddr_l2_l2_bdaddr_type" "#include <bluetooth/bluetooth.h>
#include <bluetooth/l2cap.h>
"
Index: strace-5.1/config.h.in
===================================================================
--- strace-5.1.orig/config.h.in 2019-05-22 15:08:39.000000000 +0200
+++ strace-5.1/config.h.in 2019-08-30 18:32:25.431500194 +0200
@@ -1391,6 +1391,9 @@
/* Define to 1 if the system has the type `struct sigcontext'. */
#undef HAVE_STRUCT_SIGCONTEXT
+/* Define to 1 if `hci_channel' is a member of `struct sockaddr_hci'. */
+#undef HAVE_STRUCT_SOCKADDR_HCI_HCI_CHANNEL
+
/* Define to 1 if `l2_bdaddr_type' is a member of `struct sockaddr_l2'. */
#undef HAVE_STRUCT_SOCKADDR_L2_L2_BDADDR_TYPE

View File

@ -1,90 +0,0 @@
From 4377e3a1535a0ec3a42da8a1366ad6943f4efa0e Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Sun, 4 Aug 2019 08:47:00 +0000
Subject: [PATCH] tests: fix expected output for some ipc tests
* tests/gen_tests.in (ipc_msgbuf-Xraw, ipc_shm, ipc_shm-Xabbrev,
ipc_shm-Xverbose): Adjust -a argument.
---
Backport changes:
* tests/gen_tests.in change is copied over to tests-m32/gen_tests.in
and tests-m32/gen_tests.in
---
tests/gen_tests.in | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: strace-4.24/tests/gen_tests.in
===================================================================
--- strace-4.24.orig/tests/gen_tests.in 2020-01-27 18:21:22.896068950 +0100
+++ strace-4.24/tests/gen_tests.in 2020-01-27 18:21:42.169892032 +0100
@@ -147,16 +147,16 @@
ipc_msg-Xraw +ipc.sh -Xraw -a16
ipc_msg-Xverbose +ipc.sh -Xverbose -a34
ipc_msgbuf-Xabbrev +ipc_msgbuf.test -Xabbrev
-ipc_msgbuf-Xraw +ipc_msgbuf.test -Xraw -a22
+ipc_msgbuf-Xraw +ipc_msgbuf.test -Xraw -a20
ipc_msgbuf-Xverbose +ipc_msgbuf.test -Xverbose
ipc_sem +ipc.sh -a29
ipc_sem-Xabbrev +ipc.sh -Xabbrev -a29
ipc_sem-Xraw +ipc.sh -Xraw -a19
ipc_sem-Xverbose +ipc.sh -Xverbose -a36
-ipc_shm +ipc.sh -a29
-ipc_shm-Xabbrev +ipc.sh -Xabbrev -a29
+ipc_shm +ipc.sh -a26
+ipc_shm-Xabbrev +ipc.sh -Xabbrev -a26
ipc_shm-Xraw +ipc.sh -Xraw -a19
-ipc_shm-Xverbose +ipc.sh -Xverbose -a36
+ipc_shm-Xverbose +ipc.sh -Xverbose -a34
kcmp -a22
kcmp-y -a22 -y -e trace=kcmp
kern_features -a16
Index: strace-4.24/tests-m32/gen_tests.in
===================================================================
--- strace-4.24.orig/tests-m32/gen_tests.in 2020-01-27 18:21:36.149947290 +0100
+++ strace-4.24/tests-m32/gen_tests.in 2020-01-27 18:38:00.954898561 +0100
@@ -147,16 +147,16 @@
ipc_msg-Xraw +ipc.sh -Xraw -a16
ipc_msg-Xverbose +ipc.sh -Xverbose -a34
ipc_msgbuf-Xabbrev +ipc_msgbuf.test -Xabbrev
-ipc_msgbuf-Xraw +ipc_msgbuf.test -Xraw -a22
+ipc_msgbuf-Xraw +ipc_msgbuf.test -Xraw -a20
ipc_msgbuf-Xverbose +ipc_msgbuf.test -Xverbose
ipc_sem +ipc.sh -a29
ipc_sem-Xabbrev +ipc.sh -Xabbrev -a29
ipc_sem-Xraw +ipc.sh -Xraw -a19
ipc_sem-Xverbose +ipc.sh -Xverbose -a36
-ipc_shm +ipc.sh -a29
-ipc_shm-Xabbrev +ipc.sh -Xabbrev -a29
+ipc_shm +ipc.sh -a26
+ipc_shm-Xabbrev +ipc.sh -Xabbrev -a26
ipc_shm-Xraw +ipc.sh -Xraw -a19
-ipc_shm-Xverbose +ipc.sh -Xverbose -a36
+ipc_shm-Xverbose +ipc.sh -Xverbose -a34
kcmp -a22
kcmp-y -a22 -y -e trace=kcmp
kern_features -a16
Index: strace-4.24/tests-mx32/gen_tests.in
===================================================================
--- strace-4.24.orig/tests-mx32/gen_tests.in 2020-01-27 18:21:37.445935394 +0100
+++ strace-4.24/tests-mx32/gen_tests.in 2020-01-27 18:37:59.481911731 +0100
@@ -147,16 +147,16 @@
ipc_msg-Xraw +ipc.sh -Xraw -a16
ipc_msg-Xverbose +ipc.sh -Xverbose -a34
ipc_msgbuf-Xabbrev +ipc_msgbuf.test -Xabbrev
-ipc_msgbuf-Xraw +ipc_msgbuf.test -Xraw -a22
+ipc_msgbuf-Xraw +ipc_msgbuf.test -Xraw -a20
ipc_msgbuf-Xverbose +ipc_msgbuf.test -Xverbose
ipc_sem +ipc.sh -a29
ipc_sem-Xabbrev +ipc.sh -Xabbrev -a29
ipc_sem-Xraw +ipc.sh -Xraw -a19
ipc_sem-Xverbose +ipc.sh -Xverbose -a36
-ipc_shm +ipc.sh -a29
-ipc_shm-Xabbrev +ipc.sh -Xabbrev -a29
+ipc_shm +ipc.sh -a26
+ipc_shm-Xabbrev +ipc.sh -Xabbrev -a26
ipc_shm-Xraw +ipc.sh -Xraw -a19
-ipc_shm-Xverbose +ipc.sh -Xverbose -a36
+ipc_shm-Xverbose +ipc.sh -Xverbose -a34
kcmp -a22
kcmp-y -a22 -y -e trace=kcmp
kern_features -a16

View File

@ -1,53 +0,0 @@
From a75c7c4bcb6b48680275de3e99e17e0ebec811ec Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Thu, 7 Nov 2019 19:58:36 +0000
Subject: [PATCH] tests: fix -a argument in ipc_msgbuf-Xraw test
* tests/gen_tests.in (ipc_msgbuf-Xraw): Change -a argument from 20 to 19.
---
Backport change:
* tests/gen_tests.in change has been copied over to tests-m32/gen_tests.in
and tests-mx32/gen_tests.in.
---
tests/gen_tests.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: strace-4.24/tests/gen_tests.in
===================================================================
--- strace-4.24.orig/tests/gen_tests.in 2020-01-27 18:21:42.169892032 +0100
+++ strace-4.24/tests/gen_tests.in 2020-01-27 18:38:14.935773561 +0100
@@ -147,7 +147,7 @@
ipc_msg-Xraw +ipc.sh -Xraw -a16
ipc_msg-Xverbose +ipc.sh -Xverbose -a34
ipc_msgbuf-Xabbrev +ipc_msgbuf.test -Xabbrev
-ipc_msgbuf-Xraw +ipc_msgbuf.test -Xraw -a20
+ipc_msgbuf-Xraw +ipc_msgbuf.test -Xraw -a19
ipc_msgbuf-Xverbose +ipc_msgbuf.test -Xverbose
ipc_sem +ipc.sh -a29
ipc_sem-Xabbrev +ipc.sh -Xabbrev -a29
Index: strace-4.24/tests-m32/gen_tests.in
===================================================================
--- strace-4.24.orig/tests-m32/gen_tests.in 2020-01-27 18:38:00.954898561 +0100
+++ strace-4.24/tests-m32/gen_tests.in 2020-01-27 18:38:23.407697816 +0100
@@ -147,7 +147,7 @@
ipc_msg-Xraw +ipc.sh -Xraw -a16
ipc_msg-Xverbose +ipc.sh -Xverbose -a34
ipc_msgbuf-Xabbrev +ipc_msgbuf.test -Xabbrev
-ipc_msgbuf-Xraw +ipc_msgbuf.test -Xraw -a20
+ipc_msgbuf-Xraw +ipc_msgbuf.test -Xraw -a19
ipc_msgbuf-Xverbose +ipc_msgbuf.test -Xverbose
ipc_sem +ipc.sh -a29
ipc_sem-Xabbrev +ipc.sh -Xabbrev -a29
Index: strace-4.24/tests-mx32/gen_tests.in
===================================================================
--- strace-4.24.orig/tests-mx32/gen_tests.in 2020-01-27 18:37:59.481911731 +0100
+++ strace-4.24/tests-mx32/gen_tests.in 2020-01-27 18:38:24.645686747 +0100
@@ -147,7 +147,7 @@
ipc_msg-Xraw +ipc.sh -Xraw -a16
ipc_msg-Xverbose +ipc.sh -Xverbose -a34
ipc_msgbuf-Xabbrev +ipc_msgbuf.test -Xabbrev
-ipc_msgbuf-Xraw +ipc_msgbuf.test -Xraw -a20
+ipc_msgbuf-Xraw +ipc_msgbuf.test -Xraw -a19
ipc_msgbuf-Xverbose +ipc_msgbuf.test -Xverbose
ipc_sem +ipc.sh -a29
ipc_sem-Xabbrev +ipc.sh -Xabbrev -a29

View File

@ -0,0 +1,44 @@
From ff85f882bbd8a399e036b8465520d1ff0867f4f1 Mon Sep 17 00:00:00 2001
From: Chris Packham <chris.packham@alliedtelesis.co.nz>
Date: Mon, 15 Jun 2020 22:01:25 +1200
Subject: [PATCH 113/115] io_uring: Remove struct io_cqring_offsets compile
time asserts
The generated types/check-io_uring.c already checks the kernel's struct
io_cqring_offsets for compatibility with the strace definition so
there's no need for manual checks.
* io_uring.c [HAVE_STRUCT_IO_CQRING_OFFSETS]: Remove static_asserts.
---
io_uring.c | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/io_uring.c b/io_uring.c
index ac1807b..fd83313 100644
--- a/io_uring.c
+++ b/io_uring.c
@@ -17,21 +17,6 @@
#include "xlat/uring_enter_flags.h"
#include "xlat/uring_register_opcodes.h"
-#ifdef HAVE_STRUCT_IO_CQRING_OFFSETS
-# ifdef HAVE_STRUCT_IO_CQRING_OFFSETS_RESV
-static_assert(offsetof(struct_io_cqring_offsets, resv)
- >= offsetof(struct io_cqring_offsets, resv),
- "struct io_cqring_offsets.resv offset mismatch"
- ", please update the decoder");
-static_assert(sizeof_field(struct_io_cqring_offsets, resv)
- <= sizeof_field(struct io_cqring_offsets, resv),
- "struct io_cqring_offsets.resv size mismatch"
- ", please update the decoder");
-# else /* !HAVE_STRUCT_IO_CQRING_OFFSETS_RESV */
-static_assert(0, "struct io_cqring_offsets.resv is missing"
- ", please update the decoder");
-# endif
-#endif /* HAVE_STRUCT_IO_CQRING_OFFSETS */
#ifdef HAVE_STRUCT_IO_URING_PARAMS
# ifdef HAVE_STRUCT_IO_URING_PARAMS_RESV
static_assert(offsetof(struct_io_uring_params, resv)
--
2.1.4

View File

@ -0,0 +1,383 @@
From c51b292b237214ccfcae5a84085f8d0a7e85c8ba Mon Sep 17 00:00:00 2001
From: Chris Packham <chris.packham@alliedtelesis.co.nz>
Date: Mon, 15 Jun 2020 22:01:26 +1200
Subject: [PATCH 114/115] io_uring: Add io_cqring_offset flags
Add support for displaying struct io_cqring_offsets.flags introduced
by Linux kernel commits v5.8-rc1~190^2~22 and v5.8-rc1~190^2~21.
* types/io_uring.h (struct_io_cqring_offsets): Replace resv array
with flags, resv1, and resv2 fields.
* xlat/uring_cqring_flags.in: New file.
* configure.ac (AC_CHECK_MEMBERS): Check struct io_cqring_offsets.flags.
* io_uring.c: Include "xlat/uring_cqring_flags.h".
(SYS_FUNC(io_uring_setup)): Replace printing of the resv array
of struct io_cqring_offsets with flags, resv1, and resv2 fields.
* tests/io_uring_setup.c: Check it.
Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
Resolves: https://github.com/strace/strace/issues/138
---
configure.ac | 1 +
io_uring.c | 11 +++++++----
tests/io_uring_setup.c | 31 ++++++++++++++++++++++++++-----
types/io_uring.h | 4 +++-
xlat/uring_cqring_flags.in | 1 +
5 files changed, 38 insertions(+), 10 deletions(-)
create mode 100644 xlat/uring_cqring_flags.in
Index: strace-5.7/configure.ac
===================================================================
--- strace-5.7.orig/configure.ac 2020-11-09 04:39:07.197892960 +0100
+++ strace-5.7/configure.ac 2020-11-09 04:39:14.943826575 +0100
@@ -481,6 +481,7 @@
AC_CHECK_HEADERS([linux/io_uring.h], [
AC_CHECK_MEMBERS(m4_normalize([
+ struct io_cqring_offsets.flags,
struct io_uring_params.features,
struct io_uring_params.wq_fd,
struct io_uring_params.resv
Index: strace-5.7/io_uring.c
===================================================================
--- strace-5.7.orig/io_uring.c 2020-11-09 04:39:07.197892960 +0100
+++ strace-5.7/io_uring.c 2020-11-09 04:39:14.943826575 +0100
@@ -17,6 +17,7 @@
#include "xlat/uring_setup_flags.h"
#include "xlat/uring_enter_flags.h"
#include "xlat/uring_register_opcodes.h"
+#include "xlat/uring_cqring_flags.h"
#ifdef HAVE_STRUCT_IO_URING_PARAMS
# ifdef HAVE_STRUCT_IO_URING_PARAMS_RESV
@@ -88,10 +89,12 @@
PRINT_FIELD_U(", ", params.cq_off, ring_entries);
PRINT_FIELD_U(", ", params.cq_off, overflow);
PRINT_FIELD_U(", ", params.cq_off, cqes);
- if (!IS_ARRAY_ZERO(params.cq_off.resv)) {
- PRINT_FIELD_ARRAY(", ", params.cq_off, resv, tcp,
- print_xint64_array_member);
- }
+ PRINT_FIELD_FLAGS(", ", params.cq_off, flags,
+ uring_cqring_flags, "IORING_CQ_???");
+ if (params.cq_off.resv1)
+ PRINT_FIELD_X(", ", params.cq_off, resv1);
+ if (params.cq_off.resv2)
+ PRINT_FIELD_X(", ", params.cq_off, resv2);
tprints("}");
}
tprints("}");
Index: strace-5.7/tests/io_uring_setup.c
===================================================================
--- strace-5.7.orig/tests/io_uring_setup.c 2020-11-09 04:39:07.197892960 +0100
+++ strace-5.7/tests/io_uring_setup.c 2020-11-09 04:39:14.943826575 +0100
@@ -27,6 +27,7 @@
# include "xlat.h"
# include "xlat/uring_setup_features.h"
+# include "xlat/uring_cqring_flags.h"
# ifdef HAVE_STRUCT_IO_URING_PARAMS_FEATURES
# ifdef HAVE_STRUCT_IO_URING_PARAMS_WQ_FD
@@ -144,20 +145,40 @@
params->sq_off.resv2);
printf("}, cq_off={head=%u, tail=%u, ring_mask=%u"
- ", ring_entries=%u, overflow=%u, cqes=%u",
+ ", ring_entries=%u, overflow=%u, cqes=%u, flags=",
params->cq_off.head,
params->cq_off.tail,
params->cq_off.ring_mask,
params->cq_off.ring_entries,
params->cq_off.overflow,
params->cq_off.cqes);
- if (params->cq_off.resv[0] || params->cq_off.resv[1]) {
- printf(", resv=[%#llx, %#llx]",
+#ifdef HAVE_STRUCT_IO_CQRING_OFFSETS_FLAGS
+ printflags(uring_cqring_flags,
+ params->cq_off.flags,
+ "IORING_CQ_???");
+ if (params->cq_off.resv1)
+ printf(", resv1=%#x", params->cq_off.resv1);
+ if (params->cq_off.resv2)
+ printf(", resv2=%#llx",
(unsigned long long)
- params->cq_off.resv[0],
+ params->cq_off.resv2);
+#else
+ union {
+ struct {
+ uint32_t flags;
+ uint32_t resv1;
+ } s;
+ uint64_t v;
+ } u = { .v = params->cq_off.resv[0] };
+ printflags(uring_cqring_flags, u.s.flags,
+ "IORING_CQ_???");
+ if (u.s.resv1)
+ printf(", resv1=%#x", u.s.resv1);
+ if (params->cq_off.resv[1])
+ printf(", resv2=%#llx",
(unsigned long long)
params->cq_off.resv[1]);
- }
+#endif
printf("}}) = %ld<anon_inode:[io_uring]>\n", rc);
}
Index: strace-5.7/types/io_uring.h
===================================================================
--- strace-5.7.orig/types/io_uring.h 2020-11-09 04:39:07.198892952 +0100
+++ strace-5.7/types/io_uring.h 2020-11-09 04:39:14.944826567 +0100
@@ -31,7 +31,9 @@
uint32_t ring_entries;
uint32_t overflow;
uint32_t cqes;
- uint64_t resv[2];
+ /** Added by v5.8-rc1~190^2~22 */ uint32_t flags;
+ /** Added by v5.8-rc1~190^2~22 */ uint32_t resv1;
+ /** Added by v5.8-rc1~190^2~22 */ uint64_t resv2;
} struct_io_cqring_offsets;
typedef struct {
Index: strace-5.7/xlat/uring_cqring_flags.in
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ strace-5.7/xlat/uring_cqring_flags.in 2020-11-09 04:39:14.944826567 +0100
@@ -0,0 +1 @@
+IORING_CQ_EVENTFD_DISABLED 1U
Index: strace-5.7/Makefile.in
===================================================================
--- strace-5.7.orig/Makefile.in 2020-11-09 04:39:07.201892926 +0100
+++ strace-5.7/Makefile.in 2020-11-09 04:42:54.519945367 +0100
@@ -1506,10 +1506,10 @@
xlat/uffd_register_mode_flags.in xlat/uffd_zeropage_flags.in \
xlat/umount_flags.in xlat/unix_diag_attrs.in \
xlat/unix_diag_show.in xlat/unshare_flags.in \
- xlat/uring_enter_flags.in xlat/uring_op_flags.in \
- xlat/uring_ops.in xlat/uring_register_opcodes.in \
- xlat/uring_setup_features.in xlat/uring_setup_flags.in \
- xlat/usagewho.in xlat/v4l2_buf_flags.in \
+ xlat/uring_cqring_flags.in xlat/uring_enter_flags.in \
+ xlat/uring_op_flags.in xlat/uring_ops.in \
+ xlat/uring_register_opcodes.in xlat/uring_setup_features.in \
+ xlat/uring_setup_flags.in xlat/usagewho.in xlat/v4l2_buf_flags.in \
xlat/v4l2_buf_flags_masks.in xlat/v4l2_buf_flags_ts_src.in \
xlat/v4l2_buf_flags_ts_type.in xlat/v4l2_buf_types.in \
xlat/v4l2_capture_modes.in xlat/v4l2_colorspaces.in \
@@ -1755,10 +1755,10 @@
xlat/uffd_register_mode_flags.h xlat/uffd_zeropage_flags.h \
xlat/umount_flags.h xlat/unix_diag_attrs.h \
xlat/unix_diag_show.h xlat/unshare_flags.h \
- xlat/uring_enter_flags.h xlat/uring_op_flags.h \
- xlat/uring_ops.h xlat/uring_register_opcodes.h \
- xlat/uring_setup_features.h xlat/uring_setup_flags.h \
- xlat/usagewho.h xlat/v4l2_buf_flags.h \
+ xlat/uring_cqring_flags.h xlat/uring_enter_flags.h \
+ xlat/uring_op_flags.h xlat/uring_ops.h \
+ xlat/uring_register_opcodes.h xlat/uring_setup_features.h \
+ xlat/uring_setup_flags.h xlat/usagewho.h xlat/v4l2_buf_flags.h \
xlat/v4l2_buf_flags_masks.h xlat/v4l2_buf_flags_ts_src.h \
xlat/v4l2_buf_flags_ts_type.h xlat/v4l2_buf_types.h \
xlat/v4l2_capture_modes.h xlat/v4l2_colorspaces.h \
@@ -9974,6 +9974,8 @@
$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
$(top_srcdir)/xlat/unshare_flags.h: $(top_srcdir)/xlat/unshare_flags.in $(top_srcdir)/xlat/gen.sh
$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/uring_cqring_flags.h: $(top_srcdir)/xlat/uring_cqring_flags.in $(top_srcdir)/xlat/gen.sh
+ $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
$(top_srcdir)/xlat/uring_enter_flags.h: $(top_srcdir)/xlat/uring_enter_flags.in $(top_srcdir)/xlat/gen.sh
$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
$(top_srcdir)/xlat/uring_op_flags.h: $(top_srcdir)/xlat/uring_op_flags.in $(top_srcdir)/xlat/gen.sh
Index: strace-5.7/configure
===================================================================
--- strace-5.7.orig/configure 2020-11-09 04:39:07.205892892 +0100
+++ strace-5.7/configure 2020-11-09 05:07:10.675485410 +0100
@@ -12580,7 +12580,17 @@
#define HAVE_LINUX_IO_URING_H 1
_ACEOF
- ac_fn_c_check_member "$LINENO" "struct io_uring_params" "features" "ac_cv_member_struct_io_uring_params_features" "#include <linux/io_uring.h>
+ ac_fn_c_check_member "$LINENO" "struct io_cqring_offsets" "flags" "ac_cv_member_struct_io_cqring_offsets_flags" "#include <linux/io_uring.h>
+"
+if test "x$ac_cv_member_struct_io_cqring_offsets_flags" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_IO_CQRING_OFFSETS_FLAGS 1
+_ACEOF
+
+
+fi
+ac_fn_c_check_member "$LINENO" "struct io_uring_params" "features" "ac_cv_member_struct_io_uring_params_features" "#include <linux/io_uring.h>
"
if test "x$ac_cv_member_struct_io_uring_params_features" = xyes; then :
Index: strace-5.7/tests-m32/io_uring_setup.c
===================================================================
--- strace-5.7.orig/tests-m32/io_uring_setup.c 2020-11-09 04:39:07.206892883 +0100
+++ strace-5.7/tests-m32/io_uring_setup.c 2020-11-09 04:39:14.951826507 +0100
@@ -27,6 +27,7 @@
# include "xlat.h"
# include "xlat/uring_setup_features.h"
+# include "xlat/uring_cqring_flags.h"
# ifdef HAVE_STRUCT_IO_URING_PARAMS_FEATURES
# ifdef HAVE_STRUCT_IO_URING_PARAMS_WQ_FD
@@ -144,20 +145,40 @@
params->sq_off.resv2);
printf("}, cq_off={head=%u, tail=%u, ring_mask=%u"
- ", ring_entries=%u, overflow=%u, cqes=%u",
+ ", ring_entries=%u, overflow=%u, cqes=%u, flags=",
params->cq_off.head,
params->cq_off.tail,
params->cq_off.ring_mask,
params->cq_off.ring_entries,
params->cq_off.overflow,
params->cq_off.cqes);
- if (params->cq_off.resv[0] || params->cq_off.resv[1]) {
- printf(", resv=[%#llx, %#llx]",
+#ifdef HAVE_STRUCT_IO_CQRING_OFFSETS_FLAGS
+ printflags(uring_cqring_flags,
+ params->cq_off.flags,
+ "IORING_CQ_???");
+ if (params->cq_off.resv1)
+ printf(", resv1=%#x", params->cq_off.resv1);
+ if (params->cq_off.resv2)
+ printf(", resv2=%#llx",
(unsigned long long)
- params->cq_off.resv[0],
+ params->cq_off.resv2);
+#else
+ union {
+ struct {
+ uint32_t flags;
+ uint32_t resv1;
+ } s;
+ uint64_t v;
+ } u = { .v = params->cq_off.resv[0] };
+ printflags(uring_cqring_flags, u.s.flags,
+ "IORING_CQ_???");
+ if (u.s.resv1)
+ printf(", resv1=%#x", u.s.resv1);
+ if (params->cq_off.resv[1])
+ printf(", resv2=%#llx",
(unsigned long long)
params->cq_off.resv[1]);
- }
+#endif
printf("}}) = %ld<anon_inode:[io_uring]>\n", rc);
}
Index: strace-5.7/tests-mx32/io_uring_setup.c
===================================================================
--- strace-5.7.orig/tests-mx32/io_uring_setup.c 2020-11-09 04:39:07.206892883 +0100
+++ strace-5.7/tests-mx32/io_uring_setup.c 2020-11-09 04:39:14.951826507 +0100
@@ -27,6 +27,7 @@
# include "xlat.h"
# include "xlat/uring_setup_features.h"
+# include "xlat/uring_cqring_flags.h"
# ifdef HAVE_STRUCT_IO_URING_PARAMS_FEATURES
# ifdef HAVE_STRUCT_IO_URING_PARAMS_WQ_FD
@@ -144,20 +145,40 @@
params->sq_off.resv2);
printf("}, cq_off={head=%u, tail=%u, ring_mask=%u"
- ", ring_entries=%u, overflow=%u, cqes=%u",
+ ", ring_entries=%u, overflow=%u, cqes=%u, flags=",
params->cq_off.head,
params->cq_off.tail,
params->cq_off.ring_mask,
params->cq_off.ring_entries,
params->cq_off.overflow,
params->cq_off.cqes);
- if (params->cq_off.resv[0] || params->cq_off.resv[1]) {
- printf(", resv=[%#llx, %#llx]",
+#ifdef HAVE_STRUCT_IO_CQRING_OFFSETS_FLAGS
+ printflags(uring_cqring_flags,
+ params->cq_off.flags,
+ "IORING_CQ_???");
+ if (params->cq_off.resv1)
+ printf(", resv1=%#x", params->cq_off.resv1);
+ if (params->cq_off.resv2)
+ printf(", resv2=%#llx",
(unsigned long long)
- params->cq_off.resv[0],
+ params->cq_off.resv2);
+#else
+ union {
+ struct {
+ uint32_t flags;
+ uint32_t resv1;
+ } s;
+ uint64_t v;
+ } u = { .v = params->cq_off.resv[0] };
+ printflags(uring_cqring_flags, u.s.flags,
+ "IORING_CQ_???");
+ if (u.s.resv1)
+ printf(", resv1=%#x", u.s.resv1);
+ if (params->cq_off.resv[1])
+ printf(", resv2=%#llx",
(unsigned long long)
params->cq_off.resv[1]);
- }
+#endif
printf("}}) = %ld<anon_inode:[io_uring]>\n", rc);
}
Index: strace-5.7/xlat/uring_cqring_flags.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ strace-5.7/xlat/uring_cqring_flags.h 2020-11-09 05:07:27.046345327 +0100
@@ -0,0 +1,48 @@
+/* Generated by ./xlat/gen.sh from ./xlat/uring_cqring_flags.in; do not edit. */
+
+#include "gcc_compat.h"
+#include "static_assert.h"
+
+#if defined(IORING_CQ_EVENTFD_DISABLED) || (defined(HAVE_DECL_IORING_CQ_EVENTFD_DISABLED) && HAVE_DECL_IORING_CQ_EVENTFD_DISABLED)
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((IORING_CQ_EVENTFD_DISABLED) == (1U), "IORING_CQ_EVENTFD_DISABLED != 1U");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define IORING_CQ_EVENTFD_DISABLED 1U
+#endif
+
+#ifndef XLAT_MACROS_ONLY
+
+# ifdef IN_MPERS
+
+# error static const struct xlat uring_cqring_flags in mpers mode
+
+# else
+
+static const struct xlat_data uring_cqring_flags_xdata[] = {
+ XLAT(IORING_CQ_EVENTFD_DISABLED),
+ #define XLAT_VAL_0 ((unsigned) (IORING_CQ_EVENTFD_DISABLED))
+ #define XLAT_STR_0 STRINGIFY(IORING_CQ_EVENTFD_DISABLED)
+};
+static
+const struct xlat uring_cqring_flags[1] = { {
+ .data = uring_cqring_flags_xdata,
+ .size = ARRAY_SIZE(uring_cqring_flags_xdata),
+ .type = XT_NORMAL,
+ .flags_mask = 0
+# ifdef XLAT_VAL_0
+ | XLAT_VAL_0
+# endif
+ ,
+ .flags_strsz = 0
+# ifdef XLAT_STR_0
+ + sizeof(XLAT_STR_0)
+# endif
+ ,
+} };
+
+# undef XLAT_STR_0
+# undef XLAT_VAL_0
+# endif /* !IN_MPERS */
+
+#endif /* !XLAT_MACROS_ONLY */

View File

@ -0,0 +1,217 @@
From dd6b70f5d4db14b432f424071d262e87fa944c96 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Sun, 28 Jun 2020 08:00:00 +0000
Subject: [PATCH 115/115] xlat: update IORING_* constants
* xlat/uring_ops.in (IORING_OP_TEE): New constant introduced by Linux
kernel commit v5.8-rc1~190^2~14.
* tests/io_uring_register.c: Update expected output.
---
tests/io_uring_register.c | 12 ++++++------
xlat/uring_ops.in | 1 +
2 files changed, 7 insertions(+), 6 deletions(-)
Index: strace-5.7/tests/io_uring_register.c
===================================================================
--- strace-5.7.orig/tests/io_uring_register.c 2020-11-09 04:44:38.311057254 +0100
+++ strace-5.7/tests/io_uring_register.c 2020-11-09 04:44:40.445038991 +0100
@@ -225,12 +225,12 @@
probe->ops[0].flags = 0;
probe->ops[0].resv2 = 0xbeefface;
- probe->ops[1].op = 32;
+ probe->ops[1].op = 33;
probe->ops[1].resv = 0;
probe->ops[1].flags = IO_URING_OP_SUPPORTED;
probe->ops[1].resv2 = 0xdeadc0de;
- probe->ops[2].op = 33;
+ probe->ops[2].op = 34;
probe->ops[2].resv = 0xaf;
probe->ops[2].flags = 0xbeef;
probe->ops[2].resv2 = 0;
@@ -245,22 +245,22 @@
", {last_op=IORING_OP_EPOLL_CTL, ops_len=%hhu"
", resv2=[0, %#x, 0], ops=["
"{op=IORING_OP_NOP, resv=0xde, flags=0, resv2=0xbeefface}, "
- "{op=IORING_OP_REMOVE_BUFFERS, flags=IO_URING_OP_SUPPORTED"
+ "{op=IORING_OP_TEE, flags=IO_URING_OP_SUPPORTED"
", resv2=0xdeadc0de}, "
- "{op=33 /* IORING_OP_??? */, resv=0xaf"
+ "{op=34 /* IORING_OP_??? */, resv=0xaf"
", flags=IO_URING_OP_SUPPORTED|0xbeee}, "
"{op=254 /* IORING_OP_??? */"
", flags=0xc0de /* IO_URING_OP_??? */}]}, 4) = %s\n",
fd_null, path_null, probe->ops_len, probe->resv2[1], errstr);
- probe->last_op = 33;
+ probe->last_op = 34;
probe->resv2[1] = 0;
fill_memory_ex(probe->ops, sizeof(probe->ops[0]) * (DEFAULT_STRLEN + 1),
0x40, 0x80);
sys_io_uring_register(fd_null, IORING_REGISTER_PROBE, probe,
DEFAULT_STRLEN + 1);
printf("io_uring_register(%u<%s>, IORING_REGISTER_PROBE"
- ", {last_op=33 /* IORING_OP_??? */, ops_len=%hhu, ops=[",
+ ", {last_op=34 /* IORING_OP_??? */, ops_len=%hhu, ops=[",
fd_null, path_null, probe->ops_len);
for (size_t i = 0; i < DEFAULT_STRLEN; i++) {
printf("%s{op=%u /* IORING_OP_??? */, resv=%#hhx"
Index: strace-5.7/xlat/uring_ops.in
===================================================================
--- strace-5.7.orig/xlat/uring_ops.in 2020-11-09 04:44:38.311057254 +0100
+++ strace-5.7/xlat/uring_ops.in 2020-11-09 04:44:40.445038991 +0100
@@ -32,3 +32,4 @@
IORING_OP_SPLICE 30
IORING_OP_PROVIDE_BUFFERS 31
IORING_OP_REMOVE_BUFFERS 32
+IORING_OP_TEE 33
Index: strace-5.7/tests-m32/io_uring_register.c
===================================================================
--- strace-5.7.orig/tests-m32/io_uring_register.c 2020-11-09 04:44:38.312057246 +0100
+++ strace-5.7/tests-m32/io_uring_register.c 2020-11-09 04:44:40.445038991 +0100
@@ -225,12 +225,12 @@
probe->ops[0].flags = 0;
probe->ops[0].resv2 = 0xbeefface;
- probe->ops[1].op = 32;
+ probe->ops[1].op = 33;
probe->ops[1].resv = 0;
probe->ops[1].flags = IO_URING_OP_SUPPORTED;
probe->ops[1].resv2 = 0xdeadc0de;
- probe->ops[2].op = 33;
+ probe->ops[2].op = 34;
probe->ops[2].resv = 0xaf;
probe->ops[2].flags = 0xbeef;
probe->ops[2].resv2 = 0;
@@ -245,22 +245,22 @@
", {last_op=IORING_OP_EPOLL_CTL, ops_len=%hhu"
", resv2=[0, %#x, 0], ops=["
"{op=IORING_OP_NOP, resv=0xde, flags=0, resv2=0xbeefface}, "
- "{op=IORING_OP_REMOVE_BUFFERS, flags=IO_URING_OP_SUPPORTED"
+ "{op=IORING_OP_TEE, flags=IO_URING_OP_SUPPORTED"
", resv2=0xdeadc0de}, "
- "{op=33 /* IORING_OP_??? */, resv=0xaf"
+ "{op=34 /* IORING_OP_??? */, resv=0xaf"
", flags=IO_URING_OP_SUPPORTED|0xbeee}, "
"{op=254 /* IORING_OP_??? */"
", flags=0xc0de /* IO_URING_OP_??? */}]}, 4) = %s\n",
fd_null, path_null, probe->ops_len, probe->resv2[1], errstr);
- probe->last_op = 33;
+ probe->last_op = 34;
probe->resv2[1] = 0;
fill_memory_ex(probe->ops, sizeof(probe->ops[0]) * (DEFAULT_STRLEN + 1),
0x40, 0x80);
sys_io_uring_register(fd_null, IORING_REGISTER_PROBE, probe,
DEFAULT_STRLEN + 1);
printf("io_uring_register(%u<%s>, IORING_REGISTER_PROBE"
- ", {last_op=33 /* IORING_OP_??? */, ops_len=%hhu, ops=[",
+ ", {last_op=34 /* IORING_OP_??? */, ops_len=%hhu, ops=[",
fd_null, path_null, probe->ops_len);
for (size_t i = 0; i < DEFAULT_STRLEN; i++) {
printf("%s{op=%u /* IORING_OP_??? */, resv=%#hhx"
Index: strace-5.7/tests-mx32/io_uring_register.c
===================================================================
--- strace-5.7.orig/tests-mx32/io_uring_register.c 2020-11-09 04:44:38.312057246 +0100
+++ strace-5.7/tests-mx32/io_uring_register.c 2020-11-09 04:44:40.446038982 +0100
@@ -225,12 +225,12 @@
probe->ops[0].flags = 0;
probe->ops[0].resv2 = 0xbeefface;
- probe->ops[1].op = 32;
+ probe->ops[1].op = 33;
probe->ops[1].resv = 0;
probe->ops[1].flags = IO_URING_OP_SUPPORTED;
probe->ops[1].resv2 = 0xdeadc0de;
- probe->ops[2].op = 33;
+ probe->ops[2].op = 34;
probe->ops[2].resv = 0xaf;
probe->ops[2].flags = 0xbeef;
probe->ops[2].resv2 = 0;
@@ -245,22 +245,22 @@
", {last_op=IORING_OP_EPOLL_CTL, ops_len=%hhu"
", resv2=[0, %#x, 0], ops=["
"{op=IORING_OP_NOP, resv=0xde, flags=0, resv2=0xbeefface}, "
- "{op=IORING_OP_REMOVE_BUFFERS, flags=IO_URING_OP_SUPPORTED"
+ "{op=IORING_OP_TEE, flags=IO_URING_OP_SUPPORTED"
", resv2=0xdeadc0de}, "
- "{op=33 /* IORING_OP_??? */, resv=0xaf"
+ "{op=34 /* IORING_OP_??? */, resv=0xaf"
", flags=IO_URING_OP_SUPPORTED|0xbeee}, "
"{op=254 /* IORING_OP_??? */"
", flags=0xc0de /* IO_URING_OP_??? */}]}, 4) = %s\n",
fd_null, path_null, probe->ops_len, probe->resv2[1], errstr);
- probe->last_op = 33;
+ probe->last_op = 34;
probe->resv2[1] = 0;
fill_memory_ex(probe->ops, sizeof(probe->ops[0]) * (DEFAULT_STRLEN + 1),
0x40, 0x80);
sys_io_uring_register(fd_null, IORING_REGISTER_PROBE, probe,
DEFAULT_STRLEN + 1);
printf("io_uring_register(%u<%s>, IORING_REGISTER_PROBE"
- ", {last_op=33 /* IORING_OP_??? */, ops_len=%hhu, ops=[",
+ ", {last_op=34 /* IORING_OP_??? */, ops_len=%hhu, ops=[",
fd_null, path_null, probe->ops_len);
for (size_t i = 0; i < DEFAULT_STRLEN; i++) {
printf("%s{op=%u /* IORING_OP_??? */, resv=%#hhx"
Index: strace-5.7/xlat/uring_ops.h
===================================================================
--- strace-5.7.orig/xlat/uring_ops.h 2020-11-09 04:44:38.313057237 +0100
+++ strace-5.7/xlat/uring_ops.h 2020-11-09 04:47:01.835829135 +0100
@@ -234,6 +234,13 @@
#else
# define IORING_OP_REMOVE_BUFFERS 32
#endif
+#if defined(IORING_OP_TEE) || (defined(HAVE_DECL_IORING_OP_TEE) && HAVE_DECL_IORING_OP_TEE)
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((IORING_OP_TEE) == (33), "IORING_OP_TEE != 33");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define IORING_OP_TEE 33
+#endif
#ifndef XLAT_MACROS_ONLY
@@ -343,6 +350,9 @@
[IORING_OP_REMOVE_BUFFERS] = XLAT(IORING_OP_REMOVE_BUFFERS),
#define XLAT_VAL_32 ((unsigned) (IORING_OP_REMOVE_BUFFERS))
#define XLAT_STR_32 STRINGIFY(IORING_OP_REMOVE_BUFFERS)
+ [IORING_OP_TEE] = XLAT(IORING_OP_TEE),
+ #define XLAT_VAL_33 ((unsigned) (IORING_OP_TEE))
+ #define XLAT_STR_33 STRINGIFY(IORING_OP_TEE)
};
static
const struct xlat uring_ops[1] = { {
@@ -449,6 +459,9 @@
# ifdef XLAT_VAL_32
| XLAT_VAL_32
# endif
+# ifdef XLAT_VAL_33
+ | XLAT_VAL_33
+# endif
,
.flags_strsz = 0
# ifdef XLAT_STR_0
@@ -550,6 +563,9 @@
# ifdef XLAT_STR_32
+ sizeof(XLAT_STR_32)
# endif
+# ifdef XLAT_STR_33
+ + sizeof(XLAT_STR_33)
+# endif
,
} };
@@ -619,6 +635,8 @@
# undef XLAT_VAL_31
# undef XLAT_STR_32
# undef XLAT_VAL_32
+# undef XLAT_STR_33
+# undef XLAT_VAL_33
# endif /* !IN_MPERS */
#endif /* !XLAT_MACROS_ONLY */

View File

@ -0,0 +1,84 @@
From b0a361c0a9095b396ff7100203c767ec9ffd2cfa Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Tue, 16 Jun 2020 08:00:00 +0000
Subject: [PATCH] types: skip field lines that start with comments
This allows to exclude certain fields from type checks by placing
comments at the beginning of the corresponding lines.
* types/find_last_type_fields.awk: Skip lines starting with spaces
followed by "/".
---
types/find_last_type_fields.awk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: strace-5.7/types/find_last_type_fields.awk
===================================================================
--- strace-5.7.orig/types/find_last_type_fields.awk 2020-01-21 19:02:38.000000000 +0100
+++ strace-5.7/types/find_last_type_fields.awk 2020-11-09 04:47:06.976785148 +0100
@@ -17,7 +17,7 @@
print a[1] "." last_field
next
}
- if (match($0, /^[[:space:]]+[^];:[]+[[:space:]]+([^][:space:];:[]+)(\[[^];:[]*\])?;.*$/, a)) {
+ if (match($0, /^[[:space:]]+[^];[:space:]:\/[][^];:[]*[[:space:]]+([^][:space:];:[]+)(\[[^];:[]*\])?;.*$/, a)) {
last_field = a[1]
next
}
Index: strace-5.7/types/check-io_uring.c
===================================================================
--- strace-5.7.orig/types/check-io_uring.c 2020-11-09 04:47:06.977785139 +0100
+++ strace-5.7/types/check-io_uring.c 2020-11-09 04:49:10.033732186 +0100
@@ -14,13 +14,13 @@
#endif /* HAVE_STRUCT_IO_SQRING_OFFSETS */
#ifdef HAVE_STRUCT_IO_CQRING_OFFSETS
-# ifdef HAVE_STRUCT_IO_CQRING_OFFSETS_RESV
+# ifdef HAVE_STRUCT_IO_CQRING_OFFSETS_CQES
static_assert(sizeof(struct io_cqring_offsets) == sizeof(struct_io_cqring_offsets),
"struct io_cqring_offsets size mismatch, please update the decoder or fix the kernel");
# else
-static_assert(sizeof(struct io_cqring_offsets) <= offsetof(struct_io_cqring_offsets, resv),
+static_assert(sizeof(struct io_cqring_offsets) <= offsetof(struct_io_cqring_offsets, cqes),
"struct io_cqring_offsets size mismatch, please update the decoder or fix the kernel");
-# endif /* HAVE_STRUCT_IO_CQRING_OFFSETS_RESV */
+# endif /* HAVE_STRUCT_IO_CQRING_OFFSETS_CQES */
#endif /* HAVE_STRUCT_IO_CQRING_OFFSETS */
#ifdef HAVE_STRUCT_IO_URING_PARAMS
Index: strace-5.7/config.h.in
===================================================================
--- strace-5.7.orig/config.h.in 2020-11-09 04:47:06.980785114 +0100
+++ strace-5.7/config.h.in 2020-11-09 04:50:11.871203054 +0100
@@ -2596,8 +2596,8 @@
/* Define to 1 if the system has the type `struct io_cqring_offsets'. */
#undef HAVE_STRUCT_IO_CQRING_OFFSETS
-/* Define to 1 if `resv' is a member of `struct io_cqring_offsets'. */
-#undef HAVE_STRUCT_IO_CQRING_OFFSETS_RESV
+/* Define to 1 if `cqes' is a member of `struct io_cqring_offsets'. */
+#undef HAVE_STRUCT_IO_CQRING_OFFSETS_CQES
/* Define to 1 if the system has the type `struct io_sqring_offsets'. */
#undef HAVE_STRUCT_IO_SQRING_OFFSETS
Index: strace-5.7/configure
===================================================================
--- strace-5.7.orig/configure 2020-11-09 04:47:06.988785045 +0100
+++ strace-5.7/configure 2020-11-09 04:51:12.500684263 +0100
@@ -13475,13 +13475,13 @@
#define HAVE_STRUCT_IO_CQRING_OFFSETS 1
_ACEOF
-ac_fn_c_check_member "$LINENO" "struct io_cqring_offsets" "resv" "ac_cv_member_struct_io_cqring_offsets_resv" "$ac_includes_default
+ac_fn_c_check_member "$LINENO" "struct io_cqring_offsets" "cqes" "ac_cv_member_struct_io_cqring_offsets_cqes" "$ac_includes_default
#include <linux/io_uring.h>
"
-if test "x$ac_cv_member_struct_io_cqring_offsets_resv" = xyes; then :
+if test "x$ac_cv_member_struct_io_cqring_offsets_cqes" = xyes; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_IO_CQRING_OFFSETS_RESV 1
+#define HAVE_STRUCT_IO_CQRING_OFFSETS_CQES 1
_ACEOF

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,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

File diff suppressed because it is too large Load Diff

View File

@ -1,42 +0,0 @@
Limit the scope of qual_fault.tests on aarch64 as otherwise it takes
unacceptable amount of time on available builders (more than an hour).
Index: strace-4.24/tests/qual_fault.test
===================================================================
--- strace-4.24.orig/tests/qual_fault.test 2019-06-13 17:37:10.708269613 +0200
+++ strace-4.24/tests/qual_fault.test 2019-06-13 17:41:29.358829506 +0200
@@ -75,18 +75,32 @@
done
}
-for err in '' ENOSYS 22 einval; do
+
+case "$STRACE_ARCH" in
+ aarch64)
+ NUMBERS1='2'
+ NUMBERS2='3'
+ ERRS='EnoSys 22'
+ ;;
+ *)
+ ERRS='ENOSYS 22 einval'
+ NUMBERS1='1 2 3 5 7 11'
+ NUMBERS2='1 2 3 5 7 11'
+ ;;
+esac
+
+for err in '' $(echo $ERRS); do
for fault in writev desc,51; do
check_fault_injection \
writev $fault "$err" '' '' 1 -efault=chdir
check_fault_injection \
writev $fault "$err" '' '' 1 -efault=chdir -efault=none
- for F in 1 2 3 5 7 11; do
+ for F in $(echo $NUMBERS1); do
check_fault_injection \
writev $fault "$err" $F '' 1
check_fault_injection \
writev $fault "$err" $F + 1
- for S in 1 2 3 5 7 11; do
+ for S in $(echo $NUMBERS2); do
check_fault_injection \
writev $fault "$err" $F $S 1
check_fault_injection \

View File

@ -0,0 +1,60 @@
Limit the scope of qual_fault.tests on aarch64 as otherwise it takes
unacceptable amount of time on available builders (more than an hour).
Index: strace-5.7/tests/qual_fault.test
===================================================================
--- strace-5.7.orig/tests/qual_fault.test 2020-06-02 10:41:25.870177356 +0200
+++ strace-5.7/tests/qual_fault.test 2020-06-02 10:48:33.284302800 +0200
@@ -83,19 +83,35 @@
done
}
-for err in '' ENOSYS 22 einval; do
+
+case "$STRACE_ARCH" in
+ aarch64)
+ ERRS='EnoSys 22'
+ NUMBERS1='2'
+ NUMBERS2='3'
+ NUMBERS3='5'
+ ;;
+ *)
+ ERRS='ENOSYS 22 einval'
+ NUMBERS1='1 2 3 5 7 11'
+ NUMBERS2='1 2 3 5 7 11'
+ NUMBERS3='1 2 3 5 7 11'
+ ;;
+esac
+
+for err in '' $(echo $ERRS); do
for fault in writev desc,51; do
check_fault_injection \
writev $fault "$err" '' '' '' 1 -efault=chdir
check_fault_injection \
writev $fault "$err" '' '' '' 1 -efault=chdir -efault=none
- for F in 1 2 3 5 7 11; do
+ for F in $(echo $NUMBERS1); do
check_fault_injection \
writev $fault "$err" $F '' '' 1
check_fault_injection \
writev $fault "$err" $F '' + 1
- for L in 1 2 3 5 7 11; do
+ for L in $(echo $NUMBERS2); do
[ "$L" -ge "$F" ] ||
continue
check_fault_injection \
@@ -104,12 +119,12 @@
writev $fault "$err" $F $L + 1
done
- for S in 1 2 3 5 7 11; do
+ for S in $(echo $NUMBERS2); do
check_fault_injection \
writev $fault "$err" $F '' $S 1
check_fault_injection \
writev $fault "$err" $F '' $S 4
- for L in 1 2 3 5 7 11; do
+ for L in $(echo $NUMBERS3); do
[ "$L" -ge "$F" ] ||
continue
check_fault_injection \

View File

@ -0,0 +1,17 @@
Index: strace-5.7/unwind.c
===================================================================
--- strace-5.7.orig/unwind.c 2018-12-10 01:00:00.000000000 +0100
+++ strace-5.7/unwind.c 2020-06-02 11:13:42.777871147 +0200
@@ -9,6 +9,12 @@
#include "unwind.h"
#ifdef USE_DEMANGLE
+/*
+ * demangle.h defines ARRAY_SIZE without proper guard, and its definition
+ * is "good enough" for us.
+ */
+#undef ARRAY_SIZE
+
# if defined HAVE_DEMANGLE_H
# include <demangle.h>
# elif defined HAVE_LIBIBERTY_DEMANGLE_H

View File

@ -1,7 +1,7 @@
Summary: Tracks and displays system calls associated with a running process
Name: strace
Version: 5.1
Release: 1%{?dist}
Version: 5.7
Release: 2%{?dist}
# The test suite is GPLv2+, all the rest is LGPLv2.1+.
License: LGPL-2.1+ and GPL-2.0+
Group: Development/Debuggers
@ -13,10 +13,10 @@ BuildRequires: pkgconfig(bluez)
BuildRequires: elfutils-devel binutils-devel
## Reported by covscan
# v5.2-3-g7ada13f "evdev: avoid bit vector decoding on non-successful and 0 return codes"
Patch30: 0030-evdev-avoid-bit-vector-decoding-on-non-successful-an.patch
# v5.2-4-g96194ed "evdev: fix array size calculation in decode_bitset_"
Patch31: 0031-evdev-fix-array-size-calculation-in-decode_bitset_.patch
## v5.2-3-g7ada13f "evdev: avoid bit vector decoding on non-successful and 0 return codes"
#Patch30: 0030-evdev-avoid-bit-vector-decoding-on-non-successful-an.patch
## v5.2-4-g96194ed "evdev: fix array size calculation in decode_bitset_"
#Patch31: 0031-evdev-fix-array-size-calculation-in-decode_bitset_.patch
### Pre-requisite for "tests: test evdev bitset decoding more thoroughly"
## v4.25~89 "tests: check decoding of successful evdev ioctl"
@ -24,8 +24,8 @@ Patch31: 0031-evdev-fix-array-size-calculation-in-decode_bitset_.patch
## Test for patches "evdev: avoid bit vector decoding on non-successful and 0
## return codes" and "evdev: fix array size calculation in decode_bitset_"
# v5.2-5-gcdd8206 "tests: test evdev bitset decoding more thoroughly"
Patch33: 0033-tests-test-evdev-bitset-decoding-more-thoroughly.patch
## v5.2-5-gcdd8206 "tests: test evdev bitset decoding more thoroughly"
#Patch33: 0033-tests-test-evdev-bitset-decoding-more-thoroughly.patch
### https://bugzilla.redhat.com/1747475 https://bugzilla.redhat.com/1747514
## v4.26~65 "s390x: beautify sthyi data tail prints"
@ -33,14 +33,14 @@ Patch33: 0033-tests-test-evdev-bitset-decoding-more-thoroughly.patch
## Reported by covscan (https://bugzilla.redhat.com/1747524
## https://bugzilla.redhat.com/1747526 https://bugzilla.redhat.com/1747530)
# v5.2-84-g91281fec "v4l2: avoid shifting left a signed number by 31 bit"
Patch35: 0035-v4l2-avoid-shifting-left-a-signed-number-by-31-bit.patch
# v5.2~21 "syscall.c: avoid infinite loop in subcalls parsing"
Patch36: 0036-syscall.c-avoid-infinite-loop-in-subcalls-parsing.patch
# v5.2~19 "kvm: avoid bogus vcpu_info assignment in vcpu_register"
Patch37: 0037-kvm-avoid-bogus-vcpu_info-assignment-in-vcpu_registe.patch
# v5.4~97 "xlat: use unsgined type for mount_flags fallback values"
Patch38: 0038-xlat-use-unsgined-type-for-mount_flags-fallback-valu.patch
## v5.2-84-g91281fec "v4l2: avoid shifting left a signed number by 31 bit"
#Patch35: 0035-v4l2-avoid-shifting-left-a-signed-number-by-31-bit.patch
## v5.2~21 "syscall.c: avoid infinite loop in subcalls parsing"
#Patch36: 0036-syscall.c-avoid-infinite-loop-in-subcalls-parsing.patch
## v5.2~19 "kvm: avoid bogus vcpu_info assignment in vcpu_register"
#Patch37: 0037-kvm-avoid-bogus-vcpu_info-assignment-in-vcpu_registe.patch
## v5.4~97 "xlat: use unsgined type for mount_flags fallback values"
#Patch38: 0038-xlat-use-unsgined-type-for-mount_flags-fallback-valu.patch
## Missing stack traces on attach (https://bugzilla.redhat.com/1788636)
## RHEL 7: https://bugzilla.redhat.com/1790052
@ -48,24 +48,24 @@ Patch38: 0038-xlat-use-unsgined-type-for-mount_flags-fallback-valu.patch
## RHEL 6 DTS: https://bugzilla.redhat.com/1790058
## RHEL 7 DTS: https://bugzilla.redhat.com/1790057
## RHEL 8 DTS: https://bugzilla.redhat.com/1790054
# v5.4-18-g69b2c33 "unwind-libdw: fix initialization of libdwfl cache"
Patch39: 0039-unwind-libdw-fix-initialization-of-libdwfl-cache.patch
# v5.4-27-g35e080a "syscall: do not capture stack trace while the tracee executes strace code"
Patch40: 0040-syscall-do-not-capture-stack-trace-while-the-tracee-.patch
# v5.4-63-g8e515c7 "tests: add strace-k-p test"
Patch41: 0041-tests-add-strace-k-p-test.patch
## v5.4-18-g69b2c33 "unwind-libdw: fix initialization of libdwfl cache"
#Patch39: 0039-unwind-libdw-fix-initialization-of-libdwfl-cache.patch
## v5.4-27-g35e080a "syscall: do not capture stack trace while the tracee executes strace code"
#Patch40: 0040-syscall-do-not-capture-stack-trace-while-the-tracee-.patch
## v5.4-63-g8e515c7 "tests: add strace-k-p test"
#Patch41: 0041-tests-add-strace-k-p-test.patch
## https://bugzilla.redhat.com/1746885
# v5.2-92-gc108f0b "sockaddr: properly decode sockaddr_hci addresses without hci_channel"
Patch42: 0042-sockaddr-properly-decode-sockaddr_hci-addresses-with.patch
## v5.2-92-gc108f0b "sockaddr: properly decode sockaddr_hci addresses without hci_channel"
#Patch42: 0042-sockaddr-properly-decode-sockaddr_hci-addresses-with.patch
## Some ipc tests from strace internal testsuite occasionally fail
## https://bugzilla.redhat.com/1795251 https://bugzilla.redhat.com/1795261
## https://bugzilla.redhat.com/1794490 https://bugzilla.redhat.com/1795273
# v5.3~102 "tests: fix expected output for some ipc tests"
Patch43: 0043-tests-fix-expected-output-for-some-ipc-tests.patch
# v5.4~49 "tests: fix -a argument in ipc_msgbuf-Xraw test"
Patch44: 0044-tests-fix-a-argument-in-ipc_msgbuf-Xraw-test.patch
## v5.3~102 "tests: fix expected output for some ipc tests"
#Patch43: 0043-tests-fix-expected-output-for-some-ipc-tests.patch
## v5.4~49 "tests: fix -a argument in ipc_msgbuf-Xraw test"
#Patch44: 0044-tests-fix-a-argument-in-ipc_msgbuf-Xraw-test.patch
### Update bpf decoder, as bpf-obj_get_info_by_fd-prog-v.gen.test has started
### to fail after BPF rebase in RHEL 8.2 kernel.
@ -86,20 +86,138 @@ Patch44: 0044-tests-fix-a-argument-in-ipc_msgbuf-Xraw-test.patch
## v5.1~6 "tests: robustify bpf-obj_get_info_by_fd test against future kernels"
#Patch52: 0052-tests-robustify-bpf-obj_get_info_by_fd-test-against-.patch
## Patches 53-86 were on DTS 9 for
## "some devtoolset-9-strace internal tests fail on rhel-alt-7.6"
## https://bugzilla.redhat.com/1758201
## Update io_uring(2) decoder (https://bugzilla.redhat.com/1853011)
## v5.5~65 "io_uring: do not depend on kernel header definitions"
#Patch87: 0087-io_uring-do-not-depend-on-kernel-header-definitions.patch
## v5.5~64 "io_uring: de-indent the switch case statements"
#Patch88: 0088-io_uring-de-indent-the-switch-case-statements.patch
## v5.3~15 "Add support for printing local arrays to print_array"
#Patch89: 0089-Add-support-for-printing-local-arrays-to-print_array.patch
## v5.5~63 "Rework interface for printing local arrays"
#Patch90: 0090-Rework-interface-for-printing-local-arrays.patch
## v5.5~62 "io_uring: decode io_uring_params.resv with IS_ARRAY_ZERO and PRINT_FIELD_ARRAY"
#Patch91: 0091-io_uring-decode-io_uring_params.resv-with-IS_ARRAY_Z.patch
## v5.5~61 "io_uring: print io_sqring_offsets and io_cqring_offsets reserved fields"
#Patch92: 0092-io_uring-print-io_sqring_offsets-and-io_cqring_offse.patch
## v5.5~60 "io_uring: add support for IORING_REGISTER_EVENTFD and IORING_UNREGISTER_EVENTFD"
#Patch93: 0093-io_uring-add-support-for-IORING_REGISTER_EVENTFD-and.patch
## v5.5~59 "io_uring: implement decoding of struct io_uring_params.features"
#Patch94: 0094-io_uring-implement-decoding-of-struct-io_uring_param.patch
## v5.5~58 "xlat: add IORING_SETUP_CQSIZE to uring_setup_flags"
#Patch95: 0095-xlat-add-IORING_SETUP_CQSIZE-to-uring_setup_flags.patch
## v5.5~42 "io_uring: check struct io_* types automatically"
#Patch96: 0096-io_uring-check-struct-io_-types-automatically.patch
## v5.5~41 "io_uring: add support for IORING_REGISTER_FILES_UPDATE"
#Patch97: 0097-io_uring-add-support-for-IORING_REGISTER_FILES_UPDAT.patch
## v5.5~27 "xlat: update uring_setup_features constants"
#Patch98: 0098-xlat-update-uring_setup_features-constants.patch
## v5.5~26 "xlat: add IORING_SETUP_CLAMP to uring_setup_flags"
#Patch99: 0099-xlat-add-IORING_SETUP_CLAMP-to-uring_setup_flags.patch
## v5.5~25 "io_uring: add support of wq_fd field decoding to io_uring_setup"
#Patch100: 0100-io_uring-add-support-of-wq_fd-field-decoding-to-io_u.patch
## v5.6~190 "tests/io_uring_register: properly handle big endian architectures"
#Patch101: 0101-tests-io_uring_register-properly-handle-big-endian-a.patch
## v5.6~157 "io_uring: decode IORING_REGISTER_EVENTFD_ASYNC io_uring_reginster command"
#Patch102: 0102-io_uring-decode-IORING_REGISTER_EVENTFD_ASYNC-io_uri.patch
## v5.6~95 "io_uring: de-indent some code in io_uring_setup decoder"
#Patch103: 0103-io_uring-de-indent-some-code-in-io_uring_setup-decod.patch
## v5.3~29 "defs.h: introduce {opt,dispatch}_{word,klong}size"
#Patch104: 0104-defs.h-introduce-opt-dispatch-_-word-klong-size.patch
## v5.3~9 "Handle xlat verbosity in evdev bitset printing"
#Patch105: 0105-Handle-xlat-verbosity-in-evdev-bitset-printing.patch
## v5.6~94 "io_uring: support IORING_REGISTER_PROBE io_uring_register command"
#Patch106: 0106-io_uring-support-IORING_REGISTER_PROBE-io_uring_regi.patch
## v5.6~93 "io_uring: add support for IORING_{UN,}REGISTER_PERSONALITY commands"
#Patch107: 0107-io_uring-add-support-for-IORING_-UN-REGISTER_PERSONA.patch
## v5.6~17 "tests: fix clang compilation warning"
#Patch108: 0108-tests-fix-clang-compilation-warning.patch
## v5.6~10 "tests: workaround clang compilation warning"
#Patch109: 0109-tests-workaround-clang-compilation-warning.patch
## v5.7~87 "xlat: add IORING_FEAT_FAST_POLL to uring_setup_features"
#Patch110: 0110-xlat-add-IORING_FEAT_FAST_POLL-to-uring_setup_featur.patch
## v5.7~85 "xlat: update uring_ops"
#Patch111: 0111-xlat-update-uring_ops.patch
## v5.7~68 "tests: correct error message in io_uring_register test"
#Patch112: 0112-tests-correct-error-message-in-io_uring_register-tes.patch
# v5.8~58 "io_uring: Remove struct io_cqring_offsets compile time asserts"
Patch113: 0113-io_uring-Remove-struct-io_cqring_offsets-compile-tim.patch
# v5.8~57 "io_uring: Add io_cqring_offset flags"
Patch114: 0114-io_uring-Add-io_cqring_offset-flags.patch
# v5.8~47 "xlat: update IORING_* constants"
Patch115: 0115-xlat-update-IORING_-constants.patch
## v5.5~71 "macros.h: introduce sizeof_field macro"
#Patch116: 0116-macros.h-introduce-sizeof_field-macro.patch
## v5.5~49 "types: new infrastructure for automatic checking of structure types"
#Patch117: 0117-types-new-infrastructure-for-automatic-checking-of-s.patch
# v5.8~59 "types: skip field lines that start with comments"
Patch118: 0118-types-skip-field-lines-that-start-with-comments.patch
## PID namespace translation support
## https://bugzilla.redhat.com/1035434
## https://bugzilla.redhat.com/1725113 https://bugzilla.redhat.com/1790836
## https://bugzilla.redhat.com/1804334 https://bugzilla.redhat.com/1807458
# v5.8~62 "print_fields.h: add PRINT_FIELD_LEN macro"
Patch119: 0119-print_fields.h-add-PRINT_FIELD_LEN-macro.patch
# v5.8~61 "Move ilog* functions from util.c to defs.h"
Patch120: 0120-Move-ilog-functions-from-util.c-to-defs.h.patch
## v5.8~59 "types: skip field lines that start with comments"
#Patch121: 0121-types-skip-field-lines-that-start-with-comments.patch
# v5.8~54 "tests/inject-nf.test: replace getpid with geteuid"
Patch122: 0122-tests-inject-nf.test-replace-getpid-with-geteuid.patch
# v5.8~18 "fcntl: use print_fields.h macros"
Patch123: 0123-fcntl-use-print_fields.h-macros.patch
# v5.8~17 "kcmp: fix KCMP_FILE decoding"
Patch124: 0124-kcmp-fix-KCMP_FILE-decoding.patch
# v5.8~15 "printsiginfo: fix printing of siginfo_t.si_pid and siginfo_t.si_uid"
Patch125: 0125-printsiginfo-fix-printing-of-siginfo_t.si_pid-and-si.patch
# v5.8~14 "Use PRINT_FIELD_UID instead of printuid where appropriate"
Patch126: 0126-Use-PRINT_FIELD_UID-instead-of-printuid-where-approp.patch
# v5.8~10 "Consistently print process ids as signed integers"
Patch127: 0127-Consistently-print-process-ids-as-signed-integers.patch
# v5.8~9 "Remove tcb parameter of read_int_from_file"
Patch128: 0128-Remove-tcb-parameter-of-read_int_from_file.patch
# v5.8~6 "Add "struct tcb *" parameters to various functions"
Patch129: 0129-Add-struct-tcb-parameters-to-various-functions.patch
# v5.8~53 "Modify %process class: trace syscalls associated with process lifecycle"
Patch130: 0130-Modify-process-class-trace-syscalls-associated-with-.patch
# v5.8~5 "Introduce SYS_FUNC(tkill)"
Patch131: 0131-Introduce-SYS_FUNC-tkill.patch
# v5.8~4 "tests: check decoding of tkill syscall"
Patch132: 0132-tests-check-decoding-of-tkill-syscall.patch
# v5.8~3 "tests: check decoding of tgkill syscall"
Patch133: 0133-tests-check-decoding-of-tgkill-syscall.patch
# v5.8-5-gdea0284 "PID namespace translation support"
Patch134: 0134-PID-namespace-translation-support.patch
# v5.8-6-g173257d "Use printpid in decoders"
Patch135: 0135-Use-printpid-in-decoders.patch
# v5.8-7-g18c2208 "Use get_proc_pid for /proc paths"
Patch136: 0136-Use-get_proc_pid-for-proc-paths.patch
# v5.8-8-g7ecee07 "Implement testing framework for pidns"
Patch137: 0137-Implement-testing-framework-for-pidns.patch
# v5.8-9-gf350ce0 "Add tests for PID namespace translation"
Patch138: 0138-Add-tests-for-PID-namespace-translation.patch
### Wire up rseq and kexec_file_load in order to avoid kexec_file_load
### test failure on aarch64. Addresses https://bugzilla.redhat.com/1676045
### ("strace: FTBFS in Fedora rawhide/f30").
## v5.0~62 "Wire up rseq syscall on architectures that use generic unistd.h"
#Patch100: 0100-Wire-up-rseq-syscall-on-architectures-that-use-gener.patch
#Patch1000: 1000-Wire-up-rseq-syscall-on-architectures-that-use-gener.patch
## v5.0~61 "Wire up kexec_file_load syscall on architectures that use generic unistd.h"
#Patch101: 0101-Wire-up-kexec_file_load-syscall-on-architectures-tha.patch
#Patch1001: 1001-Wire-up-kexec_file_load-syscall-on-architectures-tha.patch
### RHEL7-only: headers on some builders do not provide O_TMPFILE
#Patch200: 0200-strace-provide-O_TMPFILE-fallback-definition.patch
#Patch2000: 2000-strace-provide-O_TMPFILE-fallback-definition.patch
## RHEL-only: aarch64 brew builders are extremely slow on qual_fault.test
Patch201: 0201-limit-qual_fault-scope-on-aarch64.patch
Patch2001: 2001-limit-qual_fault-scope-on-aarch64.patch
### RHEL8.2-only: disable ksysent test due to missing rebase
#Patch202: 0202-disable-ksysent-on-8.2.patch
#Patch2002: 2002-disable-ksysent-on-8.2.patch
## RHEL-only: avoid ARRAY_SIZE macro re-definition in libiberty.h
Patch2003: 2003-undef-ARRAY_SIZE.patch
# We no longer need to build a separate strace32 binary, but we don't want
# to break existing strace32 users' workflows.
@ -109,7 +227,8 @@ Patch201: 0201-limit-qual_fault-scope-on-aarch64.patch
%define _isa_compat %{?__isa_name:(%{__isa_name}-32)}%{!?__isa:%{nil}}
%define evr %{?epoch:%{epoch}:}%{version}-%{release}
Provides: strace32 = %{evr}
Obsoletes: strace32 < %{version} strace32%{_isa_compat} < %{version}
# strace32 was a real package before strace-4.24 in RHEL
Obsoletes: strace32 < 4.24
%endif
%description
@ -125,21 +244,21 @@ received by a process.
%prep
%setup -q
%patch30 -p1
%patch31 -p1
#%patch30 -p1
#%patch31 -p1
#%patch32 -p1
%patch33 -p1
#%patch33 -p1
#%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
%patch38 -p1
%patch39 -p1
%patch40 -p1
%patch41 -p1
%patch42 -p1
%patch43 -p1
%patch44 -p1
#%patch35 -p1
#%patch36 -p1
#%patch37 -p1
#%patch38 -p1
#%patch39 -p1
#%patch40 -p1
#%patch41 -p1
#%patch42 -p1
#%patch43 -p1
#%patch44 -p1
#%patch45 -p1
#%patch46 -p1
#%patch47 -p1
@ -148,13 +267,68 @@ received by a process.
#%patch50 -p1
#%patch51 -p1
#%patch52 -p1
#%patch87 -p1
#%patch88 -p1
#%patch89 -p1
#%patch90 -p1
#%patch91 -p1
#%patch92 -p1
#%patch93 -p1
#%patch94 -p1
#%patch95 -p1
#%patch96 -p1
#%patch97 -p1
#%patch98 -p1
#%patch99 -p1
#%patch100 -p1
#%patch101 -p1
#%patch102 -p1
#%patch103 -p1
#%patch104 -p1
#%patch105 -p1
#%patch106 -p1
#%patch107 -p1
#%patch108 -p1
#%patch109 -p1
#%patch110 -p1
#%patch111 -p1
#%patch112 -p1
%patch113 -p1
%patch114 -p1
%patch115 -p1
#%patch116 -p1
#%patch117 -p1
%patch118 -p1
%patch119 -p1
%patch120 -p1
#%patch121 -p1
%patch122 -p1
%patch123 -p1
%patch124 -p1
%patch125 -p1
%patch126 -p1
%patch127 -p1
%patch128 -p1
%patch129 -p1
%patch130 -p1
%patch131 -p1
%patch132 -p1
%patch133 -p1
%patch134 -p1
%patch135 -p1
%patch136 -p1
%patch137 -p1
%patch138 -p1
#%patch200 -p1
%patch201 -p1
#%patch202 -p1
#%patch1000 -p1
#%patch1001 -p1
#%patch2000 -p1
%patch2001 -p1
#%patch2002 -p1
%patch2003 -p1
chmod a+x tests/*.test
echo -n %version-%release > .tarball-version
echo -n 2020 > .year
@ -231,6 +405,16 @@ echo 'END OF TEST SUITE INFORMATION'
%{_mandir}/man1/*
%changelog
* Mon Nov 09 2020 Eugene Syromiatnikov <esyr@redhat.com> - 5.7-2
- Add PID namespace translation support (#1725113).
* Mon Nov 09 2020 Eugene Syromiatnikov <esyr@redhat.com> - 5.7-1
- Rebase to v5.7; drop upstream patches on top of 5.1 (#1873229).
* Mon Aug 24 2020 Eugene Syromiatnikov <esyr@redhat.com> - 5.1-2
- Update io_uring(2) decoder (#1853011).
- Fix "Obsoletes:" tag on s390x (#1852960).
* Thu Jan 30 2020 Eugene Syromiatnikov <esyr@redhat.com> - 5.1-1
- Rebase to strace 5.1 (#1777847).