Compare commits

...

5 Commits

Author SHA1 Message Date
CentOS Sources 63ee62a810 import strace-5.18-2.el8 2022-11-08 15:16:34 +00:00
CentOS Sources 02ddc292d1 import strace-5.13-4.el8 2022-05-10 11:54:40 +00:00
CentOS Sources fefbb4cf09 import strace-5.7-3.el8 2021-11-10 04:21:06 +00:00
CentOS Sources 34ac6c3594 import strace-5.7-2.1.el8_4 2021-09-22 09:09:53 +00:00
CentOS Sources 884e5658e4 import strace-5.7-2.el8 2021-09-10 04:55:54 +00:00
26 changed files with 2218 additions and 2694 deletions

2
.gitignore vendored
View File

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

View File

@ -1 +1 @@
6474260dcc66aa1f591acee31ae6a1a457b34656 SOURCES/strace-5.1.tar.xz
e038ea9fc29366ce6119cde27d8cf16ac554a353 SOURCES/strace-5.18.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,58 @@
From 2bf069698a384ff2bc62d2a10544d49d766b4d7f Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Mon, 27 Jun 2022 18:00:17 +0200
Subject: [PATCH] src/xlat: remove remnants of unnecessary idx usage in xlookup
As there is no idx saving between calls anymore, there's no need to use
(and update) idx in the XT_SORTED case. Reported by clang as a dead store:
Error: CLANG_WARNING:
strace-5.18/src/xlat.c:84:4: warning[deadcode.DeadStores]: Value stored to 'idx' is never read
* src/xlat.c (xlookup): Remove idx declaration; declare idx inside
of the for loop in the XT_NORMAL case; do not offset x->data and x->size
by offs in the XT_SORTED case and do not update idx upon successful
lookup.
Complements: v5.15~164 "xlat: no longer interpret NULL xlat as continuation"
---
src/xlat.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
Index: strace-5.18/src/xlat.c
===================================================================
--- strace-5.18.orig/src/xlat.c 2022-07-12 17:11:52.660927011 +0200
+++ strace-5.18/src/xlat.c 2022-07-12 17:16:18.116794139 +0200
@@ -61,7 +61,6 @@
const char *
xlookup(const struct xlat *x, const uint64_t val)
{
- size_t idx = 0;
const struct xlat_data *e;
if (!x || !x->data)
@@ -69,21 +68,18 @@
switch (x->type) {
case XT_NORMAL:
- for (; idx < x->size; idx++)
+ for (size_t idx = 0; idx < x->size; idx++)
if (x->data[idx].val == val)
return x->data[idx].str;
break;
case XT_SORTED:
e = bsearch((const void *) &val,
- x->data + idx,
- x->size - idx,
+ x->data, x->size,
sizeof(x->data[0]),
xlat_bsearch_compare);
- if (e) {
- idx = e - x->data;
+ if (e)
return e->str;
- }
break;
case XT_INDEXED:

View File

@ -0,0 +1,56 @@
From e604d7bfd18cf5f29e6723091cc1db2945c918c9 Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Tue, 28 Jun 2022 16:46:53 +0200
Subject: [PATCH] strauss: tips whitespace and phrasing cleanups
* src/strauss.c (tips_tricks_tweaks): Fix some whitespace and phrasing
issues.
---
src/strauss.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
Index: strace-5.18/src/strauss.c
===================================================================
--- strace-5.18.orig/src/strauss.c 2022-07-12 17:17:08.712197019 +0200
+++ strace-5.18/src/strauss.c 2022-07-12 17:17:20.685055717 +0200
@@ -128,8 +128,8 @@
{ "strace is about as old as the Linux kernel.",
"It has been originally written for SunOS",
"by Paul Kranenburg in 1991. The support",
- "for all OSes except Linux has been dropped",
- "since 2012, though, in strace 4.7." },
+ "for all OSes except Linux was dropped"
+ "in 2012, though, in strace 4.7." },
{ "strace is able to decode netlink messages.",
"It does so automatically for I/O performed",
"on netlink sockets. Try it yourself:", "",
@@ -187,7 +187,7 @@
"want to try --seccomp-bpf option, maybe you",
"will feel better." },
{ "-v is a shorthand for -e abbrev=none and not",
- " for -e verbose=all. It is idiosyncratic,",
+ "for -e verbose=all. It is idiosyncratic,",
"but it is the historic behaviour." },
{ "strace uses netlink for printing",
"protocol-specific information about socket",
@@ -254,7 +254,7 @@
"by invoking it with the following options:", "",
" strace -DDDqqq -enone --signal=none" },
{ "Historically, supplying -o option to strace",
- "led to silencing of messages about tracee",
+ "leads to silencing of messages about tracee",
"attach/detach and personality changes.",
"It can be now overridden with --quiet=none",
"option." },
@@ -285,8 +285,9 @@
"will trace all syscalls related to accessing",
"and modifying process's user/group IDs",
"and capability sets. Other pre-defined",
- "syscall classes include %clock, %desc,%file,",
- "%ipc,%memory, %net,%process, and %signal." },
+ "syscall classes include %clock, %desc,"
+ "%file, %ipc, %memory, %net, %process,"
+ "and %signal." },
{ "Trying to figure out communication between",
"tracees inside a different PID namespace",
"(in so-called \"containers\", for example)?",

View File

@ -0,0 +1,48 @@
From 968789d5426442ac43b96eabd65f3e5c0c141e62 Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Tue, 28 Jun 2022 16:47:56 +0200
Subject: [PATCH] strauss: fix off-by-one error in strauss array access
It has to be limited with strauss_lines - 1, not strauss_lines.
Reported by covscan:
Error: OVERRUN (CWE-119):
strace-5.18/src/strauss.c:380: cond_at_least: Checking "4UL + i < 37UL"
implies that "i" is at least 33 on the false branch.
strace-5.18/src/strauss.c:380: overrun-local: Overrunning array "strauss"
of 37 8-byte elements at element index 37 (byte offset 303) using index
"(4UL + i < 37UL) ? 4UL + i : 37UL" (which evaluates to 37).
* src/strauss.c (print_totd): Limit strauss array accesses to
strauss_lines - 1 instead of strauss_lines.
---
src/strauss.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/strauss.c b/src/strauss.c
index 98af183..b22ab6a 100644
--- a/src/strauss.c
+++ b/src/strauss.c
@@ -373,16 +373,16 @@ print_totd(void)
tip_left[MIN(i + 1, ARRAY_SIZE(tip_left) - 1)],
w, w, tips_tricks_tweaks[id][i] ?: "",
tip_right[MIN(i + 1, ARRAY_SIZE(tip_right) - 1)],
- strauss[MIN(3 + i, strauss_lines)]);
+ strauss[MIN(3 + i, strauss_lines - 1)]);
}
fprintf(stderr, "%s%s\n",
- tip_bottom, strauss[MIN(3 + i, strauss_lines)]);
+ tip_bottom, strauss[MIN(3 + i, strauss_lines - 1)]);
do {
fprintf(stderr, "%*s%*s%*s%s\n",
(int) strlen(tip_left[0]), "",
w, "",
(int) strlen(tip_right[0]), "",
- strauss[MIN(4 + i, strauss_lines)]);
+ strauss[MIN(4 + i, strauss_lines - 1)]);
} while ((show_tips == TIPS_FULL) && (4 + ++i < strauss_lines));
printed = true;
--
2.1.4

View File

@ -0,0 +1,62 @@
From 6d3e97e83a7d61cbb2f5109efb4b519383a55712 Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Tue, 28 Jun 2022 16:55:49 +0200
Subject: [PATCH] util: add offs sanity check to print_clock_t
While it is not strictly needed right now, the code that uses
the calculated offs value lacks any checks for possible buf overruns,
which is not defensive enough, so let's add them. Reported by covscan:
Error: OVERRUN (CWE-119):
strace-5.18/src/util.c:248: assignment: Assigning:
"offs" = "ilog10(val / clk_tck)". The value of "offs" is now between
16 and 31 (inclusive).
strace-5.18/src/util.c:249: overrun-local: Overrunning array of 30 bytes
at byte offset 31 by dereferencing pointer "buf + offs". [Note: The source
code implementation of the function has been overridden by a builtin model.]
Error: OVERRUN (CWE-119):
strace-5.18/src/util.c:248: assignment: Assigning:
"offs" = "ilog10(val / clk_tck)". The value of "offs" is now between
16 and 31 (inclusive).
strace-5.18/src/util.c:253: overrun-buffer-arg: Overrunning array "buf"
of 30 bytes by passing it to a function which accesses it at byte offset
32 using argument "offs + 2UL" (which evaluates to 33). [Note: The source
code implementation of the function has been overridden by a builtin model.]
Error: OVERRUN (CWE-119):
strace-5.18/src/util.c:248: assignment: Assigning:
"offs" = "ilog10(val / clk_tck)". The value of "offs" is now between
16 and 31 (inclusive).
strace-5.18/src/util.c:254: overrun-local: Overrunning array "buf"
of 30 bytes at byte offset 32 using index "offs + 1UL" (which evaluates
to 32).
* src/util.c (print_clock_t): Add check that offs is small enough
for it and "offs + 2" not to overrun buf.
---
src/util.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/util.c b/src/util.c
index 5f87acb..93aa7b3 100644
--- a/src/util.c
+++ b/src/util.c
@@ -246,6 +246,14 @@ print_clock_t(uint64_t val)
*/
char buf[sizeof(uint64_t) * 3 + sizeof("0.0 s")];
size_t offs = ilog10(val / clk_tck);
+ /*
+ * This check is mostly to appease covscan, which thinks
+ * that offs can go as high as 31 (it cannot), but since
+ * there is no proper sanity checks against offs overrunning
+ * buf down the code, it may as well be here.
+ */
+ if (offs > (sizeof(buf) - sizeof("0.0 s")))
+ return;
int ret = snprintf(buf + offs, sizeof(buf) - offs, "%.*f s",
frac_width,
(double) (val % clk_tck) / clk_tck);
--
2.1.4

View File

@ -0,0 +1,882 @@
From 960e78f208b4f6d48962bbc9cad45588cc8c90ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Renaud=20M=C3=A9trich?= <rmetrich@redhat.com>
Date: Tue, 21 Jun 2022 08:43:00 +0200
Subject: [PATCH] secontext: print context of Unix socket's sun_path field
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
* src/sockaddr.c: Include "secontext.h".
(print_sockaddr_data_un): Print the SELinux context of sun_path field
using selinux_printfilecon.
* NEWS: Mention this change.
* tests/secontext.c (raw_secontext_full_fd, get_secontext_field_fd,
raw_secontext_short_fd, secontext_full_fd, secontext_short_fd): New
functions.
* tests/secontext.h (secontext_full_fd, secontext_short_fd,
get_secontext_field_fd): New prototypes.
(SECONTEXT_FD): New macro.
* tests/sockname.c: Include "secontext.h".
(test_sockname_syscall): Update expected output.
* tests/gen_tests.in (getsockname--secontext,
getsockname--secontext_full, getsockname--secontext_full_mismatch,
getsockname--secontext_mismatch): New tests.
Resolves: https://github.com/strace/strace/pull/214
---
NEWS | 1 +
src/sockaddr.c | 3 +++
tests/gen_tests.in | 4 ++++
tests/secontext.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/secontext.h | 12 ++++++++++++
tests/sockname.c | 54 +++++++++++++++++++++++++++++++++++-------------------
6 files changed, 104 insertions(+), 19 deletions(-)
Index: strace-5.18/NEWS
===================================================================
--- strace-5.18.orig/NEWS 2022-07-12 18:20:18.495470531 +0200
+++ strace-5.18/NEWS 2022-07-12 18:20:44.531163262 +0200
@@ -5,6 +5,7 @@
* Added an interface of raising des Strausses awareness.
* Added --tips option to print strace tips, tricks, and tweaks
at the end of the tracing session.
+ * Implemented printing of Unix socket sun_path field's SELinux context.
* Enhanced decoding of bpf and io_uring_register syscalls.
* Implemented decoding of COUNTER_*, RTC_PARAM_GET, and RTC_PARAM_SET ioctl
commands.
Index: strace-5.18/src/sockaddr.c
===================================================================
--- strace-5.18.orig/src/sockaddr.c 2022-07-12 18:17:36.745379483 +0200
+++ strace-5.18/src/sockaddr.c 2022-07-12 18:20:18.495470531 +0200
@@ -63,6 +63,8 @@
#include "xlat/mctp_addrs.h"
#include "xlat/mctp_nets.h"
+#include "secontext.h"
+
#define SIZEOF_SA_FAMILY sizeof_field(struct sockaddr, sa_family)
struct sockaddr_rxrpc {
@@ -115,6 +117,7 @@
if (sa_un->sun_path[0]) {
print_quoted_string(sa_un->sun_path, path_len + 1,
QUOTE_0_TERMINATED);
+ selinux_printfilecon(tcp, sa_un->sun_path);
} else {
tprints("@");
print_quoted_string(sa_un->sun_path + 1, path_len - 1, 0);
Index: strace-5.18/tests/gen_tests.in
===================================================================
--- strace-5.18.orig/tests/gen_tests.in 2022-07-12 18:17:36.746379471 +0200
+++ strace-5.18/tests/gen_tests.in 2022-07-12 18:20:18.496470519 +0200
@@ -225,6 +225,10 @@
getsid -a10
getsid--pidns-translation test_pidns -e trace=getsid -a10
getsockname -a27
+getsockname--secontext -a27 --secontext -e trace=getsockname
+getsockname--secontext_full -a27 --secontext=full -e trace=getsockname
+getsockname--secontext_full_mismatch -a27 --secontext=full,mismatch -e trace=getsockname
+getsockname--secontext_mismatch -a27 --secontext=mismatch -e trace=getsockname
gettid -a9
getuid-creds +getuid.test
getuid32 +getuid.test
Index: strace-5.18/tests/secontext.c
===================================================================
--- strace-5.18.orig/tests/secontext.c 2022-07-12 18:17:36.747379459 +0200
+++ strace-5.18/tests/secontext.c 2022-07-12 18:20:18.496470519 +0200
@@ -141,6 +141,21 @@
return full_secontext;
}
+static char *
+raw_secontext_full_fd(int fd)
+{
+ int saved_errno = errno;
+ char *full_secontext = NULL;
+ char *secontext;
+
+ if (fgetfilecon(fd, &secontext) >= 0) {
+ full_secontext = strip_trailing_newlines(xstrdup(secontext));
+ freecon(secontext);
+ }
+ errno = saved_errno;
+ return full_secontext;
+}
+
char *
get_secontext_field_file(const char *file, enum secontext_field field)
{
@@ -151,6 +166,16 @@
return type;
}
+char *
+get_secontext_field_fd(int fd, enum secontext_field field)
+{
+ char *ctx = raw_secontext_full_fd(fd);
+ char *type = get_secontext_field(ctx, field);
+ free(ctx);
+
+ return type;
+}
+
static char *
raw_secontext_short_file(const char *filename)
{
@@ -158,6 +183,12 @@
}
static char *
+raw_secontext_short_fd(int fd)
+{
+ return get_secontext_field_fd(fd, SECONTEXT_TYPE);
+}
+
+static char *
raw_secontext_full_pid(pid_t pid)
{
int saved_errno = errno;
@@ -205,6 +236,15 @@
}
char *
+secontext_full_fd(int fd)
+{
+ int saved_errno = errno;
+ char *context = raw_secontext_full_fd(fd);
+ errno = saved_errno;
+ return FORMAT_SPACE_BEFORE(context);
+}
+
+char *
secontext_full_pid(pid_t pid)
{
return FORMAT_SPACE_AFTER(raw_secontext_full_pid(pid));
@@ -228,6 +268,15 @@
errno = saved_errno;
return FORMAT_SPACE_BEFORE(context);
}
+
+char *
+secontext_short_fd(int fd)
+{
+ int saved_errno = errno;
+ char *context = raw_secontext_short_fd(fd);
+ errno = saved_errno;
+ return FORMAT_SPACE_BEFORE(context);
+}
char *
secontext_short_pid(pid_t pid)
Index: strace-5.18/tests/secontext.h
===================================================================
--- strace-5.18.orig/tests/secontext.h 2022-07-12 18:17:36.747379459 +0200
+++ strace-5.18/tests/secontext.h 2022-07-12 18:20:18.496470519 +0200
@@ -9,9 +9,11 @@
#include "xmalloc.h"
#include <unistd.h>
+char *secontext_full_fd(int) ATTRIBUTE_MALLOC;
char *secontext_full_file(const char *, bool) ATTRIBUTE_MALLOC;
char *secontext_full_pid(pid_t) ATTRIBUTE_MALLOC;
+char *secontext_short_fd(int) ATTRIBUTE_MALLOC;
char *secontext_short_file(const char *, bool) ATTRIBUTE_MALLOC;
char *secontext_short_pid(pid_t) ATTRIBUTE_MALLOC;
@@ -30,6 +32,7 @@
*/
char *get_secontext_field(const char *full_context, enum secontext_field field);
+char *get_secontext_field_fd(int fd, enum secontext_field field);
char *get_secontext_field_file(const char *file, enum secontext_field field);
void reset_secontext_file(const char *file);
@@ -44,6 +47,7 @@
# else
# define SECONTEXT_FILE(filename) secontext_full_file(filename, false)
# endif
+# define SECONTEXT_FD(fd) secontext_full_fd(fd)
# define SECONTEXT_PID(pid) secontext_full_pid(pid)
# else
@@ -53,6 +57,7 @@
# else
# define SECONTEXT_FILE(filename) secontext_short_file(filename, false)
# endif
+# define SECONTEXT_FD(fd) secontext_short_fd(fd)
# define SECONTEXT_PID(pid) secontext_short_pid(pid)
# endif
@@ -65,6 +70,12 @@
return NULL;
}
static inline char *
+get_secontext_field_fd(int fd, enum secontext_field field)
+{
+ return NULL;
+}
+
+static inline char *
get_secontext_field_file(const char *file, enum secontext_field field)
{
return NULL;
@@ -81,6 +92,7 @@
{
}
+# define SECONTEXT_FD(fd) xstrdup("")
# define SECONTEXT_FILE(filename) xstrdup("")
# define SECONTEXT_PID(pid) xstrdup("")
Index: strace-5.18/tests/sockname.c
===================================================================
--- strace-5.18.orig/tests/sockname.c 2022-07-12 18:17:36.748379448 +0200
+++ strace-5.18/tests/sockname.c 2022-07-12 18:20:18.496470519 +0200
@@ -18,6 +18,8 @@
#include <sys/socket.h>
#include <sys/un.h>
+#include "secontext.h"
+
#ifndef TEST_SYSCALL_NAME
# error TEST_SYSCALL_NAME must be defined
#endif
@@ -59,14 +61,19 @@
*plen = sizeof(struct sockaddr_un);
struct sockaddr_un *addr = tail_alloc(*plen);
+ char *my_secontext = SECONTEXT_PID_MY();
+ char *fd_secontext = SECONTEXT_FD(fd);
+
PREPARE_TEST_SYSCALL_INVOCATION;
int rc = TEST_SYSCALL_NAME(fd PREFIX_S_ARGS, (void *) addr,
plen SUFFIX_ARGS);
if (rc < 0)
perror_msg_and_skip(TEST_SYSCALL_STR);
- printf("%s(%d%s, {sa_family=AF_UNIX, sun_path=\"%s\"}"
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX, sun_path=\"%s\"%s}"
", [%d => %d]%s) = %d\n",
- TEST_SYSCALL_STR, fd, PREFIX_S_STR, addr->sun_path,
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
+ addr->sun_path, SECONTEXT_FILE(addr->sun_path),
(int) sizeof(struct sockaddr_un), (int) *plen, SUFFIX_STR, rc);
memset(addr, 0, sizeof(*addr));
@@ -75,28 +82,34 @@
plen SUFFIX_ARGS);
if (rc < 0)
perror_msg_and_skip(TEST_SYSCALL_STR);
- printf("%s(%d%s, {sa_family=AF_UNIX, sun_path=\"%s\"}"
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX, sun_path=\"%s\"%s}"
", [%d]%s) = %d\n",
- TEST_SYSCALL_STR, fd, PREFIX_S_STR, addr->sun_path,
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
+ addr->sun_path, SECONTEXT_FILE(addr->sun_path),
(int) *plen, SUFFIX_STR, rc);
PREPARE_TEST_SYSCALL_INVOCATION;
rc = TEST_SYSCALL_NAME(fd PREFIX_F_ARGS, (void *) addr, 0 SUFFIX_ARGS);
- printf("%s(%d%s, %p, NULL%s) = %s\n",
- TEST_SYSCALL_STR, fd, PREFIX_F_STR, addr, SUFFIX_STR,
- sprintrc(rc));
+ printf("%s%s(%d%s%s, %p, NULL%s) = %s\n",
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_F_STR,
+ addr, SUFFIX_STR, sprintrc(rc));
PREPARE_TEST_SYSCALL_INVOCATION;
rc = TEST_SYSCALL_NAME(fd PREFIX_S_ARGS, 0, 0 SUFFIX_ARGS);
- printf("%s(%d%s, NULL, NULL%s) = %s\n",
- TEST_SYSCALL_STR, fd, rc == -1 ? PREFIX_F_STR : PREFIX_S_STR,
+ printf("%s%s(%d%s%s, NULL, NULL%s) = %s\n",
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext,
+ rc == -1 ? PREFIX_F_STR : PREFIX_S_STR,
SUFFIX_STR, sprintrc(rc));
PREPARE_TEST_SYSCALL_INVOCATION;
rc = TEST_SYSCALL_NAME(fd PREFIX_F_ARGS, (void *) addr,
plen + 1 SUFFIX_ARGS);
- printf("%s(%d%s, %p, %p%s) = %s\n",
- TEST_SYSCALL_STR, fd, PREFIX_F_STR, addr,
+ printf("%s%s(%d%s%s, %p, %p%s) = %s\n",
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_F_STR, addr,
plen + 1, SUFFIX_STR, sprintrc(rc));
const size_t offsetof_sun_path = offsetof(struct sockaddr_un, sun_path);
@@ -108,8 +121,9 @@
plen SUFFIX_ARGS);
if (rc < 0)
perror_msg_and_skip(TEST_SYSCALL_STR);
- printf("%s(%d%s, {sa_family=AF_UNIX}, [%d => %d]%s) = %d\n",
- TEST_SYSCALL_STR, fd, PREFIX_S_STR,
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX}, [%d => %d]%s) = %d\n",
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
(int) offsetof_sun_path, (int) *plen, SUFFIX_STR, rc);
++addr;
@@ -121,17 +135,19 @@
plen SUFFIX_ARGS);
if (rc < 0)
perror_msg_and_skip(TEST_SYSCALL_STR);
- printf("%s(%d%s, {sa_family=AF_UNIX, sun_path=\"%.*s\"}"
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX, sun_path=\"%.*s\"%s}"
", [%d => %d]%s) = %d\n",
- TEST_SYSCALL_STR, fd, PREFIX_S_STR,
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
(int) (sizeof(struct sockaddr) - offsetof_sun_path),
- addr->sun_path, (int) sizeof(struct sockaddr),
- (int) *plen, SUFFIX_STR, rc);
+ addr->sun_path, SECONTEXT_FILE(addr->sun_path),
+ (int) sizeof(struct sockaddr), (int) *plen, SUFFIX_STR, rc);
PREPARE_TEST_SYSCALL_INVOCATION;
rc = TEST_SYSCALL_NAME(fd PREFIX_F_ARGS, (void *) addr,
plen SUFFIX_ARGS);
- printf("%s(%d%s, %p, [%d]%s) = %s\n",
- TEST_SYSCALL_STR, fd, PREFIX_F_STR, addr,
+ printf("%s%s(%d%s%s, %p, [%d]%s) = %s\n",
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_F_STR, addr,
*plen, SUFFIX_STR, sprintrc(rc));
}
Index: strace-5.18/tests-m32/secontext.c
===================================================================
--- strace-5.18.orig/tests-m32/secontext.c 2022-07-12 18:17:36.747379459 +0200
+++ strace-5.18/tests-m32/secontext.c 2022-07-12 18:20:18.496470519 +0200
@@ -141,6 +141,21 @@
return full_secontext;
}
+static char *
+raw_secontext_full_fd(int fd)
+{
+ int saved_errno = errno;
+ char *full_secontext = NULL;
+ char *secontext;
+
+ if (fgetfilecon(fd, &secontext) >= 0) {
+ full_secontext = strip_trailing_newlines(xstrdup(secontext));
+ freecon(secontext);
+ }
+ errno = saved_errno;
+ return full_secontext;
+}
+
char *
get_secontext_field_file(const char *file, enum secontext_field field)
{
@@ -151,6 +166,16 @@
return type;
}
+char *
+get_secontext_field_fd(int fd, enum secontext_field field)
+{
+ char *ctx = raw_secontext_full_fd(fd);
+ char *type = get_secontext_field(ctx, field);
+ free(ctx);
+
+ return type;
+}
+
static char *
raw_secontext_short_file(const char *filename)
{
@@ -158,6 +183,12 @@
}
static char *
+raw_secontext_short_fd(int fd)
+{
+ return get_secontext_field_fd(fd, SECONTEXT_TYPE);
+}
+
+static char *
raw_secontext_full_pid(pid_t pid)
{
int saved_errno = errno;
@@ -205,6 +236,15 @@
}
char *
+secontext_full_fd(int fd)
+{
+ int saved_errno = errno;
+ char *context = raw_secontext_full_fd(fd);
+ errno = saved_errno;
+ return FORMAT_SPACE_BEFORE(context);
+}
+
+char *
secontext_full_pid(pid_t pid)
{
return FORMAT_SPACE_AFTER(raw_secontext_full_pid(pid));
@@ -228,6 +268,15 @@
errno = saved_errno;
return FORMAT_SPACE_BEFORE(context);
}
+
+char *
+secontext_short_fd(int fd)
+{
+ int saved_errno = errno;
+ char *context = raw_secontext_short_fd(fd);
+ errno = saved_errno;
+ return FORMAT_SPACE_BEFORE(context);
+}
char *
secontext_short_pid(pid_t pid)
Index: strace-5.18/tests-m32/secontext.h
===================================================================
--- strace-5.18.orig/tests-m32/secontext.h 2022-07-12 18:17:36.747379459 +0200
+++ strace-5.18/tests-m32/secontext.h 2022-07-12 18:20:18.496470519 +0200
@@ -9,9 +9,11 @@
#include "xmalloc.h"
#include <unistd.h>
+char *secontext_full_fd(int) ATTRIBUTE_MALLOC;
char *secontext_full_file(const char *, bool) ATTRIBUTE_MALLOC;
char *secontext_full_pid(pid_t) ATTRIBUTE_MALLOC;
+char *secontext_short_fd(int) ATTRIBUTE_MALLOC;
char *secontext_short_file(const char *, bool) ATTRIBUTE_MALLOC;
char *secontext_short_pid(pid_t) ATTRIBUTE_MALLOC;
@@ -30,6 +32,7 @@
*/
char *get_secontext_field(const char *full_context, enum secontext_field field);
+char *get_secontext_field_fd(int fd, enum secontext_field field);
char *get_secontext_field_file(const char *file, enum secontext_field field);
void reset_secontext_file(const char *file);
@@ -44,6 +47,7 @@
# else
# define SECONTEXT_FILE(filename) secontext_full_file(filename, false)
# endif
+# define SECONTEXT_FD(fd) secontext_full_fd(fd)
# define SECONTEXT_PID(pid) secontext_full_pid(pid)
# else
@@ -53,6 +57,7 @@
# else
# define SECONTEXT_FILE(filename) secontext_short_file(filename, false)
# endif
+# define SECONTEXT_FD(fd) secontext_short_fd(fd)
# define SECONTEXT_PID(pid) secontext_short_pid(pid)
# endif
@@ -65,6 +70,12 @@
return NULL;
}
static inline char *
+get_secontext_field_fd(int fd, enum secontext_field field)
+{
+ return NULL;
+}
+
+static inline char *
get_secontext_field_file(const char *file, enum secontext_field field)
{
return NULL;
@@ -81,6 +92,7 @@
{
}
+# define SECONTEXT_FD(fd) xstrdup("")
# define SECONTEXT_FILE(filename) xstrdup("")
# define SECONTEXT_PID(pid) xstrdup("")
Index: strace-5.18/tests-m32/sockname.c
===================================================================
--- strace-5.18.orig/tests-m32/sockname.c 2022-07-12 18:17:36.748379448 +0200
+++ strace-5.18/tests-m32/sockname.c 2022-07-12 18:20:18.496470519 +0200
@@ -18,6 +18,8 @@
#include <sys/socket.h>
#include <sys/un.h>
+#include "secontext.h"
+
#ifndef TEST_SYSCALL_NAME
# error TEST_SYSCALL_NAME must be defined
#endif
@@ -59,14 +61,19 @@
*plen = sizeof(struct sockaddr_un);
struct sockaddr_un *addr = tail_alloc(*plen);
+ char *my_secontext = SECONTEXT_PID_MY();
+ char *fd_secontext = SECONTEXT_FD(fd);
+
PREPARE_TEST_SYSCALL_INVOCATION;
int rc = TEST_SYSCALL_NAME(fd PREFIX_S_ARGS, (void *) addr,
plen SUFFIX_ARGS);
if (rc < 0)
perror_msg_and_skip(TEST_SYSCALL_STR);
- printf("%s(%d%s, {sa_family=AF_UNIX, sun_path=\"%s\"}"
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX, sun_path=\"%s\"%s}"
", [%d => %d]%s) = %d\n",
- TEST_SYSCALL_STR, fd, PREFIX_S_STR, addr->sun_path,
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
+ addr->sun_path, SECONTEXT_FILE(addr->sun_path),
(int) sizeof(struct sockaddr_un), (int) *plen, SUFFIX_STR, rc);
memset(addr, 0, sizeof(*addr));
@@ -75,28 +82,34 @@
plen SUFFIX_ARGS);
if (rc < 0)
perror_msg_and_skip(TEST_SYSCALL_STR);
- printf("%s(%d%s, {sa_family=AF_UNIX, sun_path=\"%s\"}"
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX, sun_path=\"%s\"%s}"
", [%d]%s) = %d\n",
- TEST_SYSCALL_STR, fd, PREFIX_S_STR, addr->sun_path,
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
+ addr->sun_path, SECONTEXT_FILE(addr->sun_path),
(int) *plen, SUFFIX_STR, rc);
PREPARE_TEST_SYSCALL_INVOCATION;
rc = TEST_SYSCALL_NAME(fd PREFIX_F_ARGS, (void *) addr, 0 SUFFIX_ARGS);
- printf("%s(%d%s, %p, NULL%s) = %s\n",
- TEST_SYSCALL_STR, fd, PREFIX_F_STR, addr, SUFFIX_STR,
- sprintrc(rc));
+ printf("%s%s(%d%s%s, %p, NULL%s) = %s\n",
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_F_STR,
+ addr, SUFFIX_STR, sprintrc(rc));
PREPARE_TEST_SYSCALL_INVOCATION;
rc = TEST_SYSCALL_NAME(fd PREFIX_S_ARGS, 0, 0 SUFFIX_ARGS);
- printf("%s(%d%s, NULL, NULL%s) = %s\n",
- TEST_SYSCALL_STR, fd, rc == -1 ? PREFIX_F_STR : PREFIX_S_STR,
+ printf("%s%s(%d%s%s, NULL, NULL%s) = %s\n",
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext,
+ rc == -1 ? PREFIX_F_STR : PREFIX_S_STR,
SUFFIX_STR, sprintrc(rc));
PREPARE_TEST_SYSCALL_INVOCATION;
rc = TEST_SYSCALL_NAME(fd PREFIX_F_ARGS, (void *) addr,
plen + 1 SUFFIX_ARGS);
- printf("%s(%d%s, %p, %p%s) = %s\n",
- TEST_SYSCALL_STR, fd, PREFIX_F_STR, addr,
+ printf("%s%s(%d%s%s, %p, %p%s) = %s\n",
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_F_STR, addr,
plen + 1, SUFFIX_STR, sprintrc(rc));
const size_t offsetof_sun_path = offsetof(struct sockaddr_un, sun_path);
@@ -108,8 +121,9 @@
plen SUFFIX_ARGS);
if (rc < 0)
perror_msg_and_skip(TEST_SYSCALL_STR);
- printf("%s(%d%s, {sa_family=AF_UNIX}, [%d => %d]%s) = %d\n",
- TEST_SYSCALL_STR, fd, PREFIX_S_STR,
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX}, [%d => %d]%s) = %d\n",
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
(int) offsetof_sun_path, (int) *plen, SUFFIX_STR, rc);
++addr;
@@ -121,17 +135,19 @@
plen SUFFIX_ARGS);
if (rc < 0)
perror_msg_and_skip(TEST_SYSCALL_STR);
- printf("%s(%d%s, {sa_family=AF_UNIX, sun_path=\"%.*s\"}"
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX, sun_path=\"%.*s\"%s}"
", [%d => %d]%s) = %d\n",
- TEST_SYSCALL_STR, fd, PREFIX_S_STR,
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
(int) (sizeof(struct sockaddr) - offsetof_sun_path),
- addr->sun_path, (int) sizeof(struct sockaddr),
- (int) *plen, SUFFIX_STR, rc);
+ addr->sun_path, SECONTEXT_FILE(addr->sun_path),
+ (int) sizeof(struct sockaddr), (int) *plen, SUFFIX_STR, rc);
PREPARE_TEST_SYSCALL_INVOCATION;
rc = TEST_SYSCALL_NAME(fd PREFIX_F_ARGS, (void *) addr,
plen SUFFIX_ARGS);
- printf("%s(%d%s, %p, [%d]%s) = %s\n",
- TEST_SYSCALL_STR, fd, PREFIX_F_STR, addr,
+ printf("%s%s(%d%s%s, %p, [%d]%s) = %s\n",
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_F_STR, addr,
*plen, SUFFIX_STR, sprintrc(rc));
}
Index: strace-5.18/tests-mx32/secontext.c
===================================================================
--- strace-5.18.orig/tests-mx32/secontext.c 2022-07-12 18:17:36.747379459 +0200
+++ strace-5.18/tests-mx32/secontext.c 2022-07-12 18:20:18.496470519 +0200
@@ -141,6 +141,21 @@
return full_secontext;
}
+static char *
+raw_secontext_full_fd(int fd)
+{
+ int saved_errno = errno;
+ char *full_secontext = NULL;
+ char *secontext;
+
+ if (fgetfilecon(fd, &secontext) >= 0) {
+ full_secontext = strip_trailing_newlines(xstrdup(secontext));
+ freecon(secontext);
+ }
+ errno = saved_errno;
+ return full_secontext;
+}
+
char *
get_secontext_field_file(const char *file, enum secontext_field field)
{
@@ -151,6 +166,16 @@
return type;
}
+char *
+get_secontext_field_fd(int fd, enum secontext_field field)
+{
+ char *ctx = raw_secontext_full_fd(fd);
+ char *type = get_secontext_field(ctx, field);
+ free(ctx);
+
+ return type;
+}
+
static char *
raw_secontext_short_file(const char *filename)
{
@@ -158,6 +183,12 @@
}
static char *
+raw_secontext_short_fd(int fd)
+{
+ return get_secontext_field_fd(fd, SECONTEXT_TYPE);
+}
+
+static char *
raw_secontext_full_pid(pid_t pid)
{
int saved_errno = errno;
@@ -205,6 +236,15 @@
}
char *
+secontext_full_fd(int fd)
+{
+ int saved_errno = errno;
+ char *context = raw_secontext_full_fd(fd);
+ errno = saved_errno;
+ return FORMAT_SPACE_BEFORE(context);
+}
+
+char *
secontext_full_pid(pid_t pid)
{
return FORMAT_SPACE_AFTER(raw_secontext_full_pid(pid));
@@ -228,6 +268,15 @@
errno = saved_errno;
return FORMAT_SPACE_BEFORE(context);
}
+
+char *
+secontext_short_fd(int fd)
+{
+ int saved_errno = errno;
+ char *context = raw_secontext_short_fd(fd);
+ errno = saved_errno;
+ return FORMAT_SPACE_BEFORE(context);
+}
char *
secontext_short_pid(pid_t pid)
Index: strace-5.18/tests-mx32/secontext.h
===================================================================
--- strace-5.18.orig/tests-mx32/secontext.h 2022-07-12 18:17:36.747379459 +0200
+++ strace-5.18/tests-mx32/secontext.h 2022-07-12 18:20:18.496470519 +0200
@@ -9,9 +9,11 @@
#include "xmalloc.h"
#include <unistd.h>
+char *secontext_full_fd(int) ATTRIBUTE_MALLOC;
char *secontext_full_file(const char *, bool) ATTRIBUTE_MALLOC;
char *secontext_full_pid(pid_t) ATTRIBUTE_MALLOC;
+char *secontext_short_fd(int) ATTRIBUTE_MALLOC;
char *secontext_short_file(const char *, bool) ATTRIBUTE_MALLOC;
char *secontext_short_pid(pid_t) ATTRIBUTE_MALLOC;
@@ -30,6 +32,7 @@
*/
char *get_secontext_field(const char *full_context, enum secontext_field field);
+char *get_secontext_field_fd(int fd, enum secontext_field field);
char *get_secontext_field_file(const char *file, enum secontext_field field);
void reset_secontext_file(const char *file);
@@ -44,6 +47,7 @@
# else
# define SECONTEXT_FILE(filename) secontext_full_file(filename, false)
# endif
+# define SECONTEXT_FD(fd) secontext_full_fd(fd)
# define SECONTEXT_PID(pid) secontext_full_pid(pid)
# else
@@ -53,6 +57,7 @@
# else
# define SECONTEXT_FILE(filename) secontext_short_file(filename, false)
# endif
+# define SECONTEXT_FD(fd) secontext_short_fd(fd)
# define SECONTEXT_PID(pid) secontext_short_pid(pid)
# endif
@@ -65,6 +70,12 @@
return NULL;
}
static inline char *
+get_secontext_field_fd(int fd, enum secontext_field field)
+{
+ return NULL;
+}
+
+static inline char *
get_secontext_field_file(const char *file, enum secontext_field field)
{
return NULL;
@@ -81,6 +92,7 @@
{
}
+# define SECONTEXT_FD(fd) xstrdup("")
# define SECONTEXT_FILE(filename) xstrdup("")
# define SECONTEXT_PID(pid) xstrdup("")
Index: strace-5.18/tests-mx32/sockname.c
===================================================================
--- strace-5.18.orig/tests-mx32/sockname.c 2022-07-12 18:17:36.748379448 +0200
+++ strace-5.18/tests-mx32/sockname.c 2022-07-12 18:20:18.496470519 +0200
@@ -18,6 +18,8 @@
#include <sys/socket.h>
#include <sys/un.h>
+#include "secontext.h"
+
#ifndef TEST_SYSCALL_NAME
# error TEST_SYSCALL_NAME must be defined
#endif
@@ -59,14 +61,19 @@
*plen = sizeof(struct sockaddr_un);
struct sockaddr_un *addr = tail_alloc(*plen);
+ char *my_secontext = SECONTEXT_PID_MY();
+ char *fd_secontext = SECONTEXT_FD(fd);
+
PREPARE_TEST_SYSCALL_INVOCATION;
int rc = TEST_SYSCALL_NAME(fd PREFIX_S_ARGS, (void *) addr,
plen SUFFIX_ARGS);
if (rc < 0)
perror_msg_and_skip(TEST_SYSCALL_STR);
- printf("%s(%d%s, {sa_family=AF_UNIX, sun_path=\"%s\"}"
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX, sun_path=\"%s\"%s}"
", [%d => %d]%s) = %d\n",
- TEST_SYSCALL_STR, fd, PREFIX_S_STR, addr->sun_path,
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
+ addr->sun_path, SECONTEXT_FILE(addr->sun_path),
(int) sizeof(struct sockaddr_un), (int) *plen, SUFFIX_STR, rc);
memset(addr, 0, sizeof(*addr));
@@ -75,28 +82,34 @@
plen SUFFIX_ARGS);
if (rc < 0)
perror_msg_and_skip(TEST_SYSCALL_STR);
- printf("%s(%d%s, {sa_family=AF_UNIX, sun_path=\"%s\"}"
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX, sun_path=\"%s\"%s}"
", [%d]%s) = %d\n",
- TEST_SYSCALL_STR, fd, PREFIX_S_STR, addr->sun_path,
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
+ addr->sun_path, SECONTEXT_FILE(addr->sun_path),
(int) *plen, SUFFIX_STR, rc);
PREPARE_TEST_SYSCALL_INVOCATION;
rc = TEST_SYSCALL_NAME(fd PREFIX_F_ARGS, (void *) addr, 0 SUFFIX_ARGS);
- printf("%s(%d%s, %p, NULL%s) = %s\n",
- TEST_SYSCALL_STR, fd, PREFIX_F_STR, addr, SUFFIX_STR,
- sprintrc(rc));
+ printf("%s%s(%d%s%s, %p, NULL%s) = %s\n",
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_F_STR,
+ addr, SUFFIX_STR, sprintrc(rc));
PREPARE_TEST_SYSCALL_INVOCATION;
rc = TEST_SYSCALL_NAME(fd PREFIX_S_ARGS, 0, 0 SUFFIX_ARGS);
- printf("%s(%d%s, NULL, NULL%s) = %s\n",
- TEST_SYSCALL_STR, fd, rc == -1 ? PREFIX_F_STR : PREFIX_S_STR,
+ printf("%s%s(%d%s%s, NULL, NULL%s) = %s\n",
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext,
+ rc == -1 ? PREFIX_F_STR : PREFIX_S_STR,
SUFFIX_STR, sprintrc(rc));
PREPARE_TEST_SYSCALL_INVOCATION;
rc = TEST_SYSCALL_NAME(fd PREFIX_F_ARGS, (void *) addr,
plen + 1 SUFFIX_ARGS);
- printf("%s(%d%s, %p, %p%s) = %s\n",
- TEST_SYSCALL_STR, fd, PREFIX_F_STR, addr,
+ printf("%s%s(%d%s%s, %p, %p%s) = %s\n",
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_F_STR, addr,
plen + 1, SUFFIX_STR, sprintrc(rc));
const size_t offsetof_sun_path = offsetof(struct sockaddr_un, sun_path);
@@ -108,8 +121,9 @@
plen SUFFIX_ARGS);
if (rc < 0)
perror_msg_and_skip(TEST_SYSCALL_STR);
- printf("%s(%d%s, {sa_family=AF_UNIX}, [%d => %d]%s) = %d\n",
- TEST_SYSCALL_STR, fd, PREFIX_S_STR,
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX}, [%d => %d]%s) = %d\n",
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
(int) offsetof_sun_path, (int) *plen, SUFFIX_STR, rc);
++addr;
@@ -121,17 +135,19 @@
plen SUFFIX_ARGS);
if (rc < 0)
perror_msg_and_skip(TEST_SYSCALL_STR);
- printf("%s(%d%s, {sa_family=AF_UNIX, sun_path=\"%.*s\"}"
+ printf("%s%s(%d%s%s, {sa_family=AF_UNIX, sun_path=\"%.*s\"%s}"
", [%d => %d]%s) = %d\n",
- TEST_SYSCALL_STR, fd, PREFIX_S_STR,
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_S_STR,
(int) (sizeof(struct sockaddr) - offsetof_sun_path),
- addr->sun_path, (int) sizeof(struct sockaddr),
- (int) *plen, SUFFIX_STR, rc);
+ addr->sun_path, SECONTEXT_FILE(addr->sun_path),
+ (int) sizeof(struct sockaddr), (int) *plen, SUFFIX_STR, rc);
PREPARE_TEST_SYSCALL_INVOCATION;
rc = TEST_SYSCALL_NAME(fd PREFIX_F_ARGS, (void *) addr,
plen SUFFIX_ARGS);
- printf("%s(%d%s, %p, [%d]%s) = %s\n",
- TEST_SYSCALL_STR, fd, PREFIX_F_STR, addr,
+ printf("%s%s(%d%s%s, %p, [%d]%s) = %s\n",
+ my_secontext,
+ TEST_SYSCALL_STR, fd, fd_secontext, PREFIX_F_STR, addr,
*plen, SUFFIX_STR, sprintrc(rc));
}

View File

@ -0,0 +1,374 @@
From 676979fa9cc7920e5e4d547814f9c0edb597fa0d Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Thu, 30 Jun 2022 16:01:05 +0200
Subject: [PATCH] pathtrace, util: do not print " (deleted)" as part of the
path
In order to allow to discern the unlinked paths from the paths that
do indeed end with " (deleted)".
* src/defs.h (getfdpath_pid): Add deleted parameter.
(getfdpath): Pass NULL as deleted parameter to getfdpath_pid.
* src/largefile_wrappers.h (lstat_file): New macro.
* src/pathtrace.c: Include <sys/stat.h>, <sys/types.h>, <unistd.h>,
and "largefile_wrappers.h".
(getfdpath_pid): Add deleted parameter, check if path ends with
" (deleted)", and if it is, try to figure out if it is a part
of the path by comparing device/inode numbers of the file procfs
link resolves into and the file pointed by the path read; strip
" (deleted)"; set deleted (if it is non-NULL) to true if the fd
is turned out to be deleted and to false otherwise.
* src/util.c (print_quoted_string_in_angle_brackets): Add deleted
parameter, print "(deleted)" after the closing angle bracket if it is
non-NULL.
(printfd_pid): Add deleted local variable, pass it to getfdpath_pid
and print_quoted_string_in_angle_brackets calls.
* tests/fchmod.c: Add checks for a file with " (deleted)" in the path,
update expected output.
* NEWS: Mention the change.
---
NEWS | 5 +++++
src/defs.h | 5 +++--
src/largefile_wrappers.h | 2 ++
src/pathtrace.c | 48 +++++++++++++++++++++++++++++++++++++++++++++---
src/util.c | 10 +++++++---
tests/fchmod.c | 47 +++++++++++++++++++++++++++++++++++++++++++----
6 files changed, 105 insertions(+), 12 deletions(-)
Index: strace-5.18/NEWS
===================================================================
--- strace-5.18.orig/NEWS 2022-07-13 12:52:48.219784860 +0200
+++ strace-5.18/NEWS 2022-07-13 12:52:48.451782122 +0200
@@ -1,6 +1,11 @@
Noteworthy changes in release 5.18 (2022-06-18)
===============================================
+* Changes in behaviour
+ * The "(deleted)" marker for unlinked paths of file descriptors is now printed
+ outside angle brackets; the matching of unlinked paths of file descriptors
+ no longer includes the " (deleted)" part into consideration.
+
* Improvements
* Added an interface of raising des Strausses awareness.
* Added --tips option to print strace tips, tricks, and tweaks
Index: strace-5.18/src/defs.h
===================================================================
--- strace-5.18.orig/src/defs.h 2022-07-13 12:52:29.405006910 +0200
+++ strace-5.18/src/defs.h 2022-07-13 12:52:54.532710356 +0200
@@ -785,12 +785,13 @@
return pathtrace_match_set(tcp, &global_path_set);
}
-extern int getfdpath_pid(pid_t pid, int fd, char *buf, unsigned bufsize);
+extern int getfdpath_pid(pid_t pid, int fd, char *buf, unsigned bufsize,
+ bool *deleted);
static inline int
getfdpath(struct tcb *tcp, int fd, char *buf, unsigned bufsize)
{
- return getfdpath_pid(tcp->pid, fd, buf, bufsize);
+ return getfdpath_pid(tcp->pid, fd, buf, bufsize, NULL);
}
extern unsigned long getfdinode(struct tcb *, int);
Index: strace-5.18/src/largefile_wrappers.h
===================================================================
--- strace-5.18.orig/src/largefile_wrappers.h 2022-07-13 12:52:29.405006910 +0200
+++ strace-5.18/src/largefile_wrappers.h 2022-07-13 12:52:48.451782122 +0200
@@ -31,6 +31,7 @@
# endif
# define fstat_fd fstat64
# define strace_stat_t struct stat64
+# define lstat_file lstat64
# define stat_file stat64
# define struct_dirent struct dirent64
# define read_dir readdir64
@@ -42,6 +43,7 @@
# define fcntl_fd fcntl
# define fstat_fd fstat
# define strace_stat_t struct stat
+# define lstat_file lstat
# define stat_file stat
# define struct_dirent struct dirent
# define read_dir readdir
Index: strace-5.18/src/pathtrace.c
===================================================================
--- strace-5.18.orig/src/pathtrace.c 2022-07-13 12:52:29.405006910 +0200
+++ strace-5.18/src/pathtrace.c 2022-07-13 12:52:54.532710356 +0200
@@ -10,7 +10,11 @@
#include "defs.h"
#include <limits.h>
#include <poll.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include "largefile_wrappers.h"
#include "number_set.h"
#include "sen.h"
#include "xstring.h"
@@ -77,7 +81,7 @@
* Get path associated with fd of a process with pid.
*/
int
-getfdpath_pid(pid_t pid, int fd, char *buf, unsigned bufsize)
+getfdpath_pid(pid_t pid, int fd, char *buf, unsigned bufsize, bool *deleted)
{
char linkpath[sizeof("/proc/%u/fd/%u") + 2 * sizeof(int)*3];
ssize_t n;
@@ -91,12 +95,50 @@
xsprintf(linkpath, "/proc/%u/fd/%u", proc_pid, fd);
n = readlink(linkpath, buf, bufsize - 1);
+ if (n < 0)
+ goto end;
+
/*
* NB: if buf is too small, readlink doesn't fail,
* it returns truncated result (IOW: n == bufsize - 1).
*/
- if (n >= 0)
- buf[n] = '\0';
+ buf[n] = '\0';
+ if (deleted)
+ *deleted = false;
+
+ /*
+ * Try to figure out if the kernel has appended " (deleted)"
+ * to the end of a potentially unlinked path and set deleted
+ * if it is the case.
+ */
+ static const char del_sfx[] = " (deleted)";
+ if ((size_t) n <= sizeof(del_sfx))
+ goto end;
+
+ char *del = buf + n + 1 - sizeof(del_sfx);
+
+ if (memcmp(del, del_sfx, sizeof(del_sfx)))
+ goto end;
+
+ strace_stat_t st_link;
+ strace_stat_t st_path;
+ int rc = stat_file(linkpath, &st_link);
+
+ if (rc)
+ goto end;
+
+ rc = lstat_file(buf, &st_path);
+
+ if (rc ||
+ (st_link.st_ino != st_path.st_ino) ||
+ (st_link.st_dev != st_path.st_dev)) {
+ *del = '\0';
+ n = del - buf + 1;
+ if (deleted)
+ *deleted = true;
+ }
+
+end:
return n;
}
Index: strace-5.18/src/util.c
===================================================================
--- strace-5.18.orig/src/util.c 2022-07-13 12:52:47.989787575 +0200
+++ strace-5.18/src/util.c 2022-07-13 12:52:48.452782111 +0200
@@ -735,12 +735,15 @@
}
static void
-print_quoted_string_in_angle_brackets(const char *str)
+print_quoted_string_in_angle_brackets(const char *str, const bool deleted)
{
tprints("<");
print_quoted_string_ex(str, strlen(str),
QUOTE_OMIT_LEADING_TRAILING_QUOTES, "<>");
tprints(">");
+
+ if (deleted)
+ tprints("(deleted)");
}
void
@@ -749,8 +752,9 @@
PRINT_VAL_D(fd);
char path[PATH_MAX + 1];
+ bool deleted;
if (pid > 0 && !number_set_array_is_empty(decode_fd_set, 0)
- && getfdpath_pid(pid, fd, path, sizeof(path)) >= 0) {
+ && getfdpath_pid(pid, fd, path, sizeof(path), &deleted) >= 0) {
if (is_number_in_set(DECODE_FD_SOCKET, decode_fd_set) &&
printsocket(tcp, fd, path))
goto printed;
@@ -761,7 +765,7 @@
printpidfd(pid, fd, path))
goto printed;
if (is_number_in_set(DECODE_FD_PATH, decode_fd_set))
- print_quoted_string_in_angle_brackets(path);
+ print_quoted_string_in_angle_brackets(path, deleted);
printed: ;
}
Index: strace-5.18/tests/fchmod.c
===================================================================
--- strace-5.18.orig/tests/fchmod.c 2022-07-13 12:52:29.405006910 +0200
+++ strace-5.18/tests/fchmod.c 2022-07-13 12:52:48.452782111 +0200
@@ -35,10 +35,17 @@
(void) unlink(sample);
int fd = open(sample, O_CREAT|O_RDONLY, 0400);
if (fd == -1)
- perror_msg_and_fail("open");
+ perror_msg_and_fail("open(\"%s\")", sample);
+
+ static const char sample_del[] = "fchmod_sample_file (deleted)";
+ (void) unlink(sample_del);
+ int fd_del = open(sample_del, O_CREAT|O_RDONLY, 0400);
+ if (fd_del == -1)
+ perror_msg_and_fail("open(\"%s\")", sample);
# ifdef YFLAG
char *sample_realpath = get_fd_path(fd);
+ char *sample_del_realpath = get_fd_path(fd_del);
# endif
const char *sample_secontext = SECONTEXT_FILE(sample);
@@ -56,12 +63,27 @@
sample_secontext,
sprintrc(rc));
+ const char *sample_del_secontext = SECONTEXT_FILE(sample_del);
+ rc = syscall(__NR_fchmod, fd_del, 0600);
+# ifdef YFLAG
+ printf("%s%s(%d<%s>%s, 0600) = %s\n",
+# else
+ printf("%s%s(%d%s, 0600) = %s\n",
+# endif
+ my_secontext, "fchmod",
+ fd_del,
+# ifdef YFLAG
+ sample_del_realpath,
+# endif
+ sample_del_secontext,
+ sprintrc(rc));
+
if (unlink(sample))
- perror_msg_and_fail("unlink");
+ perror_msg_and_fail("unlink(\"%s\")", sample);
rc = syscall(__NR_fchmod, fd, 051);
# ifdef YFLAG
- printf("%s%s(%d<%s (deleted)>%s, 051) = %s\n",
+ printf("%s%s(%d<%s>(deleted)%s, 051) = %s\n",
# else
printf("%s%s(%d%s, 051) = %s\n",
# endif
@@ -73,9 +95,26 @@
sample_secontext,
sprintrc(rc));
+ if (unlink(sample_del))
+ perror_msg_and_fail("unlink(\"%s\")", sample_del);
+
+ rc = syscall(__NR_fchmod, fd_del, 051);
+# ifdef YFLAG
+ printf("%s%s(%d<%s>(deleted)%s, 051) = %s\n",
+# else
+ printf("%s%s(%d%s, 051) = %s\n",
+# endif
+ my_secontext, "fchmod",
+ fd_del,
+# ifdef YFLAG
+ sample_del_realpath,
+# endif
+ sample_del_secontext,
+ sprintrc(rc));
+
rc = syscall(__NR_fchmod, fd, 004);
# ifdef YFLAG
- printf("%s%s(%d<%s (deleted)>%s, 004) = %s\n",
+ printf("%s%s(%d<%s>(deleted)%s, 004) = %s\n",
# else
printf("%s%s(%d%s, 004) = %s\n",
# endif
Index: strace-5.18/tests-m32/fchmod.c
===================================================================
--- strace-5.18.orig/tests-m32/fchmod.c 2022-07-13 12:52:29.405006910 +0200
+++ strace-5.18/tests-m32/fchmod.c 2022-07-13 12:52:48.452782111 +0200
@@ -35,10 +35,17 @@
(void) unlink(sample);
int fd = open(sample, O_CREAT|O_RDONLY, 0400);
if (fd == -1)
- perror_msg_and_fail("open");
+ perror_msg_and_fail("open(\"%s\")", sample);
+
+ static const char sample_del[] = "fchmod_sample_file (deleted)";
+ (void) unlink(sample_del);
+ int fd_del = open(sample_del, O_CREAT|O_RDONLY, 0400);
+ if (fd_del == -1)
+ perror_msg_and_fail("open(\"%s\")", sample);
# ifdef YFLAG
char *sample_realpath = get_fd_path(fd);
+ char *sample_del_realpath = get_fd_path(fd_del);
# endif
const char *sample_secontext = SECONTEXT_FILE(sample);
@@ -56,12 +63,27 @@
sample_secontext,
sprintrc(rc));
+ const char *sample_del_secontext = SECONTEXT_FILE(sample_del);
+ rc = syscall(__NR_fchmod, fd_del, 0600);
+# ifdef YFLAG
+ printf("%s%s(%d<%s>%s, 0600) = %s\n",
+# else
+ printf("%s%s(%d%s, 0600) = %s\n",
+# endif
+ my_secontext, "fchmod",
+ fd_del,
+# ifdef YFLAG
+ sample_del_realpath,
+# endif
+ sample_del_secontext,
+ sprintrc(rc));
+
if (unlink(sample))
- perror_msg_and_fail("unlink");
+ perror_msg_and_fail("unlink(\"%s\")", sample);
rc = syscall(__NR_fchmod, fd, 051);
# ifdef YFLAG
- printf("%s%s(%d<%s (deleted)>%s, 051) = %s\n",
+ printf("%s%s(%d<%s>(deleted)%s, 051) = %s\n",
# else
printf("%s%s(%d%s, 051) = %s\n",
# endif
@@ -73,9 +95,26 @@
sample_secontext,
sprintrc(rc));
+ if (unlink(sample_del))
+ perror_msg_and_fail("unlink(\"%s\")", sample_del);
+
+ rc = syscall(__NR_fchmod, fd_del, 051);
+# ifdef YFLAG
+ printf("%s%s(%d<%s>(deleted)%s, 051) = %s\n",
+# else
+ printf("%s%s(%d%s, 051) = %s\n",
+# endif
+ my_secontext, "fchmod",
+ fd_del,
+# ifdef YFLAG
+ sample_del_realpath,
+# endif
+ sample_del_secontext,
+ sprintrc(rc));
+
rc = syscall(__NR_fchmod, fd, 004);
# ifdef YFLAG
- printf("%s%s(%d<%s (deleted)>%s, 004) = %s\n",
+ printf("%s%s(%d<%s>(deleted)%s, 004) = %s\n",
# else
printf("%s%s(%d%s, 004) = %s\n",
# endif

View File

@ -0,0 +1,209 @@
From 3f0e5340b651da98251a58cc7923525d69f96032 Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Fri, 1 Jul 2022 10:45:48 +0200
Subject: [PATCH] secontext: fix expected SELinux context check for unlinked
FDs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
selinux_getfdcon open-coded a part of getfdpath_pid since it tries
to do the same job, figure out a path associated with an FD, for slightly
different purpose: to get the expected SELinux context for it. As the previous
commit shows, it's a bit more complicated in cases when the path ends
with the " (deleted)" string, which is also used for designated unlinked paths
in procfs. Otherwise, it may manifest in test failures such as this:
[unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023] fchmod(4</root/rpmbuild/BUILD/strace-5.13/tests/fchmod-y--secontext_full_mismatch.dir/fchmod_subdir/fchmod_sample_file> [unconfined_u:object_r:admin_home_t:s0!!system_u:object_r:admin_home_t:s0], 0600) = 0
-[unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023] fchmod(4</root/rpmbuild/BUILD/strace-5.13/tests/fchmod-y--secontext_full_mismatch.dir/fchmod_subdir/fchmod_sample_file (deleted)> [unconfined_u:object_r:admin_home_t:s0!!system_u:object_r:admin_home_t:s0], 051) = 0
-[unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023] fchmod(4</root/rpmbuild/BUILD/strace-5.13/tests/fchmod-y--secontext_full_mismatch.dir/fchmod_subdir/fchmod_sample_file (deleted)> [unconfined_u:object_r:admin_home_t:s0!!system_u:object_r:admin_home_t:s0], 004) = 0
+[unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023] fchmod(4</root/rpmbuild/BUILD/strace-5.13/tests/fchmod-y--secontext_full_mismatch.dir/fchmod_subdir/fchmod_sample_file (deleted)> [unconfined_u:object_r:admin_home_t:s0], 051) = 0
+[unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023] fchmod(4</root/rpmbuild/BUILD/strace-5.13/tests/fchmod-y--secontext_full_mismatch.dir/fchmod_subdir/fchmod_sample_file (deleted)> [unconfined_u:object_r:admin_home_t:s0], 004) = 0
+++ exited with 0 +++
+ fail_ '../../src/strace -a15 -y --secontext=full,mismatch -e trace=fchmod ../fchmod-y--secontext_full_mismatch output mismatch'
+ warn_ 'fchmod-y--secontext_full_mismatch.gen.test: failed test: ../../src/strace -a15 -y --secontext=full,mismatch -e trace=fchmod ../fchmod-y--secontext_full_mismatch output mismatch'
+ printf '%s\n' 'fchmod-y--secontext_full_mismatch.gen.test: failed test: ../../src/strace -a15 -y --secontext=full,mismatch -e trace=fchmod ../fchmod-y--secontext_full_mismatch output mismatch'
fchmod-y--secontext_full_mismatch.gen.test: failed test: ../../src/strace -a15 -y --secontext=full,mismatch -e trace=fchmod ../fchmod-y--secontext_full_mismatch output mismatch
+ exit 1
FAIL fchmod-y--secontext_full_mismatch.gen.test (exit status: 1)
that happens due to the fact that the get_expected_filecontext() call
is made against the path with the " (deleted)" part, which is wrong (it
is more wrong than shown above when a file with the path that ends with
" (deleted)" exists). Moreover, it would be incorrect to call stat()
on that path.
Let's factor out the common part of the code and simply call it
from selinux_getfdcon, then use the st_mode from the procfs link.
* src/defs.h (get_proc_pid_fd_path): New declaration.
* src/pathtrace.c (get)proc_pid_fd_path): New function, part
of getfdpath_pid that performs link resolution and processing
of the result.
(getfdpath_pid): Call get_proc_pid_fd_path after PID resolution.
* src/secontext.c (get_expected_filecontext): Add mode parameter, use
it in selabel_lookup call instead of retrieveing file mode using stat()
if it is not -1.
(selinux_getfdcon): Call get_proc_pid_fd_path instead
of open-coding path resolution code, call stat() on the procfs link
and pass the retrieved st_mode to the get_expected_filecontext call.
(selinux_getfilecon): Pass -1 as mode in the get_expected_filecontext
call.
Reported-by: Václav Kadlčík <vkadlcik@redhat.com>
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2087693
---
src/defs.h | 15 +++++++++++++++
src/pathtrace.c | 26 ++++++++++++++++++--------
src/secontext.c | 35 +++++++++++++++++++++--------------
3 files changed, 54 insertions(+), 22 deletions(-)
Index: strace-5.18/src/defs.h
===================================================================
--- strace-5.18.orig/src/defs.h 2022-07-12 18:22:01.563254140 +0200
+++ strace-5.18/src/defs.h 2022-07-12 18:22:06.202199392 +0200
@@ -785,6 +785,21 @@
return pathtrace_match_set(tcp, &global_path_set);
}
+/**
+ * Resolves a path for a fd procfs PID proc_pid (the one got from
+ * get_proc_pid()).
+ *
+ * @param proc_pid PID number in /proc, obtained with get_proc_pid().
+ * @param fd FD to resolve path for.
+ * @param buf Buffer to store the resolved path in.
+ * @param bufsize The size of buf.
+ * @param deleted If non-NULL, set to true if the path associated with the FD
+ * seems to have been unlinked and to false otherwise.
+ * @return Number of bytes written including terminating '\0'.
+ */
+extern int get_proc_pid_fd_path(int proc_pid, int fd, char *buf,
+ unsigned bufsize, bool *deleted);
+
extern int getfdpath_pid(pid_t pid, int fd, char *buf, unsigned bufsize,
bool *deleted);
Index: strace-5.18/src/pathtrace.c
===================================================================
--- strace-5.18.orig/src/pathtrace.c 2022-07-12 18:22:01.532254506 +0200
+++ strace-5.18/src/pathtrace.c 2022-07-12 18:22:06.202199392 +0200
@@ -77,11 +77,9 @@
set->paths_selected[set->num_selected++] = path;
}
-/*
- * Get path associated with fd of a process with pid.
- */
int
-getfdpath_pid(pid_t pid, int fd, char *buf, unsigned bufsize, bool *deleted)
+get_proc_pid_fd_path(int proc_pid, int fd, char *buf, unsigned bufsize,
+ bool *deleted)
{
char linkpath[sizeof("/proc/%u/fd/%u") + 2 * sizeof(int)*3];
ssize_t n;
@@ -89,10 +87,6 @@
if (fd < 0)
return -1;
- int proc_pid = get_proc_pid(pid);
- if (!proc_pid)
- return -1;
-
xsprintf(linkpath, "/proc/%u/fd/%u", proc_pid, fd);
n = readlink(linkpath, buf, bufsize - 1);
if (n < 0)
@@ -143,6 +137,22 @@
}
/*
+ * Get path associated with fd of a process with pid.
+ */
+int
+getfdpath_pid(pid_t pid, int fd, char *buf, unsigned bufsize, bool *deleted)
+{
+ if (fd < 0)
+ return -1;
+
+ int proc_pid = get_proc_pid(pid);
+ if (!proc_pid)
+ return -1;
+
+ return get_proc_pid_fd_path(proc_pid, fd, buf, bufsize, deleted);
+}
+
+/*
* Add a path to the set we're tracing. Also add the canonicalized
* version of the path. Specifying NULL will delete all paths.
*/
Index: strace-5.18/src/secontext.c
===================================================================
--- strace-5.18.orig/src/secontext.c 2022-07-12 18:22:01.564254128 +0200
+++ strace-5.18/src/secontext.c 2022-07-12 18:22:06.203199380 +0200
@@ -62,7 +62,7 @@
}
static int
-get_expected_filecontext(const char *path, char **secontext)
+get_expected_filecontext(const char *path, char **secontext, int mode)
{
static struct selabel_handle *hdl;
@@ -80,12 +80,7 @@
}
}
- strace_stat_t stb;
- if (stat_file(path, &stb) < 0) {
- return -1;
- }
-
- return selabel_lookup(hdl, secontext, path, stb.st_mode);
+ return selabel_lookup(hdl, secontext, path, mode);
}
/*
@@ -130,16 +125,22 @@
/*
* We need to resolve the path, because selabel_lookup() doesn't
- * resolve anything. Using readlink() is sufficient here.
+ * resolve anything.
*/
+ char buf[PATH_MAX + 1];
+ ssize_t n = get_proc_pid_fd_path(proc_pid, fd, buf, sizeof(buf), NULL);
+ if ((size_t) n >= (sizeof(buf) - 1))
+ return 0;
- char buf[PATH_MAX];
- ssize_t n = readlink(linkpath, buf, sizeof(buf));
- if ((size_t) n >= sizeof(buf))
+ /*
+ * We retrieve stat() here since the path the procfs link resolves into
+ * may be reused by a different file with different context.
+ */
+ strace_stat_t st;
+ if (stat_file(linkpath, &st))
return 0;
- buf[n] = '\0';
- get_expected_filecontext(buf, expected);
+ get_expected_filecontext(buf, expected, st.st_mode);
return 0;
}
@@ -190,7 +191,13 @@
if (!resolved)
return 0;
- get_expected_filecontext(resolved, expected);
+ strace_stat_t st;
+ if (stat_file(resolved, &st) < 0)
+ goto out;
+
+ get_expected_filecontext(resolved, expected, st.st_mode);
+
+out:
free(resolved);
return 0;

View File

@ -0,0 +1,70 @@
From 5338636cd9ae7f53ed73f1a7909db03189ea2ff3 Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Mon, 4 Jul 2022 12:29:22 +0200
Subject: [PATCH] tests/bpf: fix sloppy low FD number usage
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
FD 42 can already be opened, so close it. Otherwise, it may lead
to the following test failure:
-bpf(BPF_LINK_CREATE, {link_create={prog_fd=0</dev/full>, target_fd=0</dev/full>, attach_type=BPF_TRACE_ITER, flags=0, iter_info=[{map={map_fd=0</dev/full>}}, {map={map_fd=42}}, {map={map_fd=314159265}}, {map={map_fd=-1159983635}}, {map={map_fd=-1}}], iter_info_len=5}}, 28) = 841540765612359407 (INJECTED)
+bpf(BPF_LINK_CREATE, {link_create={prog_fd=0</dev/full>, target_fd=0</dev/full>, attach_type=BPF_TRACE_ITER, flags=0, iter_info=[{map={map_fd=0</dev/full>}}, {map={map_fd=42</var/tmp/restraintd/logs/146893626/task.log>}}, {map={map_fd=314159265}}, {map={map_fd=-1159983635}}, {map={map_fd=-1}}], iter_info_len=5}}, 28) = 841540765612359407 (INJECTED)
bpf(BPF_LINK_CREATE, 0x3ff95574fe5, 28) = 841540765612359407 (INJECTED)
-bpf(BPF_LINK_CREATE, {link_create={prog_fd=0</dev/full>, target_fd=0</dev/full>, attach_type=BPF_TRACE_ITER, flags=0, iter_info=[{map={map_fd=0</dev/full>}}, {map={map_fd=42}}, {map={map_fd=314159265}}, {map={map_fd=-1159983635}}, {map={map_fd=-1}}, ... /* 0x3ff9555d000 */], iter_info_len=6}}, 28) = 841540765612359407 (INJECTED)
+bpf(BPF_LINK_CREATE, {link_create={prog_fd=0</dev/full>, target_fd=0</dev/full>, attach_type=BPF_TRACE_ITER, flags=0, iter_info=[{map={map_fd=0</dev/full>}}, {map={map_fd=42</var/tmp/restraintd/logs/146893626/task.log>}}, {map={map_fd=314159265}}, {map={map_fd=-1159983635}}, {map={map_fd=-1}}, ... /* 0x3ff9555d000 */], iter_info_len=6}}, 28) = 841540765612359407 (INJECTED)
[...]
FAIL bpf-success-long-y.test (exit status: 1)
* tests/bpf.c (init_BPF_LINK_CREATE_attr7): Close iter_info_data[1] fd.
Fixes: v5.18~18 "bpf: improve bpf(BPF_LINK_CREATE) decoding"
Reported-by: Lenka Špačková <lkuprova@redhat.com>
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103137
---
tests/bpf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tests/bpf.c b/tests/bpf.c
index 82d870e..6c1ffd4 100644
--- a/tests/bpf.c
+++ b/tests/bpf.c
@@ -1557,6 +1557,8 @@ init_BPF_LINK_CREATE_attr7(struct bpf_attr_check *check, size_t idx)
{
struct BPF_LINK_CREATE_struct *attr = &check->data.BPF_LINK_CREATE_data;
+ close(iter_info_data[1]);
+
if (!iter_info_data_p) {
iter_info_data_p = tail_memdup(iter_info_data,
sizeof(iter_info_data));
diff --git a/tests-m32/bpf.c b/tests-m32/bpf.c
index 82d870e..6c1ffd4 100644
--- a/tests-m32/bpf.c
+++ b/tests-m32/bpf.c
@@ -1557,6 +1557,8 @@ init_BPF_LINK_CREATE_attr7(struct bpf_attr_check *check, size_t idx)
{
struct BPF_LINK_CREATE_struct *attr = &check->data.BPF_LINK_CREATE_data;
+ close(iter_info_data[1]);
+
if (!iter_info_data_p) {
iter_info_data_p = tail_memdup(iter_info_data,
sizeof(iter_info_data));
diff --git a/tests-mx32/bpf.c b/tests-mx32/bpf.c
index 82d870e..6c1ffd4 100644
--- a/tests-mx32/bpf.c
+++ b/tests-mx32/bpf.c
@@ -1557,6 +1557,8 @@ init_BPF_LINK_CREATE_attr7(struct bpf_attr_check *check, size_t idx)
{
struct BPF_LINK_CREATE_struct *attr = &check->data.BPF_LINK_CREATE_data;
+ close(iter_info_data[1]);
+
if (!iter_info_data_p) {
iter_info_data_p = tail_memdup(iter_info_data,
sizeof(iter_info_data));
--
2.1.4

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,59 @@
Index: strace-5.17/tests/qual_fault.test
===================================================================
--- strace-5.17.orig/tests/qual_fault.test 2022-06-09 15:47:28.871554186 +0200
+++ strace-5.17/tests/qual_fault.test 2022-06-09 15:50:50.016108370 +0200
@@ -83,19 +83,36 @@
done
}
-for err in '' ENOSYS 22 einval; do
+case "$STRACE_ARCH" in
+ aarch64)
+ ERRS='EnoSys 22'
+ NUMBERS1='2'
+ NUMBERS2='3'
+ NUMBERS3='5'
+ NUMBERS4='7'
+ ;;
+ *)
+ ERRS='ENOSYS 22 einval'
+ NUMBERS1='1 2 3 7'
+ NUMBERS2='1 2 5 11'
+ NUMBERS3='1 2 3 7'
+ NUMBERS4='1 2 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 7; do
+ for F in $(echo $NUMBERS1); do
check_fault_injection \
writev $fault "$err" $F '' '' 1
check_fault_injection \
writev $fault "$err" $F '' + 1
- for L in 1 2 5 11; do
+ for L in $(echo $NUMBERS2); do
[ "$L" -ge "$F" ] ||
continue
check_fault_injection \
@@ -104,12 +121,12 @@
writev $fault "$err" $F $L + 1
done
- for S in 1 2 3 7; do
+ for S in $(echo $NUMBERS3); do
check_fault_injection \
writev $fault "$err" $F '' $S 1
check_fault_injection \
writev $fault "$err" $F '' $S 4
- for L in 1 2 7 11; do
+ for L in $(echo $NUMBERS4); do
[ "$L" -ge "$F" ] ||
continue
check_fault_injection \

View File

@ -1,22 +1,23 @@
Summary: Tracks and displays system calls associated with a running process
Name: strace
Version: 5.1
Release: 1%{?dist}
Version: 5.18
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
URL: https://strace.io/
Source: https://strace.io/files/%{version}/%{name}-%{version}.tar.xz
BuildRequires: libacl-devel time gcc gzip
BuildRequires: libacl-devel time gcc gzip make
BuildRequires: pkgconfig(bluez)
BuildRequires: elfutils-devel binutils-devel
BuildRequires: libselinux-devel
## Reported by covscan
# v5.2-3-g7ada13f "evdev: avoid bit vector decoding on non-successful and 0 return codes"
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 +25,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 +34,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 +49,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 +87,222 @@ 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
## v5.12~55 "tests: add fchmod-y test"
#Patch142: 0142-tests-add-fchmod-y-test.patch
## v5.12~54 "tests: introduce create_and_enter_subdir and leave_and_remove_subdir"
#Patch143: 0143-tests-introduce-create_and_enter_subdir-and-leave_an.patch
## v5.8~36 "tests: check decoding of faccessat syscall in -P, -y, and -yy modes"
#Patch144: 0144-tests-check-decoding-of-faccessat-syscall-in-P-y-and.patch
## v5.12~97 "xmalloc: introduce xasprintf"
#Patch145: 0145-xmalloc-introduce-xasprintf.patch
## v5.12~96 "tests: use xasprintf instead of asprintf"
#Patch146: 0146-tests-use-xasprintf-instead-of-asprintf.patch
## v5.12~156 "file_handle: print f_handle as a hexadecimal string"
#Patch147: 0147-file_handle-print-f_handle-as-a-hexadecimal-string.patch
## v5.10~47 "tests: fix execve test with fresh linux kernels"
#Patch148: 0148-tests-fix-execve-test-with-fresh-linux-kernels.patch
## v5.12~49 "Implement --secontext[=full] option to display SELinux contexts"
#Patch149: 0149-Implement-secontext-full-option-to-display-SELinux-c.patch
# v5.13-14-g9623154 "m4/mpers.m4: generate HAVE_*_SELINUX_RUNTIME config defines"
#Patch155: 0155-m4-mpers.m4-generate-HAVE_-_SELINUX_RUNTIME-config-d.patch
## v5.9~28 "Introduce GLIBC_PREREQ_GE and GLIBC_PREREQ_LT macros"
#Patch156: 0156-Introduce-GLIBC_PREREQ_GE-and-GLIBC_PREREQ_LT-macros.patch
## v5.9~27 "tests/ipc_msg.c: disable TEST_MSGCTL_BOGUS_ADDR on glibc >= 2.32"
#Patch157: 0157-tests-ipc_msg.c-disable-TEST_MSGCTL_BOGUS_ADDR-on-gl.patch
## v5.10~46 "tests: disable TEST_MSGCTL_BOGUS_ADDR in ipc_msg test on glibc >= 2.31"
#Patch158: 0158-tests-disable-TEST_MSGCTL_BOGUS_ADDR-in-ipc_msg-test.patch
## v5.10~22 "tests: disable tests for invalid msgctl commands on glibc >= 2.32"
#Patch159: 0159-tests-disable-tests-for-invalid-msgctl-commands-on-g.patch
## v5.9~11 "tests: disable shmctl IPC_STAT test with a bogus address on glibc >= 2.32"
#Patch160: 0160-tests-disable-shmctl-IPC_STAT-test-with-a-bogus-addr.patch
## v5.9~10 "tests: disable tests for invalid shmctl commands on glibc >= 2.32"
#Patch161: 0161-tests-disable-tests-for-invalid-shmctl-commands-on-g.patch
## v5.9~12 "tests: disable tests for invalid semctl commands on glibc >= 2.32"
#Patch162: 0162-tests-disable-tests-for-invalid-semctl-commands-on-g.patch
## v5.13-55-g6b2191f "filter_qualify: free allocated data on the error path exit of parse_poke_token"
#Patch163: 0163-filter_qualify-free-allocated-data-on-the-error-path.patch
## v5.13-56-g80dc60c "macros: expand BIT macros, add MASK macros; add *_SAFE macros"
#Patch164: 0164-macros-expand-BIT-macros-add-MASK-macros-add-_SAFE-m.patch
## v5.13-58-g94ae5c2 "trie: use BIT* and MASK* macros"
#Patch165: 0165-trie-use-BIT-and-MASK-macros.patch
## v5.13-65-g41b753e "tee: rewrite num_params access in tee_fetch_buf_data"
#Patch166: 0166-tee-rewrite-num_params-access-in-tee_fetch_buf_data.patch
## v5.15~1 "print_ifindex: fix IFNAME_QUOTED_SZ definition"
#Patch167: 0167-print_ifindex-fix-IFNAME_QUOTED_SZ-definition.patch
## v5.15~18 "m4: fix st_SELINUX check"
#Patch168: 0168-m4-fix-st_SELINUX-check.patch
## v5.16~31 "Implement displaying of expected context upon mismatch"
#Patch169: 0169-Implement-displaying-of-expected-context-upon-mismat.patch
#Patch170: 0170-tests-linkat-reset-errno-before-SELinux-context-mani.patch
#Patch171: 0171-tests-secontext-add-secontext-field-getters.patch
#Patch172: 0172-tests-linkat-provide-fallback-values-for-secontext-f.patch
#Patch173: 0173-tests-secontext-eliminate-separate-secontext_format-.patch
#Patch174: 0174-tests-linkat-reset-context-to-the-expected-one-if-a-.patch
## https://bugzilla.redhat.com/2103068 covscan fixes
# v5.18-5-g2bf0696 "src/xlat: remove remnants of unnecessary idx usage in xlookup"
Patch175: 0175-src-xlat-remove-remnants-of-unnecessary-idx-usage-in.patch
# v5.18-7-ge604d7b "strauss: tips whitespace and phrasing cleanups"
Patch176: 0176-strauss-tips-whitespace-and-phrasing-cleanups.patch
# v5.18-8-g968789d "strauss: fix off-by-one error in strauss array access"
Patch177: 0177-strauss-fix-off-by-one-error-in-strauss-array-access.patch
# v5.18-9-g6d3e97e "util: add offs sanity check to print_clock_t"
Patch178: 0178-util-add-offs-sanity-check-to-print_clock_t.patch
## https://bugzilla.redhat.com/2087693
# v5.18-13-g960e78f "secontext: print context of Unix socket's sun_path field"
Patch179: 0179-secontext-print-context-of-Unix-socket-s-sun_path-fi.patch
# v5.18-18-g676979f "pathtrace, util: do not print " (deleted)" as part of the path"
Patch180: 0180-pathtrace-util-do-not-print-deleted-as-part-of-the-p.patch
# v5.18-19-g3f0e534 "secontext: fix expected SELinux context check for unlinked FDs"
Patch181: 0181-secontext-fix-expected-SELinux-context-check-for-unl.patch
## https://bugzilla.redhat.com/2103137
# v5.18-21-g5338636 "tests/bpf: fix sloppy low FD number usage"
Patch182: 0182-tests-bpf-fix-sloppy-low-FD-number-usage.patch
### 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
## No longer needed, since upstream commit v5.14~14
#Patch2003: 2003-undef-ARRAY_SIZE.patch
### RHEL-only: glibc-2.32.9000-147-ga16d2abd496bd974a882,
### glibc-2.32.9000-149-gbe9b0b9a012780a403a2 and
### glibc-2.32.9000-207-g9ebaabeaac1a96b0d91f have been backported in RHEL.
## No longer needed, since upstream commit v5.15~9
#Patch2004: 2004-glibc-msgctl-semctl-shmctl-backport-workaround.patch
# We no longer need to build a separate strace32 binary, but we don't want
# to break existing strace32 users' workflows.
@ -109,9 +312,16 @@ 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
# Fallback definitions for make_build/make_install macros
%{?!__make: %global __make %_bindir/make}
%{?!__install: %global __install %_bindir/install}
%{?!make_build: %global make_build %__make %{?_smp_mflags}}
%{?!make_install: %global make_install %__make install DESTDIR="%{?buildroot}" INSTALL="%__install -p"}
%description
The strace program intercepts and records the system calls called and
received by a running process. Strace can print a record of each
@ -125,21 +335,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,18 +358,111 @@ 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
#%patch142 -p1
#%patch143 -p1
#%patch144 -p1
#%patch145 -p1
#%patch146 -p1
#%patch147 -p1
#%patch148 -p1
#%patch149 -p1
#%patch155 -p1
#%patch156 -p1
#%patch157 -p1
#%patch158 -p1
#%patch159 -p1
#%patch160 -p1
#%patch161 -p1
#%patch162 -p1
#%patch163 -p1
#%patch164 -p1
#%patch165 -p1
#%patch166 -p1
#%patch167 -p1
#%patch168 -p1
#%patch169 -p1
#%patch170 -p1
#%patch171 -p1
#%patch172 -p1
#%patch173 -p1
#%patch174 -p1
#%patch200 -p1
%patch201 -p1
#%patch202 -p1
%patch175 -p1
%patch176 -p1
%patch177 -p1
%patch178 -p1
%patch179 -p1
%patch180 -p1
%patch181 -p1
%patch182 -p1
#%patch1000 -p1
#%patch1001 -p1
#%patch2000 -p1
%patch2001 -p1
#%patch2002 -p1
#%patch2003 -p1
#%patch2004 -p1
chmod a+x tests/*.test
echo -n %version-%release > .tarball-version
echo -n 2020 > .year
echo -n 2020-04-30 > .strace.1.in.date
echo -n 2022 > .year
echo -n 2022-06-22 > doc/.strace.1.in.date
echo -n 2022-06-22 > doc/.strace-log-merge.1.in.date
%build
echo 'BEGIN OF BUILD ENVIRONMENT INFORMATION'
@ -178,18 +481,18 @@ CFLAGS=" $RPM_OPT_FLAGS $LDFLAGS "
[ "x${CFLAGS#* -m64 }" = "x${CFLAGS}" ] || CFLAGS=$(echo "$CFLAGS" | sed 's/ -m64 / /g')
export CFLAGS
CPPFLAGS=" -I%{_includedir} %{optflags} "
CPPFLAGS=" -isystem %{_includedir} %{optflags} "
# Removing explicit -m64 as it breaks mpers
[ "x${CPPFLAGS#* -m64 }" = "x${CPPFLAGS}" ] || CPPFLAGS=$(echo "$CPPFLAGS" | sed 's/ -m64 / /g')
export CPPFLAGS
CFLAGS_FOR_BUILD="$RPM_OPT_FLAGS"; export CFLAGS_FOR_BUILD
%configure --enable-mpers=check --with-libdw --with-libiberty
make %{?_smp_mflags}
%make_build
%install
make DESTDIR=%{buildroot} install
%make_install
%ifarch %{strace32_arches}
ln -s ./strace %{buildroot}%{_bindir}/strace32
@ -212,10 +515,9 @@ chmod u+x tests/*.test tests-m32/*.test tests-mx32/*.test
# We have to limit concurrent execution of tests as some time-sensitive tests
# start to fail if the reported time is way too off from the expected one.
make -j2 -k check VERBOSE=1 V=1 TIMEOUT_DURATION=5400
%make_build -k check VERBOSE=1 V=1
echo 'BEGIN OF TEST SUITE INFORMATION'
tail -n 99999 -- tests*/test-suite.log
tail -n 99999 -- tests*/ksysent.log ||:
tail -n 99999 -- tests*/test-suite.log tests*/ksysent.gen.log
find tests* -type f -name '*.log' -print0 |
xargs -r0 grep -H '^KERNEL BUG:' -- ||:
echo 'END OF TEST SUITE INFORMATION'
@ -231,6 +533,41 @@ echo 'END OF TEST SUITE INFORMATION'
%{_mandir}/man1/*
%changelog
* Mon Jul 11 2022 Eugene Syromiatnikov <esyr@redhat.com> - 5.18-2
- Fix the issues reported by covscan (#2103068).
- Fix SELinux context matching for the deleted paths (#2087693).
- Fix sloppy FD usage in the bpf test (#2103137).
* Wed Jun 22 2022 Eugene Syromiatnikov <esyr@redhat.com> - 5.18-1
- Rebase to v5.18; drop upstream patches on top of 5.13 (#2084000).
* Mon Feb 07 2022 Eugene Syromiatnikov <esyr@redhat.com> - 5.13-4
- Update tests-m32 and tests-mx32 with --secontext=mismatch option support
changes (#2046259).
* Wed Jan 19 2022 Eugene Syromiatnikov <esyr@redhat.com> - 5.13-3
- Add --secontext=mismatch option support (#2038810).
* Wed Jan 05 2022 Eugene Syromiatnikov <esyr@redhat.com> - 5.13-2
- Fix incorrect ifname printing buffer size (#2028158).
* Wed Oct 20 2021 Eugene Syromiatnikov <esyr@redhat.com> - 5.13-1
- Rebase to v5.13; drop upstream patches on top of 5.7 (#2015917).
- Address some issues reported by covscan.
* Mon Aug 09 2021 Eugene Syromiatnikov <esyr@redhat.com> - 5.7-3
- Add SELnux context decoding support (#1946500).
* Mon Nov 09 2020 Eugene Syromiatnikov <esyr@redhat.com> - 5.7-2
- Add PID namespace translation support (#1725113).
* 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).