diff --git a/SOURCES/0000-limit-qual_fault-scope-on-aarch64.patch b/SOURCES/0000-limit-qual_fault-scope-on-aarch64.patch deleted file mode 100644 index 30df75a..0000000 --- a/SOURCES/0000-limit-qual_fault-scope-on-aarch64.patch +++ /dev/null @@ -1,39 +0,0 @@ -Index: strace-5.1/tests/qual_fault.test -=================================================================== ---- strace-5.1.orig/tests/qual_fault.test 2018-12-10 01:00:00.000000000 +0100 -+++ strace-5.1/tests/qual_fault.test 2019-06-13 16:59:58.498626547 +0200 -@@ -75,18 +75,31 @@ - done - } - --for err in '' ENOSYS 22 einval; do -+case "$STRACE_ARCH" in -+ aarch64) -+ ERRS='EnoSys 22' -+ NUMBERS1='2' -+ NUMBERS2='3' -+ ;; -+ *) -+ 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 \ diff --git a/SOURCES/0001-evdev-avoid-bit-vector-decoding-on-non-successful-an.patch b/SOURCES/0001-evdev-avoid-bit-vector-decoding-on-non-successful-an.patch deleted file mode 100644 index 3d21fae..0000000 --- a/SOURCES/0001-evdev-avoid-bit-vector-decoding-on-non-successful-an.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 7ada13f3a40e2f58aea335cf910666378e7dd99a Mon Sep 17 00:00:00 2001 -From: Eugene Syromyatnikov -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 - diff --git a/SOURCES/0002-evdev-fix-array-size-calculation-in-decode_bitset_.patch b/SOURCES/0002-evdev-fix-array-size-calculation-in-decode_bitset_.patch deleted file mode 100644 index 18cf773..0000000 --- a/SOURCES/0002-evdev-fix-array-size-calculation-in-decode_bitset_.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 96194ed74158f0b9976fae43a910ad14eaea141e Mon Sep 17 00:00:00 2001 -From: Eugene Syromyatnikov -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 - diff --git a/SOURCES/0003-tests-test-evdev-bitset-decoding-more-thoroughly.patch b/SOURCES/0003-tests-test-evdev-bitset-decoding-more-thoroughly.patch deleted file mode 100644 index b4afe2e..0000000 --- a/SOURCES/0003-tests-test-evdev-bitset-decoding-more-thoroughly.patch +++ /dev/null @@ -1,795 +0,0 @@ -From cdd8206af74fcb961f0179e21eacf5d55d23f0ac Mon Sep 17 00:00:00 2001 -From: Eugene Syromyatnikov -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-5.1/tests/ioctl_evdev-success-v.test -=================================================================== ---- strace-5.1.orig/tests/ioctl_evdev-success-v.test 2018-12-25 00:46:43.000000000 +0100 -+++ strace-5.1/tests/ioctl_evdev-success-v.test 2019-08-29 12:08:51.568168577 +0200 -@@ -8,11 +8,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-5.1/tests/ioctl_evdev-success.c -=================================================================== ---- strace-5.1.orig/tests/ioctl_evdev-success.c 2018-12-25 00:46:43.000000000 +0100 -+++ strace-5.1/tests/ioctl_evdev-success.c 2019-08-29 12:08:51.568168577 +0200 -@@ -9,6 +9,7 @@ - - #ifdef HAVE_LINUX_INPUT_H - -+# include - # include - # include - # include -@@ -16,17 +17,19 @@ - # include - # 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); -@@ -38,7 +41,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); -@@ -50,9 +53,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); -@@ -74,9 +77,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); -@@ -91,10 +94,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) { -@@ -111,27 +114,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("]"); - } -@@ -177,6 +179,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 */ -@@ -190,36 +193,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-5.1/tests/ioctl_evdev-success.test -=================================================================== ---- strace-5.1.orig/tests/ioctl_evdev-success.test 2018-12-25 00:46:43.000000000 +0100 -+++ strace-5.1/tests/ioctl_evdev-success.test 2019-08-29 12:08:51.568168577 +0200 -@@ -8,11 +8,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-5.1/tests-m32/ioctl_evdev-success-v.test -=================================================================== ---- strace-5.1.orig/tests-m32/ioctl_evdev-success-v.test 2018-12-25 00:46:43.000000000 +0100 -+++ strace-5.1/tests-m32/ioctl_evdev-success-v.test 2019-08-29 12:08:51.568168577 +0200 -@@ -8,11 +8,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-5.1/tests-m32/ioctl_evdev-success.test -=================================================================== ---- strace-5.1.orig/tests-m32/ioctl_evdev-success.test 2018-12-25 00:46:43.000000000 +0100 -+++ strace-5.1/tests-m32/ioctl_evdev-success.test 2019-08-29 12:08:51.568168577 +0200 -@@ -8,11 +8,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-5.1/tests-mx32/ioctl_evdev-success-v.test -=================================================================== ---- strace-5.1.orig/tests-mx32/ioctl_evdev-success-v.test 2018-12-25 00:46:43.000000000 +0100 -+++ strace-5.1/tests-mx32/ioctl_evdev-success-v.test 2019-08-29 12:08:51.569168564 +0200 -@@ -8,11 +8,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-5.1/tests-mx32/ioctl_evdev-success.test -=================================================================== ---- strace-5.1.orig/tests-mx32/ioctl_evdev-success.test 2018-12-25 00:46:43.000000000 +0100 -+++ strace-5.1/tests-mx32/ioctl_evdev-success.test 2019-08-29 12:08:51.569168564 +0200 -@@ -8,11 +8,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-5.1/tests-m32/ioctl_evdev-success.c -=================================================================== ---- strace-5.1.orig/tests-m32/ioctl_evdev-success.c 2018-12-25 00:46:43.000000000 +0100 -+++ strace-5.1/tests-m32/ioctl_evdev-success.c 2019-08-29 12:09:27.898700830 +0200 -@@ -9,6 +9,7 @@ - - #ifdef HAVE_LINUX_INPUT_H - -+# include - # include - # include - # include -@@ -16,17 +17,19 @@ - # include - # 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); -@@ -38,7 +41,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); -@@ -50,9 +53,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); -@@ -74,9 +77,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); -@@ -91,10 +94,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) { -@@ -111,27 +114,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("]"); - } -@@ -177,6 +179,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 */ -@@ -190,36 +193,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-5.1/tests-mx32/ioctl_evdev-success.c -=================================================================== ---- strace-5.1.orig/tests-mx32/ioctl_evdev-success.c 2018-12-25 00:46:43.000000000 +0100 -+++ strace-5.1/tests-mx32/ioctl_evdev-success.c 2019-08-29 12:09:30.350669261 +0200 -@@ -9,6 +9,7 @@ - - #ifdef HAVE_LINUX_INPUT_H - -+# include - # include - # include - # include -@@ -16,17 +17,19 @@ - # include - # 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); -@@ -38,7 +41,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); -@@ -50,9 +53,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); -@@ -74,9 +77,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); -@@ -91,10 +94,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) { -@@ -111,27 +114,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("]"); - } -@@ -177,6 +179,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 */ -@@ -190,36 +193,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 } diff --git a/SOURCES/0004-sockaddr-properly-decode-sockaddr_hci-addresses-with.patch b/SOURCES/0004-sockaddr-properly-decode-sockaddr_hci-addresses-with.patch deleted file mode 100644 index f802107..0000000 --- a/SOURCES/0004-sockaddr-properly-decode-sockaddr_hci-addresses-with.patch +++ /dev/null @@ -1,225 +0,0 @@ -From 5a9b0f1ef83300f853e77ada03515c8542c1cfe0 Mon Sep 17 00:00:00 2001 -From: Eugene Syromyatnikov -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 -+ #include ]) - AC_CHECK_MEMBERS([struct sockaddr_l2.l2_bdaddr_type],,, - [#include - #include ]) -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 -+ #include -+" -+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 - #include - " -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 - diff --git a/SOURCES/0005-v4l2-avoid-shifting-left-a-signed-number-by-31-bit.patch b/SOURCES/0005-v4l2-avoid-shifting-left-a-signed-number-by-31-bit.patch deleted file mode 100644 index a2c85f9..0000000 --- a/SOURCES/0005-v4l2-avoid-shifting-left-a-signed-number-by-31-bit.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 91281fec7823f1cd3df3374fbcbd14af52a3fa1b Mon Sep 17 00:00:00 2001 -From: Eugene Syromyatnikov -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 - diff --git a/SOURCES/0006-syscall.c-avoid-infinite-loop-in-subcalls-parsing.patch b/SOURCES/0006-syscall.c-avoid-infinite-loop-in-subcalls-parsing.patch deleted file mode 100644 index 9144dc1..0000000 --- a/SOURCES/0006-syscall.c-avoid-infinite-loop-in-subcalls-parsing.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 522ad3a0e73148dadd2480cd9cec84d9112b2e57 Mon Sep 17 00:00:00 2001 -From: Eugene Syromyatnikov -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 - diff --git a/SOURCES/0007-kvm-avoid-bogus-vcpu_info-assignment-in-vcpu_registe.patch b/SOURCES/0007-kvm-avoid-bogus-vcpu_info-assignment-in-vcpu_registe.patch deleted file mode 100644 index 7531868..0000000 --- a/SOURCES/0007-kvm-avoid-bogus-vcpu_info-assignment-in-vcpu_registe.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 9446038e9face3313373ca5f7539476789fd4660 Mon Sep 17 00:00:00 2001 -From: Eugene Syromyatnikov -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 - diff --git a/SOURCES/0030-evdev-avoid-bit-vector-decoding-on-non-successful-an.patch b/SOURCES/0030-evdev-avoid-bit-vector-decoding-on-non-successful-an.patch new file mode 100644 index 0000000..3d21fae --- /dev/null +++ b/SOURCES/0030-evdev-avoid-bit-vector-decoding-on-non-successful-an.patch @@ -0,0 +1,42 @@ +From 7ada13f3a40e2f58aea335cf910666378e7dd99a Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +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 + diff --git a/SOURCES/0031-evdev-fix-array-size-calculation-in-decode_bitset_.patch b/SOURCES/0031-evdev-fix-array-size-calculation-in-decode_bitset_.patch new file mode 100644 index 0000000..18cf773 --- /dev/null +++ b/SOURCES/0031-evdev-fix-array-size-calculation-in-decode_bitset_.patch @@ -0,0 +1,57 @@ +From 96194ed74158f0b9976fae43a910ad14eaea141e Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +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 + diff --git a/SOURCES/0033-tests-test-evdev-bitset-decoding-more-thoroughly.patch b/SOURCES/0033-tests-test-evdev-bitset-decoding-more-thoroughly.patch new file mode 100644 index 0000000..b4afe2e --- /dev/null +++ b/SOURCES/0033-tests-test-evdev-bitset-decoding-more-thoroughly.patch @@ -0,0 +1,795 @@ +From cdd8206af74fcb961f0179e21eacf5d55d23f0ac Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +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-5.1/tests/ioctl_evdev-success-v.test +=================================================================== +--- strace-5.1.orig/tests/ioctl_evdev-success-v.test 2018-12-25 00:46:43.000000000 +0100 ++++ strace-5.1/tests/ioctl_evdev-success-v.test 2019-08-29 12:08:51.568168577 +0200 +@@ -8,11 +8,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-5.1/tests/ioctl_evdev-success.c +=================================================================== +--- strace-5.1.orig/tests/ioctl_evdev-success.c 2018-12-25 00:46:43.000000000 +0100 ++++ strace-5.1/tests/ioctl_evdev-success.c 2019-08-29 12:08:51.568168577 +0200 +@@ -9,6 +9,7 @@ + + #ifdef HAVE_LINUX_INPUT_H + ++# include + # include + # include + # include +@@ -16,17 +17,19 @@ + # include + # 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); +@@ -38,7 +41,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); +@@ -50,9 +53,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); +@@ -74,9 +77,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); +@@ -91,10 +94,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) { +@@ -111,27 +114,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("]"); + } +@@ -177,6 +179,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 */ +@@ -190,36 +193,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-5.1/tests/ioctl_evdev-success.test +=================================================================== +--- strace-5.1.orig/tests/ioctl_evdev-success.test 2018-12-25 00:46:43.000000000 +0100 ++++ strace-5.1/tests/ioctl_evdev-success.test 2019-08-29 12:08:51.568168577 +0200 +@@ -8,11 +8,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-5.1/tests-m32/ioctl_evdev-success-v.test +=================================================================== +--- strace-5.1.orig/tests-m32/ioctl_evdev-success-v.test 2018-12-25 00:46:43.000000000 +0100 ++++ strace-5.1/tests-m32/ioctl_evdev-success-v.test 2019-08-29 12:08:51.568168577 +0200 +@@ -8,11 +8,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-5.1/tests-m32/ioctl_evdev-success.test +=================================================================== +--- strace-5.1.orig/tests-m32/ioctl_evdev-success.test 2018-12-25 00:46:43.000000000 +0100 ++++ strace-5.1/tests-m32/ioctl_evdev-success.test 2019-08-29 12:08:51.568168577 +0200 +@@ -8,11 +8,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-5.1/tests-mx32/ioctl_evdev-success-v.test +=================================================================== +--- strace-5.1.orig/tests-mx32/ioctl_evdev-success-v.test 2018-12-25 00:46:43.000000000 +0100 ++++ strace-5.1/tests-mx32/ioctl_evdev-success-v.test 2019-08-29 12:08:51.569168564 +0200 +@@ -8,11 +8,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-5.1/tests-mx32/ioctl_evdev-success.test +=================================================================== +--- strace-5.1.orig/tests-mx32/ioctl_evdev-success.test 2018-12-25 00:46:43.000000000 +0100 ++++ strace-5.1/tests-mx32/ioctl_evdev-success.test 2019-08-29 12:08:51.569168564 +0200 +@@ -8,11 +8,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-5.1/tests-m32/ioctl_evdev-success.c +=================================================================== +--- strace-5.1.orig/tests-m32/ioctl_evdev-success.c 2018-12-25 00:46:43.000000000 +0100 ++++ strace-5.1/tests-m32/ioctl_evdev-success.c 2019-08-29 12:09:27.898700830 +0200 +@@ -9,6 +9,7 @@ + + #ifdef HAVE_LINUX_INPUT_H + ++# include + # include + # include + # include +@@ -16,17 +17,19 @@ + # include + # 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); +@@ -38,7 +41,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); +@@ -50,9 +53,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); +@@ -74,9 +77,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); +@@ -91,10 +94,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) { +@@ -111,27 +114,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("]"); + } +@@ -177,6 +179,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 */ +@@ -190,36 +193,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-5.1/tests-mx32/ioctl_evdev-success.c +=================================================================== +--- strace-5.1.orig/tests-mx32/ioctl_evdev-success.c 2018-12-25 00:46:43.000000000 +0100 ++++ strace-5.1/tests-mx32/ioctl_evdev-success.c 2019-08-29 12:09:30.350669261 +0200 +@@ -9,6 +9,7 @@ + + #ifdef HAVE_LINUX_INPUT_H + ++# include + # include + # include + # include +@@ -16,17 +17,19 @@ + # include + # 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); +@@ -38,7 +41,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); +@@ -50,9 +53,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); +@@ -74,9 +77,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); +@@ -91,10 +94,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) { +@@ -111,27 +114,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("]"); + } +@@ -177,6 +179,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 */ +@@ -190,36 +193,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 } diff --git a/SOURCES/0035-v4l2-avoid-shifting-left-a-signed-number-by-31-bit.patch b/SOURCES/0035-v4l2-avoid-shifting-left-a-signed-number-by-31-bit.patch new file mode 100644 index 0000000..a2c85f9 --- /dev/null +++ b/SOURCES/0035-v4l2-avoid-shifting-left-a-signed-number-by-31-bit.patch @@ -0,0 +1,32 @@ +From 91281fec7823f1cd3df3374fbcbd14af52a3fa1b Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +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 + diff --git a/SOURCES/0036-syscall.c-avoid-infinite-loop-in-subcalls-parsing.patch b/SOURCES/0036-syscall.c-avoid-infinite-loop-in-subcalls-parsing.patch new file mode 100644 index 0000000..9144dc1 --- /dev/null +++ b/SOURCES/0036-syscall.c-avoid-infinite-loop-in-subcalls-parsing.patch @@ -0,0 +1,55 @@ +From 522ad3a0e73148dadd2480cd9cec84d9112b2e57 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +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 + diff --git a/SOURCES/0037-kvm-avoid-bogus-vcpu_info-assignment-in-vcpu_registe.patch b/SOURCES/0037-kvm-avoid-bogus-vcpu_info-assignment-in-vcpu_registe.patch new file mode 100644 index 0000000..7531868 --- /dev/null +++ b/SOURCES/0037-kvm-avoid-bogus-vcpu_info-assignment-in-vcpu_registe.patch @@ -0,0 +1,36 @@ +From 9446038e9face3313373ca5f7539476789fd4660 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +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 + diff --git a/SOURCES/0038-xlat-use-unsgined-type-for-mount_flags-fallback-valu.patch b/SOURCES/0038-xlat-use-unsgined-type-for-mount_flags-fallback-valu.patch new file mode 100644 index 0000000..5bc3768 --- /dev/null +++ b/SOURCES/0038-xlat-use-unsgined-type-for-mount_flags-fallback-valu.patch @@ -0,0 +1,365 @@ +From c26541c73c3b4be2977e719d77287255eb346cdf Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +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 diff --git a/SOURCES/0039-unwind-libdw-fix-initialization-of-libdwfl-cache.patch b/SOURCES/0039-unwind-libdw-fix-initialization-of-libdwfl-cache.patch new file mode 100644 index 0000000..17fd6cc --- /dev/null +++ b/SOURCES/0039-unwind-libdw-fix-initialization-of-libdwfl-cache.patch @@ -0,0 +1,36 @@ +From 69b2c33a77fa687feb41fafdbe187013aa812384 Mon Sep 17 00:00:00 2001 +From: "Dmitry V. Levin" +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; + } + diff --git a/SOURCES/0040-syscall-do-not-capture-stack-trace-while-the-tracee-.patch b/SOURCES/0040-syscall-do-not-capture-stack-trace-while-the-tracee-.patch new file mode 100644 index 0000000..a9add6e --- /dev/null +++ b/SOURCES/0040-syscall-do-not-capture-stack-trace-while-the-tracee-.patch @@ -0,0 +1,42 @@ +From 35e080ae319d25c1df82855cda3a1bb014e90ba6 Mon Sep 17 00:00:00 2001 +From: "Dmitry V. Levin" +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 + diff --git a/SOURCES/0041-tests-add-strace-k-p-test.patch b/SOURCES/0041-tests-add-strace-k-p-test.patch new file mode 100644 index 0000000..3f56199 --- /dev/null +++ b/SOURCES/0041-tests-add-strace-k-p-test.patch @@ -0,0 +1,761 @@ +From 8e515c744935fe67e6a1b941f4c5414472c163b7 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +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 . +[!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 + #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 + #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 + #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 ' diff --git a/SOURCES/0042-sockaddr-properly-decode-sockaddr_hci-addresses-with.patch b/SOURCES/0042-sockaddr-properly-decode-sockaddr_hci-addresses-with.patch new file mode 100644 index 0000000..f802107 --- /dev/null +++ b/SOURCES/0042-sockaddr-properly-decode-sockaddr_hci-addresses-with.patch @@ -0,0 +1,225 @@ +From 5a9b0f1ef83300f853e77ada03515c8542c1cfe0 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +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 ++ #include ]) + AC_CHECK_MEMBERS([struct sockaddr_l2.l2_bdaddr_type],,, + [#include + #include ]) +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 ++ #include ++" ++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 + #include + " +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 + diff --git a/SOURCES/0043-tests-fix-expected-output-for-some-ipc-tests.patch b/SOURCES/0043-tests-fix-expected-output-for-some-ipc-tests.patch new file mode 100644 index 0000000..a05241d --- /dev/null +++ b/SOURCES/0043-tests-fix-expected-output-for-some-ipc-tests.patch @@ -0,0 +1,90 @@ +From 4377e3a1535a0ec3a42da8a1366ad6943f4efa0e Mon Sep 17 00:00:00 2001 +From: "Dmitry V. Levin" +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 diff --git a/SOURCES/0044-tests-fix-a-argument-in-ipc_msgbuf-Xraw-test.patch b/SOURCES/0044-tests-fix-a-argument-in-ipc_msgbuf-Xraw-test.patch new file mode 100644 index 0000000..3ce20d2 --- /dev/null +++ b/SOURCES/0044-tests-fix-a-argument-in-ipc_msgbuf-Xraw-test.patch @@ -0,0 +1,53 @@ +From a75c7c4bcb6b48680275de3e99e17e0ebec811ec Mon Sep 17 00:00:00 2001 +From: "Dmitry V. Levin" +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 diff --git a/SOURCES/0053-xlat-provide-fallback-definitions-for-UFFD_FEATURE_-.patch b/SOURCES/0053-xlat-provide-fallback-definitions-for-UFFD_FEATURE_-.patch new file mode 100644 index 0000000..cd84e03 --- /dev/null +++ b/SOURCES/0053-xlat-provide-fallback-definitions-for-UFFD_FEATURE_-.patch @@ -0,0 +1,151 @@ +From 769b79f04163b8467f4acf24963c82ad17180885 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Wed, 9 Oct 2019 20:06:15 +0200 +Subject: [PATCH 53/76] xlat: provide fallback definitions for UFFD_FEATURE_* + constants + +* xlat/uffd_api_features.in: Add fallback definitions. + +References: https://bugzilla.redhat.com/show_bug.cgi?id=1758201 +--- + xlat/uffd_api_features.in | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +Index: strace-5.1/xlat/uffd_api_features.in +=================================================================== +--- strace-5.1.orig/xlat/uffd_api_features.in 2017-09-17 14:04:11.000000000 +0200 ++++ strace-5.1/xlat/uffd_api_features.in 2020-01-29 12:06:42.473425856 +0100 +@@ -1,10 +1,10 @@ + #val_type uint64_t +-UFFD_FEATURE_PAGEFAULT_FLAG_WP +-UFFD_FEATURE_EVENT_FORK +-UFFD_FEATURE_EVENT_REMAP +-UFFD_FEATURE_EVENT_REMOVE +-UFFD_FEATURE_MISSING_HUGETLBFS +-UFFD_FEATURE_MISSING_SHMEM +-UFFD_FEATURE_EVENT_UNMAP +-UFFD_FEATURE_SIGBUS +-UFFD_FEATURE_THREAD_ID ++UFFD_FEATURE_PAGEFAULT_FLAG_WP (1<<0) ++UFFD_FEATURE_EVENT_FORK (1<<1) ++UFFD_FEATURE_EVENT_REMAP (1<<2) ++UFFD_FEATURE_EVENT_REMOVE (1<<3) ++UFFD_FEATURE_MISSING_HUGETLBFS (1<<4) ++UFFD_FEATURE_MISSING_SHMEM (1<<5) ++UFFD_FEATURE_EVENT_UNMAP (1<<6) ++UFFD_FEATURE_SIGBUS (1<<7) ++UFFD_FEATURE_THREAD_ID (1<<8) +Index: strace-5.1/xlat/uffd_api_features.h +=================================================================== +--- strace-5.1.orig/xlat/uffd_api_features.h 2019-05-22 15:08:31.000000000 +0200 ++++ strace-5.1/xlat/uffd_api_features.h 2020-01-29 12:07:13.199158142 +0100 +@@ -3,44 +3,89 @@ + #include "gcc_compat.h" + #include "static_assert.h" + +- +-#ifndef XLAT_MACROS_ONLY +- +-# ifdef IN_MPERS +- +-# error static const struct xlat uffd_api_features in mpers mode +- +-# else +- +-static +-const struct xlat uffd_api_features[] = { + #if defined(UFFD_FEATURE_PAGEFAULT_FLAG_WP) || (defined(HAVE_DECL_UFFD_FEATURE_PAGEFAULT_FLAG_WP) && HAVE_DECL_UFFD_FEATURE_PAGEFAULT_FLAG_WP) +- XLAT_TYPE(uint64_t, UFFD_FEATURE_PAGEFAULT_FLAG_WP), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((UFFD_FEATURE_PAGEFAULT_FLAG_WP) == ((1<<0)), "UFFD_FEATURE_PAGEFAULT_FLAG_WP != (1<<0)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define UFFD_FEATURE_PAGEFAULT_FLAG_WP (1<<0) + #endif + #if defined(UFFD_FEATURE_EVENT_FORK) || (defined(HAVE_DECL_UFFD_FEATURE_EVENT_FORK) && HAVE_DECL_UFFD_FEATURE_EVENT_FORK) +- XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_FORK), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((UFFD_FEATURE_EVENT_FORK) == ((1<<1)), "UFFD_FEATURE_EVENT_FORK != (1<<1)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define UFFD_FEATURE_EVENT_FORK (1<<1) + #endif + #if defined(UFFD_FEATURE_EVENT_REMAP) || (defined(HAVE_DECL_UFFD_FEATURE_EVENT_REMAP) && HAVE_DECL_UFFD_FEATURE_EVENT_REMAP) +- XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_REMAP), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((UFFD_FEATURE_EVENT_REMAP) == ((1<<2)), "UFFD_FEATURE_EVENT_REMAP != (1<<2)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define UFFD_FEATURE_EVENT_REMAP (1<<2) + #endif + #if defined(UFFD_FEATURE_EVENT_REMOVE) || (defined(HAVE_DECL_UFFD_FEATURE_EVENT_REMOVE) && HAVE_DECL_UFFD_FEATURE_EVENT_REMOVE) +- XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_REMOVE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((UFFD_FEATURE_EVENT_REMOVE) == ((1<<3)), "UFFD_FEATURE_EVENT_REMOVE != (1<<3)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define UFFD_FEATURE_EVENT_REMOVE (1<<3) + #endif + #if defined(UFFD_FEATURE_MISSING_HUGETLBFS) || (defined(HAVE_DECL_UFFD_FEATURE_MISSING_HUGETLBFS) && HAVE_DECL_UFFD_FEATURE_MISSING_HUGETLBFS) +- XLAT_TYPE(uint64_t, UFFD_FEATURE_MISSING_HUGETLBFS), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((UFFD_FEATURE_MISSING_HUGETLBFS) == ((1<<4)), "UFFD_FEATURE_MISSING_HUGETLBFS != (1<<4)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define UFFD_FEATURE_MISSING_HUGETLBFS (1<<4) + #endif + #if defined(UFFD_FEATURE_MISSING_SHMEM) || (defined(HAVE_DECL_UFFD_FEATURE_MISSING_SHMEM) && HAVE_DECL_UFFD_FEATURE_MISSING_SHMEM) +- XLAT_TYPE(uint64_t, UFFD_FEATURE_MISSING_SHMEM), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((UFFD_FEATURE_MISSING_SHMEM) == ((1<<5)), "UFFD_FEATURE_MISSING_SHMEM != (1<<5)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define UFFD_FEATURE_MISSING_SHMEM (1<<5) + #endif + #if defined(UFFD_FEATURE_EVENT_UNMAP) || (defined(HAVE_DECL_UFFD_FEATURE_EVENT_UNMAP) && HAVE_DECL_UFFD_FEATURE_EVENT_UNMAP) +- XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_UNMAP), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((UFFD_FEATURE_EVENT_UNMAP) == ((1<<6)), "UFFD_FEATURE_EVENT_UNMAP != (1<<6)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define UFFD_FEATURE_EVENT_UNMAP (1<<6) + #endif + #if defined(UFFD_FEATURE_SIGBUS) || (defined(HAVE_DECL_UFFD_FEATURE_SIGBUS) && HAVE_DECL_UFFD_FEATURE_SIGBUS) +- XLAT_TYPE(uint64_t, UFFD_FEATURE_SIGBUS), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((UFFD_FEATURE_SIGBUS) == ((1<<7)), "UFFD_FEATURE_SIGBUS != (1<<7)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define UFFD_FEATURE_SIGBUS (1<<7) + #endif + #if defined(UFFD_FEATURE_THREAD_ID) || (defined(HAVE_DECL_UFFD_FEATURE_THREAD_ID) && HAVE_DECL_UFFD_FEATURE_THREAD_ID) +- XLAT_TYPE(uint64_t, UFFD_FEATURE_THREAD_ID), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((UFFD_FEATURE_THREAD_ID) == ((1<<8)), "UFFD_FEATURE_THREAD_ID != (1<<8)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define UFFD_FEATURE_THREAD_ID (1<<8) + #endif ++ ++#ifndef XLAT_MACROS_ONLY ++ ++# ifdef IN_MPERS ++ ++# error static const struct xlat uffd_api_features in mpers mode ++ ++# else ++ ++static ++const struct xlat uffd_api_features[] = { ++ XLAT_TYPE(uint64_t, UFFD_FEATURE_PAGEFAULT_FLAG_WP), ++ XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_FORK), ++ XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_REMAP), ++ XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_REMOVE), ++ XLAT_TYPE(uint64_t, UFFD_FEATURE_MISSING_HUGETLBFS), ++ XLAT_TYPE(uint64_t, UFFD_FEATURE_MISSING_SHMEM), ++ XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_UNMAP), ++ XLAT_TYPE(uint64_t, UFFD_FEATURE_SIGBUS), ++ XLAT_TYPE(uint64_t, UFFD_FEATURE_THREAD_ID), + XLAT_END + }; + diff --git a/SOURCES/0054-xlat-provide-fallback-definitions-for-netlink_ack_fl.patch b/SOURCES/0054-xlat-provide-fallback-definitions-for-netlink_ack_fl.patch new file mode 100644 index 0000000..a6b77b0 --- /dev/null +++ b/SOURCES/0054-xlat-provide-fallback-definitions-for-netlink_ack_fl.patch @@ -0,0 +1,62 @@ +From a0306ed4ca69434ed67e7717460a83a027d3dec8 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Wed, 9 Oct 2019 20:12:41 +0200 +Subject: [PATCH 54/76] xlat: provide fallback definitions for + netlink_ack_flags constants + +* xlat/netlink_ack_flags.in: Add fallback definitions. + +References: https://bugzilla.redhat.com/show_bug.cgi?id=1758201 +--- + xlat/netlink_ack_flags.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +Index: strace-5.1/xlat/netlink_ack_flags.in +=================================================================== +--- strace-5.1.orig/xlat/netlink_ack_flags.in 2017-07-19 11:25:58.000000000 +0200 ++++ strace-5.1/xlat/netlink_ack_flags.in 2020-01-29 12:15:46.027048646 +0100 +@@ -1,2 +1,2 @@ +-NLM_F_CAPPED +-NLM_F_ACK_TLVS ++NLM_F_CAPPED 0x100 ++NLM_F_ACK_TLVS 0x200 +Index: strace-5.1/xlat/netlink_ack_flags.h +=================================================================== +--- strace-5.1.orig/xlat/netlink_ack_flags.h 2019-05-22 15:08:30.000000000 +0200 ++++ strace-5.1/xlat/netlink_ack_flags.h 2020-01-29 12:16:05.491944228 +0100 +@@ -3,6 +3,20 @@ + #include "gcc_compat.h" + #include "static_assert.h" + ++#if defined(NLM_F_CAPPED) || (defined(HAVE_DECL_NLM_F_CAPPED) && HAVE_DECL_NLM_F_CAPPED) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((NLM_F_CAPPED) == (0x100), "NLM_F_CAPPED != 0x100"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define NLM_F_CAPPED 0x100 ++#endif ++#if defined(NLM_F_ACK_TLVS) || (defined(HAVE_DECL_NLM_F_ACK_TLVS) && HAVE_DECL_NLM_F_ACK_TLVS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((NLM_F_ACK_TLVS) == (0x200), "NLM_F_ACK_TLVS != 0x200"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define NLM_F_ACK_TLVS 0x200 ++#endif + + #ifndef XLAT_MACROS_ONLY + +@@ -14,12 +28,8 @@ + + static + const struct xlat netlink_ack_flags[] = { +-#if defined(NLM_F_CAPPED) || (defined(HAVE_DECL_NLM_F_CAPPED) && HAVE_DECL_NLM_F_CAPPED) +- XLAT(NLM_F_CAPPED), +-#endif +-#if defined(NLM_F_ACK_TLVS) || (defined(HAVE_DECL_NLM_F_ACK_TLVS) && HAVE_DECL_NLM_F_ACK_TLVS) +- XLAT(NLM_F_ACK_TLVS), +-#endif ++ XLAT(NLM_F_CAPPED), ++ XLAT(NLM_F_ACK_TLVS), + XLAT_END + }; + diff --git a/SOURCES/0055-xlat-provide-fallback-definitions-for-XDP_FLAGS_-con.patch b/SOURCES/0055-xlat-provide-fallback-definitions-for-XDP_FLAGS_-con.patch new file mode 100644 index 0000000..ae6be70 --- /dev/null +++ b/SOURCES/0055-xlat-provide-fallback-definitions-for-XDP_FLAGS_-con.patch @@ -0,0 +1,101 @@ +From 5ca08b7fac24f21cfd1ae02dbc10e3886f68d858 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Thu, 10 Oct 2019 11:23:00 +0200 +Subject: [PATCH 55/76] xlat: provide fallback definitions for XDP_FLAGS_* + constants + +* xlat/xdp_flags.in: Add fallback definitions. + +References: https://bugzilla.redhat.com/show_bug.cgi?id=1758201 +--- + xlat/xdp_flags.in | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +Index: strace-5.1/xlat/xdp_flags.in +=================================================================== +--- strace-5.1.orig/xlat/xdp_flags.in 2017-09-03 17:39:24.000000000 +0200 ++++ strace-5.1/xlat/xdp_flags.in 2020-01-29 12:16:20.823861980 +0100 +@@ -1,5 +1,5 @@ +-XDP_FLAGS_MODES +-XDP_FLAGS_UPDATE_IF_NOEXIST +-XDP_FLAGS_SKB_MODE +-XDP_FLAGS_DRV_MODE +-XDP_FLAGS_HW_MODE ++XDP_FLAGS_MODES 0xe ++XDP_FLAGS_UPDATE_IF_NOEXIST 0x1 ++XDP_FLAGS_SKB_MODE 0x2 ++XDP_FLAGS_DRV_MODE 0x4 ++XDP_FLAGS_HW_MODE 0x8 +Index: strace-5.1/xlat/xdp_flags.h +=================================================================== +--- strace-5.1.orig/xlat/xdp_flags.h 2019-05-22 15:08:31.000000000 +0200 ++++ strace-5.1/xlat/xdp_flags.h 2020-01-29 12:16:47.515705540 +0100 +@@ -3,6 +3,41 @@ + #include "gcc_compat.h" + #include "static_assert.h" + ++#if defined(XDP_FLAGS_MODES) || (defined(HAVE_DECL_XDP_FLAGS_MODES) && HAVE_DECL_XDP_FLAGS_MODES) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((XDP_FLAGS_MODES) == (0xe), "XDP_FLAGS_MODES != 0xe"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define XDP_FLAGS_MODES 0xe ++#endif ++#if defined(XDP_FLAGS_UPDATE_IF_NOEXIST) || (defined(HAVE_DECL_XDP_FLAGS_UPDATE_IF_NOEXIST) && HAVE_DECL_XDP_FLAGS_UPDATE_IF_NOEXIST) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((XDP_FLAGS_UPDATE_IF_NOEXIST) == (0x1), "XDP_FLAGS_UPDATE_IF_NOEXIST != 0x1"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define XDP_FLAGS_UPDATE_IF_NOEXIST 0x1 ++#endif ++#if defined(XDP_FLAGS_SKB_MODE) || (defined(HAVE_DECL_XDP_FLAGS_SKB_MODE) && HAVE_DECL_XDP_FLAGS_SKB_MODE) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((XDP_FLAGS_SKB_MODE) == (0x2), "XDP_FLAGS_SKB_MODE != 0x2"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define XDP_FLAGS_SKB_MODE 0x2 ++#endif ++#if defined(XDP_FLAGS_DRV_MODE) || (defined(HAVE_DECL_XDP_FLAGS_DRV_MODE) && HAVE_DECL_XDP_FLAGS_DRV_MODE) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((XDP_FLAGS_DRV_MODE) == (0x4), "XDP_FLAGS_DRV_MODE != 0x4"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define XDP_FLAGS_DRV_MODE 0x4 ++#endif ++#if defined(XDP_FLAGS_HW_MODE) || (defined(HAVE_DECL_XDP_FLAGS_HW_MODE) && HAVE_DECL_XDP_FLAGS_HW_MODE) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((XDP_FLAGS_HW_MODE) == (0x8), "XDP_FLAGS_HW_MODE != 0x8"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define XDP_FLAGS_HW_MODE 0x8 ++#endif + + #ifndef XLAT_MACROS_ONLY + +@@ -14,21 +49,11 @@ + + static + const struct xlat xdp_flags[] = { +-#if defined(XDP_FLAGS_MODES) || (defined(HAVE_DECL_XDP_FLAGS_MODES) && HAVE_DECL_XDP_FLAGS_MODES) +- XLAT(XDP_FLAGS_MODES), +-#endif +-#if defined(XDP_FLAGS_UPDATE_IF_NOEXIST) || (defined(HAVE_DECL_XDP_FLAGS_UPDATE_IF_NOEXIST) && HAVE_DECL_XDP_FLAGS_UPDATE_IF_NOEXIST) +- XLAT(XDP_FLAGS_UPDATE_IF_NOEXIST), +-#endif +-#if defined(XDP_FLAGS_SKB_MODE) || (defined(HAVE_DECL_XDP_FLAGS_SKB_MODE) && HAVE_DECL_XDP_FLAGS_SKB_MODE) +- XLAT(XDP_FLAGS_SKB_MODE), +-#endif +-#if defined(XDP_FLAGS_DRV_MODE) || (defined(HAVE_DECL_XDP_FLAGS_DRV_MODE) && HAVE_DECL_XDP_FLAGS_DRV_MODE) +- XLAT(XDP_FLAGS_DRV_MODE), +-#endif +-#if defined(XDP_FLAGS_HW_MODE) || (defined(HAVE_DECL_XDP_FLAGS_HW_MODE) && HAVE_DECL_XDP_FLAGS_HW_MODE) +- XLAT(XDP_FLAGS_HW_MODE), +-#endif ++ XLAT(XDP_FLAGS_MODES), ++ XLAT(XDP_FLAGS_UPDATE_IF_NOEXIST), ++ XLAT(XDP_FLAGS_SKB_MODE), ++ XLAT(XDP_FLAGS_DRV_MODE), ++ XLAT(XDP_FLAGS_HW_MODE), + XLAT_END + }; + diff --git a/SOURCES/0056-xlat-update-MDB_FLAGS_-constants.patch b/SOURCES/0056-xlat-update-MDB_FLAGS_-constants.patch new file mode 100644 index 0000000..4b900cc --- /dev/null +++ b/SOURCES/0056-xlat-update-MDB_FLAGS_-constants.patch @@ -0,0 +1,59 @@ +From 2947a7dc764413f236db956b0d5af0a6f4169eee Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Thu, 10 Oct 2019 11:49:02 +0200 +Subject: [PATCH 56/76] xlat: update MDB_FLAGS_* constants + +Also, provide fallback definitions for constants. + +* xlat/mdb_flags.in (MDB_FLAGS_OFFLOAD): Add fallback definition. +(MDB_FLAGS_FAST_LEAVE): New constant, introduced by Linux commit +v5.4-rc1~131^2~321. +--- + xlat/mdb_flags.in | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +Index: strace-5.1/xlat/mdb_flags.in +=================================================================== +--- strace-5.1.orig/xlat/mdb_flags.in 2017-09-17 14:04:11.000000000 +0200 ++++ strace-5.1/xlat/mdb_flags.in 2020-01-29 12:28:36.222845420 +0100 +@@ -1 +1,2 @@ +-MDB_FLAGS_OFFLOAD ++MDB_FLAGS_OFFLOAD (1 << 0) ++MDB_FLAGS_FAST_LEAVE (1 << 1) +Index: strace-5.1/xlat/mdb_flags.h +=================================================================== +--- strace-5.1.orig/xlat/mdb_flags.h 2019-05-22 15:08:30.000000000 +0200 ++++ strace-5.1/xlat/mdb_flags.h 2020-01-29 12:32:34.459433886 +0100 +@@ -3,6 +3,20 @@ + #include "gcc_compat.h" + #include "static_assert.h" + ++#if defined(MDB_FLAGS_OFFLOAD) || (defined(HAVE_DECL_MDB_FLAGS_OFFLOAD) && HAVE_DECL_MDB_FLAGS_OFFLOAD) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((MDB_FLAGS_OFFLOAD) == ((1 << 0)), "MDB_FLAGS_OFFLOAD != (1 << 0)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define MDB_FLAGS_OFFLOAD (1 << 0) ++#endif ++#if defined(MDB_FLAGS_FAST_LEAVE) || (defined(HAVE_DECL_MDB_FLAGS_FAST_LEAVE) && HAVE_DECL_MDB_FLAGS_FAST_LEAVE) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((MDB_FLAGS_FAST_LEAVE) == ((1 << 1)), "MDB_FLAGS_FAST_LEAVE != (1 << 1)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define MDB_FLAGS_FAST_LEAVE (1 << 1) ++#endif + + #ifndef XLAT_MACROS_ONLY + +@@ -14,9 +28,8 @@ + + static + const struct xlat mdb_flags[] = { +-#if defined(MDB_FLAGS_OFFLOAD) || (defined(HAVE_DECL_MDB_FLAGS_OFFLOAD) && HAVE_DECL_MDB_FLAGS_OFFLOAD) +- XLAT(MDB_FLAGS_OFFLOAD), +-#endif ++ XLAT(MDB_FLAGS_OFFLOAD), ++ XLAT(MDB_FLAGS_FAST_LEAVE), + XLAT_END + }; + diff --git a/SOURCES/0057-rtnl_rule-decode-fib_rule_uid_range-without-use-of-l.patch b/SOURCES/0057-rtnl_rule-decode-fib_rule_uid_range-without-use-of-l.patch new file mode 100644 index 0000000..e119616 --- /dev/null +++ b/SOURCES/0057-rtnl_rule-decode-fib_rule_uid_range-without-use-of-l.patch @@ -0,0 +1,148 @@ +From 23f0dc01aec74e21eca3bf1fd532a0ef853db7b4 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Thu, 10 Oct 2019 10:27:40 +0200 +Subject: [PATCH 57/76] rtnl_rule: decode fib_rule_uid_range without use of + + +* rtnl_rule.c (decode_fib_rule_uid_range): Define struct type for +fib_rule_uid_range explicitly. +(decode_fib_rule_uid_range) [!HAVE_STRUCT_FIB_RULE_UID_RANGE]: Remove. +* xlat/fib_rule_flags.in: Add fallback definitions. + +References: https://bugzilla.redhat.com/show_bug.cgi?id=1758201 +--- + rtnl_rule.c | 9 ++++----- + xlat/fib_rule_flags.in | 12 ++++++------ + 2 files changed, 10 insertions(+), 11 deletions(-) + +Index: strace-5.1/rtnl_rule.c +=================================================================== +--- strace-5.1.orig/rtnl_rule.c 2018-12-10 01:00:00.000000000 +0100 ++++ strace-5.1/rtnl_rule.c 2020-01-29 12:32:57.315224088 +0100 +@@ -42,8 +42,10 @@ + const unsigned int len, + const void *const opaque_data) + { +-#ifdef HAVE_STRUCT_FIB_RULE_UID_RANGE +- struct fib_rule_uid_range range; ++ struct /* fib_rule_uid_range */ { ++ uint32_t start; ++ uint32_t end; ++ } range; + + if (len < sizeof(range)) + return false; +@@ -54,9 +56,6 @@ + } + + return true; +-#else +- return false; +-#endif + } + + static bool +Index: strace-5.1/xlat/fib_rule_flags.in +=================================================================== +--- strace-5.1.orig/xlat/fib_rule_flags.in 2017-08-14 03:06:59.000000000 +0200 ++++ strace-5.1/xlat/fib_rule_flags.in 2020-01-29 12:32:57.316224079 +0100 +@@ -1,6 +1,6 @@ +-FIB_RULE_PERMANENT +-FIB_RULE_INVERT +-FIB_RULE_UNRESOLVED +-FIB_RULE_IIF_DETACHED +-FIB_RULE_OIF_DETACHED +-FIB_RULE_FIND_SADDR ++FIB_RULE_PERMANENT 0x00000001 ++FIB_RULE_INVERT 0x00000002 ++FIB_RULE_UNRESOLVED 0x00000004 ++FIB_RULE_IIF_DETACHED 0x00000008 ++FIB_RULE_OIF_DETACHED 0x00000010 ++FIB_RULE_FIND_SADDR 0x00010000 +Index: strace-5.1/xlat/fib_rule_flags.h +=================================================================== +--- strace-5.1.orig/xlat/fib_rule_flags.h 2019-05-22 15:08:30.000000000 +0200 ++++ strace-5.1/xlat/fib_rule_flags.h 2020-01-29 12:33:16.856044719 +0100 +@@ -3,35 +3,65 @@ + #include "gcc_compat.h" + #include "static_assert.h" + +- +-#ifndef XLAT_MACROS_ONLY +- +-# ifdef IN_MPERS +- +-# error static const struct xlat fib_rule_flags in mpers mode +- +-# else +- +-static +-const struct xlat fib_rule_flags[] = { + #if defined(FIB_RULE_PERMANENT) || (defined(HAVE_DECL_FIB_RULE_PERMANENT) && HAVE_DECL_FIB_RULE_PERMANENT) +- XLAT(FIB_RULE_PERMANENT), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((FIB_RULE_PERMANENT) == (0x00000001), "FIB_RULE_PERMANENT != 0x00000001"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define FIB_RULE_PERMANENT 0x00000001 + #endif + #if defined(FIB_RULE_INVERT) || (defined(HAVE_DECL_FIB_RULE_INVERT) && HAVE_DECL_FIB_RULE_INVERT) +- XLAT(FIB_RULE_INVERT), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((FIB_RULE_INVERT) == (0x00000002), "FIB_RULE_INVERT != 0x00000002"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define FIB_RULE_INVERT 0x00000002 + #endif + #if defined(FIB_RULE_UNRESOLVED) || (defined(HAVE_DECL_FIB_RULE_UNRESOLVED) && HAVE_DECL_FIB_RULE_UNRESOLVED) +- XLAT(FIB_RULE_UNRESOLVED), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((FIB_RULE_UNRESOLVED) == (0x00000004), "FIB_RULE_UNRESOLVED != 0x00000004"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define FIB_RULE_UNRESOLVED 0x00000004 + #endif + #if defined(FIB_RULE_IIF_DETACHED) || (defined(HAVE_DECL_FIB_RULE_IIF_DETACHED) && HAVE_DECL_FIB_RULE_IIF_DETACHED) +- XLAT(FIB_RULE_IIF_DETACHED), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((FIB_RULE_IIF_DETACHED) == (0x00000008), "FIB_RULE_IIF_DETACHED != 0x00000008"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define FIB_RULE_IIF_DETACHED 0x00000008 + #endif + #if defined(FIB_RULE_OIF_DETACHED) || (defined(HAVE_DECL_FIB_RULE_OIF_DETACHED) && HAVE_DECL_FIB_RULE_OIF_DETACHED) +- XLAT(FIB_RULE_OIF_DETACHED), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((FIB_RULE_OIF_DETACHED) == (0x00000010), "FIB_RULE_OIF_DETACHED != 0x00000010"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define FIB_RULE_OIF_DETACHED 0x00000010 + #endif + #if defined(FIB_RULE_FIND_SADDR) || (defined(HAVE_DECL_FIB_RULE_FIND_SADDR) && HAVE_DECL_FIB_RULE_FIND_SADDR) +- XLAT(FIB_RULE_FIND_SADDR), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((FIB_RULE_FIND_SADDR) == (0x00010000), "FIB_RULE_FIND_SADDR != 0x00010000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define FIB_RULE_FIND_SADDR 0x00010000 + #endif ++ ++#ifndef XLAT_MACROS_ONLY ++ ++# ifdef IN_MPERS ++ ++# error static const struct xlat fib_rule_flags in mpers mode ++ ++# else ++ ++static ++const struct xlat fib_rule_flags[] = { ++ XLAT(FIB_RULE_PERMANENT), ++ XLAT(FIB_RULE_INVERT), ++ XLAT(FIB_RULE_UNRESOLVED), ++ XLAT(FIB_RULE_IIF_DETACHED), ++ XLAT(FIB_RULE_OIF_DETACHED), ++ XLAT(FIB_RULE_FIND_SADDR), + XLAT_END + }; + diff --git a/SOURCES/0058-xlat-provide-fallback-definitions-for-ABS_MT_-consta.patch b/SOURCES/0058-xlat-provide-fallback-definitions-for-ABS_MT_-consta.patch new file mode 100644 index 0000000..ff472a6 --- /dev/null +++ b/SOURCES/0058-xlat-provide-fallback-definitions-for-ABS_MT_-consta.patch @@ -0,0 +1,216 @@ +From b31fdb9db2fdab3df9f3225c3adcfee2bbb763e0 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Sun, 13 Oct 2019 17:06:08 +0200 +Subject: [PATCH 58/76] xlat: provide fallback definitions for ABS_MT_* + constants + +* xlat/evdev_mtslots.in: Add fallback definitions. Add #sorted. + +References: https://bugzilla.redhat.com/show_bug.cgi?id=1758201 +--- + xlat/evdev_mtslots.in | 30 +++++++++++++++--------------- + 1 file changed, 15 insertions(+), 15 deletions(-) + +Index: strace-5.1/xlat/evdev_mtslots.in +=================================================================== +--- strace-5.1.orig/xlat/evdev_mtslots.in 2015-02-22 03:29:54.000000000 +0100 ++++ strace-5.1/xlat/evdev_mtslots.in 2020-01-29 12:33:27.876943556 +0100 +@@ -1,15 +1,15 @@ +-ABS_MT_SLOT +-ABS_MT_TOUCH_MAJOR +-ABS_MT_TOUCH_MINOR +-ABS_MT_WIDTH_MAJOR +-ABS_MT_WIDTH_MINOR +-ABS_MT_ORIENTATION +-ABS_MT_POSITION_X +-ABS_MT_POSITION_Y +-ABS_MT_TOOL_TYPE +-ABS_MT_BLOB_ID +-ABS_MT_TRACKING_ID +-ABS_MT_PRESSURE +-ABS_MT_DISTANCE +-ABS_MT_TOOL_X +-ABS_MT_TOOL_Y ++ABS_MT_SLOT 0x2f ++ABS_MT_TOUCH_MAJOR 0x30 ++ABS_MT_TOUCH_MINOR 0x31 ++ABS_MT_WIDTH_MAJOR 0x32 ++ABS_MT_WIDTH_MINOR 0x33 ++ABS_MT_ORIENTATION 0x34 ++ABS_MT_POSITION_X 0x35 ++ABS_MT_POSITION_Y 0x36 ++ABS_MT_TOOL_TYPE 0x37 ++ABS_MT_BLOB_ID 0x38 ++ABS_MT_TRACKING_ID 0x39 ++ABS_MT_PRESSURE 0x3a ++ABS_MT_DISTANCE 0x3b ++ABS_MT_TOOL_X 0x3c ++ABS_MT_TOOL_Y 0x3d +Index: strace-5.1/xlat/evdev_mtslots.h +=================================================================== +--- strace-5.1.orig/xlat/evdev_mtslots.h 2019-05-22 15:08:30.000000000 +0200 ++++ strace-5.1/xlat/evdev_mtslots.h 2020-01-29 12:33:40.167830736 +0100 +@@ -3,62 +3,137 @@ + #include "gcc_compat.h" + #include "static_assert.h" + +- +-#ifndef XLAT_MACROS_ONLY +- +-# ifdef IN_MPERS +- +-# error static const struct xlat evdev_mtslots in mpers mode +- +-# else +- +-static +-const struct xlat evdev_mtslots[] = { + #if defined(ABS_MT_SLOT) || (defined(HAVE_DECL_ABS_MT_SLOT) && HAVE_DECL_ABS_MT_SLOT) +- XLAT(ABS_MT_SLOT), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((ABS_MT_SLOT) == (0x2f), "ABS_MT_SLOT != 0x2f"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define ABS_MT_SLOT 0x2f + #endif + #if defined(ABS_MT_TOUCH_MAJOR) || (defined(HAVE_DECL_ABS_MT_TOUCH_MAJOR) && HAVE_DECL_ABS_MT_TOUCH_MAJOR) +- XLAT(ABS_MT_TOUCH_MAJOR), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((ABS_MT_TOUCH_MAJOR) == (0x30), "ABS_MT_TOUCH_MAJOR != 0x30"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define ABS_MT_TOUCH_MAJOR 0x30 + #endif + #if defined(ABS_MT_TOUCH_MINOR) || (defined(HAVE_DECL_ABS_MT_TOUCH_MINOR) && HAVE_DECL_ABS_MT_TOUCH_MINOR) +- XLAT(ABS_MT_TOUCH_MINOR), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((ABS_MT_TOUCH_MINOR) == (0x31), "ABS_MT_TOUCH_MINOR != 0x31"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define ABS_MT_TOUCH_MINOR 0x31 + #endif + #if defined(ABS_MT_WIDTH_MAJOR) || (defined(HAVE_DECL_ABS_MT_WIDTH_MAJOR) && HAVE_DECL_ABS_MT_WIDTH_MAJOR) +- XLAT(ABS_MT_WIDTH_MAJOR), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((ABS_MT_WIDTH_MAJOR) == (0x32), "ABS_MT_WIDTH_MAJOR != 0x32"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define ABS_MT_WIDTH_MAJOR 0x32 + #endif + #if defined(ABS_MT_WIDTH_MINOR) || (defined(HAVE_DECL_ABS_MT_WIDTH_MINOR) && HAVE_DECL_ABS_MT_WIDTH_MINOR) +- XLAT(ABS_MT_WIDTH_MINOR), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((ABS_MT_WIDTH_MINOR) == (0x33), "ABS_MT_WIDTH_MINOR != 0x33"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define ABS_MT_WIDTH_MINOR 0x33 + #endif + #if defined(ABS_MT_ORIENTATION) || (defined(HAVE_DECL_ABS_MT_ORIENTATION) && HAVE_DECL_ABS_MT_ORIENTATION) +- XLAT(ABS_MT_ORIENTATION), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((ABS_MT_ORIENTATION) == (0x34), "ABS_MT_ORIENTATION != 0x34"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define ABS_MT_ORIENTATION 0x34 + #endif + #if defined(ABS_MT_POSITION_X) || (defined(HAVE_DECL_ABS_MT_POSITION_X) && HAVE_DECL_ABS_MT_POSITION_X) +- XLAT(ABS_MT_POSITION_X), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((ABS_MT_POSITION_X) == (0x35), "ABS_MT_POSITION_X != 0x35"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define ABS_MT_POSITION_X 0x35 + #endif + #if defined(ABS_MT_POSITION_Y) || (defined(HAVE_DECL_ABS_MT_POSITION_Y) && HAVE_DECL_ABS_MT_POSITION_Y) +- XLAT(ABS_MT_POSITION_Y), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((ABS_MT_POSITION_Y) == (0x36), "ABS_MT_POSITION_Y != 0x36"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define ABS_MT_POSITION_Y 0x36 + #endif + #if defined(ABS_MT_TOOL_TYPE) || (defined(HAVE_DECL_ABS_MT_TOOL_TYPE) && HAVE_DECL_ABS_MT_TOOL_TYPE) +- XLAT(ABS_MT_TOOL_TYPE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((ABS_MT_TOOL_TYPE) == (0x37), "ABS_MT_TOOL_TYPE != 0x37"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define ABS_MT_TOOL_TYPE 0x37 + #endif + #if defined(ABS_MT_BLOB_ID) || (defined(HAVE_DECL_ABS_MT_BLOB_ID) && HAVE_DECL_ABS_MT_BLOB_ID) +- XLAT(ABS_MT_BLOB_ID), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((ABS_MT_BLOB_ID) == (0x38), "ABS_MT_BLOB_ID != 0x38"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define ABS_MT_BLOB_ID 0x38 + #endif + #if defined(ABS_MT_TRACKING_ID) || (defined(HAVE_DECL_ABS_MT_TRACKING_ID) && HAVE_DECL_ABS_MT_TRACKING_ID) +- XLAT(ABS_MT_TRACKING_ID), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((ABS_MT_TRACKING_ID) == (0x39), "ABS_MT_TRACKING_ID != 0x39"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define ABS_MT_TRACKING_ID 0x39 + #endif + #if defined(ABS_MT_PRESSURE) || (defined(HAVE_DECL_ABS_MT_PRESSURE) && HAVE_DECL_ABS_MT_PRESSURE) +- XLAT(ABS_MT_PRESSURE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((ABS_MT_PRESSURE) == (0x3a), "ABS_MT_PRESSURE != 0x3a"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define ABS_MT_PRESSURE 0x3a + #endif + #if defined(ABS_MT_DISTANCE) || (defined(HAVE_DECL_ABS_MT_DISTANCE) && HAVE_DECL_ABS_MT_DISTANCE) +- XLAT(ABS_MT_DISTANCE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((ABS_MT_DISTANCE) == (0x3b), "ABS_MT_DISTANCE != 0x3b"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define ABS_MT_DISTANCE 0x3b + #endif + #if defined(ABS_MT_TOOL_X) || (defined(HAVE_DECL_ABS_MT_TOOL_X) && HAVE_DECL_ABS_MT_TOOL_X) +- XLAT(ABS_MT_TOOL_X), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((ABS_MT_TOOL_X) == (0x3c), "ABS_MT_TOOL_X != 0x3c"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define ABS_MT_TOOL_X 0x3c + #endif + #if defined(ABS_MT_TOOL_Y) || (defined(HAVE_DECL_ABS_MT_TOOL_Y) && HAVE_DECL_ABS_MT_TOOL_Y) +- XLAT(ABS_MT_TOOL_Y), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((ABS_MT_TOOL_Y) == (0x3d), "ABS_MT_TOOL_Y != 0x3d"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define ABS_MT_TOOL_Y 0x3d + #endif ++ ++#ifndef XLAT_MACROS_ONLY ++ ++# ifdef IN_MPERS ++ ++# error static const struct xlat evdev_mtslots in mpers mode ++ ++# else ++ ++static ++const struct xlat evdev_mtslots[] = { ++ XLAT(ABS_MT_SLOT), ++ XLAT(ABS_MT_TOUCH_MAJOR), ++ XLAT(ABS_MT_TOUCH_MINOR), ++ XLAT(ABS_MT_WIDTH_MAJOR), ++ XLAT(ABS_MT_WIDTH_MINOR), ++ XLAT(ABS_MT_ORIENTATION), ++ XLAT(ABS_MT_POSITION_X), ++ XLAT(ABS_MT_POSITION_Y), ++ XLAT(ABS_MT_TOOL_TYPE), ++ XLAT(ABS_MT_BLOB_ID), ++ XLAT(ABS_MT_TRACKING_ID), ++ XLAT(ABS_MT_PRESSURE), ++ XLAT(ABS_MT_DISTANCE), ++ XLAT(ABS_MT_TOOL_X), ++ XLAT(ABS_MT_TOOL_Y), + XLAT_END + }; + diff --git a/SOURCES/0059-tests-introduce-TEST_NLATTR_OBJECT_MINSZ.patch b/SOURCES/0059-tests-introduce-TEST_NLATTR_OBJECT_MINSZ.patch new file mode 100644 index 0000000..39901e2 --- /dev/null +++ b/SOURCES/0059-tests-introduce-TEST_NLATTR_OBJECT_MINSZ.patch @@ -0,0 +1,367 @@ +From c9e520582586dd309462646d330654e02c531226 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Thu, 10 Oct 2019 18:19:31 +0200 +Subject: [PATCH 59/76] tests: introduce TEST_NLATTR_OBJECT_MINSZ + +It is useful in cases where a structure grows over time and we support +decoding of only part of it. + +* tests/test_nlattr.h (TEST_NLATTR_OBJECT_EX_, TEST_NLATTR_OBJECT_EX): +Add minsz_ parameter, use it instead of sizeof(obj_). +(TEST_NLATTR_OBJECT): Pass sizeof(obj_) as minsz_. +(TEST_NLATTR_OBJECT_MINSZ): New macro. +* tests/nlattr_crypto_user_alg.c (main): Add proper minsz_ argument to +TEST_NLATTR_OBJECT_EX instances. +--- + tests/nlattr_crypto_user_alg.c | 14 +++++++++----- + tests/test_nlattr.h | 27 +++++++++++++++++---------- + 2 files changed, 26 insertions(+), 15 deletions(-) + +Index: strace-5.1/tests/nlattr_crypto_user_alg.c +=================================================================== +--- strace-5.1.orig/tests/nlattr_crypto_user_alg.c 2018-12-30 16:35:21.000000000 +0100 ++++ strace-5.1/tests/nlattr_crypto_user_alg.c 2020-01-29 12:33:55.598689093 +0100 +@@ -85,7 +85,8 @@ + TEST_NLATTR_OBJECT_EX(fd, nlh0, hdrlen, + init_crypto_user_alg, print_crypto_user_alg, + CRYPTOCFGA_REPORT_HASH, +- pattern, rhash, print_quoted_memory, ++ pattern, rhash, sizeof(rhash), ++ print_quoted_memory, + printf("{type=\"efgh\""); + PRINT_FIELD_U(", ", rhash, blocksize); + PRINT_FIELD_U(", ", rhash, digestsize); +@@ -104,7 +105,8 @@ + TEST_NLATTR_OBJECT_EX(fd, nlh0, hdrlen, + init_crypto_user_alg, print_crypto_user_alg, + CRYPTOCFGA_REPORT_BLKCIPHER, +- pattern, rblkcipher, print_quoted_memory, ++ pattern, rblkcipher, sizeof(rblkcipher), ++ print_quoted_memory, + printf("{type=\"abcd\", geniv=\"efgh\""); + PRINT_FIELD_U(", ", rblkcipher, blocksize); + PRINT_FIELD_U(", ", rblkcipher, min_keysize); +@@ -124,7 +126,8 @@ + TEST_NLATTR_OBJECT_EX(fd, nlh0, hdrlen, + init_crypto_user_alg, print_crypto_user_alg, + CRYPTOCFGA_REPORT_AEAD, +- pattern, raead, print_quoted_memory, ++ pattern, raead, sizeof(raead), ++ print_quoted_memory, + printf("{type=\"abcd\", geniv=\"efgh\""); + PRINT_FIELD_U(", ", raead, blocksize); + PRINT_FIELD_U(", ", raead, maxauthsize); +@@ -140,7 +143,7 @@ + TEST_NLATTR_OBJECT_EX(fd, nlh0, hdrlen, + init_crypto_user_alg, print_crypto_user_alg, + CRYPTOCFGA_REPORT_RNG, +- pattern, rrng, print_quoted_memory, ++ pattern, rrng, sizeof(rrng), print_quoted_memory, + printf("{type=\"abcd\""); + PRINT_FIELD_U(", ", rrng, seedsize); + printf("}")); +@@ -156,7 +159,8 @@ + TEST_NLATTR_OBJECT_EX(fd, nlh0, hdrlen, + init_crypto_user_alg, print_crypto_user_alg, + CRYPTOCFGA_REPORT_CIPHER, +- pattern, rcipher, print_quoted_memory, ++ pattern, rcipher, sizeof(rcipher), ++ print_quoted_memory, + printf("{type=\"abcd\""); + PRINT_FIELD_U(", ", rcipher, blocksize); + PRINT_FIELD_U(", ", rcipher, min_keysize); +Index: strace-5.1/tests/test_nlattr.h +=================================================================== +--- strace-5.1.orig/tests/test_nlattr.h 2018-12-10 01:00:00.000000000 +0100 ++++ strace-5.1/tests/test_nlattr.h 2020-01-29 12:33:55.604689038 +0100 +@@ -96,11 +96,9 @@ + #define TEST_NLATTR_OBJECT_EX_(fd_, nlh0_, hdrlen_, \ + init_msg_, print_msg_, \ + nla_type_, nla_type_str_, \ +- pattern_, obj_, fallback_func, ...) \ ++ pattern_, obj_, minsz_, fallback_func, ...) \ + do { \ +- const unsigned int plen = \ +- sizeof(obj_) - 1 > DEFAULT_STRLEN \ +- ? DEFAULT_STRLEN : (int) sizeof(obj_) - 1; \ ++ const unsigned int plen = MIN((minsz_) - 1, DEFAULT_STRLEN); \ + /* len < sizeof(obj_) */ \ + if (plen > 0) \ + TEST_NLATTR_((fd_), (nlh0_), (hdrlen_), \ +@@ -113,7 +111,7 @@ + (init_msg_), (print_msg_), \ + (nla_type_), (nla_type_str_), \ + sizeof(obj_), \ +- (pattern_), sizeof(obj_) - 1, \ ++ (pattern_), (minsz_) - 1, \ + printf("%p", \ + RTA_DATA(NLMSG_ATTR(nlh, (hdrlen_))))); \ + /* sizeof(obj_) */ \ +@@ -128,12 +126,12 @@ + #define TEST_NLATTR_OBJECT_EX(fd_, nlh0_, hdrlen_, \ + init_msg_, print_msg_, \ + nla_type_, \ +- pattern_, obj_, fallback_func, ...) \ ++ pattern_, obj_, minsz_, fallback_func, ...) \ + TEST_NLATTR_OBJECT_EX_((fd_), (nlh0_), (hdrlen_), \ + (init_msg_), (print_msg_), \ + (nla_type_), #nla_type_, \ +- (pattern_), (obj_), (fallback_func), \ +- __VA_ARGS__) ++ (pattern_), (obj_), (minsz_), \ ++ (fallback_func), __VA_ARGS__) + + #define TEST_NLATTR_OBJECT(fd_, nlh0_, hdrlen_, \ + init_msg_, print_msg_, \ +@@ -141,8 +139,17 @@ + TEST_NLATTR_OBJECT_EX_((fd_), (nlh0_), (hdrlen_), \ + (init_msg_), (print_msg_), \ + (nla_type_), #nla_type_, \ +- (pattern_), (obj_), print_quoted_hex, \ +- __VA_ARGS__) ++ (pattern_), (obj_), sizeof(obj_), \ ++ print_quoted_hex, __VA_ARGS__) ++ ++#define TEST_NLATTR_OBJECT_MINSZ(fd_, nlh0_, hdrlen_, \ ++ init_msg_, print_msg_, \ ++ nla_type_, pattern_, obj_, minsz_, ...) \ ++ TEST_NLATTR_OBJECT_EX_((fd_), (nlh0_), (hdrlen_), \ ++ (init_msg_), (print_msg_), \ ++ (nla_type_), #nla_type_, \ ++ (pattern_), (obj_), (minsz_), \ ++ print_quoted_hex, __VA_ARGS__) + + #define TEST_NLATTR_ARRAY(fd_, nlh0_, hdrlen_, \ + init_msg_, print_msg_, \ +Index: strace-5.1/tests-m32/nlattr_crypto_user_alg.c +=================================================================== +--- strace-5.1.orig/tests-m32/nlattr_crypto_user_alg.c 2018-12-30 16:35:21.000000000 +0100 ++++ strace-5.1/tests-m32/nlattr_crypto_user_alg.c 2020-01-29 12:35:29.940886920 +0100 +@@ -85,7 +85,8 @@ + TEST_NLATTR_OBJECT_EX(fd, nlh0, hdrlen, + init_crypto_user_alg, print_crypto_user_alg, + CRYPTOCFGA_REPORT_HASH, +- pattern, rhash, print_quoted_memory, ++ pattern, rhash, sizeof(rhash), ++ print_quoted_memory, + printf("{type=\"efgh\""); + PRINT_FIELD_U(", ", rhash, blocksize); + PRINT_FIELD_U(", ", rhash, digestsize); +@@ -104,7 +105,8 @@ + TEST_NLATTR_OBJECT_EX(fd, nlh0, hdrlen, + init_crypto_user_alg, print_crypto_user_alg, + CRYPTOCFGA_REPORT_BLKCIPHER, +- pattern, rblkcipher, print_quoted_memory, ++ pattern, rblkcipher, sizeof(rblkcipher), ++ print_quoted_memory, + printf("{type=\"abcd\", geniv=\"efgh\""); + PRINT_FIELD_U(", ", rblkcipher, blocksize); + PRINT_FIELD_U(", ", rblkcipher, min_keysize); +@@ -124,7 +126,8 @@ + TEST_NLATTR_OBJECT_EX(fd, nlh0, hdrlen, + init_crypto_user_alg, print_crypto_user_alg, + CRYPTOCFGA_REPORT_AEAD, +- pattern, raead, print_quoted_memory, ++ pattern, raead, sizeof(raead), ++ print_quoted_memory, + printf("{type=\"abcd\", geniv=\"efgh\""); + PRINT_FIELD_U(", ", raead, blocksize); + PRINT_FIELD_U(", ", raead, maxauthsize); +@@ -140,7 +143,7 @@ + TEST_NLATTR_OBJECT_EX(fd, nlh0, hdrlen, + init_crypto_user_alg, print_crypto_user_alg, + CRYPTOCFGA_REPORT_RNG, +- pattern, rrng, print_quoted_memory, ++ pattern, rrng, sizeof(rrng), print_quoted_memory, + printf("{type=\"abcd\""); + PRINT_FIELD_U(", ", rrng, seedsize); + printf("}")); +@@ -156,7 +159,8 @@ + TEST_NLATTR_OBJECT_EX(fd, nlh0, hdrlen, + init_crypto_user_alg, print_crypto_user_alg, + CRYPTOCFGA_REPORT_CIPHER, +- pattern, rcipher, print_quoted_memory, ++ pattern, rcipher, sizeof(rcipher), ++ print_quoted_memory, + printf("{type=\"abcd\""); + PRINT_FIELD_U(", ", rcipher, blocksize); + PRINT_FIELD_U(", ", rcipher, min_keysize); +Index: strace-5.1/tests-m32/test_nlattr.h +=================================================================== +--- strace-5.1.orig/tests-m32/test_nlattr.h 2018-12-10 01:00:00.000000000 +0100 ++++ strace-5.1/tests-m32/test_nlattr.h 2020-01-29 12:35:30.010886327 +0100 +@@ -96,11 +96,9 @@ + #define TEST_NLATTR_OBJECT_EX_(fd_, nlh0_, hdrlen_, \ + init_msg_, print_msg_, \ + nla_type_, nla_type_str_, \ +- pattern_, obj_, fallback_func, ...) \ ++ pattern_, obj_, minsz_, fallback_func, ...) \ + do { \ +- const unsigned int plen = \ +- sizeof(obj_) - 1 > DEFAULT_STRLEN \ +- ? DEFAULT_STRLEN : (int) sizeof(obj_) - 1; \ ++ const unsigned int plen = MIN((minsz_) - 1, DEFAULT_STRLEN); \ + /* len < sizeof(obj_) */ \ + if (plen > 0) \ + TEST_NLATTR_((fd_), (nlh0_), (hdrlen_), \ +@@ -113,7 +111,7 @@ + (init_msg_), (print_msg_), \ + (nla_type_), (nla_type_str_), \ + sizeof(obj_), \ +- (pattern_), sizeof(obj_) - 1, \ ++ (pattern_), (minsz_) - 1, \ + printf("%p", \ + RTA_DATA(NLMSG_ATTR(nlh, (hdrlen_))))); \ + /* sizeof(obj_) */ \ +@@ -128,12 +126,12 @@ + #define TEST_NLATTR_OBJECT_EX(fd_, nlh0_, hdrlen_, \ + init_msg_, print_msg_, \ + nla_type_, \ +- pattern_, obj_, fallback_func, ...) \ ++ pattern_, obj_, minsz_, fallback_func, ...) \ + TEST_NLATTR_OBJECT_EX_((fd_), (nlh0_), (hdrlen_), \ + (init_msg_), (print_msg_), \ + (nla_type_), #nla_type_, \ +- (pattern_), (obj_), (fallback_func), \ +- __VA_ARGS__) ++ (pattern_), (obj_), (minsz_), \ ++ (fallback_func), __VA_ARGS__) + + #define TEST_NLATTR_OBJECT(fd_, nlh0_, hdrlen_, \ + init_msg_, print_msg_, \ +@@ -141,8 +139,17 @@ + TEST_NLATTR_OBJECT_EX_((fd_), (nlh0_), (hdrlen_), \ + (init_msg_), (print_msg_), \ + (nla_type_), #nla_type_, \ +- (pattern_), (obj_), print_quoted_hex, \ +- __VA_ARGS__) ++ (pattern_), (obj_), sizeof(obj_), \ ++ print_quoted_hex, __VA_ARGS__) ++ ++#define TEST_NLATTR_OBJECT_MINSZ(fd_, nlh0_, hdrlen_, \ ++ init_msg_, print_msg_, \ ++ nla_type_, pattern_, obj_, minsz_, ...) \ ++ TEST_NLATTR_OBJECT_EX_((fd_), (nlh0_), (hdrlen_), \ ++ (init_msg_), (print_msg_), \ ++ (nla_type_), #nla_type_, \ ++ (pattern_), (obj_), (minsz_), \ ++ print_quoted_hex, __VA_ARGS__) + + #define TEST_NLATTR_ARRAY(fd_, nlh0_, hdrlen_, \ + init_msg_, print_msg_, \ +Index: strace-5.1/tests-mx32/nlattr_crypto_user_alg.c +=================================================================== +--- strace-5.1.orig/tests-mx32/nlattr_crypto_user_alg.c 2018-12-30 16:35:21.000000000 +0100 ++++ strace-5.1/tests-mx32/nlattr_crypto_user_alg.c 2020-01-29 12:35:29.946886869 +0100 +@@ -85,7 +85,8 @@ + TEST_NLATTR_OBJECT_EX(fd, nlh0, hdrlen, + init_crypto_user_alg, print_crypto_user_alg, + CRYPTOCFGA_REPORT_HASH, +- pattern, rhash, print_quoted_memory, ++ pattern, rhash, sizeof(rhash), ++ print_quoted_memory, + printf("{type=\"efgh\""); + PRINT_FIELD_U(", ", rhash, blocksize); + PRINT_FIELD_U(", ", rhash, digestsize); +@@ -104,7 +105,8 @@ + TEST_NLATTR_OBJECT_EX(fd, nlh0, hdrlen, + init_crypto_user_alg, print_crypto_user_alg, + CRYPTOCFGA_REPORT_BLKCIPHER, +- pattern, rblkcipher, print_quoted_memory, ++ pattern, rblkcipher, sizeof(rblkcipher), ++ print_quoted_memory, + printf("{type=\"abcd\", geniv=\"efgh\""); + PRINT_FIELD_U(", ", rblkcipher, blocksize); + PRINT_FIELD_U(", ", rblkcipher, min_keysize); +@@ -124,7 +126,8 @@ + TEST_NLATTR_OBJECT_EX(fd, nlh0, hdrlen, + init_crypto_user_alg, print_crypto_user_alg, + CRYPTOCFGA_REPORT_AEAD, +- pattern, raead, print_quoted_memory, ++ pattern, raead, sizeof(raead), ++ print_quoted_memory, + printf("{type=\"abcd\", geniv=\"efgh\""); + PRINT_FIELD_U(", ", raead, blocksize); + PRINT_FIELD_U(", ", raead, maxauthsize); +@@ -140,7 +143,7 @@ + TEST_NLATTR_OBJECT_EX(fd, nlh0, hdrlen, + init_crypto_user_alg, print_crypto_user_alg, + CRYPTOCFGA_REPORT_RNG, +- pattern, rrng, print_quoted_memory, ++ pattern, rrng, sizeof(rrng), print_quoted_memory, + printf("{type=\"abcd\""); + PRINT_FIELD_U(", ", rrng, seedsize); + printf("}")); +@@ -156,7 +159,8 @@ + TEST_NLATTR_OBJECT_EX(fd, nlh0, hdrlen, + init_crypto_user_alg, print_crypto_user_alg, + CRYPTOCFGA_REPORT_CIPHER, +- pattern, rcipher, print_quoted_memory, ++ pattern, rcipher, sizeof(rcipher), ++ print_quoted_memory, + printf("{type=\"abcd\""); + PRINT_FIELD_U(", ", rcipher, blocksize); + PRINT_FIELD_U(", ", rcipher, min_keysize); +Index: strace-5.1/tests-mx32/test_nlattr.h +=================================================================== +--- strace-5.1.orig/tests-mx32/test_nlattr.h 2018-12-10 01:00:00.000000000 +0100 ++++ strace-5.1/tests-mx32/test_nlattr.h 2020-01-29 12:35:30.012886310 +0100 +@@ -96,11 +96,9 @@ + #define TEST_NLATTR_OBJECT_EX_(fd_, nlh0_, hdrlen_, \ + init_msg_, print_msg_, \ + nla_type_, nla_type_str_, \ +- pattern_, obj_, fallback_func, ...) \ ++ pattern_, obj_, minsz_, fallback_func, ...) \ + do { \ +- const unsigned int plen = \ +- sizeof(obj_) - 1 > DEFAULT_STRLEN \ +- ? DEFAULT_STRLEN : (int) sizeof(obj_) - 1; \ ++ const unsigned int plen = MIN((minsz_) - 1, DEFAULT_STRLEN); \ + /* len < sizeof(obj_) */ \ + if (plen > 0) \ + TEST_NLATTR_((fd_), (nlh0_), (hdrlen_), \ +@@ -113,7 +111,7 @@ + (init_msg_), (print_msg_), \ + (nla_type_), (nla_type_str_), \ + sizeof(obj_), \ +- (pattern_), sizeof(obj_) - 1, \ ++ (pattern_), (minsz_) - 1, \ + printf("%p", \ + RTA_DATA(NLMSG_ATTR(nlh, (hdrlen_))))); \ + /* sizeof(obj_) */ \ +@@ -128,12 +126,12 @@ + #define TEST_NLATTR_OBJECT_EX(fd_, nlh0_, hdrlen_, \ + init_msg_, print_msg_, \ + nla_type_, \ +- pattern_, obj_, fallback_func, ...) \ ++ pattern_, obj_, minsz_, fallback_func, ...) \ + TEST_NLATTR_OBJECT_EX_((fd_), (nlh0_), (hdrlen_), \ + (init_msg_), (print_msg_), \ + (nla_type_), #nla_type_, \ +- (pattern_), (obj_), (fallback_func), \ +- __VA_ARGS__) ++ (pattern_), (obj_), (minsz_), \ ++ (fallback_func), __VA_ARGS__) + + #define TEST_NLATTR_OBJECT(fd_, nlh0_, hdrlen_, \ + init_msg_, print_msg_, \ +@@ -141,8 +139,17 @@ + TEST_NLATTR_OBJECT_EX_((fd_), (nlh0_), (hdrlen_), \ + (init_msg_), (print_msg_), \ + (nla_type_), #nla_type_, \ +- (pattern_), (obj_), print_quoted_hex, \ +- __VA_ARGS__) ++ (pattern_), (obj_), sizeof(obj_), \ ++ print_quoted_hex, __VA_ARGS__) ++ ++#define TEST_NLATTR_OBJECT_MINSZ(fd_, nlh0_, hdrlen_, \ ++ init_msg_, print_msg_, \ ++ nla_type_, pattern_, obj_, minsz_, ...) \ ++ TEST_NLATTR_OBJECT_EX_((fd_), (nlh0_), (hdrlen_), \ ++ (init_msg_), (print_msg_), \ ++ (nla_type_), #nla_type_, \ ++ (pattern_), (obj_), (minsz_), \ ++ print_quoted_hex, __VA_ARGS__) + + #define TEST_NLATTR_ARRAY(fd_, nlh0_, hdrlen_, \ + init_msg_, print_msg_, \ diff --git a/SOURCES/0060-evdev-remove-additional-indentation-level-for-switch.patch b/SOURCES/0060-evdev-remove-additional-indentation-level-for-switch.patch new file mode 100644 index 0000000..325ae76 --- /dev/null +++ b/SOURCES/0060-evdev-remove-additional-indentation-level-for-switch.patch @@ -0,0 +1,414 @@ +From e94797108b98045fcdbdebe2237f9d98b951fa96 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Sun, 13 Oct 2019 17:13:52 +0200 +Subject: [PATCH 60/76] evdev: remove additional indentation level for switch + case labels + +And while we are here, factor out evdev_write_ioctl_mpers call +out of the switch statement. + +* evdev.c (bit_ioctl, evdev_read_ioctl, evdev_ioctl): Remove +one indentation level inside the switch statements. +(evedev_write_ioctl): Remove one indentation level inside the switch +statement; move default branch out of the switch statement. + +Conflicts: + evdev.c +--- + evdev.c | 231 +++++++++++++++++++++++++++++----------------------------- + evdev_mpers.c | 86 +++++++++++----------- + 2 files changed, 158 insertions(+), 159 deletions(-) + +diff --git a/evdev.c b/evdev.c +index e402d26..b9ac666 100644 +--- a/evdev.c ++++ b/evdev.c +@@ -238,48 +238,48 @@ bit_ioctl(struct tcb *const tcp, const unsigned int ev_nr, + const kernel_ulong_t arg) + { + switch (ev_nr) { +- case 0: +- return decode_bitset(tcp, arg, evdev_ev, +- EV_MAX, "EV_???", XT_SORTED); +- case EV_KEY: +- return decode_bitset(tcp, arg, evdev_keycode, +- KEY_MAX, "KEY_???", XT_INDEXED); +- case EV_REL: +- return decode_bitset(tcp, arg, evdev_relative_axes, +- REL_MAX, "REL_???", XT_INDEXED); +- case EV_ABS: +- return decode_bitset(tcp, arg, evdev_abs, +- ABS_MAX, "ABS_???", XT_INDEXED); +- case EV_MSC: +- return decode_bitset(tcp, arg, evdev_misc, +- MSC_MAX, "MSC_???", XT_INDEXED); +- case EV_SW: +- return decode_bitset(tcp, arg, evdev_switch, +- SW_MAX, "SW_???", XT_INDEXED); +- case EV_LED: +- return decode_bitset(tcp, arg, evdev_leds, +- LED_MAX, "LED_???", XT_INDEXED); +- case EV_SND: +- return decode_bitset(tcp, arg, evdev_snd, +- SND_MAX, "SND_???", XT_INDEXED); +- case EV_REP: +- return decode_bitset(tcp, arg, evdev_autorepeat, +- REP_MAX, "REP_???", XT_INDEXED); +- case EV_FF: +- return decode_bitset(tcp, arg, evdev_ff_types, +- FF_MAX, "FF_???", XT_SORTED); +- case EV_PWR: +- tprints(", "); +- printnum_int(tcp, arg, "%d"); +- return RVAL_IOCTL_DECODED; +- case EV_FF_STATUS: +- return decode_bitset(tcp, arg, evdev_ff_status, +- FF_STATUS_MAX, "FF_STATUS_???", +- XT_INDEXED); +- default: +- tprints(", "); +- printaddr(arg); +- return RVAL_IOCTL_DECODED; ++ case 0: ++ return decode_bitset(tcp, arg, evdev_ev, ++ EV_MAX, "EV_???", XT_SORTED); ++ case EV_KEY: ++ return decode_bitset(tcp, arg, evdev_keycode, ++ KEY_MAX, "KEY_???", XT_INDEXED); ++ case EV_REL: ++ return decode_bitset(tcp, arg, evdev_relative_axes, ++ REL_MAX, "REL_???", XT_INDEXED); ++ case EV_ABS: ++ return decode_bitset(tcp, arg, evdev_abs, ++ ABS_MAX, "ABS_???", XT_INDEXED); ++ case EV_MSC: ++ return decode_bitset(tcp, arg, evdev_misc, ++ MSC_MAX, "MSC_???", XT_INDEXED); ++ case EV_SW: ++ return decode_bitset(tcp, arg, evdev_switch, ++ SW_MAX, "SW_???", XT_INDEXED); ++ case EV_LED: ++ return decode_bitset(tcp, arg, evdev_leds, ++ LED_MAX, "LED_???", XT_INDEXED); ++ case EV_SND: ++ return decode_bitset(tcp, arg, evdev_snd, ++ SND_MAX, "SND_???", XT_INDEXED); ++ case EV_REP: ++ return decode_bitset(tcp, arg, evdev_autorepeat, ++ REP_MAX, "REP_???", XT_INDEXED); ++ case EV_FF: ++ return decode_bitset(tcp, arg, evdev_ff_types, ++ FF_MAX, "FF_???", XT_SORTED); ++ case EV_PWR: ++ tprints(", "); ++ printnum_int(tcp, arg, "%d"); ++ return RVAL_IOCTL_DECODED; ++ case EV_FF_STATUS: ++ return decode_bitset(tcp, arg, evdev_ff_status, ++ FF_STATUS_MAX, "FF_STATUS_???", ++ XT_INDEXED); ++ default: ++ tprints(", "); ++ printaddr(arg); ++ return RVAL_IOCTL_DECODED; + } + } + +@@ -289,63 +289,63 @@ evdev_read_ioctl(struct tcb *const tcp, const unsigned int code, + { + /* fixed-number fixed-length commands */ + switch (code) { +- case EVIOCGVERSION: +- tprints(", "); +- printnum_int(tcp, arg, "%#x"); +- return RVAL_IOCTL_DECODED; +- case EVIOCGEFFECTS: +- tprints(", "); +- printnum_int(tcp, arg, "%u"); +- return RVAL_IOCTL_DECODED; +- case EVIOCGID: +- return getid_ioctl(tcp, arg); ++ case EVIOCGVERSION: ++ tprints(", "); ++ printnum_int(tcp, arg, "%#x"); ++ return RVAL_IOCTL_DECODED; ++ case EVIOCGEFFECTS: ++ tprints(", "); ++ printnum_int(tcp, arg, "%u"); ++ return RVAL_IOCTL_DECODED; ++ case EVIOCGID: ++ return getid_ioctl(tcp, arg); + # ifdef EVIOCGREP +- case EVIOCGREP: +- return repeat_ioctl(tcp, arg); ++ case EVIOCGREP: ++ return repeat_ioctl(tcp, arg); + # endif +- case EVIOCGKEYCODE: +- return keycode_ioctl(tcp, arg); ++ case EVIOCGKEYCODE: ++ return keycode_ioctl(tcp, arg); + # ifdef EVIOCGKEYCODE_V2 +- case EVIOCGKEYCODE_V2: +- return keycode_V2_ioctl(tcp, arg); ++ case EVIOCGKEYCODE_V2: ++ return keycode_V2_ioctl(tcp, arg); + # endif + } + + /* fixed-number variable-length commands */ + switch (_IOC_NR(code)) { + # ifdef EVIOCGMTSLOTS +- case _IOC_NR(EVIOCGMTSLOTS(0)): +- return mtslots_ioctl(tcp, code, arg); ++ case _IOC_NR(EVIOCGMTSLOTS(0)): ++ return mtslots_ioctl(tcp, code, arg); + # endif +- case _IOC_NR(EVIOCGNAME(0)): +- case _IOC_NR(EVIOCGPHYS(0)): +- case _IOC_NR(EVIOCGUNIQ(0)): +- tprints(", "); +- if (syserror(tcp)) +- printaddr(arg); +- else +- printstrn(tcp, arg, tcp->u_rval); +- return RVAL_IOCTL_DECODED; ++ case _IOC_NR(EVIOCGNAME(0)): ++ case _IOC_NR(EVIOCGPHYS(0)): ++ case _IOC_NR(EVIOCGUNIQ(0)): ++ tprints(", "); ++ if (syserror(tcp)) ++ printaddr(arg); ++ else ++ printstrn(tcp, arg, tcp->u_rval); ++ return RVAL_IOCTL_DECODED; + # ifdef EVIOCGPROP +- case _IOC_NR(EVIOCGPROP(0)): +- return decode_bitset(tcp, arg, evdev_prop, +- INPUT_PROP_MAX, "PROP_???", +- XT_INDEXED); ++ case _IOC_NR(EVIOCGPROP(0)): ++ return decode_bitset(tcp, arg, evdev_prop, ++ INPUT_PROP_MAX, "PROP_???", ++ XT_INDEXED); + # endif +- case _IOC_NR(EVIOCGSND(0)): +- return decode_bitset(tcp, arg, evdev_snd, +- SND_MAX, "SND_???", XT_INDEXED); ++ case _IOC_NR(EVIOCGSND(0)): ++ return decode_bitset(tcp, arg, evdev_snd, ++ SND_MAX, "SND_???", XT_INDEXED); + # ifdef EVIOCGSW +- case _IOC_NR(EVIOCGSW(0)): +- return decode_bitset(tcp, arg, evdev_switch, +- SW_MAX, "SW_???", XT_INDEXED); ++ case _IOC_NR(EVIOCGSW(0)): ++ return decode_bitset(tcp, arg, evdev_switch, ++ SW_MAX, "SW_???", XT_INDEXED); + # endif +- case _IOC_NR(EVIOCGKEY(0)): +- return decode_bitset(tcp, arg, evdev_keycode, +- KEY_MAX, "KEY_???", XT_INDEXED); +- case _IOC_NR(EVIOCGLED(0)): +- return decode_bitset(tcp, arg, evdev_leds, +- LED_MAX, "LED_???", XT_INDEXED); ++ case _IOC_NR(EVIOCGKEY(0)): ++ return decode_bitset(tcp, arg, evdev_keycode, ++ KEY_MAX, "KEY_???", XT_INDEXED); ++ case _IOC_NR(EVIOCGLED(0)): ++ return decode_bitset(tcp, arg, evdev_leds, ++ LED_MAX, "LED_???", XT_INDEXED); + } + + /* multi-number fixed-length commands */ +@@ -366,38 +366,37 @@ evdev_write_ioctl(struct tcb *const tcp, const unsigned int code, + /* fixed-number fixed-length commands */ + switch (code) { + # ifdef EVIOCSREP +- case EVIOCSREP: +- return repeat_ioctl(tcp, arg); ++ case EVIOCSREP: ++ return repeat_ioctl(tcp, arg); + # endif +- case EVIOCSKEYCODE: +- return keycode_ioctl(tcp, arg); ++ case EVIOCSKEYCODE: ++ return keycode_ioctl(tcp, arg); + # ifdef EVIOCSKEYCODE_V2 +- case EVIOCSKEYCODE_V2: +- return keycode_V2_ioctl(tcp, arg); ++ case EVIOCSKEYCODE_V2: ++ return keycode_V2_ioctl(tcp, arg); + # endif +- case EVIOCRMFF: +- tprintf(", %d", (int) arg); +- return RVAL_IOCTL_DECODED; +- case EVIOCGRAB: ++ case EVIOCRMFF: ++ tprintf(", %d", (int) arg); ++ return RVAL_IOCTL_DECODED; ++ case EVIOCGRAB: + # ifdef EVIOCREVOKE +- case EVIOCREVOKE: ++ case EVIOCREVOKE: + # endif +- tprintf(", %" PRI_klu, arg); +- return RVAL_IOCTL_DECODED; ++ tprintf(", %" PRI_klu, arg); ++ return RVAL_IOCTL_DECODED; + # ifdef EVIOCSCLOCKID +- case EVIOCSCLOCKID: +- tprints(", "); +- printnum_int(tcp, arg, "%u"); +- return RVAL_IOCTL_DECODED; ++ case EVIOCSCLOCKID: ++ tprints(", "); ++ printnum_int(tcp, arg, "%u"); ++ return RVAL_IOCTL_DECODED; + # endif +- default: { +- int rc = evdev_write_ioctl_mpers(tcp, code, arg); +- +- if (rc != RVAL_DECODED) +- return rc; +- } + } + ++ int rc = evdev_write_ioctl_mpers(tcp, code, arg); ++ ++ if (rc != RVAL_DECODED) ++ return rc; ++ + /* multi-number fixed-length commands */ + if ((_IOC_NR(code) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0))) + return abs_ioctl(tcp, arg); +@@ -416,14 +415,14 @@ evdev_ioctl(struct tcb *const tcp, + const unsigned int code, const kernel_ulong_t arg) + { + switch (_IOC_DIR(code)) { +- case _IOC_READ: +- if (entering(tcp)) +- return 0; +- return evdev_read_ioctl(tcp, code, arg); +- case _IOC_WRITE: +- return evdev_write_ioctl(tcp, code, arg) | RVAL_DECODED; +- default: +- return RVAL_DECODED; ++ case _IOC_READ: ++ if (entering(tcp)) ++ return 0; ++ return evdev_read_ioctl(tcp, code, arg); ++ case _IOC_WRITE: ++ return evdev_write_ioctl(tcp, code, arg) | RVAL_DECODED; ++ default: ++ return RVAL_DECODED; + } + } + +diff --git a/evdev_mpers.c b/evdev_mpers.c +index ff99544..ebf9658 100644 +--- a/evdev_mpers.c ++++ b/evdev_mpers.c +@@ -71,45 +71,45 @@ ff_effect_ioctl(struct tcb *const tcp, const kernel_ulong_t arg) + ffe.replay.delay); + + switch (ffe.type) { +- case FF_CONSTANT: +- tprintf(", constant={level=%" PRId16, +- ffe.u.constant.level); +- decode_envelope(&ffe.u.constant.envelope); +- tprints("}"); +- break; +- case FF_RAMP: +- tprintf(", ramp={start_level=%" PRId16 +- ", end_level=%" PRId16, +- ffe.u.ramp.start_level, +- ffe.u.ramp.end_level); +- decode_envelope(&ffe.u.ramp.envelope); +- tprints("}"); +- break; +- case FF_PERIODIC: +- tprintf(", periodic={waveform=%" PRIu16 +- ", period=%" PRIu16 +- ", magnitude=%" PRId16 +- ", offset=%" PRId16 +- ", phase=%" PRIu16, +- ffe.u.periodic.waveform, +- ffe.u.periodic.period, +- ffe.u.periodic.magnitude, +- ffe.u.periodic.offset, +- ffe.u.periodic.phase); +- decode_envelope(&ffe.u.periodic.envelope); +- tprintf(", custom_len=%u, custom_data=", +- ffe.u.periodic.custom_len); +- printaddr(ptr_to_kulong(ffe.u.periodic.custom_data)); +- tprints("}"); +- break; +- case FF_RUMBLE: +- tprintf(", rumble={strong_magnitude=%" PRIu16 +- ", weak_magnitude=%" PRIu16 "}", +- ffe.u.rumble.strong_magnitude, +- ffe.u.rumble.weak_magnitude); +- break; +- default: +- break; ++ case FF_CONSTANT: ++ tprintf(", constant={level=%" PRId16, ++ ffe.u.constant.level); ++ decode_envelope(&ffe.u.constant.envelope); ++ tprints("}"); ++ break; ++ case FF_RAMP: ++ tprintf(", ramp={start_level=%" PRId16 ++ ", end_level=%" PRId16, ++ ffe.u.ramp.start_level, ++ ffe.u.ramp.end_level); ++ decode_envelope(&ffe.u.ramp.envelope); ++ tprints("}"); ++ break; ++ case FF_PERIODIC: ++ tprintf(", periodic={waveform=%" PRIu16 ++ ", period=%" PRIu16 ++ ", magnitude=%" PRId16 ++ ", offset=%" PRId16 ++ ", phase=%" PRIu16, ++ ffe.u.periodic.waveform, ++ ffe.u.periodic.period, ++ ffe.u.periodic.magnitude, ++ ffe.u.periodic.offset, ++ ffe.u.periodic.phase); ++ decode_envelope(&ffe.u.periodic.envelope); ++ tprintf(", custom_len=%u, custom_data=", ++ ffe.u.periodic.custom_len); ++ printaddr(ptr_to_kulong(ffe.u.periodic.custom_data)); ++ tprints("}"); ++ break; ++ case FF_RUMBLE: ++ tprintf(", rumble={strong_magnitude=%" PRIu16 ++ ", weak_magnitude=%" PRIu16 "}", ++ ffe.u.rumble.strong_magnitude, ++ ffe.u.rumble.weak_magnitude); ++ break; ++ default: ++ break; + } + + tprints("}"); +@@ -121,10 +121,10 @@ MPERS_PRINTER_DECL(int, evdev_write_ioctl_mpers, struct tcb *const tcp, + const unsigned int code, const kernel_ulong_t arg) + { + switch (code) { +- case EVIOCSFF: +- return ff_effect_ioctl(tcp, arg); +- default: +- return RVAL_DECODED; ++ case EVIOCSFF: ++ return ff_effect_ioctl(tcp, arg); ++ default: ++ return RVAL_DECODED; + } + } + +-- +2.1.4 + diff --git a/SOURCES/0061-macros.h-include-stddef.h.patch b/SOURCES/0061-macros.h-include-stddef.h.patch new file mode 100644 index 0000000..2690157 --- /dev/null +++ b/SOURCES/0061-macros.h-include-stddef.h.patch @@ -0,0 +1,28 @@ +From cae3eefe176923b7af44a798197af81623d9bdd2 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Thu, 17 Oct 2019 15:28:46 +0200 +Subject: [PATCH 61/76] macros.h: include + +Since offsetofend macro definition relies on presence of offsetof +declaration. + +* macros.h: Include . +--- + macros.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/macros.h b/macros.h +index f3ebdaf..c58ac6a 100644 +--- a/macros.h ++++ b/macros.h +@@ -9,6 +9,7 @@ + # define STRACE_MACROS_H + + # include ++# include + # include + + # include "gcc_compat.h" +-- +2.1.4 + diff --git a/SOURCES/0062-Enable-building-of-netlink_crypto-decoder-without-li.patch b/SOURCES/0062-Enable-building-of-netlink_crypto-decoder-without-li.patch new file mode 100644 index 0000000..ef45aee --- /dev/null +++ b/SOURCES/0062-Enable-building-of-netlink_crypto-decoder-without-li.patch @@ -0,0 +1,405 @@ +From cf4013ff48ef3a687ba223450210862e1b2b7a6f Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Wed, 9 Oct 2019 20:07:58 +0200 +Subject: [PATCH 62/76] Enable building of netlink_crypto decoder without + linux/cryptouser.h + +* xlat/crypto_msgs.in: New file. +* configure.ac (AC_CHECK_TYPES): Check for struct crypto_user_alg. +* netlink.c: Include "xlat/crypto_msgs.h" with XLAT_MACROS_ONLY defined. +(netlink_decoders[]): Remove HAVE_LINUX_CRYPTOUSER_H guard around +[NETLINK_CRYPTO] item. +* netlink_crypto.c: Remove HAVE_LINUX_CRYPTOUSER_H guard; include + under HAVE_LINUX_CRYPTOUSER_H; include +"xlat/crypto_msgs.h" with XLAT_MACROS_ONLY defined. +[!CRYPTO_MAX_NAME] (CRYPTO_MAX_NAME): New macro. +(struct_crypto_user_alg, struct_crypto_report_hash, +struct_crypto_report_cipher, struct_crypto_report_blkcipher, +struct_crypto_report_aead, struct_crypto_report_rng): New typedefs. +[HAVE_STRUCT_CRYPTO_USER_ALG]: New static_assert to check +that sizeof(struct crypto_user_alg) has the expected value. +[HAVE_STRUCT_CRYPTO_REPORT_HASH]: New static_assert to check +that sizeof(struct crypto_report_hash) has the expected value. +[HAVE_STRUCT_CRYPTO_REPORT_CIPHER]: New static_assert to check +that sizeof(struct crypto_report_cipher) has the expected value. +[HAVE_STRUCT_CRYPTO_REPORT_BLKCIPHER]: New static_assert to check +that sizeof(struct crypto_report_blkcipher) has the expected value. +[HAVE_STRUCT_CRYPTO_REPORT_AEAD]: New static_assert to check +that sizeof(struct crypto_report_aead) has the expected value. +[HAVE_STRUCT_CRYPTO_REPORT_RNG]: New static_assert to check +that sizeof(struct crypto_report_rng) has the expected value. +(decode_crypto_report_hash) [!HAVE_STRUCT_CRYPTO_REPORT_HASH]: Remove. +(decode_crypto_report_hash): Change type of rhash to +struct_crypto_report_hash. +(decode_crypto_report_blkcipher) [!HAVE_STRUCT_CRYPTO_REPORT_BLKCIPHER]: +Remove. +(decode_crypto_report_blkcipher): Change type of rblkcipher to +struct_crypto_report_blkcipher. +(decode_crypto_report_aead) [!HAVE_STRUCT_CRYPTO_REPORT_AEAD]: Remove. +(decode_crypto_report_aead): Change type of raead to +struct_crypto_report_aead. +(decode_crypto_report_rng) [!HAVE_STRUCT_CRYPTO_REPORT_RNG]: Remove. +(decode_crypto_report_rng): Change type of rrng to +struct_crypto_report_rng. +(decode_crypto_report_cipher) [!HAVE_STRUCT_CRYPTO_REPORT_CIPHER]: +Remove. +(decode_crypto_report_cipher): Change type of rcipher to +struct_crypto_report_cipher. +(decode_crypto_user_alg): Change type of alg to struct_crypto_user_alg. + +References: https://bugzilla.redhat.com/show_bug.cgi?id=1758201 +--- + configure.ac | 1 + + netlink.c | 6 ++- + netlink_crypto.c | 125 +++++++++++++++++++++++++++++++++++++++------------- + xlat/crypto_msgs.in | 6 +++ + 4 files changed, 105 insertions(+), 33 deletions(-) + create mode 100644 xlat/crypto_msgs.in + +Index: strace-5.1/configure.ac +=================================================================== +--- strace-5.1.orig/configure.ac 2020-01-27 19:35:31.069505931 +0100 ++++ strace-5.1/configure.ac 2020-01-29 12:35:51.722702560 +0100 +@@ -320,6 +320,7 @@ + #include ]) + + AC_CHECK_TYPES(m4_normalize([ ++ struct crypto_user_alg, + struct crypto_report_aead, + struct crypto_report_blkcipher, + struct crypto_report_cipher, +Index: strace-5.1/netlink.c +=================================================================== +--- strace-5.1.orig/netlink.c 2018-12-10 01:00:00.000000000 +0100 ++++ strace-5.1/netlink.c 2020-01-29 12:35:51.723702551 +0100 +@@ -39,6 +39,10 @@ + #include "xlat/nl_xfrm_types.h" + #include "xlat/nlmsgerr_attrs.h" + ++# define XLAT_MACROS_ONLY ++# include "xlat/crypto_msgs.h" ++# undef XLAT_MACROS_ONLY ++ + /* + * Fetch a struct nlmsghdr from the given address. + */ +@@ -534,9 +538,7 @@ + } + + static const netlink_decoder_t netlink_decoders[] = { +-#ifdef HAVE_LINUX_CRYPTOUSER_H + [NETLINK_CRYPTO] = decode_netlink_crypto, +-#endif + #ifdef HAVE_LINUX_NETFILTER_NFNETLINK_H + [NETLINK_NETFILTER] = decode_netlink_netfilter, + #endif +Index: strace-5.1/netlink_crypto.c +=================================================================== +--- strace-5.1.orig/netlink_crypto.c 2018-12-25 00:46:43.000000000 +0100 ++++ strace-5.1/netlink_crypto.c 2020-01-29 12:35:51.725702535 +0100 +@@ -8,16 +8,101 @@ + + #include "defs.h" + +-#ifdef HAVE_LINUX_CRYPTOUSER_H +- + # include "netlink.h" + # include "nlattr.h" + # include "print_fields.h" + +-# include ++# if HAVE_LINUX_CRYPTOUSER_H ++# include ++# endif + + # include "xlat/crypto_nl_attrs.h" + ++# define XLAT_MACROS_ONLY ++# include "xlat/crypto_msgs.h" ++# undef XLAT_MACROS_ONLY ++ ++ ++# ifndef CRYPTO_MAX_NAME ++# define CRYPTO_MAX_NAME 64 ++# endif ++ ++typedef struct { ++ char cru_name[CRYPTO_MAX_NAME]; ++ char cru_driver_name[CRYPTO_MAX_NAME]; ++ char cru_module_name[CRYPTO_MAX_NAME]; ++ uint32_t cru_type; ++ uint32_t cru_mask; ++ uint32_t cru_refcnt; ++ uint32_t cru_flags; ++} struct_crypto_user_alg; ++ ++typedef struct { ++ char type[CRYPTO_MAX_NAME]; ++ uint32_t blocksize; ++ uint32_t digestsize; ++} struct_crypto_report_hash; ++ ++typedef struct { ++ char type[CRYPTO_MAX_NAME]; ++ uint32_t blocksize; ++ uint32_t min_keysize; ++ uint32_t max_keysize; ++} struct_crypto_report_cipher; ++ ++typedef struct { ++ char type[CRYPTO_MAX_NAME]; ++ char geniv[CRYPTO_MAX_NAME]; ++ uint32_t blocksize; ++ uint32_t min_keysize; ++ uint32_t max_keysize; ++ uint32_t ivsize; ++} struct_crypto_report_blkcipher; ++ ++typedef struct { ++ char type[CRYPTO_MAX_NAME]; ++ char geniv[CRYPTO_MAX_NAME]; ++ uint32_t blocksize; ++ uint32_t maxauthsize; ++ uint32_t ivsize; ++} struct_crypto_report_aead; ++ ++typedef struct { ++ char type[CRYPTO_MAX_NAME]; ++ uint32_t seedsize; ++} struct_crypto_report_rng; ++ ++# ifdef HAVE_STRUCT_CRYPTO_USER_ALG ++static_assert(sizeof(struct_crypto_user_alg) == sizeof(struct crypto_user_alg), ++ "struct crypto_user_alg mismatch, please update the decoder"); ++# endif ++# ifdef HAVE_STRUCT_CRYPTO_REPORT_HASH ++static_assert(sizeof(struct_crypto_report_hash) ++ == sizeof(struct crypto_report_hash), ++ "struct crypto_report_hash mismatch, please update the decoder"); ++# endif ++# ifdef HAVE_STRUCT_CRYPTO_REPORT_CIPHER ++static_assert(sizeof(struct_crypto_report_cipher) ++ == sizeof(struct crypto_report_cipher), ++ "struct crypto_report_cipher mismatch, please update the decoder"); ++# endif ++# ifdef HAVE_STRUCT_CRYPTO_REPORT_BLKCIPHER ++static_assert(sizeof(struct_crypto_report_blkcipher) ++ == sizeof(struct crypto_report_blkcipher), ++ "struct crypto_report_blkcipher mismatch, please update the decoder"); ++# endif ++# ifdef HAVE_STRUCT_CRYPTO_REPORT_AEAD ++static_assert(sizeof(struct_crypto_report_aead) ++ == sizeof(struct crypto_report_aead), ++ "struct crypto_report_aead mismatch, please update the decoder"); ++# endif ++# ifdef HAVE_STRUCT_CRYPTO_REPORT_RNG ++static_assert(sizeof(struct_crypto_report_rng) ++ == sizeof(struct crypto_report_rng), ++ "struct crypto_report_rng mismatch, please update the decoder"); ++# endif ++ ++ + static bool + decode_crypto_report_generic(struct tcb *const tcp, + const kernel_ulong_t addr, +@@ -37,8 +122,7 @@ + const unsigned int len, + const void *const opaque_data) + { +-# ifdef HAVE_STRUCT_CRYPTO_REPORT_HASH +- struct crypto_report_hash rhash; ++ struct_crypto_report_hash rhash; + + if (len < sizeof(rhash)) + printstrn(tcp, addr, len); +@@ -48,9 +132,6 @@ + PRINT_FIELD_U(", ", rhash, digestsize); + tprints("}"); + } +-# else +- printstrn(tcp, addr, len); +-# endif + + return true; + } +@@ -61,8 +142,7 @@ + const unsigned int len, + const void *const opaque_data) + { +-# ifdef HAVE_STRUCT_CRYPTO_REPORT_BLKCIPHER +- struct crypto_report_blkcipher rblkcipher; ++ struct_crypto_report_blkcipher rblkcipher; + + if (len < sizeof(rblkcipher)) + printstrn(tcp, addr, len); +@@ -75,9 +155,6 @@ + PRINT_FIELD_U(", ", rblkcipher, ivsize); + tprints("}"); + } +-# else +- printstrn(tcp, addr, len); +-# endif + + return true; + } +@@ -88,8 +165,7 @@ + const unsigned int len, + const void *const opaque_data) + { +-# ifdef HAVE_STRUCT_CRYPTO_REPORT_AEAD +- struct crypto_report_aead raead; ++ struct_crypto_report_aead raead; + + if (len < sizeof(raead)) + printstrn(tcp, addr, len); +@@ -101,9 +177,6 @@ + PRINT_FIELD_U(", ", raead, ivsize); + tprints("}"); + } +-# else +- printstrn(tcp, addr, len); +-# endif + + return true; + } +@@ -114,8 +187,7 @@ + const unsigned int len, + const void *const opaque_data) + { +-# ifdef HAVE_STRUCT_CRYPTO_REPORT_RNG +- struct crypto_report_rng rrng; ++ struct_crypto_report_rng rrng; + + if (len < sizeof(rrng)) + printstrn(tcp, addr, len); +@@ -124,9 +196,6 @@ + PRINT_FIELD_U(", ", rrng, seedsize); + tprints("}"); + } +-# else +- printstrn(tcp, addr, len); +-# endif + + return true; + } +@@ -137,8 +206,7 @@ + const unsigned int len, + const void *const opaque_data) + { +-# ifdef HAVE_STRUCT_CRYPTO_REPORT_CIPHER +- struct crypto_report_cipher rcipher; ++ struct_crypto_report_cipher rcipher; + + if (len < sizeof(rcipher)) + printstrn(tcp, addr, len); +@@ -149,9 +217,6 @@ + PRINT_FIELD_U(", ", rcipher, max_keysize); + tprints("}"); + } +-# else +- printstrn(tcp, addr, len); +-# endif + + return true; + } +@@ -175,7 +240,7 @@ + const kernel_ulong_t addr, + const unsigned int len) + { +- struct crypto_user_alg alg; ++ struct_crypto_user_alg alg; + + if (len < sizeof(alg)) + printstrn(tcp, addr, len); +@@ -220,5 +285,3 @@ + + return true; + } +- +-#endif /* HAVE_LINUX_CRYPTOUSER_H */ +Index: strace-5.1/xlat/crypto_msgs.in +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-5.1/xlat/crypto_msgs.in 2020-01-29 12:35:51.725702535 +0100 +@@ -0,0 +1,6 @@ ++CRYPTO_MSG_NEWALG 0x10 ++CRYPTO_MSG_DELALG 0x11 ++CRYPTO_MSG_UPDATEALG 0x12 ++CRYPTO_MSG_GETALG 0x13 ++CRYPTO_MSG_DELRNG 0x14 ++CRYPTO_MSG_GETSTAT 0x15 +Index: strace-5.1/xlat/crypto_msgs.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-5.1/xlat/crypto_msgs.h 2020-01-29 12:36:08.847557616 +0100 +@@ -0,0 +1,70 @@ ++/* Generated by xlat/gen.sh from xlat/crypto_msgs.in; do not edit. */ ++ ++#include "gcc_compat.h" ++#include "static_assert.h" ++ ++#if defined(CRYPTO_MSG_NEWALG) || (defined(HAVE_DECL_CRYPTO_MSG_NEWALG) && HAVE_DECL_CRYPTO_MSG_NEWALG) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((CRYPTO_MSG_NEWALG) == (0x10), "CRYPTO_MSG_NEWALG != 0x10"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define CRYPTO_MSG_NEWALG 0x10 ++#endif ++#if defined(CRYPTO_MSG_DELALG) || (defined(HAVE_DECL_CRYPTO_MSG_DELALG) && HAVE_DECL_CRYPTO_MSG_DELALG) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((CRYPTO_MSG_DELALG) == (0x11), "CRYPTO_MSG_DELALG != 0x11"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define CRYPTO_MSG_DELALG 0x11 ++#endif ++#if defined(CRYPTO_MSG_UPDATEALG) || (defined(HAVE_DECL_CRYPTO_MSG_UPDATEALG) && HAVE_DECL_CRYPTO_MSG_UPDATEALG) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((CRYPTO_MSG_UPDATEALG) == (0x12), "CRYPTO_MSG_UPDATEALG != 0x12"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define CRYPTO_MSG_UPDATEALG 0x12 ++#endif ++#if defined(CRYPTO_MSG_GETALG) || (defined(HAVE_DECL_CRYPTO_MSG_GETALG) && HAVE_DECL_CRYPTO_MSG_GETALG) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((CRYPTO_MSG_GETALG) == (0x13), "CRYPTO_MSG_GETALG != 0x13"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define CRYPTO_MSG_GETALG 0x13 ++#endif ++#if defined(CRYPTO_MSG_DELRNG) || (defined(HAVE_DECL_CRYPTO_MSG_DELRNG) && HAVE_DECL_CRYPTO_MSG_DELRNG) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((CRYPTO_MSG_DELRNG) == (0x14), "CRYPTO_MSG_DELRNG != 0x14"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define CRYPTO_MSG_DELRNG 0x14 ++#endif ++#if defined(CRYPTO_MSG_GETSTAT) || (defined(HAVE_DECL_CRYPTO_MSG_GETSTAT) && HAVE_DECL_CRYPTO_MSG_GETSTAT) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((CRYPTO_MSG_GETSTAT) == (0x15), "CRYPTO_MSG_GETSTAT != 0x15"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define CRYPTO_MSG_GETSTAT 0x15 ++#endif ++ ++#ifndef XLAT_MACROS_ONLY ++ ++# ifdef IN_MPERS ++ ++# error static const struct xlat crypto_msgs in mpers mode ++ ++# else ++ ++static ++const struct xlat crypto_msgs[] = { ++ XLAT(CRYPTO_MSG_NEWALG), ++ XLAT(CRYPTO_MSG_DELALG), ++ XLAT(CRYPTO_MSG_UPDATEALG), ++ XLAT(CRYPTO_MSG_GETALG), ++ XLAT(CRYPTO_MSG_DELRNG), ++ XLAT(CRYPTO_MSG_GETSTAT), ++ XLAT_END ++}; ++ ++# endif /* !IN_MPERS */ ++ ++#endif /* !XLAT_MACROS_ONLY */ diff --git a/SOURCES/0063-rtnl_link-use-internal-rtnl_link_stats-and-ifla_port.patch b/SOURCES/0063-rtnl_link-use-internal-rtnl_link_stats-and-ifla_port.patch new file mode 100644 index 0000000..babd6e2 --- /dev/null +++ b/SOURCES/0063-rtnl_link-use-internal-rtnl_link_stats-and-ifla_port.patch @@ -0,0 +1,206 @@ +From be67f0080a317a7089cde75a6011ac5bb78aae5b Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Thu, 10 Oct 2019 11:08:51 +0200 +Subject: [PATCH 63/76] rtnl_link: use internal rtnl_link_stats* and + ifla_port_vsi definitions + +Define substitutes for struct rtnl_link_stats, struct +rtnl_link_stats64, and struct ifla_port_vsi internally. +Add a static_assert that informs about future growth of the structures +provided by the kernel headers. + +* rtnl_link.c (struct_rtnl_link_stats, struct_rtnl_link_stats64, +struct_ifla_port_vsi): New typedefs. +[HAVE_STRUCT_RTNL_LINK_STATS_RX_NOHANDLER]: Add a static_assert to check +that sizeof(struct rtnl_link_stats) has the expected value. +[HAVE_STRUCT_RTNL_LINK_STATS64_RX_NOHANDLER]: Add a static_assert +to check that sizeof(struct rtnl_link_stats) has the expected value. +[HAVE_STRUCT_IFLA_PORT_VSI]: Add a static_assert to check +that sizeof(struct ifla_port_vsi) has the expected value. +(decode_rtnl_link_stats) [HAVE_STRUCT_RTNL_LINK_STATS_RX_NOHANDLER]: +Remove guard. +(decode_rtnl_link_stats): Change the type of st variable to +struct_rtnl_link_stats; use struct_rtnl_link_stats in offsetofend +statement for min_size definition. +(decode_rtnl_link_stats64) [HAVE_STRUCT_RTNL_LINK_STATS64, +HAVE_STRUCT_RTNL_LINK_STATS64_RX_NOHANDLER]: Remove guards. +(decode_rtnl_link_stats64): Change the type of st variable +to struct_rtnl_link_stats64. +(decode_ifla_port_vsi) [HAVE_STRUCT_IFLA_PORT_VSI]: Remove guard. +(decode_ifla_port_vsi): Change the type of vsi variable +to struct_ifla_port_vsi. + +References: https://bugzilla.redhat.com/show_bug.cgi?id=1758201 +--- + rtnl_link.c | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++---------- + 1 file changed, 87 insertions(+), 17 deletions(-) + +diff --git a/rtnl_link.c b/rtnl_link.c +index 92bc1e0..5ab3d03 100644 +--- a/rtnl_link.c ++++ b/rtnl_link.c +@@ -42,15 +42,95 @@ + #include "xlat/tun_device_types.h" + #include "xlat/xdp_flags.h" + ++typedef struct { ++ uint32_t rx_packets; ++ uint32_t tx_packets; ++ uint32_t rx_bytes; ++ uint32_t tx_bytes; ++ uint32_t rx_errors; ++ uint32_t tx_errors; ++ uint32_t rx_dropped; ++ uint32_t tx_dropped; ++ uint32_t multicast; ++ uint32_t collisions; ++ uint32_t rx_length_errors; ++ uint32_t rx_over_errors; ++ uint32_t rx_crc_errors; ++ uint32_t rx_frame_errors; ++ uint32_t rx_fifo_errors; ++ uint32_t rx_missed_errors; ++ uint32_t tx_aborted_errors; ++ uint32_t tx_carrier_errors; ++ uint32_t tx_fifo_errors; ++ uint32_t tx_heartbeat_errors; ++ uint32_t tx_window_errors; ++ uint32_t rx_compressed; ++ uint32_t tx_compressed; ++ uint32_t rx_nohandler; /**< Added by v4.6-rc1~91^2~329^2~2 */ ++} struct_rtnl_link_stats; ++ ++/** Added by Linux commit v2.6.35-rc1~473^2~759 */ ++typedef struct { ++ uint64_t rx_packets; ++ uint64_t tx_packets; ++ uint64_t rx_bytes; ++ uint64_t tx_bytes; ++ uint64_t rx_errors; ++ uint64_t tx_errors; ++ uint64_t rx_dropped; ++ uint64_t tx_dropped; ++ uint64_t multicast; ++ uint64_t collisions; ++ uint64_t rx_length_errors; ++ uint64_t rx_over_errors; ++ uint64_t rx_crc_errors; ++ uint64_t rx_frame_errors; ++ uint64_t rx_fifo_errors; ++ uint64_t rx_missed_errors; ++ uint64_t tx_aborted_errors; ++ uint64_t tx_carrier_errors; ++ uint64_t tx_fifo_errors; ++ uint64_t tx_heartbeat_errors; ++ uint64_t tx_window_errors; ++ uint64_t rx_compressed; ++ uint64_t tx_compressed; ++ uint64_t rx_nohandler; /**< Added by v4.6-rc1~91^2~329^2~2 */ ++} struct_rtnl_link_stats64; ++ ++/** Added by Linux commit v2.6.35-rc1~473^2~33 */ ++typedef struct { ++ uint8_t vsi_mgr_id; ++ uint8_t vsi_type_id[3]; ++ uint8_t vsi_type_version; ++ uint8_t pad[3]; ++} struct_ifla_port_vsi; ++ ++#ifdef HAVE_STRUCT_RTNL_LINK_STATS_RX_NOHANDLER ++static_assert(sizeof(struct_rtnl_link_stats) ++ == sizeof(struct rtnl_link_stats), ++ "struct rtnl_link_stats size mismatch" ++ ", please update the decoder"); ++#endif ++#ifdef HAVE_STRUCT_RTNL_LINK_STATS64_RX_NOHANDLER ++static_assert(sizeof(struct_rtnl_link_stats64) ++ == sizeof(struct rtnl_link_stats64), ++ "struct rtnl_link_stats64 size mismatch" ++ ", please update the decoder"); ++#endif ++#ifdef HAVE_STRUCT_IFLA_PORT_VSI ++static_assert(sizeof(struct_ifla_port_vsi) == sizeof(struct ifla_port_vsi), ++ "struct ifla_port_vsi size mismatch, please update the decoder"); ++#endif ++ + static bool + decode_rtnl_link_stats(struct tcb *const tcp, + const kernel_ulong_t addr, + const unsigned int len, + const void *const opaque_data) + { +- struct rtnl_link_stats st; ++ struct_rtnl_link_stats st; + const unsigned int min_size = +- offsetofend(struct rtnl_link_stats, tx_compressed); ++ offsetofend(struct_rtnl_link_stats, tx_compressed); + const unsigned int def_size = sizeof(st); + const unsigned int size = + (len >= def_size) ? def_size : +@@ -86,10 +166,9 @@ decode_rtnl_link_stats(struct tcb *const tcp, + + PRINT_FIELD_U(", ", st, rx_compressed); + PRINT_FIELD_U(", ", st, tx_compressed); +-#ifdef HAVE_STRUCT_RTNL_LINK_STATS_RX_NOHANDLER ++ + if (len >= def_size) + PRINT_FIELD_U(", ", st, rx_nohandler); +-#endif + tprints("}"); + } + +@@ -424,10 +503,9 @@ decode_rtnl_link_stats64(struct tcb *const tcp, + const unsigned int len, + const void *const opaque_data) + { +-#ifdef HAVE_STRUCT_RTNL_LINK_STATS64 +- struct rtnl_link_stats64 st; ++ struct_rtnl_link_stats64 st; + const unsigned int min_size = +- offsetofend(struct rtnl_link_stats64, tx_compressed); ++ offsetofend(struct_rtnl_link_stats64, tx_compressed); + const unsigned int def_size = sizeof(st); + const unsigned int size = + (len >= def_size) ? def_size : +@@ -463,17 +541,13 @@ decode_rtnl_link_stats64(struct tcb *const tcp, + + PRINT_FIELD_U(", ", st, rx_compressed); + PRINT_FIELD_U(", ", st, tx_compressed); +-# ifdef HAVE_STRUCT_RTNL_LINK_STATS64_RX_NOHANDLER ++ + if (len >= def_size) + PRINT_FIELD_U(", ", st, rx_nohandler); +-# endif + tprints("}"); + } + + return true; +-#else +- return false; +-#endif + } + + static bool +@@ -482,8 +556,7 @@ decode_ifla_port_vsi(struct tcb *const tcp, + const unsigned int len, + const void *const opaque_data) + { +-#ifdef HAVE_STRUCT_IFLA_PORT_VSI +- struct ifla_port_vsi vsi; ++ struct_ifla_port_vsi vsi; + + if (len < sizeof(vsi)) + return false; +@@ -496,9 +569,6 @@ decode_ifla_port_vsi(struct tcb *const tcp, + } + + return true; +-#else +- return false; +-#endif + } + + static const nla_decoder_t ifla_port_nla_decoders[] = { +-- +2.1.4 + diff --git a/SOURCES/0064-rtnl_link-print-pad-field-in-the-struct-ifla_port_vs.patch b/SOURCES/0064-rtnl_link-print-pad-field-in-the-struct-ifla_port_vs.patch new file mode 100644 index 0000000..e8c50e8 --- /dev/null +++ b/SOURCES/0064-rtnl_link-print-pad-field-in-the-struct-ifla_port_vs.patch @@ -0,0 +1,124 @@ +From fb287742d4221195708f5865fd5335d43e8a8a5d Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Sat, 19 Oct 2019 10:44:36 +0200 +Subject: [PATCH 64/76] rtnl_link: print pad field in the struct ifla_port_vsi + decoder + +And steamline the flow a bit. + +* rtnl_link.c (decode_ifla_port_vsi): Factor the printing code out of +the conditional statement, add pad field printing. +* tests/nlattr_ifla_port.c: Add check for the pad field printing. +--- + rtnl_link.c | 19 ++++++++++++------- + tests/nlattr_ifla_port.c | 15 +++++++++++++++ + 2 files changed, 27 insertions(+), 7 deletions(-) + +Index: strace-5.1/rtnl_link.c +=================================================================== +--- strace-5.1.orig/rtnl_link.c 2020-01-29 12:36:17.631477314 +0100 ++++ strace-5.1/rtnl_link.c 2020-01-29 12:36:19.726458084 +0100 +@@ -560,13 +560,18 @@ + + if (len < sizeof(vsi)) + return false; +- else if (!umove_or_printaddr(tcp, addr, &vsi)) { +- PRINT_FIELD_U("{", vsi, vsi_mgr_id); +- PRINT_FIELD_STRING(", ", vsi, vsi_type_id, +- sizeof(vsi.vsi_type_id), QUOTE_FORCE_HEX); +- PRINT_FIELD_U(", ", vsi, vsi_type_version); +- tprints("}"); +- } ++ if (umove_or_printaddr(tcp, addr, &vsi)) ++ return true; ++ ++ PRINT_FIELD_U("{", vsi, vsi_mgr_id); ++ PRINT_FIELD_STRING(", ", vsi, vsi_type_id, ++ sizeof(vsi.vsi_type_id), QUOTE_FORCE_HEX); ++ PRINT_FIELD_U(", ", vsi, vsi_type_version); ++ ++ if (!IS_ARRAY_ZERO(vsi.pad)) ++ PRINT_FIELD_HEX_ARRAY(", ", vsi, pad); ++ ++ tprints("}"); + + return true; + } +Index: strace-5.1/tests/nlattr_ifla_port.c +=================================================================== +--- strace-5.1.orig/tests/nlattr_ifla_port.c 2018-12-10 01:00:00.000000000 +0100 ++++ strace-5.1/tests/nlattr_ifla_port.c 2020-01-29 12:36:19.729458056 +0100 +@@ -57,6 +57,21 @@ + printf(", vsi_type_id=\"\\x61\\x62\\x63\""); + PRINT_FIELD_U(", ", vsi, vsi_type_version); + printf("}")); ++ ++ static const struct ifla_port_vsi vsi2 = { ++ .vsi_mgr_id = 0xab, ++ .vsi_type_id = { 10, 0, 255 }, ++ .vsi_type_version = 0xef, ++ .pad = { 0, 1, 2 }, ++ }; ++ TEST_NESTED_NLATTR_OBJECT(fd, nlh0, hdrlen, ++ init_ifinfomsg, print_ifinfomsg, ++ IFLA_PORT_VSI_TYPE, pattern, vsi2, ++ PRINT_FIELD_U("{", vsi2, vsi_mgr_id); ++ printf(", vsi_type_id=\"\\x0a\\x00\\xff\""); ++ PRINT_FIELD_U(", ", vsi2, vsi_type_version); ++ printf(", pad=\"\\x00\\x01\\x02\""); ++ printf("}")); + #endif + + puts("+++ exited with 0 +++"); +Index: strace-5.1/tests-m32/nlattr_ifla_port.c +=================================================================== +--- strace-5.1.orig/tests-m32/nlattr_ifla_port.c 2018-12-10 01:00:00.000000000 +0100 ++++ strace-5.1/tests-m32/nlattr_ifla_port.c 2020-01-29 12:36:51.841163297 +0100 +@@ -57,6 +57,21 @@ + printf(", vsi_type_id=\"\\x61\\x62\\x63\""); + PRINT_FIELD_U(", ", vsi, vsi_type_version); + printf("}")); ++ ++ static const struct ifla_port_vsi vsi2 = { ++ .vsi_mgr_id = 0xab, ++ .vsi_type_id = { 10, 0, 255 }, ++ .vsi_type_version = 0xef, ++ .pad = { 0, 1, 2 }, ++ }; ++ TEST_NESTED_NLATTR_OBJECT(fd, nlh0, hdrlen, ++ init_ifinfomsg, print_ifinfomsg, ++ IFLA_PORT_VSI_TYPE, pattern, vsi2, ++ PRINT_FIELD_U("{", vsi2, vsi_mgr_id); ++ printf(", vsi_type_id=\"\\x0a\\x00\\xff\""); ++ PRINT_FIELD_U(", ", vsi2, vsi_type_version); ++ printf(", pad=\"\\x00\\x01\\x02\""); ++ printf("}")); + #endif + + puts("+++ exited with 0 +++"); +Index: strace-5.1/tests-mx32/nlattr_ifla_port.c +=================================================================== +--- strace-5.1.orig/tests-mx32/nlattr_ifla_port.c 2018-12-10 01:00:00.000000000 +0100 ++++ strace-5.1/tests-mx32/nlattr_ifla_port.c 2020-01-29 12:36:51.843163278 +0100 +@@ -57,6 +57,21 @@ + printf(", vsi_type_id=\"\\x61\\x62\\x63\""); + PRINT_FIELD_U(", ", vsi, vsi_type_version); + printf("}")); ++ ++ static const struct ifla_port_vsi vsi2 = { ++ .vsi_mgr_id = 0xab, ++ .vsi_type_id = { 10, 0, 255 }, ++ .vsi_type_version = 0xef, ++ .pad = { 0, 1, 2 }, ++ }; ++ TEST_NESTED_NLATTR_OBJECT(fd, nlh0, hdrlen, ++ init_ifinfomsg, print_ifinfomsg, ++ IFLA_PORT_VSI_TYPE, pattern, vsi2, ++ PRINT_FIELD_U("{", vsi2, vsi_mgr_id); ++ printf(", vsi_type_id=\"\\x0a\\x00\\xff\""); ++ PRINT_FIELD_U(", ", vsi2, vsi_type_version); ++ printf(", pad=\"\\x00\\x01\\x02\""); ++ printf("}")); + #endif + + puts("+++ exited with 0 +++"); diff --git a/SOURCES/0065-rtnl_mdb-decode-messages-regardless-of-availability-.patch b/SOURCES/0065-rtnl_mdb-decode-messages-regardless-of-availability-.patch new file mode 100644 index 0000000..7be2c42 --- /dev/null +++ b/SOURCES/0065-rtnl_mdb-decode-messages-regardless-of-availability-.patch @@ -0,0 +1,519 @@ +From 9099fc83708c5329a705b4cf91cffd3bcd17929c Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Thu, 10 Oct 2019 13:58:44 +0200 +Subject: [PATCH 65/76] rtnl_mdb: decode messages regardless of availability of + kernel headers + +* netlink_route.c [!HAVE_STRUCT_BR_PORT_MSG]: Do not skip decoding of +RTM_DELMDB, RTM_GETMDB, and RTM_NEWMDB messages. +* rtnl_mdb.c: Remove #ifdef HAVE_STRUCT_BR_PORT_MSG guard. +(struct_br_port_msg, struct_br_mdb_entry): New typedefs. +[HAVE_STRUCT_BR_PORT_MSG]: Static assert check for struct br_port_msg +size. +[HAVE_STRUCT_BR_NDB_ENTRY]: Static assert check for strucr br_mdb_entry +size. +(decode_mdba_mdb_entry_info) [!HAVE_STRUCT_BR_MDB_ENTRY]: Remove. +(decode_mdba_mdb_entry_info): Change entry type to struct_br_mdb_entry. +(decode_mdba_mdb_entry_info) [HAVE_STRUCT_BR_MDB_ENTRY_FLAGS, +HAVE_STRUCT_BR_MDB_ENTRY_VID]: Remove guards. +(decode_br_port_msg): Change bpm type to struct_br_port_msg. +* tests/nlattr_ifinfomsg.c: Use TEST_NLATTR_OBJECT_MINSZ to test +struct rtnl_link_stats printing. +* tests/nlattr_mdba_mdb_entry.c: Update expected output. + +References: https://bugzilla.redhat.com/show_bug.cgi?id=1758201 +--- + netlink_route.c | 2 -- + rtnl_mdb.c | 83 +++++++++++++++++++++++++++---------------- + tests/nlattr_ifinfomsg.c | 60 +++++++++++++++---------------- + tests/nlattr_mdba_mdb_entry.c | 8 +++++ + 4 files changed, 89 insertions(+), 64 deletions(-) + +Index: strace-5.1/netlink_route.c +=================================================================== +--- strace-5.1.orig/netlink_route.c 2018-12-25 00:46:43.000000000 +0100 ++++ strace-5.1/netlink_route.c 2020-01-29 12:37:03.065060270 +0100 +@@ -90,11 +90,9 @@ + [RTM_NEWNETCONF - RTM_BASE] = decode_netconfmsg, + #endif + +-#ifdef HAVE_STRUCT_BR_PORT_MSG + [RTM_DELMDB - RTM_BASE] = decode_br_port_msg, + [RTM_GETMDB - RTM_BASE] = decode_br_port_msg, + [RTM_NEWMDB - RTM_BASE] = decode_br_port_msg, +-#endif + + [RTM_DELNSID - RTM_BASE] = decode_rtgenmsg, + [RTM_GETNSID - RTM_BASE] = decode_rtgenmsg, +Index: strace-5.1/rtnl_mdb.c +=================================================================== +--- strace-5.1.orig/rtnl_mdb.c 2018-12-10 01:00:00.000000000 +0100 ++++ strace-5.1/rtnl_mdb.c 2020-01-29 12:37:03.066060261 +0100 +@@ -9,27 +9,52 @@ + + #include "defs.h" + ++#include "netlink_route.h" ++#include "nlattr.h" ++#include "print_fields.h" ++ ++#include ++#include ++#include "netlink.h" ++ ++#include "xlat/mdb_flags.h" ++#include "xlat/mdb_states.h" ++#include "xlat/multicast_router_types.h" ++#include "xlat/rtnl_mdb_attrs.h" ++#include "xlat/rtnl_mdba_mdb_attrs.h" ++#include "xlat/rtnl_mdba_mdb_eattr_attrs.h" ++#include "xlat/rtnl_mdba_mdb_entry_attrs.h" ++#include "xlat/rtnl_mdba_router_attrs.h" ++#include "xlat/rtnl_mdba_router_pattr_attrs.h" ++ ++typedef struct { ++ uint8_t family; ++ uint32_t ifindex; ++} struct_br_port_msg; ++ ++typedef struct { ++ uint32_t ifindex; ++ uint8_t state; ++ uint8_t flags; ++ uint16_t vid; ++ struct { ++ union { ++ uint32_t /* __be32 */ ip4; ++ struct in6_addr ip6; ++ } u; ++ uint16_t /* __be16 */ proto; ++ } addr; ++} struct_br_mdb_entry; ++ + #ifdef HAVE_STRUCT_BR_PORT_MSG ++static_assert(sizeof(struct br_port_msg) <= sizeof(struct_br_port_msg), ++ "Unexpected struct br_port_msg size, please update the decoder"); ++#endif + +-# include "netlink_route.h" +-# include "nlattr.h" +-# include "print_fields.h" +- +-# include +-# include +-# include "netlink.h" +- +-# ifdef HAVE_STRUCT_BR_MDB_ENTRY_FLAGS +-# include "xlat/mdb_flags.h" +-# endif +-# include "xlat/mdb_states.h" +-# include "xlat/multicast_router_types.h" +-# include "xlat/rtnl_mdb_attrs.h" +-# include "xlat/rtnl_mdba_mdb_attrs.h" +-# include "xlat/rtnl_mdba_mdb_eattr_attrs.h" +-# include "xlat/rtnl_mdba_mdb_entry_attrs.h" +-# include "xlat/rtnl_mdba_router_attrs.h" +-# include "xlat/rtnl_mdba_router_pattr_attrs.h" ++#ifdef HAVE_STRUCT_BR_NDB_ENTRY ++static_assert(sizeof(struct br_mdb_entry) <= sizeof(struct_br_mdb_entry), ++ "Unexpected struct br_mdb_entry size, please update the decoder"); ++#endif + + static const nla_decoder_t mdba_mdb_eattr_nla_decoders[] = { + [MDBA_MDB_EATTR_TIMER] = decode_nla_u32 +@@ -41,21 +66,22 @@ + const unsigned int len, + const void *const opaque_data) + { +-# ifdef HAVE_STRUCT_BR_MDB_ENTRY +- struct br_mdb_entry entry; ++ struct_br_mdb_entry entry; + + if (len < sizeof(entry)) + return false; + else if (!umove_or_printaddr(tcp, addr, &entry)) { + PRINT_FIELD_IFINDEX("{", entry, ifindex); + PRINT_FIELD_XVAL(", ", entry, state, mdb_states, "MDB_???"); +-# ifdef HAVE_STRUCT_BR_MDB_ENTRY_FLAGS ++ ++ /* ++ * Note that it's impossible to derive if flags/vid fields ++ * are present on all architectures except m68k; as a side note, ++ * v4.3-rc1~96^2~365 has introduced an ABI breakage on m68k. ++ */ + PRINT_FIELD_FLAGS(", ", entry, flags, + mdb_flags, "MDB_FLAGS_???"); +-# endif +-# ifdef HAVE_STRUCT_BR_MDB_ENTRY_VID + PRINT_FIELD_U(", ", entry, vid); +-# endif + + const int proto = ntohs(entry.addr.proto); + +@@ -77,9 +103,6 @@ + } + + return true; +-# else +- return false; +-# endif /* HAVE_STRUCT_BR_MDB_ENTRY */ + } + + static const nla_decoder_t mdba_mdb_entry_nla_decoders[] = { +@@ -185,7 +208,7 @@ + + DECL_NETLINK_ROUTE_DECODER(decode_br_port_msg) + { +- struct br_port_msg bpm = { .family = family }; ++ struct_br_port_msg bpm = { .family = family }; + size_t offset = sizeof(bpm.family); + bool decode_nla = false; + +@@ -212,5 +235,3 @@ + ARRAY_SIZE(br_port_msg_nla_decoders), NULL); + } + } +- +-#endif +Index: strace-5.1/tests/nlattr_ifinfomsg.c +=================================================================== +--- strace-5.1.orig/tests/nlattr_ifinfomsg.c 2018-12-30 16:35:21.000000000 +0100 ++++ strace-5.1/tests/nlattr_ifinfomsg.c 2020-01-29 12:37:03.068060243 +0100 +@@ -118,40 +118,39 @@ + IFLA_LINK_NETNSID, pattern, netnsid, + printf("%d", netnsid)); + +- TEST_NLATTR_OBJECT(fd, nlh0, hdrlen, +- init_ifinfomsg, print_ifinfomsg, +- IFLA_STATS, pattern, st, +- PRINT_FIELD_U("{", st, rx_packets); +- PRINT_FIELD_U(", ", st, tx_packets); +- PRINT_FIELD_U(", ", st, rx_bytes); +- PRINT_FIELD_U(", ", st, tx_bytes); +- PRINT_FIELD_U(", ", st, rx_errors); +- PRINT_FIELD_U(", ", st, tx_errors); +- PRINT_FIELD_U(", ", st, rx_dropped); +- PRINT_FIELD_U(", ", st, tx_dropped); +- PRINT_FIELD_U(", ", st, multicast); +- PRINT_FIELD_U(", ", st, collisions); +- PRINT_FIELD_U(", ", st, rx_length_errors); +- PRINT_FIELD_U(", ", st, rx_over_errors); +- PRINT_FIELD_U(", ", st, rx_crc_errors); +- PRINT_FIELD_U(", ", st, rx_frame_errors); +- PRINT_FIELD_U(", ", st, rx_fifo_errors); +- PRINT_FIELD_U(", ", st, rx_missed_errors); +- PRINT_FIELD_U(", ", st, tx_aborted_errors); +- PRINT_FIELD_U(", ", st, tx_carrier_errors); +- PRINT_FIELD_U(", ", st, tx_fifo_errors); +- PRINT_FIELD_U(", ", st, tx_heartbeat_errors); +- PRINT_FIELD_U(", ", st, tx_window_errors); +- PRINT_FIELD_U(", ", st, rx_compressed); +- PRINT_FIELD_U(", ", st, tx_compressed); ++ const unsigned int sizeof_stats = ++ offsetofend(struct rtnl_link_stats, tx_compressed); ++ TEST_NLATTR_OBJECT_MINSZ(fd, nlh0, hdrlen, ++ init_ifinfomsg, print_ifinfomsg, ++ IFLA_STATS, pattern, st, sizeof_stats, ++ PRINT_FIELD_U("{", st, rx_packets); ++ PRINT_FIELD_U(", ", st, tx_packets); ++ PRINT_FIELD_U(", ", st, rx_bytes); ++ PRINT_FIELD_U(", ", st, tx_bytes); ++ PRINT_FIELD_U(", ", st, rx_errors); ++ PRINT_FIELD_U(", ", st, tx_errors); ++ PRINT_FIELD_U(", ", st, rx_dropped); ++ PRINT_FIELD_U(", ", st, tx_dropped); ++ PRINT_FIELD_U(", ", st, multicast); ++ PRINT_FIELD_U(", ", st, collisions); ++ PRINT_FIELD_U(", ", st, rx_length_errors); ++ PRINT_FIELD_U(", ", st, rx_over_errors); ++ PRINT_FIELD_U(", ", st, rx_crc_errors); ++ PRINT_FIELD_U(", ", st, rx_frame_errors); ++ PRINT_FIELD_U(", ", st, rx_fifo_errors); ++ PRINT_FIELD_U(", ", st, rx_missed_errors); ++ PRINT_FIELD_U(", ", st, tx_aborted_errors); ++ PRINT_FIELD_U(", ", st, tx_carrier_errors); ++ PRINT_FIELD_U(", ", st, tx_fifo_errors); ++ PRINT_FIELD_U(", ", st, tx_heartbeat_errors); ++ PRINT_FIELD_U(", ", st, tx_window_errors); ++ PRINT_FIELD_U(", ", st, rx_compressed); ++ PRINT_FIELD_U(", ", st, tx_compressed); + #ifdef HAVE_STRUCT_RTNL_LINK_STATS_RX_NOHANDLER +- PRINT_FIELD_U(", ", st, rx_nohandler); ++ PRINT_FIELD_U(", ", st, rx_nohandler); + #endif + printf("}")); + +-#ifdef HAVE_STRUCT_RTNL_LINK_STATS_RX_NOHANDLER +- const unsigned int sizeof_stats = +- offsetofend(struct rtnl_link_stats, tx_compressed); + TEST_NLATTR(fd, nlh0, hdrlen, + init_ifinfomsg, print_ifinfomsg, + IFLA_STATS, sizeof_stats, &st, sizeof_stats, +@@ -179,7 +178,6 @@ + PRINT_FIELD_U(", ", st, rx_compressed); + PRINT_FIELD_U(", ", st, tx_compressed); + printf("}")); +-#endif /* HAVE_STRUCT_RTNL_LINK_STATS_RX_NOHANDLER */ + + static const struct rtnl_link_ifmap map = { + .mem_start = 0xadcbefedefbcdedb, +Index: strace-5.1/tests/nlattr_mdba_mdb_entry.c +=================================================================== +--- strace-5.1.orig/tests/nlattr_mdba_mdb_entry.c 2018-12-10 01:00:00.000000000 +0100 ++++ strace-5.1/tests/nlattr_mdba_mdb_entry.c 2020-01-29 12:37:03.072060206 +0100 +@@ -122,9 +122,13 @@ + printf(", state=MDB_TEMPORARY"); + # ifdef HAVE_STRUCT_BR_MDB_ENTRY_FLAGS + printf(", flags=MDB_FLAGS_OFFLOAD"); ++# else ++ printf(", flags=0"); + # endif + # ifdef HAVE_STRUCT_BR_MDB_ENTRY_VID + PRINT_FIELD_U(", ", entry, vid); ++# else ++ printf(", vid=0"); + # endif + printf(", addr={u="); + print_quoted_hex(&entry.addr.u, +@@ -145,9 +149,13 @@ + printf(", state=MDB_TEMPORARY"); + # ifdef HAVE_STRUCT_BR_MDB_ENTRY_FLAGS + printf(", flags=MDB_FLAGS_OFFLOAD"); ++# else ++ printf(", flags=0"); + # endif + # ifdef HAVE_STRUCT_BR_MDB_ENTRY_VID + PRINT_FIELD_U(", ", entry, vid); ++# else ++ printf(", vid=0"); + # endif + printf(", addr={u="); + print_quoted_hex(&entry.addr.u, sizeof(entry.addr.u)); +Index: strace-5.1/tests-m32/nlattr_ifinfomsg.c +=================================================================== +--- strace-5.1.orig/tests-m32/nlattr_ifinfomsg.c 2018-12-30 16:35:21.000000000 +0100 ++++ strace-5.1/tests-m32/nlattr_ifinfomsg.c 2020-01-29 12:37:24.526863268 +0100 +@@ -118,40 +118,39 @@ + IFLA_LINK_NETNSID, pattern, netnsid, + printf("%d", netnsid)); + +- TEST_NLATTR_OBJECT(fd, nlh0, hdrlen, +- init_ifinfomsg, print_ifinfomsg, +- IFLA_STATS, pattern, st, +- PRINT_FIELD_U("{", st, rx_packets); +- PRINT_FIELD_U(", ", st, tx_packets); +- PRINT_FIELD_U(", ", st, rx_bytes); +- PRINT_FIELD_U(", ", st, tx_bytes); +- PRINT_FIELD_U(", ", st, rx_errors); +- PRINT_FIELD_U(", ", st, tx_errors); +- PRINT_FIELD_U(", ", st, rx_dropped); +- PRINT_FIELD_U(", ", st, tx_dropped); +- PRINT_FIELD_U(", ", st, multicast); +- PRINT_FIELD_U(", ", st, collisions); +- PRINT_FIELD_U(", ", st, rx_length_errors); +- PRINT_FIELD_U(", ", st, rx_over_errors); +- PRINT_FIELD_U(", ", st, rx_crc_errors); +- PRINT_FIELD_U(", ", st, rx_frame_errors); +- PRINT_FIELD_U(", ", st, rx_fifo_errors); +- PRINT_FIELD_U(", ", st, rx_missed_errors); +- PRINT_FIELD_U(", ", st, tx_aborted_errors); +- PRINT_FIELD_U(", ", st, tx_carrier_errors); +- PRINT_FIELD_U(", ", st, tx_fifo_errors); +- PRINT_FIELD_U(", ", st, tx_heartbeat_errors); +- PRINT_FIELD_U(", ", st, tx_window_errors); +- PRINT_FIELD_U(", ", st, rx_compressed); +- PRINT_FIELD_U(", ", st, tx_compressed); ++ const unsigned int sizeof_stats = ++ offsetofend(struct rtnl_link_stats, tx_compressed); ++ TEST_NLATTR_OBJECT_MINSZ(fd, nlh0, hdrlen, ++ init_ifinfomsg, print_ifinfomsg, ++ IFLA_STATS, pattern, st, sizeof_stats, ++ PRINT_FIELD_U("{", st, rx_packets); ++ PRINT_FIELD_U(", ", st, tx_packets); ++ PRINT_FIELD_U(", ", st, rx_bytes); ++ PRINT_FIELD_U(", ", st, tx_bytes); ++ PRINT_FIELD_U(", ", st, rx_errors); ++ PRINT_FIELD_U(", ", st, tx_errors); ++ PRINT_FIELD_U(", ", st, rx_dropped); ++ PRINT_FIELD_U(", ", st, tx_dropped); ++ PRINT_FIELD_U(", ", st, multicast); ++ PRINT_FIELD_U(", ", st, collisions); ++ PRINT_FIELD_U(", ", st, rx_length_errors); ++ PRINT_FIELD_U(", ", st, rx_over_errors); ++ PRINT_FIELD_U(", ", st, rx_crc_errors); ++ PRINT_FIELD_U(", ", st, rx_frame_errors); ++ PRINT_FIELD_U(", ", st, rx_fifo_errors); ++ PRINT_FIELD_U(", ", st, rx_missed_errors); ++ PRINT_FIELD_U(", ", st, tx_aborted_errors); ++ PRINT_FIELD_U(", ", st, tx_carrier_errors); ++ PRINT_FIELD_U(", ", st, tx_fifo_errors); ++ PRINT_FIELD_U(", ", st, tx_heartbeat_errors); ++ PRINT_FIELD_U(", ", st, tx_window_errors); ++ PRINT_FIELD_U(", ", st, rx_compressed); ++ PRINT_FIELD_U(", ", st, tx_compressed); + #ifdef HAVE_STRUCT_RTNL_LINK_STATS_RX_NOHANDLER +- PRINT_FIELD_U(", ", st, rx_nohandler); ++ PRINT_FIELD_U(", ", st, rx_nohandler); + #endif + printf("}")); + +-#ifdef HAVE_STRUCT_RTNL_LINK_STATS_RX_NOHANDLER +- const unsigned int sizeof_stats = +- offsetofend(struct rtnl_link_stats, tx_compressed); + TEST_NLATTR(fd, nlh0, hdrlen, + init_ifinfomsg, print_ifinfomsg, + IFLA_STATS, sizeof_stats, &st, sizeof_stats, +@@ -179,7 +178,6 @@ + PRINT_FIELD_U(", ", st, rx_compressed); + PRINT_FIELD_U(", ", st, tx_compressed); + printf("}")); +-#endif /* HAVE_STRUCT_RTNL_LINK_STATS_RX_NOHANDLER */ + + static const struct rtnl_link_ifmap map = { + .mem_start = 0xadcbefedefbcdedb, +Index: strace-5.1/tests-m32/nlattr_mdba_mdb_entry.c +=================================================================== +--- strace-5.1.orig/tests-m32/nlattr_mdba_mdb_entry.c 2018-12-10 01:00:00.000000000 +0100 ++++ strace-5.1/tests-m32/nlattr_mdba_mdb_entry.c 2020-01-29 12:37:24.583862745 +0100 +@@ -122,9 +122,13 @@ + printf(", state=MDB_TEMPORARY"); + # ifdef HAVE_STRUCT_BR_MDB_ENTRY_FLAGS + printf(", flags=MDB_FLAGS_OFFLOAD"); ++# else ++ printf(", flags=0"); + # endif + # ifdef HAVE_STRUCT_BR_MDB_ENTRY_VID + PRINT_FIELD_U(", ", entry, vid); ++# else ++ printf(", vid=0"); + # endif + printf(", addr={u="); + print_quoted_hex(&entry.addr.u, +@@ -145,9 +149,13 @@ + printf(", state=MDB_TEMPORARY"); + # ifdef HAVE_STRUCT_BR_MDB_ENTRY_FLAGS + printf(", flags=MDB_FLAGS_OFFLOAD"); ++# else ++ printf(", flags=0"); + # endif + # ifdef HAVE_STRUCT_BR_MDB_ENTRY_VID + PRINT_FIELD_U(", ", entry, vid); ++# else ++ printf(", vid=0"); + # endif + printf(", addr={u="); + print_quoted_hex(&entry.addr.u, sizeof(entry.addr.u)); +Index: strace-5.1/tests-mx32/nlattr_ifinfomsg.c +=================================================================== +--- strace-5.1.orig/tests-mx32/nlattr_ifinfomsg.c 2018-12-30 16:35:21.000000000 +0100 ++++ strace-5.1/tests-mx32/nlattr_ifinfomsg.c 2020-01-29 12:37:24.529863241 +0100 +@@ -118,40 +118,39 @@ + IFLA_LINK_NETNSID, pattern, netnsid, + printf("%d", netnsid)); + +- TEST_NLATTR_OBJECT(fd, nlh0, hdrlen, +- init_ifinfomsg, print_ifinfomsg, +- IFLA_STATS, pattern, st, +- PRINT_FIELD_U("{", st, rx_packets); +- PRINT_FIELD_U(", ", st, tx_packets); +- PRINT_FIELD_U(", ", st, rx_bytes); +- PRINT_FIELD_U(", ", st, tx_bytes); +- PRINT_FIELD_U(", ", st, rx_errors); +- PRINT_FIELD_U(", ", st, tx_errors); +- PRINT_FIELD_U(", ", st, rx_dropped); +- PRINT_FIELD_U(", ", st, tx_dropped); +- PRINT_FIELD_U(", ", st, multicast); +- PRINT_FIELD_U(", ", st, collisions); +- PRINT_FIELD_U(", ", st, rx_length_errors); +- PRINT_FIELD_U(", ", st, rx_over_errors); +- PRINT_FIELD_U(", ", st, rx_crc_errors); +- PRINT_FIELD_U(", ", st, rx_frame_errors); +- PRINT_FIELD_U(", ", st, rx_fifo_errors); +- PRINT_FIELD_U(", ", st, rx_missed_errors); +- PRINT_FIELD_U(", ", st, tx_aborted_errors); +- PRINT_FIELD_U(", ", st, tx_carrier_errors); +- PRINT_FIELD_U(", ", st, tx_fifo_errors); +- PRINT_FIELD_U(", ", st, tx_heartbeat_errors); +- PRINT_FIELD_U(", ", st, tx_window_errors); +- PRINT_FIELD_U(", ", st, rx_compressed); +- PRINT_FIELD_U(", ", st, tx_compressed); ++ const unsigned int sizeof_stats = ++ offsetofend(struct rtnl_link_stats, tx_compressed); ++ TEST_NLATTR_OBJECT_MINSZ(fd, nlh0, hdrlen, ++ init_ifinfomsg, print_ifinfomsg, ++ IFLA_STATS, pattern, st, sizeof_stats, ++ PRINT_FIELD_U("{", st, rx_packets); ++ PRINT_FIELD_U(", ", st, tx_packets); ++ PRINT_FIELD_U(", ", st, rx_bytes); ++ PRINT_FIELD_U(", ", st, tx_bytes); ++ PRINT_FIELD_U(", ", st, rx_errors); ++ PRINT_FIELD_U(", ", st, tx_errors); ++ PRINT_FIELD_U(", ", st, rx_dropped); ++ PRINT_FIELD_U(", ", st, tx_dropped); ++ PRINT_FIELD_U(", ", st, multicast); ++ PRINT_FIELD_U(", ", st, collisions); ++ PRINT_FIELD_U(", ", st, rx_length_errors); ++ PRINT_FIELD_U(", ", st, rx_over_errors); ++ PRINT_FIELD_U(", ", st, rx_crc_errors); ++ PRINT_FIELD_U(", ", st, rx_frame_errors); ++ PRINT_FIELD_U(", ", st, rx_fifo_errors); ++ PRINT_FIELD_U(", ", st, rx_missed_errors); ++ PRINT_FIELD_U(", ", st, tx_aborted_errors); ++ PRINT_FIELD_U(", ", st, tx_carrier_errors); ++ PRINT_FIELD_U(", ", st, tx_fifo_errors); ++ PRINT_FIELD_U(", ", st, tx_heartbeat_errors); ++ PRINT_FIELD_U(", ", st, tx_window_errors); ++ PRINT_FIELD_U(", ", st, rx_compressed); ++ PRINT_FIELD_U(", ", st, tx_compressed); + #ifdef HAVE_STRUCT_RTNL_LINK_STATS_RX_NOHANDLER +- PRINT_FIELD_U(", ", st, rx_nohandler); ++ PRINT_FIELD_U(", ", st, rx_nohandler); + #endif + printf("}")); + +-#ifdef HAVE_STRUCT_RTNL_LINK_STATS_RX_NOHANDLER +- const unsigned int sizeof_stats = +- offsetofend(struct rtnl_link_stats, tx_compressed); + TEST_NLATTR(fd, nlh0, hdrlen, + init_ifinfomsg, print_ifinfomsg, + IFLA_STATS, sizeof_stats, &st, sizeof_stats, +@@ -179,7 +178,6 @@ + PRINT_FIELD_U(", ", st, rx_compressed); + PRINT_FIELD_U(", ", st, tx_compressed); + printf("}")); +-#endif /* HAVE_STRUCT_RTNL_LINK_STATS_RX_NOHANDLER */ + + static const struct rtnl_link_ifmap map = { + .mem_start = 0xadcbefedefbcdedb, +Index: strace-5.1/tests-mx32/nlattr_mdba_mdb_entry.c +=================================================================== +--- strace-5.1.orig/tests-mx32/nlattr_mdba_mdb_entry.c 2018-12-10 01:00:00.000000000 +0100 ++++ strace-5.1/tests-mx32/nlattr_mdba_mdb_entry.c 2020-01-29 12:37:24.585862727 +0100 +@@ -122,9 +122,13 @@ + printf(", state=MDB_TEMPORARY"); + # ifdef HAVE_STRUCT_BR_MDB_ENTRY_FLAGS + printf(", flags=MDB_FLAGS_OFFLOAD"); ++# else ++ printf(", flags=0"); + # endif + # ifdef HAVE_STRUCT_BR_MDB_ENTRY_VID + PRINT_FIELD_U(", ", entry, vid); ++# else ++ printf(", vid=0"); + # endif + printf(", addr={u="); + print_quoted_hex(&entry.addr.u, +@@ -145,9 +149,13 @@ + printf(", state=MDB_TEMPORARY"); + # ifdef HAVE_STRUCT_BR_MDB_ENTRY_FLAGS + printf(", flags=MDB_FLAGS_OFFLOAD"); ++# else ++ printf(", flags=0"); + # endif + # ifdef HAVE_STRUCT_BR_MDB_ENTRY_VID + PRINT_FIELD_U(", ", entry, vid); ++# else ++ printf(", vid=0"); + # endif + printf(", addr={u="); + print_quoted_hex(&entry.addr.u, sizeof(entry.addr.u)); diff --git a/SOURCES/0066-rtnl_neightbl-always-decode-struct-ndt_config-and-st.patch b/SOURCES/0066-rtnl_neightbl-always-decode-struct-ndt_config-and-st.patch new file mode 100644 index 0000000..76f6b51 --- /dev/null +++ b/SOURCES/0066-rtnl_neightbl-always-decode-struct-ndt_config-and-st.patch @@ -0,0 +1,120 @@ +From 76f5cf99f83f38ce23be29ea470d4da3d525c859 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Thu, 17 Oct 2019 15:50:09 +0200 +Subject: [PATCH 66/76] rtnl_neightbl: always decode struct ndt_config and + struct ndt_stats + +* rtnl_neightbl.c (struct_ndt_config, struct_ndt_stats): New typedefs. +[HAVE_STRUCT_NDT_CONFIG]: New static_assert to check +that sizeof(struct ndt_config) has the expected value. +[HAVE_STRUCT_NDT_STATS]: New static_assert to check +that sizeof(struct ndt_stats) has the expected value. +(decode_ndt_config) [HAVE_STRUCT_NDT_CONFIG]: Remove guard. +(decode_ndt_config): Change the type of ndtc variable +to struct_ndt_config. +(decode_ndt_stats) [HAVE_STRUCT_NDT_STATS]: Remove guard. +(decode_ndt_stats): Change the type of ndtst variable +to struct_ndt_stats. + +References: https://bugzilla.redhat.com/show_bug.cgi?id=1758201 +--- + rtnl_neightbl.c | 50 ++++++++++++++++++++++++++++++++++++++------------ + 1 file changed, 38 insertions(+), 12 deletions(-) + +diff --git a/rtnl_neightbl.c b/rtnl_neightbl.c +index f9f5756..0f5d6eb 100644 +--- a/rtnl_neightbl.c ++++ b/rtnl_neightbl.c +@@ -21,14 +21,49 @@ + #include "xlat/rtnl_neightbl_attrs.h" + #include "xlat/rtnl_neightbl_parms_attrs.h" + ++typedef struct { ++ uint16_t ndtc_key_len; ++ uint16_t ndtc_entry_size; ++ uint32_t ndtc_entries; ++ uint32_t ndtc_last_flush; ++ uint32_t ndtc_last_rand; ++ uint32_t ndtc_hash_rnd; ++ uint32_t ndtc_hash_mask; ++ uint32_t ndtc_hash_chain_gc; ++ uint32_t ndtc_proxy_qlen; ++} struct_ndt_config; ++ ++typedef struct { ++ uint64_t ndts_allocs; ++ uint64_t ndts_destroys; ++ uint64_t ndts_hash_grows; ++ uint64_t ndts_res_failed; ++ uint64_t ndts_lookups; ++ uint64_t ndts_hits; ++ uint64_t ndts_rcv_probes_mcast; ++ uint64_t ndts_rcv_probes_ucast; ++ uint64_t ndts_periodic_gc_runs; ++ uint64_t ndts_forced_gc_runs; ++ uint64_t ndts_table_fulls; /**< Added by v4.3-rc1~96^2~202 */ ++} struct_ndt_stats; ++ ++# ifdef HAVE_STRUCT_NDT_CONFIG ++static_assert(sizeof(struct ndt_config) == sizeof(struct_ndt_config), ++ "Unexpected struct ndt_config size, please update the decoder"); ++# endif ++# ifdef HAVE_STRUCT_NDT_STATS ++static_assert(sizeof(struct ndt_stats) <= sizeof(struct_ndt_stats), ++ "Unexpected struct ndt_stats size, please update the decoder"); ++# endif ++ ++ + static bool + decode_ndt_config(struct tcb *const tcp, + const kernel_ulong_t addr, + const unsigned int len, + const void *const opaque_data) + { +-#ifdef HAVE_STRUCT_NDT_CONFIG +- struct ndt_config ndtc; ++ struct_ndt_config ndtc; + + if (len < sizeof(ndtc)) + return false; +@@ -46,9 +81,6 @@ decode_ndt_config(struct tcb *const tcp, + } + + return true; +-#else +- return false; +-#endif + } + + static const nla_decoder_t ndt_parms_nla_decoders[] = { +@@ -91,8 +123,7 @@ decode_ndt_stats(struct tcb *const tcp, + const unsigned int len, + const void *const opaque_data) + { +-#ifdef HAVE_STRUCT_NDT_STATS +- struct ndt_stats ndtst; ++ struct_ndt_stats ndtst; + const unsigned int min_size = + offsetofend(struct ndt_stats, ndts_forced_gc_runs); + const unsigned int def_size = sizeof(ndtst); +@@ -114,17 +145,12 @@ decode_ndt_stats(struct tcb *const tcp, + PRINT_FIELD_U(", ", ndtst, ndts_rcv_probes_ucast); + PRINT_FIELD_U(", ", ndtst, ndts_periodic_gc_runs); + PRINT_FIELD_U(", ", ndtst, ndts_forced_gc_runs); +-# ifdef HAVE_STRUCT_NDT_STATS_NDTS_TABLE_FULLS + if (len >= def_size) + PRINT_FIELD_U(", ", ndtst, ndts_table_fulls); +-# endif + tprints("}"); + } + + return true; +-#else +- return false; +-#endif + } + + static const nla_decoder_t ndtmsg_nla_decoders[] = { +-- +2.1.4 + diff --git a/SOURCES/0067-rtnl_route-decode-struct-rta_mfc_stats-and-struct-rt.patch b/SOURCES/0067-rtnl_route-decode-struct-rta_mfc_stats-and-struct-rt.patch new file mode 100644 index 0000000..f6b23d1 --- /dev/null +++ b/SOURCES/0067-rtnl_route-decode-struct-rta_mfc_stats-and-struct-rt.patch @@ -0,0 +1,104 @@ +From 0eda4eb08b74e5c1e3100a9369b78625b8bb79c6 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Sun, 20 Oct 2019 12:59:51 +0200 +Subject: [PATCH 67/76] rtnl_route: decode struct rta_mfc_stats and struct + rtvia unconditionally + +* rtnl_route.c (struct_rta_mfc_stats, struct_rtvia): New typedefs. +[HAVE_STRUCT_RTA_MFC_STATS]: Add a static_assert to check +that sizeof(struct rta_mfc_stats) has the expected value. +[HAVE_STRUCT_RTVIA]: Add a static_assert to check that sizeof(struct +rtvia) has the expected value. +(decode_rta_mfc_stats) [HAVE_STRUCT_RTA_MFC_STATS]: Remove guard. +(decode_rta_mfc_stats): Change the type of mfcs variable to +struct_rta_mfc_stats. +(decode_rtvia): Change the type of via variable to struct_rtvia. + +References: https://bugzilla.redhat.com/show_bug.cgi?id=1758201 +--- + rtnl_route.c | 35 ++++++++++++++++++++++++----------- + 1 file changed, 24 insertions(+), 11 deletions(-) + +diff --git a/rtnl_route.c b/rtnl_route.c +index f1bca94..aa81e50 100644 +--- a/rtnl_route.c ++++ b/rtnl_route.c +@@ -26,6 +26,27 @@ + #include "xlat/rtnl_route_attrs.h" + #include "xlat/rtnl_rta_metrics_attrs.h" + ++/** Added by Linux commit v3.8-rc1~139^2~90 */ ++typedef struct { ++ uint64_t mfcs_packets; ++ uint64_t mfcs_bytes; ++ uint64_t mfcs_wrong_if; ++} struct_rta_mfc_stats; ++ ++typedef struct { ++ uint16_t /* __kernel_sa_family_t */ rtvia_family; ++ uint8_t rtvia_addr[0]; ++} struct_rtvia; ++ ++#ifdef HAVE_STRUCT_RTA_MFC_STATS ++static_assert(sizeof(struct_rta_mfc_stats) == sizeof(struct rta_mfc_stats), ++ "Unexpected struct rta_mfc_stats, please update the decoder"); ++#endif ++#ifdef HAVE_STRUCT_RTVIA ++static_assert(sizeof(struct_rtvia) == sizeof(struct rtvia), ++ "Unexpected struct rtvia, please update the decoder"); ++#endif ++ + bool + decode_nla_rt_class(struct tcb *const tcp, + const kernel_ulong_t addr, +@@ -138,8 +159,7 @@ decode_rta_mfc_stats(struct tcb *const tcp, + const unsigned int len, + const void *const opaque_data) + { +-#ifdef HAVE_STRUCT_RTA_MFC_STATS +- struct rta_mfc_stats mfcs; ++ struct_rta_mfc_stats mfcs; + + if (len < sizeof(mfcs)) + return false; +@@ -151,9 +171,6 @@ decode_rta_mfc_stats(struct tcb *const tcp, + } + + return true; +-#else +- return false; +-#endif + } + + static bool +@@ -162,15 +179,14 @@ decode_rtvia(struct tcb *const tcp, + const unsigned int len, + const void *const opaque_data) + { +-#ifdef HAVE_STRUCT_RTVIA +- struct rtvia via; ++ struct_rtvia via; + + if (len < sizeof(via)) + return false; + else if (!umove_or_printaddr(tcp, addr, &via)) { + PRINT_FIELD_XVAL("{", via, rtvia_family, addrfams, "AF_???"); + +- const unsigned int offset = offsetof(struct rtvia, rtvia_addr); ++ const unsigned int offset = offsetof(struct_rtvia, rtvia_addr); + + if (len > offset) { + tprints(", "); +@@ -181,9 +197,6 @@ decode_rtvia(struct tcb *const tcp, + } + + return true; +-#else +- return false; +-#endif + } + + static bool +-- +2.1.4 + diff --git a/SOURCES/0068-evdev-do-not-rely-on-EVIOC-constants-provided-in-lin.patch b/SOURCES/0068-evdev-do-not-rely-on-EVIOC-constants-provided-in-lin.patch new file mode 100644 index 0000000..0465524 --- /dev/null +++ b/SOURCES/0068-evdev-do-not-rely-on-EVIOC-constants-provided-in-lin.patch @@ -0,0 +1,421 @@ +From 8cff8e59d501e41af8de9b0ff0e2f7bf65fc22f2 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Sun, 13 Oct 2019 17:18:38 +0200 +Subject: [PATCH 68/76] evdev: do not rely on EVIOC* constants provided in + + +* xlat/evdev_ioctl_cmds.in: New file. +* configure.ac (AC_CHECK_HEADERS([linux/input.h])): Check for struct +input_keymap_entry and struct input_mask. +* evdev.c [!INPUT_PROP_MAX] (INPUT_PROP_MAX): New macro definition. +(struct_input_keymap_entry, struct_input_mask): New typedefs. +[HAVE_STRUCT_INPUT_KEYMAP_ENTRY]: Add a static_assert to check +that sizeof(struct input_keymap_entry) has the expected value. +[HAVE_STRUCT_INPUT_MASK]: Add a static_assert to check +that sizeof(struct input_mask) has the expected value. +[!EVIOCGPROP] (EVIOCGPROP): New macro definition. +[!EVIOCGMTSLOTS] (EVIOCGMTSLOTS): Likewise. +[!EVIOCGSW] (EVIOCGSW): Likewise. +[!EVIOCGKEYCODE_V2] (keycode_V2_ioctl): Remove guard. +(keycode_V2_ioctl): Change type of ike to struct_input_keymap_entry. +[!EVIOCGMTSLOTS] (mtslots_ioctl): Remove guard. +[!EVIOCGREP || EVIOCSREP] (repeat_ioctl): Likewise. +(evdev_read_ioctl) [!EVIOCGREP] : Likewise. +(evdev_read_ioctl) [!EVIOCGKEYCODE_V2] : +Likewise. +(evdev_read_ioctl) [!EVIOCGMTSLOTS] : Likewise. +(evdev_read_ioctl) [!EVIOCGPROP] : Likewise. +(evdev_read_ioctl) [!EVIOCGSW] : Likewise. +(evdev_write_ioctl) [!EVIOCSREP] : Likewise. +(evdev_write_ioctl) [!EVIOCSKEYCODE_V2] : Likewise. +(evdev_write_ioctl) [!EVIOCREVOKE] : Likewise. +(evdev_write_ioctl) [!EVIOCSCLOCKID] : Likewise. + +References: https://bugzilla.redhat.com/show_bug.cgi?id=1758201 + +Conflicts: + evdev.c +--- + configure.ac | 4 +++ + evdev.c | 75 ++++++++++++++++++++++++++++++++---------------- + xlat/evdev_ioctl_cmds.in | 17 +++++++++++ + 3 files changed, 71 insertions(+), 25 deletions(-) + create mode 100644 xlat/evdev_ioctl_cmds.in + +Index: strace-5.1/configure.ac +=================================================================== +--- strace-5.1.orig/configure.ac 2020-01-29 12:35:51.722702560 +0100 ++++ strace-5.1/configure.ac 2020-01-29 12:37:35.136765878 +0100 +@@ -453,6 +453,10 @@ + #include ]) + + AC_CHECK_HEADERS([linux/input.h], [ ++ AC_CHECK_TYPES(m4_normalize([ ++ struct input_keymap_entry, ++ struct input_mask ++ ]),,, [#include ]) + AC_CHECK_MEMBERS([struct input_absinfo.resolution],,, [#include ]) + ]) + +Index: strace-5.1/evdev.c +=================================================================== +--- strace-5.1.orig/evdev.c 2020-01-29 12:35:42.692778989 +0100 ++++ strace-5.1/evdev.c 2020-01-29 12:37:35.139765850 +0100 +@@ -29,10 +29,59 @@ + # include "xlat/evdev_snd.h" + # include "xlat/evdev_switch.h" + ++/** Added by Linux commit v2.6.38-rc1~247^2~1^2~2^2~5 */ ++# ifndef INPUT_PROP_MAX ++# define INPUT_PROP_MAX 0x1f ++# endif + # ifndef SYN_MAX + # define SYN_MAX 0xf + # endif + ++/** Added by Linux commit v2.6.37-rc1~5^2~3^2~47 */ ++typedef struct { ++ uint8_t flags; ++ uint8_t len; ++ uint16_t index; ++ uint32_t keycode; ++ uint8_t scancode[32]; ++} struct_input_keymap_entry; ++ ++/** Added by Linux commit v4.4-rc1~11^2~3^2~2 */ ++typedef struct { ++ uint32_t type; ++ uint32_t codes_size; ++ uint64_t codes_ptr; ++} struct_input_mask; ++ ++# ifdef HAVE_STRUCT_INPUT_KEYMAP_ENTRY ++static_assert(sizeof(struct input_keymap_entry) ++ == sizeof(struct_input_keymap_entry), ++ "Unexpected struct input_keymap_entry size, please update " ++ "the decoder"); ++# endif ++# ifdef HAVE_STRUCT_INPUT_MASK ++static_assert(sizeof(struct input_mask) == sizeof(struct_input_mask), ++ "Unexpected struct input_mask size, please update the decoder"); ++# endif ++ ++/* ++ * Has to be included after struct_* type definitions, since _IO* macros ++ * used in fallback definitions require them for sizeof(). ++ */ ++# define XLAT_MACROS_ONLY ++# include "xlat/evdev_ioctl_cmds.h" ++# undef XLAT_MACROS_ONLY ++ ++# ifndef EVIOCGPROP ++# define EVIOCGPROP(len) _IOR('E', 0x09, len) ++# endif ++# ifndef EVIOCGMTSLOTS ++# define EVIOCGMTSLOTS(len) _IOR('E', 0x0a, len) ++# endif ++# ifndef EVIOCGSW ++# define EVIOCGSW(len) _IOR('E', 0x1b, len) ++# endif ++ + const size_t evdev_abs_size = ARRAY_SIZE(evdev_abs) - 1; + + static int +@@ -85,13 +134,12 @@ + return RVAL_IOCTL_DECODED; + } + +-# ifdef EVIOCGKEYCODE_V2 + static int + keycode_V2_ioctl(struct tcb *const tcp, const kernel_ulong_t arg) + { + tprints(", "); + +- struct input_keymap_entry ike; ++ struct_input_keymap_entry ike; + + if (umove_or_printaddr(tcp, arg, &ike)) + return RVAL_IOCTL_DECODED; +@@ -121,7 +169,6 @@ + + return RVAL_IOCTL_DECODED; + } +-# endif /* EVIOCGKEYCODE_V2 */ + + static int + getid_ioctl(struct tcb *const tcp, const kernel_ulong_t arg) +@@ -201,7 +248,6 @@ + decode_bitset_((tcp_), (arg_), (decode_nr_), (max_nr_), \ + (dflt_), ARRAY_SIZE(decode_nr_) - 1, (xt_)) + +-# ifdef EVIOCGMTSLOTS + static int + mtslots_ioctl(struct tcb *const tcp, const unsigned int code, + const kernel_ulong_t arg) +@@ -232,9 +278,7 @@ + + return RVAL_IOCTL_DECODED; + } +-# endif /* EVIOCGMTSLOTS */ + +-# if defined EVIOCGREP || defined EVIOCSREP + static int + repeat_ioctl(struct tcb *const tcp, const kernel_ulong_t arg) + { +@@ -242,7 +286,6 @@ + printpair_int(tcp, arg, "%u"); + return RVAL_IOCTL_DECODED; + } +-# endif /* EVIOCGREP || EVIOCSREP */ + + static int + bit_ioctl(struct tcb *const tcp, const unsigned int ev_nr, +@@ -310,24 +353,18 @@ + return RVAL_IOCTL_DECODED; + case EVIOCGID: + return getid_ioctl(tcp, arg); +-# ifdef EVIOCGREP + case EVIOCGREP: + return repeat_ioctl(tcp, arg); +-# endif + case EVIOCGKEYCODE: + return keycode_ioctl(tcp, arg); +-# ifdef EVIOCGKEYCODE_V2 + case EVIOCGKEYCODE_V2: + return keycode_V2_ioctl(tcp, arg); +-# endif + } + + /* fixed-number variable-length commands */ + switch (_IOC_NR(code)) { +-# ifdef EVIOCGMTSLOTS + case _IOC_NR(EVIOCGMTSLOTS(0)): + return mtslots_ioctl(tcp, code, arg); +-# endif + case _IOC_NR(EVIOCGNAME(0)): + case _IOC_NR(EVIOCGPHYS(0)): + case _IOC_NR(EVIOCGUNIQ(0)): +@@ -337,20 +374,16 @@ + else + printstrn(tcp, arg, tcp->u_rval); + return RVAL_IOCTL_DECODED; +-# ifdef EVIOCGPROP + case _IOC_NR(EVIOCGPROP(0)): + return decode_bitset(tcp, arg, evdev_prop, + INPUT_PROP_MAX, "PROP_???", + XT_INDEXED); +-# endif + case _IOC_NR(EVIOCGSND(0)): + return decode_bitset(tcp, arg, evdev_snd, + SND_MAX, "SND_???", XT_INDEXED); +-# ifdef EVIOCGSW + case _IOC_NR(EVIOCGSW(0)): + return decode_bitset(tcp, arg, evdev_switch, + SW_MAX, "SW_???", XT_INDEXED); +-# endif + case _IOC_NR(EVIOCGKEY(0)): + return decode_bitset(tcp, arg, evdev_keycode, + KEY_MAX, "KEY_???", XT_INDEXED); +@@ -376,31 +409,23 @@ + { + /* fixed-number fixed-length commands */ + switch (code) { +-# ifdef EVIOCSREP + case EVIOCSREP: + return repeat_ioctl(tcp, arg); +-# endif + case EVIOCSKEYCODE: + return keycode_ioctl(tcp, arg); +-# ifdef EVIOCSKEYCODE_V2 + case EVIOCSKEYCODE_V2: + return keycode_V2_ioctl(tcp, arg); +-# endif + case EVIOCRMFF: + tprintf(", %d", (int) arg); + return RVAL_IOCTL_DECODED; + case EVIOCGRAB: +-# ifdef EVIOCREVOKE + case EVIOCREVOKE: +-# endif + tprintf(", %" PRI_klu, arg); + return RVAL_IOCTL_DECODED; +-# ifdef EVIOCSCLOCKID + case EVIOCSCLOCKID: + tprints(", "); + printnum_int(tcp, arg, "%u"); + return RVAL_IOCTL_DECODED; +-# endif + } + + int rc = evdev_write_ioctl_mpers(tcp, code, arg); +Index: strace-5.1/xlat/evdev_ioctl_cmds.in +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-5.1/xlat/evdev_ioctl_cmds.in 2020-01-29 12:37:35.139765850 +0100 +@@ -0,0 +1,17 @@ ++EVIOCGVERSION _IOR('E', 0x01, int) ++EVIOCGID _IOR('E', 0x02, struct input_id) ++EVIOCGREP _IOR('E', 0x03, unsigned int[2]) ++EVIOCSREP _IOW('E', 0x03, unsigned int[2]) ++EVIOCGKEYCODE _IOR('E', 0x04, unsigned int[2]) ++EVIOCGKEYCODE_V2 _IOR('E', 0x04, struct_input_keymap_entry) ++EVIOCSKEYCODE _IOW('E', 0x04, unsigned int[2]) ++EVIOCSKEYCODE_V2 _IOW('E', 0x04, struct_input_keymap_entry) ++/* struct ff_effect is personality-dependent in size */ ++/* EVIOCSFF _IOW('E', 0x80, struct ff_effect) */ ++EVIOCRMFF _IOW('E', 0x81, int) ++EVIOCGEFFECTS _IOR('E', 0x84, int) ++EVIOCGRAB _IOW('E', 0x90, int) ++EVIOCREVOKE _IOW('E', 0x91, int) ++EVIOCGMASK _IOR('E', 0x92, struct_input_mask) ++EVIOCSMASK _IOW('E', 0x93, struct_input_mask) ++EVIOCSCLOCKID _IOW('E', 0xa0, int) +Index: strace-5.1/xlat/evdev_ioctl_cmds.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-5.1/xlat/evdev_ioctl_cmds.h 2020-01-29 12:38:33.041234361 +0100 +@@ -0,0 +1,144 @@ ++/* Generated by ./xlat/gen.sh from ./xlat/evdev_ioctl_cmds.in; do not edit. */ ++ ++#include "gcc_compat.h" ++#include "static_assert.h" ++ ++#if defined(EVIOCGVERSION) || (defined(HAVE_DECL_EVIOCGVERSION) && HAVE_DECL_EVIOCGVERSION) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((EVIOCGVERSION) == (_IOR('E', 0x01, int)), "EVIOCGVERSION != _IOR('E', 0x01, int)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define EVIOCGVERSION _IOR('E', 0x01, int) ++#endif ++#if defined(EVIOCGID) || (defined(HAVE_DECL_EVIOCGID) && HAVE_DECL_EVIOCGID) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((EVIOCGID) == (_IOR('E', 0x02, struct input_id)), "EVIOCGID != _IOR('E', 0x02, struct input_id)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define EVIOCGID _IOR('E', 0x02, struct input_id) ++#endif ++#if defined(EVIOCGREP) || (defined(HAVE_DECL_EVIOCGREP) && HAVE_DECL_EVIOCGREP) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((EVIOCGREP) == (_IOR('E', 0x03, unsigned int[2])), "EVIOCGREP != _IOR('E', 0x03, unsigned int[2])"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) ++#endif ++#if defined(EVIOCSREP) || (defined(HAVE_DECL_EVIOCSREP) && HAVE_DECL_EVIOCSREP) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((EVIOCSREP) == (_IOW('E', 0x03, unsigned int[2])), "EVIOCSREP != _IOW('E', 0x03, unsigned int[2])"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) ++#endif ++#if defined(EVIOCGKEYCODE) || (defined(HAVE_DECL_EVIOCGKEYCODE) && HAVE_DECL_EVIOCGKEYCODE) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((EVIOCGKEYCODE) == (_IOR('E', 0x04, unsigned int[2])), "EVIOCGKEYCODE != _IOR('E', 0x04, unsigned int[2])"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define EVIOCGKEYCODE _IOR('E', 0x04, unsigned int[2]) ++#endif ++#if defined(EVIOCGKEYCODE_V2) || (defined(HAVE_DECL_EVIOCGKEYCODE_V2) && HAVE_DECL_EVIOCGKEYCODE_V2) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((EVIOCGKEYCODE_V2) == (_IOR('E', 0x04, struct_input_keymap_entry)), "EVIOCGKEYCODE_V2 != _IOR('E', 0x04, struct_input_keymap_entry)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define EVIOCGKEYCODE_V2 _IOR('E', 0x04, struct_input_keymap_entry) ++#endif ++#if defined(EVIOCSKEYCODE) || (defined(HAVE_DECL_EVIOCSKEYCODE) && HAVE_DECL_EVIOCSKEYCODE) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((EVIOCSKEYCODE) == (_IOW('E', 0x04, unsigned int[2])), "EVIOCSKEYCODE != _IOW('E', 0x04, unsigned int[2])"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define EVIOCSKEYCODE _IOW('E', 0x04, unsigned int[2]) ++#endif ++#if defined(EVIOCSKEYCODE_V2) || (defined(HAVE_DECL_EVIOCSKEYCODE_V2) && HAVE_DECL_EVIOCSKEYCODE_V2) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((EVIOCSKEYCODE_V2) == (_IOW('E', 0x04, struct_input_keymap_entry)), "EVIOCSKEYCODE_V2 != _IOW('E', 0x04, struct_input_keymap_entry)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define EVIOCSKEYCODE_V2 _IOW('E', 0x04, struct_input_keymap_entry) ++#endif ++#if defined(EVIOCRMFF) || (defined(HAVE_DECL_EVIOCRMFF) && HAVE_DECL_EVIOCRMFF) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((EVIOCRMFF) == (_IOW('E', 0x81, int)), "EVIOCRMFF != _IOW('E', 0x81, int)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define EVIOCRMFF _IOW('E', 0x81, int) ++#endif ++#if defined(EVIOCGEFFECTS) || (defined(HAVE_DECL_EVIOCGEFFECTS) && HAVE_DECL_EVIOCGEFFECTS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((EVIOCGEFFECTS) == (_IOR('E', 0x84, int)), "EVIOCGEFFECTS != _IOR('E', 0x84, int)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define EVIOCGEFFECTS _IOR('E', 0x84, int) ++#endif ++#if defined(EVIOCGRAB) || (defined(HAVE_DECL_EVIOCGRAB) && HAVE_DECL_EVIOCGRAB) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((EVIOCGRAB) == (_IOW('E', 0x90, int)), "EVIOCGRAB != _IOW('E', 0x90, int)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define EVIOCGRAB _IOW('E', 0x90, int) ++#endif ++#if defined(EVIOCREVOKE) || (defined(HAVE_DECL_EVIOCREVOKE) && HAVE_DECL_EVIOCREVOKE) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((EVIOCREVOKE) == (_IOW('E', 0x91, int)), "EVIOCREVOKE != _IOW('E', 0x91, int)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define EVIOCREVOKE _IOW('E', 0x91, int) ++#endif ++#if defined(EVIOCGMASK) || (defined(HAVE_DECL_EVIOCGMASK) && HAVE_DECL_EVIOCGMASK) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((EVIOCGMASK) == (_IOR('E', 0x92, struct_input_mask)), "EVIOCGMASK != _IOR('E', 0x92, struct_input_mask)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define EVIOCGMASK _IOR('E', 0x92, struct_input_mask) ++#endif ++#if defined(EVIOCSMASK) || (defined(HAVE_DECL_EVIOCSMASK) && HAVE_DECL_EVIOCSMASK) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((EVIOCSMASK) == (_IOW('E', 0x93, struct_input_mask)), "EVIOCSMASK != _IOW('E', 0x93, struct_input_mask)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define EVIOCSMASK _IOW('E', 0x93, struct_input_mask) ++#endif ++#if defined(EVIOCSCLOCKID) || (defined(HAVE_DECL_EVIOCSCLOCKID) && HAVE_DECL_EVIOCSCLOCKID) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((EVIOCSCLOCKID) == (_IOW('E', 0xa0, int)), "EVIOCSCLOCKID != _IOW('E', 0xa0, int)"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define EVIOCSCLOCKID _IOW('E', 0xa0, int) ++#endif ++ ++#ifndef XLAT_MACROS_ONLY ++ ++# ifdef IN_MPERS ++ ++# error static const struct xlat evdev_ioctl_cmds in mpers mode ++ ++# else ++ ++static ++const struct xlat evdev_ioctl_cmds[] = { ++ XLAT(EVIOCGVERSION), ++ XLAT(EVIOCGID), ++ XLAT(EVIOCGREP), ++ XLAT(EVIOCSREP), ++ XLAT(EVIOCGKEYCODE), ++ XLAT(EVIOCGKEYCODE_V2), ++ XLAT(EVIOCSKEYCODE), ++ XLAT(EVIOCSKEYCODE_V2), ++ ++ ++ XLAT(EVIOCRMFF), ++ XLAT(EVIOCGEFFECTS), ++ XLAT(EVIOCGRAB), ++ XLAT(EVIOCREVOKE), ++ XLAT(EVIOCGMASK), ++ XLAT(EVIOCSMASK), ++ XLAT(EVIOCSCLOCKID), ++ XLAT_END ++}; ++ ++# endif /* !IN_MPERS */ ++ ++#endif /* !XLAT_MACROS_ONLY */ diff --git a/SOURCES/0069-xlat-update-v4l2_format_description_flags.patch b/SOURCES/0069-xlat-update-v4l2_format_description_flags.patch new file mode 100644 index 0000000..9d995c4 --- /dev/null +++ b/SOURCES/0069-xlat-update-v4l2_format_description_flags.patch @@ -0,0 +1,82 @@ +From b37e0c801e4c4e448906c0c4dc1191492ff50605 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Sun, 20 Oct 2019 19:05:16 +0200 +Subject: [PATCH 69/76] xlat: update v4l2_format_description_flags + +* xlat/v4l2_format_description_flags.in (V4L2_FMT_FLAG_COMPRESSED, +V4L2_FMT_FLAG_EMULATED): Add fallback definitions. +(V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM): New constant, introduced by Linux +commit v5.4-rc1~145^2~69. +(V4L2_FMT_FLAG_DYN_RESOLUTION): New constant, introduced by Linux commit +v5.4-rc1~145^2~68. +--- + xlat/v4l2_format_description_flags.in | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +Index: strace-5.1/xlat/v4l2_format_description_flags.in +=================================================================== +--- strace-5.1.orig/xlat/v4l2_format_description_flags.in 2014-11-04 16:27:31.000000000 +0100 ++++ strace-5.1/xlat/v4l2_format_description_flags.in 2020-01-29 12:38:57.160012970 +0100 +@@ -1,2 +1,4 @@ +-V4L2_FMT_FLAG_COMPRESSED +-V4L2_FMT_FLAG_EMULATED ++V4L2_FMT_FLAG_COMPRESSED 0x0001 ++V4L2_FMT_FLAG_EMULATED 0x0002 ++V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM 0x0004 ++V4L2_FMT_FLAG_DYN_RESOLUTION 0x0008 +Index: strace-5.1/xlat/v4l2_format_description_flags.h +=================================================================== +--- strace-5.1.orig/xlat/v4l2_format_description_flags.h 2019-05-22 15:08:31.000000000 +0200 ++++ strace-5.1/xlat/v4l2_format_description_flags.h 2020-01-29 12:39:06.599926319 +0100 +@@ -3,6 +3,34 @@ + #include "gcc_compat.h" + #include "static_assert.h" + ++#if defined(V4L2_FMT_FLAG_COMPRESSED) || (defined(HAVE_DECL_V4L2_FMT_FLAG_COMPRESSED) && HAVE_DECL_V4L2_FMT_FLAG_COMPRESSED) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_FMT_FLAG_COMPRESSED) == (0x0001), "V4L2_FMT_FLAG_COMPRESSED != 0x0001"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_FMT_FLAG_COMPRESSED 0x0001 ++#endif ++#if defined(V4L2_FMT_FLAG_EMULATED) || (defined(HAVE_DECL_V4L2_FMT_FLAG_EMULATED) && HAVE_DECL_V4L2_FMT_FLAG_EMULATED) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_FMT_FLAG_EMULATED) == (0x0002), "V4L2_FMT_FLAG_EMULATED != 0x0002"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_FMT_FLAG_EMULATED 0x0002 ++#endif ++#if defined(V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM) || (defined(HAVE_DECL_V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM) && HAVE_DECL_V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM) == (0x0004), "V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM != 0x0004"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM 0x0004 ++#endif ++#if defined(V4L2_FMT_FLAG_DYN_RESOLUTION) || (defined(HAVE_DECL_V4L2_FMT_FLAG_DYN_RESOLUTION) && HAVE_DECL_V4L2_FMT_FLAG_DYN_RESOLUTION) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_FMT_FLAG_DYN_RESOLUTION) == (0x0008), "V4L2_FMT_FLAG_DYN_RESOLUTION != 0x0008"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_FMT_FLAG_DYN_RESOLUTION 0x0008 ++#endif + + #ifndef XLAT_MACROS_ONLY + +@@ -16,12 +44,10 @@ + static + # endif + const struct xlat v4l2_format_description_flags[] = { +-#if defined(V4L2_FMT_FLAG_COMPRESSED) || (defined(HAVE_DECL_V4L2_FMT_FLAG_COMPRESSED) && HAVE_DECL_V4L2_FMT_FLAG_COMPRESSED) +- XLAT(V4L2_FMT_FLAG_COMPRESSED), +-#endif +-#if defined(V4L2_FMT_FLAG_EMULATED) || (defined(HAVE_DECL_V4L2_FMT_FLAG_EMULATED) && HAVE_DECL_V4L2_FMT_FLAG_EMULATED) +- XLAT(V4L2_FMT_FLAG_EMULATED), +-#endif ++ XLAT(V4L2_FMT_FLAG_COMPRESSED), ++ XLAT(V4L2_FMT_FLAG_EMULATED), ++ XLAT(V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM), ++ XLAT(V4L2_FMT_FLAG_DYN_RESOLUTION), + XLAT_END + }; + diff --git a/SOURCES/0070-evdev-decode-struct-input_absinfo-regardless-of-in-k.patch b/SOURCES/0070-evdev-decode-struct-input_absinfo-regardless-of-in-k.patch new file mode 100644 index 0000000..bac39bb --- /dev/null +++ b/SOURCES/0070-evdev-decode-struct-input_absinfo-regardless-of-in-k.patch @@ -0,0 +1,411 @@ +From 5680918c9e2cc8b2418a3809892532be0d10018a Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Thu, 17 Oct 2019 15:29:50 +0200 +Subject: [PATCH 70/76] evdev: decode struct input_absinfo regardless of + in-kernel definitions + +* evdev.c (struct_input_absinfo): New typedef. +(abs_ioctl): Add code argument. Add orig_sz, res_sz, sz, read_sz local +variables. Decode resolution field regardless of +HAVE_STRUCT_INPUT_ABSINFO_RESOLUTION. +(evdev_read_ioctl, evdev_write_ioctl): Pass code to abs_ioctl. +* tests/ioctl_evdev-success.c (print_input_absinfo): Update expected +output. +(main): Add absinfo_sz, absinfo_24, absinfo_32 local variables; add +additional checks for struct input_absinfo. + +References: https://bugzilla.redhat.com/show_bug.cgi?id=1758201 +--- + evdev.c | 78 ++++++++++++++++++++++++++++++--------------- + tests/ioctl_evdev-success.c | 51 ++++++++++++++++++++++++++--- + 2 files changed, 99 insertions(+), 30 deletions(-) + +Index: strace-5.1/evdev.c +=================================================================== +--- strace-5.1.orig/evdev.c 2020-01-29 12:37:35.139765850 +0100 ++++ strace-5.1/evdev.c 2020-01-29 12:39:10.344891943 +0100 +@@ -37,6 +37,15 @@ + # define SYN_MAX 0xf + # endif + ++typedef struct { ++ int32_t value; ++ int32_t minimum; ++ int32_t maximum; ++ int32_t fuzz; ++ int32_t flat; ++ int32_t resolution; /**< Added by Linux commit v2.6.31-rc1~100^2~1 */ ++} struct_input_absinfo; ++ + /** Added by Linux commit v2.6.37-rc1~5^2~3^2~47 */ + typedef struct { + uint8_t flags; +@@ -53,6 +62,9 @@ + uint64_t codes_ptr; + } struct_input_mask; + ++static_assert(sizeof(struct input_absinfo) <= sizeof(struct_input_absinfo), ++ "Unexpected struct input_absinfo size, please update " ++ "the decoder"); + # ifdef HAVE_STRUCT_INPUT_KEYMAP_ENTRY + static_assert(sizeof(struct input_keymap_entry) + == sizeof(struct_input_keymap_entry), +@@ -85,36 +97,50 @@ + const size_t evdev_abs_size = ARRAY_SIZE(evdev_abs) - 1; + + static int +-abs_ioctl(struct tcb *const tcp, const kernel_ulong_t arg) ++abs_ioctl(struct tcb *const tcp, const unsigned int code, ++ const kernel_ulong_t arg) + { ++ static const size_t orig_sz = offsetofend(struct_input_absinfo, flat); ++ static const size_t res_sz = offsetofend(struct_input_absinfo, ++ resolution); ++ ++ struct_input_absinfo absinfo; ++ size_t sz = _IOC_SIZE(code); ++ size_t read_sz = MIN(sz, sizeof(absinfo)); ++ ++ if (sz < orig_sz) ++ return RVAL_DECODED; ++ + tprints(", "); + +- struct input_absinfo absinfo; ++ if (umoven_or_printaddr(tcp, arg, read_sz, &absinfo)) ++ return RVAL_IOCTL_DECODED; + +- if (!umove_or_printaddr(tcp, arg, &absinfo)) { +- tprintf("{value=%u" +- ", minimum=%u, ", +- absinfo.value, +- absinfo.minimum); +- +- if (!abbrev(tcp)) { +- tprintf("maximum=%u" +- ", fuzz=%u" +- ", flat=%u", +- absinfo.maximum, +- absinfo.fuzz, +- absinfo.flat); +-# ifdef HAVE_STRUCT_INPUT_ABSINFO_RESOLUTION +- tprintf(", resolution=%u", +- absinfo.resolution); +-# endif +- } else { +- tprints("..."); +- } ++ tprintf("{value=%u" ++ ", minimum=%u, ", ++ absinfo.value, ++ absinfo.minimum); + +- tprints("}"); ++ if (!abbrev(tcp)) { ++ tprintf("maximum=%u" ++ ", fuzz=%u" ++ ", flat=%u", ++ absinfo.maximum, ++ absinfo.fuzz, ++ absinfo.flat); ++ if (sz >= res_sz) { ++ tprintf(", resolution=%u%s", ++ absinfo.resolution, ++ sz > res_sz ? ", ..." : ""); ++ } else if (sz > orig_sz) { ++ tprints(", ..."); ++ } ++ } else { ++ tprints("..."); + } + ++ tprints("}"); ++ + return RVAL_IOCTL_DECODED; + } + +@@ -394,7 +420,7 @@ + + /* multi-number fixed-length commands */ + if ((_IOC_NR(code) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0))) +- return abs_ioctl(tcp, arg); ++ return abs_ioctl(tcp, code, arg); + + /* multi-number variable-length commands */ + if ((_IOC_NR(code) & ~EV_MAX) == _IOC_NR(EVIOCGBIT(0, 0))) +@@ -435,7 +461,7 @@ + + /* multi-number fixed-length commands */ + if ((_IOC_NR(code) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0))) +- return abs_ioctl(tcp, arg); ++ return abs_ioctl(tcp, code, arg); + + return 0; + } +Index: strace-5.1/tests/ioctl_evdev-success.c +=================================================================== +--- strace-5.1.orig/tests/ioctl_evdev-success.c 2020-01-27 19:35:30.929507199 +0100 ++++ strace-5.1/tests/ioctl_evdev-success.c 2020-01-29 12:39:10.345891934 +0100 +@@ -56,6 +56,9 @@ + print_input_absinfo(long rc, const void *ptr, const void *arg) + { + const struct input_absinfo *absinfo = ptr; ++# if VERBOSE ++ const uintptr_t sz = (uintptr_t) arg; ++# endif + + if (rc < 0) { + printf("%p", absinfo); +@@ -67,9 +70,20 @@ + PRINT_FIELD_U(", ", *absinfo, maximum); + PRINT_FIELD_U(", ", *absinfo, fuzz); + PRINT_FIELD_U(", ", *absinfo, flat); ++ if (sz > offsetofend(struct input_absinfo, flat)) { ++ if (sz >= 24) { + # ifdef HAVE_STRUCT_INPUT_ABSINFO_RESOLUTION +- PRINT_FIELD_U(", ", *absinfo, resolution); ++ PRINT_FIELD_U(", ", *absinfo, resolution); ++# else ++ printf(", resolution=%u", *((int *) ptr + 5)); + # endif ++ ++ if (sz > 24) ++ printf(", ..."); ++ } else { ++ printf(", ..."); ++ } ++ } + # else + printf(", ..."); + # endif +@@ -176,10 +190,22 @@ + ", EVIOCGID, NULL) returning %lu", + inject_retval); + ++ static const void *absinfo_sz = ++ (const void *) (uintptr_t) sizeof(struct input_absinfo); ++ + 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); + ++ struct input_absinfo *absinfo_24 = tail_alloc(MAX(sizeof(*absinfo_24), ++ 24)); ++ struct input_absinfo *absinfo_32 = tail_alloc(MAX(sizeof(*absinfo_32), ++ 32)); ++ ++ fill_memory(absinfo, sizeof(struct input_absinfo)); ++ fill_memory(absinfo_24, 24); ++ fill_memory(absinfo_32, 32); ++ + # ifdef EVIOCGMTSLOTS + int mtslots[] = { ABS_MT_SLOT, 1, 3 }; + /* we use the second element to indicate the number of values */ +@@ -236,9 +262,26 @@ + 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 }, ++ { { _IOC(_IOC_READ, 'E', 0x40 + ABS_Y, 19), "EVIOCGABS(ABS_Y)", ++ absinfo, NULL }, NULL }, ++ { { _IOC(_IOC_READ, 'E', 0x40 + ABS_Y, 20), ++ "EVIOCGABS(ABS_Y)", absinfo, print_input_absinfo }, ++ (const void *) (uintptr_t) 20 }, ++ { { _IOC(_IOC_READ, 'E', 0x40 + ABS_Y, 21), ++ "EVIOCGABS(ABS_Y)", absinfo_24, print_input_absinfo }, ++ (const void *) (uintptr_t) 21 }, ++ { { _IOC(_IOC_READ, 'E', 0x40 + ABS_Y, 24), ++ "EVIOCGABS(ABS_Y)", absinfo_24, print_input_absinfo }, ++ (const void *) (uintptr_t) 24 }, ++ { { _IOC(_IOC_READ, 'E', 0x40 + ABS_Y, 32), ++ "EVIOCGABS(ABS_Y)", absinfo_32, print_input_absinfo }, ++ (const void *) (uintptr_t) 32 }, ++ { { ARG_STR(EVIOCGABS(ABS_X)), absinfo, print_input_absinfo }, ++ absinfo_sz}, ++ { { ARG_STR(EVIOCGABS(ABS_Y)), absinfo, print_input_absinfo }, ++ absinfo_sz }, ++ { { ARG_STR(EVIOCGABS(ABS_Y)), absinfo, print_input_absinfo }, ++ absinfo_sz }, + { { ARG_STR(EVIOCGBIT(0, 0)), ev_more, print_getbit }, + inject_retval * 8 <= EV_LED + ? (const void *) &ev_more_str_2 +Index: strace-5.1/tests-m32/ioctl_evdev-success.c +=================================================================== +--- strace-5.1.orig/tests-m32/ioctl_evdev-success.c 2020-01-27 19:35:30.932507172 +0100 ++++ strace-5.1/tests-m32/ioctl_evdev-success.c 2020-01-29 12:39:23.992766667 +0100 +@@ -56,6 +56,9 @@ + print_input_absinfo(long rc, const void *ptr, const void *arg) + { + const struct input_absinfo *absinfo = ptr; ++# if VERBOSE ++ const uintptr_t sz = (uintptr_t) arg; ++# endif + + if (rc < 0) { + printf("%p", absinfo); +@@ -67,9 +70,20 @@ + PRINT_FIELD_U(", ", *absinfo, maximum); + PRINT_FIELD_U(", ", *absinfo, fuzz); + PRINT_FIELD_U(", ", *absinfo, flat); ++ if (sz > offsetofend(struct input_absinfo, flat)) { ++ if (sz >= 24) { + # ifdef HAVE_STRUCT_INPUT_ABSINFO_RESOLUTION +- PRINT_FIELD_U(", ", *absinfo, resolution); ++ PRINT_FIELD_U(", ", *absinfo, resolution); ++# else ++ printf(", resolution=%u", *((int *) ptr + 5)); + # endif ++ ++ if (sz > 24) ++ printf(", ..."); ++ } else { ++ printf(", ..."); ++ } ++ } + # else + printf(", ..."); + # endif +@@ -176,10 +190,22 @@ + ", EVIOCGID, NULL) returning %lu", + inject_retval); + ++ static const void *absinfo_sz = ++ (const void *) (uintptr_t) sizeof(struct input_absinfo); ++ + 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); + ++ struct input_absinfo *absinfo_24 = tail_alloc(MAX(sizeof(*absinfo_24), ++ 24)); ++ struct input_absinfo *absinfo_32 = tail_alloc(MAX(sizeof(*absinfo_32), ++ 32)); ++ ++ fill_memory(absinfo, sizeof(struct input_absinfo)); ++ fill_memory(absinfo_24, 24); ++ fill_memory(absinfo_32, 32); ++ + # ifdef EVIOCGMTSLOTS + int mtslots[] = { ABS_MT_SLOT, 1, 3 }; + /* we use the second element to indicate the number of values */ +@@ -236,9 +262,26 @@ + 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 }, ++ { { _IOC(_IOC_READ, 'E', 0x40 + ABS_Y, 19), "EVIOCGABS(ABS_Y)", ++ absinfo, NULL }, NULL }, ++ { { _IOC(_IOC_READ, 'E', 0x40 + ABS_Y, 20), ++ "EVIOCGABS(ABS_Y)", absinfo, print_input_absinfo }, ++ (const void *) (uintptr_t) 20 }, ++ { { _IOC(_IOC_READ, 'E', 0x40 + ABS_Y, 21), ++ "EVIOCGABS(ABS_Y)", absinfo_24, print_input_absinfo }, ++ (const void *) (uintptr_t) 21 }, ++ { { _IOC(_IOC_READ, 'E', 0x40 + ABS_Y, 24), ++ "EVIOCGABS(ABS_Y)", absinfo_24, print_input_absinfo }, ++ (const void *) (uintptr_t) 24 }, ++ { { _IOC(_IOC_READ, 'E', 0x40 + ABS_Y, 32), ++ "EVIOCGABS(ABS_Y)", absinfo_32, print_input_absinfo }, ++ (const void *) (uintptr_t) 32 }, ++ { { ARG_STR(EVIOCGABS(ABS_X)), absinfo, print_input_absinfo }, ++ absinfo_sz}, ++ { { ARG_STR(EVIOCGABS(ABS_Y)), absinfo, print_input_absinfo }, ++ absinfo_sz }, ++ { { ARG_STR(EVIOCGABS(ABS_Y)), absinfo, print_input_absinfo }, ++ absinfo_sz }, + { { ARG_STR(EVIOCGBIT(0, 0)), ev_more, print_getbit }, + inject_retval * 8 <= EV_LED + ? (const void *) &ev_more_str_2 +Index: strace-5.1/tests-mx32/ioctl_evdev-success.c +=================================================================== +--- strace-5.1.orig/tests-mx32/ioctl_evdev-success.c 2020-01-27 19:35:30.933507163 +0100 ++++ strace-5.1/tests-mx32/ioctl_evdev-success.c 2020-01-29 12:39:23.994766648 +0100 +@@ -56,6 +56,9 @@ + print_input_absinfo(long rc, const void *ptr, const void *arg) + { + const struct input_absinfo *absinfo = ptr; ++# if VERBOSE ++ const uintptr_t sz = (uintptr_t) arg; ++# endif + + if (rc < 0) { + printf("%p", absinfo); +@@ -67,9 +70,20 @@ + PRINT_FIELD_U(", ", *absinfo, maximum); + PRINT_FIELD_U(", ", *absinfo, fuzz); + PRINT_FIELD_U(", ", *absinfo, flat); ++ if (sz > offsetofend(struct input_absinfo, flat)) { ++ if (sz >= 24) { + # ifdef HAVE_STRUCT_INPUT_ABSINFO_RESOLUTION +- PRINT_FIELD_U(", ", *absinfo, resolution); ++ PRINT_FIELD_U(", ", *absinfo, resolution); ++# else ++ printf(", resolution=%u", *((int *) ptr + 5)); + # endif ++ ++ if (sz > 24) ++ printf(", ..."); ++ } else { ++ printf(", ..."); ++ } ++ } + # else + printf(", ..."); + # endif +@@ -176,10 +190,22 @@ + ", EVIOCGID, NULL) returning %lu", + inject_retval); + ++ static const void *absinfo_sz = ++ (const void *) (uintptr_t) sizeof(struct input_absinfo); ++ + 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); + ++ struct input_absinfo *absinfo_24 = tail_alloc(MAX(sizeof(*absinfo_24), ++ 24)); ++ struct input_absinfo *absinfo_32 = tail_alloc(MAX(sizeof(*absinfo_32), ++ 32)); ++ ++ fill_memory(absinfo, sizeof(struct input_absinfo)); ++ fill_memory(absinfo_24, 24); ++ fill_memory(absinfo_32, 32); ++ + # ifdef EVIOCGMTSLOTS + int mtslots[] = { ABS_MT_SLOT, 1, 3 }; + /* we use the second element to indicate the number of values */ +@@ -236,9 +262,26 @@ + 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 }, ++ { { _IOC(_IOC_READ, 'E', 0x40 + ABS_Y, 19), "EVIOCGABS(ABS_Y)", ++ absinfo, NULL }, NULL }, ++ { { _IOC(_IOC_READ, 'E', 0x40 + ABS_Y, 20), ++ "EVIOCGABS(ABS_Y)", absinfo, print_input_absinfo }, ++ (const void *) (uintptr_t) 20 }, ++ { { _IOC(_IOC_READ, 'E', 0x40 + ABS_Y, 21), ++ "EVIOCGABS(ABS_Y)", absinfo_24, print_input_absinfo }, ++ (const void *) (uintptr_t) 21 }, ++ { { _IOC(_IOC_READ, 'E', 0x40 + ABS_Y, 24), ++ "EVIOCGABS(ABS_Y)", absinfo_24, print_input_absinfo }, ++ (const void *) (uintptr_t) 24 }, ++ { { _IOC(_IOC_READ, 'E', 0x40 + ABS_Y, 32), ++ "EVIOCGABS(ABS_Y)", absinfo_32, print_input_absinfo }, ++ (const void *) (uintptr_t) 32 }, ++ { { ARG_STR(EVIOCGABS(ABS_X)), absinfo, print_input_absinfo }, ++ absinfo_sz}, ++ { { ARG_STR(EVIOCGABS(ABS_Y)), absinfo, print_input_absinfo }, ++ absinfo_sz }, ++ { { ARG_STR(EVIOCGABS(ABS_Y)), absinfo, print_input_absinfo }, ++ absinfo_sz }, + { { ARG_STR(EVIOCGBIT(0, 0)), ev_more, print_getbit }, + inject_retval * 8 <= EV_LED + ? (const void *) &ev_more_str_2 diff --git a/SOURCES/0071-xlat-provide-fallback-definitions-for-V4L2_CAP_-cons.patch b/SOURCES/0071-xlat-provide-fallback-definitions-for-V4L2_CAP_-cons.patch new file mode 100644 index 0000000..6c83969 --- /dev/null +++ b/SOURCES/0071-xlat-provide-fallback-definitions-for-V4L2_CAP_-cons.patch @@ -0,0 +1,414 @@ +From f650a4c7e2bf5d1636d52eab09b086ecab4d1e9f Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Thu, 3 Jan 2019 15:39:26 +0100 +Subject: [PATCH 71/76] xlat: provide fallback definitions for V4L2_CAP_* + constants + +* xlat/v4l2_device_capabilities_flags.in: Sort, add fallback definitions +for constants. +* configure.ac (AC_CHECK_MEMBERS): Check for struct +v4l2_capability.device_caps. +* v4l2.c (print_v4l2_capability): Change V4L2_CAP_DEVICE_CAPS guard +to HAVE_STRUCT_V4L2_CAPABILITY_DEVICE_CAPS. +--- + configure.ac | 1 + + v4l2.c | 2 +- + xlat/v4l2_device_capabilities_flags.in | 58 +++++++++++++++++----------------- + 3 files changed, 31 insertions(+), 30 deletions(-) + +Index: strace-5.1/configure.ac +=================================================================== +--- strace-5.1.orig/configure.ac 2020-01-29 12:37:35.136765878 +0100 ++++ strace-5.1/configure.ac 2020-01-29 12:39:33.198682164 +0100 +@@ -778,6 +778,7 @@ + #include ]) + + AC_CHECK_MEMBERS(m4_normalize([ ++ struct v4l2_capability.device_caps, + struct v4l2_window.global_alpha, + struct v4l2_sdr_format.buffersize + ]),,, [#include +Index: strace-5.1/v4l2.c +=================================================================== +--- strace-5.1.orig/v4l2.c 2020-01-27 19:35:30.949507018 +0100 ++++ strace-5.1/v4l2.c 2020-01-29 12:39:33.199682155 +0100 +@@ -133,7 +133,7 @@ + caps.version & 0xFF); + printflags(v4l2_device_capabilities_flags, caps.capabilities, + "V4L2_CAP_???"); +-#ifdef V4L2_CAP_DEVICE_CAPS ++#ifdef HAVE_STRUCT_V4L2_CAPABILITY_DEVICE_CAPS + tprints(", device_caps="); + printflags(v4l2_device_capabilities_flags, caps.device_caps, + "V4L2_CAP_???"); +Index: strace-5.1/xlat/v4l2_device_capabilities_flags.in +=================================================================== +--- strace-5.1.orig/xlat/v4l2_device_capabilities_flags.in 2019-01-05 22:14:42.000000000 +0100 ++++ strace-5.1/xlat/v4l2_device_capabilities_flags.in 2020-01-29 12:39:33.203682118 +0100 +@@ -1,29 +1,29 @@ +-V4L2_CAP_VIDEO_CAPTURE +-V4L2_CAP_VIDEO_OUTPUT +-V4L2_CAP_VIDEO_OVERLAY +-V4L2_CAP_VBI_CAPTURE +-V4L2_CAP_VBI_OUTPUT +-V4L2_CAP_SLICED_VBI_CAPTURE +-V4L2_CAP_SLICED_VBI_OUTPUT +-V4L2_CAP_RDS_CAPTURE +-V4L2_CAP_VIDEO_OUTPUT_OVERLAY +-V4L2_CAP_HW_FREQ_SEEK +-V4L2_CAP_RDS_OUTPUT +-V4L2_CAP_VIDEO_CAPTURE_MPLANE +-V4L2_CAP_VIDEO_OUTPUT_MPLANE +-V4L2_CAP_VIDEO_M2M +-V4L2_CAP_VIDEO_M2M_MPLANE +-V4L2_CAP_TUNER +-V4L2_CAP_AUDIO +-V4L2_CAP_RADIO +-V4L2_CAP_MODULATOR +-V4L2_CAP_READWRITE +-V4L2_CAP_ASYNCIO +-V4L2_CAP_STREAMING +-V4L2_CAP_META_OUTPUT +-V4L2_CAP_TOUCH +-V4L2_CAP_DEVICE_CAPS +-V4L2_CAP_SDR_CAPTURE +-V4L2_CAP_EXT_PIX_FORMAT +-V4L2_CAP_SDR_OUTPUT +-V4L2_CAP_META_CAPTURE ++V4L2_CAP_VIDEO_CAPTURE 0x00000001 ++V4L2_CAP_VIDEO_OUTPUT 0x00000002 ++V4L2_CAP_VIDEO_OVERLAY 0x00000004 ++V4L2_CAP_VBI_CAPTURE 0x00000010 ++V4L2_CAP_VBI_OUTPUT 0x00000020 ++V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 ++V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 ++V4L2_CAP_RDS_CAPTURE 0x00000100 ++V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 ++V4L2_CAP_HW_FREQ_SEEK 0x00000400 ++V4L2_CAP_RDS_OUTPUT 0x00000800 ++V4L2_CAP_VIDEO_CAPTURE_MPLANE 0x00001000 ++V4L2_CAP_VIDEO_OUTPUT_MPLANE 0x00002000 ++V4L2_CAP_VIDEO_M2M_MPLANE 0x00004000 ++V4L2_CAP_VIDEO_M2M 0x00008000 ++V4L2_CAP_TUNER 0x00010000 ++V4L2_CAP_AUDIO 0x00020000 ++V4L2_CAP_RADIO 0x00040000 ++V4L2_CAP_MODULATOR 0x00080000 ++V4L2_CAP_SDR_CAPTURE 0x00100000 ++V4L2_CAP_EXT_PIX_FORMAT 0x00200000 ++V4L2_CAP_SDR_OUTPUT 0x00400000 ++V4L2_CAP_META_CAPTURE 0x00800000 ++V4L2_CAP_READWRITE 0x01000000 ++V4L2_CAP_ASYNCIO 0x02000000 ++V4L2_CAP_STREAMING 0x04000000 ++V4L2_CAP_META_OUTPUT 0x08000000 ++V4L2_CAP_TOUCH 0x10000000 ++V4L2_CAP_DEVICE_CAPS 0x80000000 +Index: strace-5.1/xlat/v4l2_device_capabilities_flags.h +=================================================================== +--- strace-5.1.orig/xlat/v4l2_device_capabilities_flags.h 2019-05-22 15:08:31.000000000 +0200 ++++ strace-5.1/xlat/v4l2_device_capabilities_flags.h 2020-01-29 12:39:50.579522622 +0100 +@@ -3,106 +3,251 @@ + #include "gcc_compat.h" + #include "static_assert.h" + +- +-#ifndef XLAT_MACROS_ONLY +- +-# ifdef IN_MPERS +- +-extern const struct xlat v4l2_device_capabilities_flags[]; +- +-# else +- +-# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) +-static +-# endif +-const struct xlat v4l2_device_capabilities_flags[] = { + #if defined(V4L2_CAP_VIDEO_CAPTURE) || (defined(HAVE_DECL_V4L2_CAP_VIDEO_CAPTURE) && HAVE_DECL_V4L2_CAP_VIDEO_CAPTURE) +- XLAT(V4L2_CAP_VIDEO_CAPTURE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_VIDEO_CAPTURE) == (0x00000001), "V4L2_CAP_VIDEO_CAPTURE != 0x00000001"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_VIDEO_CAPTURE 0x00000001 + #endif + #if defined(V4L2_CAP_VIDEO_OUTPUT) || (defined(HAVE_DECL_V4L2_CAP_VIDEO_OUTPUT) && HAVE_DECL_V4L2_CAP_VIDEO_OUTPUT) +- XLAT(V4L2_CAP_VIDEO_OUTPUT), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_VIDEO_OUTPUT) == (0x00000002), "V4L2_CAP_VIDEO_OUTPUT != 0x00000002"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_VIDEO_OUTPUT 0x00000002 + #endif + #if defined(V4L2_CAP_VIDEO_OVERLAY) || (defined(HAVE_DECL_V4L2_CAP_VIDEO_OVERLAY) && HAVE_DECL_V4L2_CAP_VIDEO_OVERLAY) +- XLAT(V4L2_CAP_VIDEO_OVERLAY), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_VIDEO_OVERLAY) == (0x00000004), "V4L2_CAP_VIDEO_OVERLAY != 0x00000004"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_VIDEO_OVERLAY 0x00000004 + #endif + #if defined(V4L2_CAP_VBI_CAPTURE) || (defined(HAVE_DECL_V4L2_CAP_VBI_CAPTURE) && HAVE_DECL_V4L2_CAP_VBI_CAPTURE) +- XLAT(V4L2_CAP_VBI_CAPTURE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_VBI_CAPTURE) == (0x00000010), "V4L2_CAP_VBI_CAPTURE != 0x00000010"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_VBI_CAPTURE 0x00000010 + #endif + #if defined(V4L2_CAP_VBI_OUTPUT) || (defined(HAVE_DECL_V4L2_CAP_VBI_OUTPUT) && HAVE_DECL_V4L2_CAP_VBI_OUTPUT) +- XLAT(V4L2_CAP_VBI_OUTPUT), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_VBI_OUTPUT) == (0x00000020), "V4L2_CAP_VBI_OUTPUT != 0x00000020"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_VBI_OUTPUT 0x00000020 + #endif + #if defined(V4L2_CAP_SLICED_VBI_CAPTURE) || (defined(HAVE_DECL_V4L2_CAP_SLICED_VBI_CAPTURE) && HAVE_DECL_V4L2_CAP_SLICED_VBI_CAPTURE) +- XLAT(V4L2_CAP_SLICED_VBI_CAPTURE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_SLICED_VBI_CAPTURE) == (0x00000040), "V4L2_CAP_SLICED_VBI_CAPTURE != 0x00000040"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 + #endif + #if defined(V4L2_CAP_SLICED_VBI_OUTPUT) || (defined(HAVE_DECL_V4L2_CAP_SLICED_VBI_OUTPUT) && HAVE_DECL_V4L2_CAP_SLICED_VBI_OUTPUT) +- XLAT(V4L2_CAP_SLICED_VBI_OUTPUT), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_SLICED_VBI_OUTPUT) == (0x00000080), "V4L2_CAP_SLICED_VBI_OUTPUT != 0x00000080"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 + #endif + #if defined(V4L2_CAP_RDS_CAPTURE) || (defined(HAVE_DECL_V4L2_CAP_RDS_CAPTURE) && HAVE_DECL_V4L2_CAP_RDS_CAPTURE) +- XLAT(V4L2_CAP_RDS_CAPTURE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_RDS_CAPTURE) == (0x00000100), "V4L2_CAP_RDS_CAPTURE != 0x00000100"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_RDS_CAPTURE 0x00000100 + #endif + #if defined(V4L2_CAP_VIDEO_OUTPUT_OVERLAY) || (defined(HAVE_DECL_V4L2_CAP_VIDEO_OUTPUT_OVERLAY) && HAVE_DECL_V4L2_CAP_VIDEO_OUTPUT_OVERLAY) +- XLAT(V4L2_CAP_VIDEO_OUTPUT_OVERLAY), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_VIDEO_OUTPUT_OVERLAY) == (0x00000200), "V4L2_CAP_VIDEO_OUTPUT_OVERLAY != 0x00000200"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 + #endif + #if defined(V4L2_CAP_HW_FREQ_SEEK) || (defined(HAVE_DECL_V4L2_CAP_HW_FREQ_SEEK) && HAVE_DECL_V4L2_CAP_HW_FREQ_SEEK) +- XLAT(V4L2_CAP_HW_FREQ_SEEK), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_HW_FREQ_SEEK) == (0x00000400), "V4L2_CAP_HW_FREQ_SEEK != 0x00000400"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_HW_FREQ_SEEK 0x00000400 + #endif + #if defined(V4L2_CAP_RDS_OUTPUT) || (defined(HAVE_DECL_V4L2_CAP_RDS_OUTPUT) && HAVE_DECL_V4L2_CAP_RDS_OUTPUT) +- XLAT(V4L2_CAP_RDS_OUTPUT), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_RDS_OUTPUT) == (0x00000800), "V4L2_CAP_RDS_OUTPUT != 0x00000800"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_RDS_OUTPUT 0x00000800 + #endif + #if defined(V4L2_CAP_VIDEO_CAPTURE_MPLANE) || (defined(HAVE_DECL_V4L2_CAP_VIDEO_CAPTURE_MPLANE) && HAVE_DECL_V4L2_CAP_VIDEO_CAPTURE_MPLANE) +- XLAT(V4L2_CAP_VIDEO_CAPTURE_MPLANE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_VIDEO_CAPTURE_MPLANE) == (0x00001000), "V4L2_CAP_VIDEO_CAPTURE_MPLANE != 0x00001000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_VIDEO_CAPTURE_MPLANE 0x00001000 + #endif + #if defined(V4L2_CAP_VIDEO_OUTPUT_MPLANE) || (defined(HAVE_DECL_V4L2_CAP_VIDEO_OUTPUT_MPLANE) && HAVE_DECL_V4L2_CAP_VIDEO_OUTPUT_MPLANE) +- XLAT(V4L2_CAP_VIDEO_OUTPUT_MPLANE), +-#endif +-#if defined(V4L2_CAP_VIDEO_M2M) || (defined(HAVE_DECL_V4L2_CAP_VIDEO_M2M) && HAVE_DECL_V4L2_CAP_VIDEO_M2M) +- XLAT(V4L2_CAP_VIDEO_M2M), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_VIDEO_OUTPUT_MPLANE) == (0x00002000), "V4L2_CAP_VIDEO_OUTPUT_MPLANE != 0x00002000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_VIDEO_OUTPUT_MPLANE 0x00002000 + #endif + #if defined(V4L2_CAP_VIDEO_M2M_MPLANE) || (defined(HAVE_DECL_V4L2_CAP_VIDEO_M2M_MPLANE) && HAVE_DECL_V4L2_CAP_VIDEO_M2M_MPLANE) +- XLAT(V4L2_CAP_VIDEO_M2M_MPLANE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_VIDEO_M2M_MPLANE) == (0x00004000), "V4L2_CAP_VIDEO_M2M_MPLANE != 0x00004000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_VIDEO_M2M_MPLANE 0x00004000 ++#endif ++#if defined(V4L2_CAP_VIDEO_M2M) || (defined(HAVE_DECL_V4L2_CAP_VIDEO_M2M) && HAVE_DECL_V4L2_CAP_VIDEO_M2M) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_VIDEO_M2M) == (0x00008000), "V4L2_CAP_VIDEO_M2M != 0x00008000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_VIDEO_M2M 0x00008000 + #endif + #if defined(V4L2_CAP_TUNER) || (defined(HAVE_DECL_V4L2_CAP_TUNER) && HAVE_DECL_V4L2_CAP_TUNER) +- XLAT(V4L2_CAP_TUNER), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_TUNER) == (0x00010000), "V4L2_CAP_TUNER != 0x00010000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_TUNER 0x00010000 + #endif + #if defined(V4L2_CAP_AUDIO) || (defined(HAVE_DECL_V4L2_CAP_AUDIO) && HAVE_DECL_V4L2_CAP_AUDIO) +- XLAT(V4L2_CAP_AUDIO), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_AUDIO) == (0x00020000), "V4L2_CAP_AUDIO != 0x00020000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_AUDIO 0x00020000 + #endif + #if defined(V4L2_CAP_RADIO) || (defined(HAVE_DECL_V4L2_CAP_RADIO) && HAVE_DECL_V4L2_CAP_RADIO) +- XLAT(V4L2_CAP_RADIO), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_RADIO) == (0x00040000), "V4L2_CAP_RADIO != 0x00040000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_RADIO 0x00040000 + #endif + #if defined(V4L2_CAP_MODULATOR) || (defined(HAVE_DECL_V4L2_CAP_MODULATOR) && HAVE_DECL_V4L2_CAP_MODULATOR) +- XLAT(V4L2_CAP_MODULATOR), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_MODULATOR) == (0x00080000), "V4L2_CAP_MODULATOR != 0x00080000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_MODULATOR 0x00080000 ++#endif ++#if defined(V4L2_CAP_SDR_CAPTURE) || (defined(HAVE_DECL_V4L2_CAP_SDR_CAPTURE) && HAVE_DECL_V4L2_CAP_SDR_CAPTURE) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_SDR_CAPTURE) == (0x00100000), "V4L2_CAP_SDR_CAPTURE != 0x00100000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_SDR_CAPTURE 0x00100000 ++#endif ++#if defined(V4L2_CAP_EXT_PIX_FORMAT) || (defined(HAVE_DECL_V4L2_CAP_EXT_PIX_FORMAT) && HAVE_DECL_V4L2_CAP_EXT_PIX_FORMAT) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_EXT_PIX_FORMAT) == (0x00200000), "V4L2_CAP_EXT_PIX_FORMAT != 0x00200000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_EXT_PIX_FORMAT 0x00200000 ++#endif ++#if defined(V4L2_CAP_SDR_OUTPUT) || (defined(HAVE_DECL_V4L2_CAP_SDR_OUTPUT) && HAVE_DECL_V4L2_CAP_SDR_OUTPUT) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_SDR_OUTPUT) == (0x00400000), "V4L2_CAP_SDR_OUTPUT != 0x00400000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_SDR_OUTPUT 0x00400000 ++#endif ++#if defined(V4L2_CAP_META_CAPTURE) || (defined(HAVE_DECL_V4L2_CAP_META_CAPTURE) && HAVE_DECL_V4L2_CAP_META_CAPTURE) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_META_CAPTURE) == (0x00800000), "V4L2_CAP_META_CAPTURE != 0x00800000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_META_CAPTURE 0x00800000 + #endif + #if defined(V4L2_CAP_READWRITE) || (defined(HAVE_DECL_V4L2_CAP_READWRITE) && HAVE_DECL_V4L2_CAP_READWRITE) +- XLAT(V4L2_CAP_READWRITE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_READWRITE) == (0x01000000), "V4L2_CAP_READWRITE != 0x01000000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_READWRITE 0x01000000 + #endif + #if defined(V4L2_CAP_ASYNCIO) || (defined(HAVE_DECL_V4L2_CAP_ASYNCIO) && HAVE_DECL_V4L2_CAP_ASYNCIO) +- XLAT(V4L2_CAP_ASYNCIO), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_ASYNCIO) == (0x02000000), "V4L2_CAP_ASYNCIO != 0x02000000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_ASYNCIO 0x02000000 + #endif + #if defined(V4L2_CAP_STREAMING) || (defined(HAVE_DECL_V4L2_CAP_STREAMING) && HAVE_DECL_V4L2_CAP_STREAMING) +- XLAT(V4L2_CAP_STREAMING), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_STREAMING) == (0x04000000), "V4L2_CAP_STREAMING != 0x04000000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_STREAMING 0x04000000 + #endif + #if defined(V4L2_CAP_META_OUTPUT) || (defined(HAVE_DECL_V4L2_CAP_META_OUTPUT) && HAVE_DECL_V4L2_CAP_META_OUTPUT) +- XLAT(V4L2_CAP_META_OUTPUT), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_META_OUTPUT) == (0x08000000), "V4L2_CAP_META_OUTPUT != 0x08000000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_META_OUTPUT 0x08000000 + #endif + #if defined(V4L2_CAP_TOUCH) || (defined(HAVE_DECL_V4L2_CAP_TOUCH) && HAVE_DECL_V4L2_CAP_TOUCH) +- XLAT(V4L2_CAP_TOUCH), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_TOUCH) == (0x10000000), "V4L2_CAP_TOUCH != 0x10000000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_TOUCH 0x10000000 + #endif + #if defined(V4L2_CAP_DEVICE_CAPS) || (defined(HAVE_DECL_V4L2_CAP_DEVICE_CAPS) && HAVE_DECL_V4L2_CAP_DEVICE_CAPS) +- XLAT(V4L2_CAP_DEVICE_CAPS), +-#endif +-#if defined(V4L2_CAP_SDR_CAPTURE) || (defined(HAVE_DECL_V4L2_CAP_SDR_CAPTURE) && HAVE_DECL_V4L2_CAP_SDR_CAPTURE) +- XLAT(V4L2_CAP_SDR_CAPTURE), +-#endif +-#if defined(V4L2_CAP_EXT_PIX_FORMAT) || (defined(HAVE_DECL_V4L2_CAP_EXT_PIX_FORMAT) && HAVE_DECL_V4L2_CAP_EXT_PIX_FORMAT) +- XLAT(V4L2_CAP_EXT_PIX_FORMAT), +-#endif +-#if defined(V4L2_CAP_SDR_OUTPUT) || (defined(HAVE_DECL_V4L2_CAP_SDR_OUTPUT) && HAVE_DECL_V4L2_CAP_SDR_OUTPUT) +- XLAT(V4L2_CAP_SDR_OUTPUT), +-#endif +-#if defined(V4L2_CAP_META_CAPTURE) || (defined(HAVE_DECL_V4L2_CAP_META_CAPTURE) && HAVE_DECL_V4L2_CAP_META_CAPTURE) +- XLAT(V4L2_CAP_META_CAPTURE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CAP_DEVICE_CAPS) == (0x80000000), "V4L2_CAP_DEVICE_CAPS != 0x80000000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CAP_DEVICE_CAPS 0x80000000 + #endif ++ ++#ifndef XLAT_MACROS_ONLY ++ ++# ifdef IN_MPERS ++ ++extern const struct xlat v4l2_device_capabilities_flags[]; ++ ++# else ++ ++# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) ++static ++# endif ++const struct xlat v4l2_device_capabilities_flags[] = { ++ XLAT(V4L2_CAP_VIDEO_CAPTURE), ++ XLAT(V4L2_CAP_VIDEO_OUTPUT), ++ XLAT(V4L2_CAP_VIDEO_OVERLAY), ++ XLAT(V4L2_CAP_VBI_CAPTURE), ++ XLAT(V4L2_CAP_VBI_OUTPUT), ++ XLAT(V4L2_CAP_SLICED_VBI_CAPTURE), ++ XLAT(V4L2_CAP_SLICED_VBI_OUTPUT), ++ XLAT(V4L2_CAP_RDS_CAPTURE), ++ XLAT(V4L2_CAP_VIDEO_OUTPUT_OVERLAY), ++ XLAT(V4L2_CAP_HW_FREQ_SEEK), ++ XLAT(V4L2_CAP_RDS_OUTPUT), ++ XLAT(V4L2_CAP_VIDEO_CAPTURE_MPLANE), ++ XLAT(V4L2_CAP_VIDEO_OUTPUT_MPLANE), ++ XLAT(V4L2_CAP_VIDEO_M2M_MPLANE), ++ XLAT(V4L2_CAP_VIDEO_M2M), ++ XLAT(V4L2_CAP_TUNER), ++ XLAT(V4L2_CAP_AUDIO), ++ XLAT(V4L2_CAP_RADIO), ++ XLAT(V4L2_CAP_MODULATOR), ++ XLAT(V4L2_CAP_SDR_CAPTURE), ++ XLAT(V4L2_CAP_EXT_PIX_FORMAT), ++ XLAT(V4L2_CAP_SDR_OUTPUT), ++ XLAT(V4L2_CAP_META_CAPTURE), ++ XLAT(V4L2_CAP_READWRITE), ++ XLAT(V4L2_CAP_ASYNCIO), ++ XLAT(V4L2_CAP_STREAMING), ++ XLAT(V4L2_CAP_META_OUTPUT), ++ XLAT(V4L2_CAP_TOUCH), ++ XLAT(V4L2_CAP_DEVICE_CAPS), + XLAT_END + }; + diff --git a/SOURCES/0072-xlat-update-V4L2_BUF_TYPE_-constants.patch b/SOURCES/0072-xlat-update-V4L2_BUF_TYPE_-constants.patch new file mode 100644 index 0000000..bb9c0ed --- /dev/null +++ b/SOURCES/0072-xlat-update-V4L2_BUF_TYPE_-constants.patch @@ -0,0 +1,280 @@ +From 422bc707e5de3a9770108ce84e8910c272f8801f Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Thu, 3 Jan 2019 15:40:36 +0100 +Subject: [PATCH 72/76] xlat: update V4L2_BUF_TYPE_* constants + +* xlat/v4l2_buf_types.in: Add fallback definitions for constants, +mention V4L2_BUF_TYPE_PRIVATE in comment, add #value_indexed. +* configure.ac (AC_CHECK_MEMBERS): Add checks for +struct v4l2_format.fmt.pix_mp, struct v4l2_format.fmt.sdr, and +struct v4l2_format.fmt.sliced. +* v4l2.c (print_v4l2_format_fmt): Use the relevant HAVE_STRUCT_* macros +instead of HAVE_DECL_V4L2_BUF_TYPE_*. +--- + configure.ac | 3 +++ + v4l2.c | 10 +++------- + xlat/v4l2_buf_types.in | 29 +++++++++++++++-------------- + 3 files changed, 21 insertions(+), 21 deletions(-) + +Index: strace-5.1/configure.ac +=================================================================== +--- strace-5.1.orig/configure.ac 2020-01-29 12:39:33.198682164 +0100 ++++ strace-5.1/configure.ac 2020-01-29 12:39:56.946464178 +0100 +@@ -779,6 +779,9 @@ + + AC_CHECK_MEMBERS(m4_normalize([ + struct v4l2_capability.device_caps, ++ struct v4l2_format.fmt.pix_mp, ++ struct v4l2_format.fmt.sdr, ++ struct v4l2_format.fmt.sliced, + struct v4l2_window.global_alpha, + struct v4l2_sdr_format.buffersize + ]),,, [#include +Index: strace-5.1/v4l2.c +=================================================================== +--- strace-5.1.orig/v4l2.c 2020-01-29 12:39:33.199682155 +0100 ++++ strace-5.1/v4l2.c 2020-01-29 12:39:56.947464169 +0100 +@@ -204,7 +204,7 @@ + "V4L2_COLORSPACE_???"); + tprints("}"); + break; +-#if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ++#if HAVE_STRUCT_V4L2_FORMAT_FMT_PIX_MP + case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: + case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: { + unsigned int i, max; +@@ -235,9 +235,7 @@ + } + #endif + /* OUTPUT_OVERLAY since Linux v2.6.22-rc1~1118^2~179 */ +-#if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY + case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: +-#endif + case V4L2_BUF_TYPE_VIDEO_OVERLAY: { + struct_v4l2_clip clip; + tprints(prefix); +@@ -272,7 +270,7 @@ + tprints("}"); + break; + /* both since Linux v2.6.14-rc2~64 */ +-#if HAVE_DECL_V4L2_BUF_TYPE_SLICED_VBI_CAPTURE ++#if HAVE_STRUCT_V4L2_FORMAT_FMT_SLICED + case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: + case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: { + unsigned int i, j; +@@ -301,12 +299,10 @@ + break; + } + #endif ++#if HAVE_STRUCT_V4L2_FORMAT_FMT_SDR + /* since Linux v4.4-rc1~118^2~14 */ +-#if HAVE_DECL_V4L2_BUF_TYPE_SDR_OUTPUT + case V4L2_BUF_TYPE_SDR_OUTPUT: +-#endif + /* since Linux v3.15-rc1~85^2~213 */ +-#if HAVE_DECL_V4L2_BUF_TYPE_SDR_CAPTURE + case V4L2_BUF_TYPE_SDR_CAPTURE: + tprints(prefix); + tprints("fmt.sdr={pixelformat="); +Index: strace-5.1/xlat/v4l2_buf_types.in +=================================================================== +--- strace-5.1.orig/xlat/v4l2_buf_types.in 2019-01-05 22:14:42.000000000 +0100 ++++ strace-5.1/xlat/v4l2_buf_types.in 2020-01-29 12:39:56.948464160 +0100 +@@ -1,14 +1,15 @@ +-V4L2_BUF_TYPE_VIDEO_CAPTURE +-V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE +-V4L2_BUF_TYPE_VIDEO_OUTPUT +-V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE +-V4L2_BUF_TYPE_VIDEO_OVERLAY +-V4L2_BUF_TYPE_VBI_CAPTURE +-V4L2_BUF_TYPE_VBI_OUTPUT +-V4L2_BUF_TYPE_SLICED_VBI_CAPTURE +-V4L2_BUF_TYPE_SLICED_VBI_OUTPUT +-V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY +-V4L2_BUF_TYPE_SDR_CAPTURE +-V4L2_BUF_TYPE_SDR_OUTPUT +-V4L2_BUF_TYPE_META_CAPTURE +-V4L2_BUF_TYPE_META_OUTPUT ++V4L2_BUF_TYPE_VIDEO_CAPTURE 1 ++V4L2_BUF_TYPE_VIDEO_OUTPUT 2 ++V4L2_BUF_TYPE_VIDEO_OVERLAY 3 ++V4L2_BUF_TYPE_VBI_CAPTURE 4 ++V4L2_BUF_TYPE_VBI_OUTPUT 5 ++V4L2_BUF_TYPE_SLICED_VBI_CAPTURE 6 ++V4L2_BUF_TYPE_SLICED_VBI_OUTPUT 7 ++V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY 8 ++V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE 9 ++V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE 10 ++V4L2_BUF_TYPE_SDR_CAPTURE 11 ++V4L2_BUF_TYPE_SDR_OUTPUT 12 ++V4L2_BUF_TYPE_META_CAPTURE 13 ++V4L2_BUF_TYPE_META_OUTPUT 14 ++/* V4L2_BUF_TYPE_PRIVATE 0x80 */ +Index: strace-5.1/xlat/v4l2_buf_types.h +=================================================================== +--- strace-5.1.orig/xlat/v4l2_buf_types.h 2019-05-22 15:08:31.000000000 +0200 ++++ strace-5.1/xlat/v4l2_buf_types.h 2020-01-29 12:40:07.413368100 +0100 +@@ -3,61 +3,132 @@ + #include "gcc_compat.h" + #include "static_assert.h" + +- +-#ifndef XLAT_MACROS_ONLY +- +-# ifdef IN_MPERS +- +-extern const struct xlat v4l2_buf_types[]; +- +-# else +- +-# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) +-static +-# endif +-const struct xlat v4l2_buf_types[] = { + #if defined(V4L2_BUF_TYPE_VIDEO_CAPTURE) || (defined(HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE) && HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE) +- XLAT(V4L2_BUF_TYPE_VIDEO_CAPTURE), +-#endif +-#if defined(V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) || (defined(HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) && HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) +- XLAT(V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_TYPE_VIDEO_CAPTURE) == (1), "V4L2_BUF_TYPE_VIDEO_CAPTURE != 1"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_TYPE_VIDEO_CAPTURE 1 + #endif + #if defined(V4L2_BUF_TYPE_VIDEO_OUTPUT) || (defined(HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT) && HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT) +- XLAT(V4L2_BUF_TYPE_VIDEO_OUTPUT), +-#endif +-#if defined(V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) || (defined(HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) && HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) +- XLAT(V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_TYPE_VIDEO_OUTPUT) == (2), "V4L2_BUF_TYPE_VIDEO_OUTPUT != 2"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_TYPE_VIDEO_OUTPUT 2 + #endif + #if defined(V4L2_BUF_TYPE_VIDEO_OVERLAY) || (defined(HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OVERLAY) && HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OVERLAY) +- XLAT(V4L2_BUF_TYPE_VIDEO_OVERLAY), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_TYPE_VIDEO_OVERLAY) == (3), "V4L2_BUF_TYPE_VIDEO_OVERLAY != 3"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_TYPE_VIDEO_OVERLAY 3 + #endif + #if defined(V4L2_BUF_TYPE_VBI_CAPTURE) || (defined(HAVE_DECL_V4L2_BUF_TYPE_VBI_CAPTURE) && HAVE_DECL_V4L2_BUF_TYPE_VBI_CAPTURE) +- XLAT(V4L2_BUF_TYPE_VBI_CAPTURE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_TYPE_VBI_CAPTURE) == (4), "V4L2_BUF_TYPE_VBI_CAPTURE != 4"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_TYPE_VBI_CAPTURE 4 + #endif + #if defined(V4L2_BUF_TYPE_VBI_OUTPUT) || (defined(HAVE_DECL_V4L2_BUF_TYPE_VBI_OUTPUT) && HAVE_DECL_V4L2_BUF_TYPE_VBI_OUTPUT) +- XLAT(V4L2_BUF_TYPE_VBI_OUTPUT), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_TYPE_VBI_OUTPUT) == (5), "V4L2_BUF_TYPE_VBI_OUTPUT != 5"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_TYPE_VBI_OUTPUT 5 + #endif + #if defined(V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) || (defined(HAVE_DECL_V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) && HAVE_DECL_V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) +- XLAT(V4L2_BUF_TYPE_SLICED_VBI_CAPTURE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) == (6), "V4L2_BUF_TYPE_SLICED_VBI_CAPTURE != 6"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_TYPE_SLICED_VBI_CAPTURE 6 + #endif + #if defined(V4L2_BUF_TYPE_SLICED_VBI_OUTPUT) || (defined(HAVE_DECL_V4L2_BUF_TYPE_SLICED_VBI_OUTPUT) && HAVE_DECL_V4L2_BUF_TYPE_SLICED_VBI_OUTPUT) +- XLAT(V4L2_BUF_TYPE_SLICED_VBI_OUTPUT), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_TYPE_SLICED_VBI_OUTPUT) == (7), "V4L2_BUF_TYPE_SLICED_VBI_OUTPUT != 7"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_TYPE_SLICED_VBI_OUTPUT 7 + #endif + #if defined(V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY) || (defined(HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY) && HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY) +- XLAT(V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY) == (8), "V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY != 8"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY 8 ++#endif ++#if defined(V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) || (defined(HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) && HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) == (9), "V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE != 9"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE 9 ++#endif ++#if defined(V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) || (defined(HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) && HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) == (10), "V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE != 10"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE 10 + #endif + #if defined(V4L2_BUF_TYPE_SDR_CAPTURE) || (defined(HAVE_DECL_V4L2_BUF_TYPE_SDR_CAPTURE) && HAVE_DECL_V4L2_BUF_TYPE_SDR_CAPTURE) +- XLAT(V4L2_BUF_TYPE_SDR_CAPTURE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_TYPE_SDR_CAPTURE) == (11), "V4L2_BUF_TYPE_SDR_CAPTURE != 11"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_TYPE_SDR_CAPTURE 11 + #endif + #if defined(V4L2_BUF_TYPE_SDR_OUTPUT) || (defined(HAVE_DECL_V4L2_BUF_TYPE_SDR_OUTPUT) && HAVE_DECL_V4L2_BUF_TYPE_SDR_OUTPUT) +- XLAT(V4L2_BUF_TYPE_SDR_OUTPUT), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_TYPE_SDR_OUTPUT) == (12), "V4L2_BUF_TYPE_SDR_OUTPUT != 12"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_TYPE_SDR_OUTPUT 12 + #endif + #if defined(V4L2_BUF_TYPE_META_CAPTURE) || (defined(HAVE_DECL_V4L2_BUF_TYPE_META_CAPTURE) && HAVE_DECL_V4L2_BUF_TYPE_META_CAPTURE) +- XLAT(V4L2_BUF_TYPE_META_CAPTURE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_TYPE_META_CAPTURE) == (13), "V4L2_BUF_TYPE_META_CAPTURE != 13"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_TYPE_META_CAPTURE 13 + #endif + #if defined(V4L2_BUF_TYPE_META_OUTPUT) || (defined(HAVE_DECL_V4L2_BUF_TYPE_META_OUTPUT) && HAVE_DECL_V4L2_BUF_TYPE_META_OUTPUT) +- XLAT(V4L2_BUF_TYPE_META_OUTPUT), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_TYPE_META_OUTPUT) == (14), "V4L2_BUF_TYPE_META_OUTPUT != 14"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_TYPE_META_OUTPUT 14 + #endif ++ ++#ifndef XLAT_MACROS_ONLY ++ ++# ifdef IN_MPERS ++ ++extern const struct xlat v4l2_buf_types[]; ++ ++# else ++ ++# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) ++static ++# endif ++const struct xlat v4l2_buf_types[] = { ++ XLAT(V4L2_BUF_TYPE_VIDEO_CAPTURE), ++ XLAT(V4L2_BUF_TYPE_VIDEO_OUTPUT), ++ XLAT(V4L2_BUF_TYPE_VIDEO_OVERLAY), ++ XLAT(V4L2_BUF_TYPE_VBI_CAPTURE), ++ XLAT(V4L2_BUF_TYPE_VBI_OUTPUT), ++ XLAT(V4L2_BUF_TYPE_SLICED_VBI_CAPTURE), ++ XLAT(V4L2_BUF_TYPE_SLICED_VBI_OUTPUT), ++ XLAT(V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY), ++ XLAT(V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE), ++ XLAT(V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE), ++ XLAT(V4L2_BUF_TYPE_SDR_CAPTURE), ++ XLAT(V4L2_BUF_TYPE_SDR_OUTPUT), ++ XLAT(V4L2_BUF_TYPE_META_CAPTURE), ++ XLAT(V4L2_BUF_TYPE_META_OUTPUT), ++ + XLAT_END + }; + diff --git a/SOURCES/0073-xlat-Provide-fallback-definitions-for-V4L2_FIELD_-co.patch b/SOURCES/0073-xlat-Provide-fallback-definitions-for-V4L2_FIELD_-co.patch new file mode 100644 index 0000000..f18d786 --- /dev/null +++ b/SOURCES/0073-xlat-Provide-fallback-definitions-for-V4L2_FIELD_-co.patch @@ -0,0 +1,164 @@ +From 300b952c68a991eca56d31b044bd9643028ee46b Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Sun, 20 Oct 2019 21:06:28 +0200 +Subject: [PATCH 73/76] xlat: Provide fallback definitions for V4L2_FIELD_* + constants + +* xlat/v4l2_fields.in: Add fallback definitions for constants. +--- + xlat/v4l2_fields.in | 21 +++++++++++---------- + 1 file changed, 11 insertions(+), 10 deletions(-) + +Index: strace-5.1/xlat/v4l2_fields.in +=================================================================== +--- strace-5.1.orig/xlat/v4l2_fields.in 2014-11-04 16:27:31.000000000 +0100 ++++ strace-5.1/xlat/v4l2_fields.in 2020-01-29 12:40:10.613338727 +0100 +@@ -1,10 +1,11 @@ +-V4L2_FIELD_ANY +-V4L2_FIELD_NONE +-V4L2_FIELD_TOP +-V4L2_FIELD_BOTTOM +-V4L2_FIELD_INTERLACED +-V4L2_FIELD_SEQ_TB +-V4L2_FIELD_SEQ_BT +-V4L2_FIELD_ALTERNATE +-V4L2_FIELD_INTERLACED_TB +-V4L2_FIELD_INTERLACED_BT ++#value_indexed ++V4L2_FIELD_ANY 0 ++V4L2_FIELD_NONE 1 ++V4L2_FIELD_TOP 2 ++V4L2_FIELD_BOTTOM 3 ++V4L2_FIELD_INTERLACED 4 ++V4L2_FIELD_SEQ_TB 5 ++V4L2_FIELD_SEQ_BT 6 ++V4L2_FIELD_ALTERNATE 7 ++V4L2_FIELD_INTERLACED_TB 8 ++V4L2_FIELD_INTERLACED_BT 9 +Index: strace-5.1/xlat/v4l2_fields.h +=================================================================== +--- strace-5.1.orig/xlat/v4l2_fields.h 2019-05-22 15:08:31.000000000 +0200 ++++ strace-5.1/xlat/v4l2_fields.h 2020-01-29 12:40:18.817263422 +0100 +@@ -3,49 +3,99 @@ + #include "gcc_compat.h" + #include "static_assert.h" + +- +-#ifndef XLAT_MACROS_ONLY +- +-# ifdef IN_MPERS +- +-extern const struct xlat v4l2_fields[]; +- +-# else +- +-# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) +-static +-# endif +-const struct xlat v4l2_fields[] = { + #if defined(V4L2_FIELD_ANY) || (defined(HAVE_DECL_V4L2_FIELD_ANY) && HAVE_DECL_V4L2_FIELD_ANY) +- XLAT(V4L2_FIELD_ANY), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_FIELD_ANY) == (0), "V4L2_FIELD_ANY != 0"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_FIELD_ANY 0 + #endif + #if defined(V4L2_FIELD_NONE) || (defined(HAVE_DECL_V4L2_FIELD_NONE) && HAVE_DECL_V4L2_FIELD_NONE) +- XLAT(V4L2_FIELD_NONE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_FIELD_NONE) == (1), "V4L2_FIELD_NONE != 1"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_FIELD_NONE 1 + #endif + #if defined(V4L2_FIELD_TOP) || (defined(HAVE_DECL_V4L2_FIELD_TOP) && HAVE_DECL_V4L2_FIELD_TOP) +- XLAT(V4L2_FIELD_TOP), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_FIELD_TOP) == (2), "V4L2_FIELD_TOP != 2"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_FIELD_TOP 2 + #endif + #if defined(V4L2_FIELD_BOTTOM) || (defined(HAVE_DECL_V4L2_FIELD_BOTTOM) && HAVE_DECL_V4L2_FIELD_BOTTOM) +- XLAT(V4L2_FIELD_BOTTOM), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_FIELD_BOTTOM) == (3), "V4L2_FIELD_BOTTOM != 3"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_FIELD_BOTTOM 3 + #endif + #if defined(V4L2_FIELD_INTERLACED) || (defined(HAVE_DECL_V4L2_FIELD_INTERLACED) && HAVE_DECL_V4L2_FIELD_INTERLACED) +- XLAT(V4L2_FIELD_INTERLACED), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_FIELD_INTERLACED) == (4), "V4L2_FIELD_INTERLACED != 4"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_FIELD_INTERLACED 4 + #endif + #if defined(V4L2_FIELD_SEQ_TB) || (defined(HAVE_DECL_V4L2_FIELD_SEQ_TB) && HAVE_DECL_V4L2_FIELD_SEQ_TB) +- XLAT(V4L2_FIELD_SEQ_TB), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_FIELD_SEQ_TB) == (5), "V4L2_FIELD_SEQ_TB != 5"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_FIELD_SEQ_TB 5 + #endif + #if defined(V4L2_FIELD_SEQ_BT) || (defined(HAVE_DECL_V4L2_FIELD_SEQ_BT) && HAVE_DECL_V4L2_FIELD_SEQ_BT) +- XLAT(V4L2_FIELD_SEQ_BT), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_FIELD_SEQ_BT) == (6), "V4L2_FIELD_SEQ_BT != 6"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_FIELD_SEQ_BT 6 + #endif + #if defined(V4L2_FIELD_ALTERNATE) || (defined(HAVE_DECL_V4L2_FIELD_ALTERNATE) && HAVE_DECL_V4L2_FIELD_ALTERNATE) +- XLAT(V4L2_FIELD_ALTERNATE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_FIELD_ALTERNATE) == (7), "V4L2_FIELD_ALTERNATE != 7"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_FIELD_ALTERNATE 7 + #endif + #if defined(V4L2_FIELD_INTERLACED_TB) || (defined(HAVE_DECL_V4L2_FIELD_INTERLACED_TB) && HAVE_DECL_V4L2_FIELD_INTERLACED_TB) +- XLAT(V4L2_FIELD_INTERLACED_TB), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_FIELD_INTERLACED_TB) == (8), "V4L2_FIELD_INTERLACED_TB != 8"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_FIELD_INTERLACED_TB 8 + #endif + #if defined(V4L2_FIELD_INTERLACED_BT) || (defined(HAVE_DECL_V4L2_FIELD_INTERLACED_BT) && HAVE_DECL_V4L2_FIELD_INTERLACED_BT) +- XLAT(V4L2_FIELD_INTERLACED_BT), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_FIELD_INTERLACED_BT) == (9), "V4L2_FIELD_INTERLACED_BT != 9"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_FIELD_INTERLACED_BT 9 + #endif ++ ++#ifndef XLAT_MACROS_ONLY ++ ++# ifdef IN_MPERS ++ ++extern const struct xlat v4l2_fields[]; ++ ++# else ++ ++# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) ++static ++# endif ++const struct xlat v4l2_fields[] = { ++ [V4L2_FIELD_ANY] = XLAT(V4L2_FIELD_ANY), ++ [V4L2_FIELD_NONE] = XLAT(V4L2_FIELD_NONE), ++ [V4L2_FIELD_TOP] = XLAT(V4L2_FIELD_TOP), ++ [V4L2_FIELD_BOTTOM] = XLAT(V4L2_FIELD_BOTTOM), ++ [V4L2_FIELD_INTERLACED] = XLAT(V4L2_FIELD_INTERLACED), ++ [V4L2_FIELD_SEQ_TB] = XLAT(V4L2_FIELD_SEQ_TB), ++ [V4L2_FIELD_SEQ_BT] = XLAT(V4L2_FIELD_SEQ_BT), ++ [V4L2_FIELD_ALTERNATE] = XLAT(V4L2_FIELD_ALTERNATE), ++ [V4L2_FIELD_INTERLACED_TB] = XLAT(V4L2_FIELD_INTERLACED_TB), ++ [V4L2_FIELD_INTERLACED_BT] = XLAT(V4L2_FIELD_INTERLACED_BT), + XLAT_END + }; + diff --git a/SOURCES/0074-xlat-update-V4L2_COLORSPACE_-constants.patch b/SOURCES/0074-xlat-update-V4L2_COLORSPACE_-constants.patch new file mode 100644 index 0000000..2b674dd --- /dev/null +++ b/SOURCES/0074-xlat-update-V4L2_COLORSPACE_-constants.patch @@ -0,0 +1,206 @@ +From 381f4ded3592163e30c45ac9064a065fdbbd8c49 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Sun, 20 Oct 2019 22:01:15 +0200 +Subject: [PATCH 74/76] xlat: update V4L2_COLORSPACE_* constants + +* xlat/v4l2_colorspaces.in: Add #value_indexed. +(V4L2_COLORSPACE_DEFAULT): New constant introduced by Linux commit +v4.2-rc1~107^2~184. +(V4L2_COLORSPACE_ADOBERGB): Rename to V4L2_COLORSPACE_OPRGB, per Linux +commit v4.20-rc1~69^2~122. +(V4L2_COLORSPACE_SMPTE170M, V4L2_COLORSPACE_SMPTE240M, +V4L2_COLORSPACE_REC709, V4L2_COLORSPACE_BT878, +V4L2_COLORSPACE_470_SYSTEM_M, V4L2_COLORSPACE_470_SYSTEM_BG, +V4L2_COLORSPACE_JPEG, V4L2_COLORSPACE_SRGB, V4L2_COLORSPACE_OPRGB, +V4L2_COLORSPACE_BT2020, V4L2_COLORSPACE_RAW, V4L2_COLORSPACE_DCI_P3): +Add fallback definitions. +--- + xlat/v4l2_colorspaces.in | 26 ++++++++++++++------------ + 1 file changed, 14 insertions(+), 12 deletions(-) + +Index: strace-5.1/xlat/v4l2_colorspaces.in +=================================================================== +--- strace-5.1.orig/xlat/v4l2_colorspaces.in 2017-04-07 03:21:36.000000000 +0200 ++++ strace-5.1/xlat/v4l2_colorspaces.in 2020-01-29 12:40:34.307117739 +0100 +@@ -1,12 +1,14 @@ +-V4L2_COLORSPACE_SMPTE170M +-V4L2_COLORSPACE_SMPTE240M +-V4L2_COLORSPACE_REC709 +-V4L2_COLORSPACE_BT878 +-V4L2_COLORSPACE_470_SYSTEM_M +-V4L2_COLORSPACE_470_SYSTEM_BG +-V4L2_COLORSPACE_JPEG +-V4L2_COLORSPACE_SRGB +-V4L2_COLORSPACE_ADOBERGB +-V4L2_COLORSPACE_BT2020 +-V4L2_COLORSPACE_RAW +-V4L2_COLORSPACE_DCI_P3 ++#value_indexed ++V4L2_COLORSPACE_DEFAULT 0 ++V4L2_COLORSPACE_SMPTE170M 1 ++V4L2_COLORSPACE_SMPTE240M 2 ++V4L2_COLORSPACE_REC709 3 ++V4L2_COLORSPACE_BT878 4 ++V4L2_COLORSPACE_470_SYSTEM_M 5 ++V4L2_COLORSPACE_470_SYSTEM_BG 6 ++V4L2_COLORSPACE_JPEG 7 ++V4L2_COLORSPACE_SRGB 8 ++V4L2_COLORSPACE_OPRGB 9 ++V4L2_COLORSPACE_BT2020 10 ++V4L2_COLORSPACE_RAW 11 ++V4L2_COLORSPACE_DCI_P3 12 +Index: strace-5.1/xlat/v4l2_colorspaces.h +=================================================================== +--- strace-5.1.orig/xlat/v4l2_colorspaces.h 2019-05-22 15:08:31.000000000 +0200 ++++ strace-5.1/xlat/v4l2_colorspaces.h 2020-01-29 12:41:11.073762718 +0100 +@@ -3,55 +3,123 @@ + #include "gcc_compat.h" + #include "static_assert.h" + +- +-#ifndef XLAT_MACROS_ONLY +- +-# ifdef IN_MPERS +- +-extern const struct xlat v4l2_colorspaces[]; +- +-# else +- +-# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) +-static +-# endif +-const struct xlat v4l2_colorspaces[] = { ++#if defined(V4L2_COLORSPACE_DEFAULT) || (defined(HAVE_DECL_V4L2_COLORSPACE_DEFAULT) && HAVE_DECL_V4L2_COLORSPACE_DEFAULT) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_COLORSPACE_DEFAULT) == (0), "V4L2_COLORSPACE_DEFAULT != 0"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_COLORSPACE_DEFAULT 0 ++#endif + #if defined(V4L2_COLORSPACE_SMPTE170M) || (defined(HAVE_DECL_V4L2_COLORSPACE_SMPTE170M) && HAVE_DECL_V4L2_COLORSPACE_SMPTE170M) +- XLAT(V4L2_COLORSPACE_SMPTE170M), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_COLORSPACE_SMPTE170M) == (1), "V4L2_COLORSPACE_SMPTE170M != 1"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_COLORSPACE_SMPTE170M 1 + #endif + #if defined(V4L2_COLORSPACE_SMPTE240M) || (defined(HAVE_DECL_V4L2_COLORSPACE_SMPTE240M) && HAVE_DECL_V4L2_COLORSPACE_SMPTE240M) +- XLAT(V4L2_COLORSPACE_SMPTE240M), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_COLORSPACE_SMPTE240M) == (2), "V4L2_COLORSPACE_SMPTE240M != 2"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_COLORSPACE_SMPTE240M 2 + #endif + #if defined(V4L2_COLORSPACE_REC709) || (defined(HAVE_DECL_V4L2_COLORSPACE_REC709) && HAVE_DECL_V4L2_COLORSPACE_REC709) +- XLAT(V4L2_COLORSPACE_REC709), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_COLORSPACE_REC709) == (3), "V4L2_COLORSPACE_REC709 != 3"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_COLORSPACE_REC709 3 + #endif + #if defined(V4L2_COLORSPACE_BT878) || (defined(HAVE_DECL_V4L2_COLORSPACE_BT878) && HAVE_DECL_V4L2_COLORSPACE_BT878) +- XLAT(V4L2_COLORSPACE_BT878), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_COLORSPACE_BT878) == (4), "V4L2_COLORSPACE_BT878 != 4"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_COLORSPACE_BT878 4 + #endif + #if defined(V4L2_COLORSPACE_470_SYSTEM_M) || (defined(HAVE_DECL_V4L2_COLORSPACE_470_SYSTEM_M) && HAVE_DECL_V4L2_COLORSPACE_470_SYSTEM_M) +- XLAT(V4L2_COLORSPACE_470_SYSTEM_M), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_COLORSPACE_470_SYSTEM_M) == (5), "V4L2_COLORSPACE_470_SYSTEM_M != 5"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_COLORSPACE_470_SYSTEM_M 5 + #endif + #if defined(V4L2_COLORSPACE_470_SYSTEM_BG) || (defined(HAVE_DECL_V4L2_COLORSPACE_470_SYSTEM_BG) && HAVE_DECL_V4L2_COLORSPACE_470_SYSTEM_BG) +- XLAT(V4L2_COLORSPACE_470_SYSTEM_BG), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_COLORSPACE_470_SYSTEM_BG) == (6), "V4L2_COLORSPACE_470_SYSTEM_BG != 6"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_COLORSPACE_470_SYSTEM_BG 6 + #endif + #if defined(V4L2_COLORSPACE_JPEG) || (defined(HAVE_DECL_V4L2_COLORSPACE_JPEG) && HAVE_DECL_V4L2_COLORSPACE_JPEG) +- XLAT(V4L2_COLORSPACE_JPEG), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_COLORSPACE_JPEG) == (7), "V4L2_COLORSPACE_JPEG != 7"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_COLORSPACE_JPEG 7 + #endif + #if defined(V4L2_COLORSPACE_SRGB) || (defined(HAVE_DECL_V4L2_COLORSPACE_SRGB) && HAVE_DECL_V4L2_COLORSPACE_SRGB) +- XLAT(V4L2_COLORSPACE_SRGB), +-#endif +-#if defined(V4L2_COLORSPACE_ADOBERGB) || (defined(HAVE_DECL_V4L2_COLORSPACE_ADOBERGB) && HAVE_DECL_V4L2_COLORSPACE_ADOBERGB) +- XLAT(V4L2_COLORSPACE_ADOBERGB), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_COLORSPACE_SRGB) == (8), "V4L2_COLORSPACE_SRGB != 8"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_COLORSPACE_SRGB 8 ++#endif ++#if defined(V4L2_COLORSPACE_OPRGB) || (defined(HAVE_DECL_V4L2_COLORSPACE_OPRGB) && HAVE_DECL_V4L2_COLORSPACE_OPRGB) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_COLORSPACE_OPRGB) == (9), "V4L2_COLORSPACE_OPRGB != 9"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_COLORSPACE_OPRGB 9 + #endif + #if defined(V4L2_COLORSPACE_BT2020) || (defined(HAVE_DECL_V4L2_COLORSPACE_BT2020) && HAVE_DECL_V4L2_COLORSPACE_BT2020) +- XLAT(V4L2_COLORSPACE_BT2020), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_COLORSPACE_BT2020) == (10), "V4L2_COLORSPACE_BT2020 != 10"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_COLORSPACE_BT2020 10 + #endif + #if defined(V4L2_COLORSPACE_RAW) || (defined(HAVE_DECL_V4L2_COLORSPACE_RAW) && HAVE_DECL_V4L2_COLORSPACE_RAW) +- XLAT(V4L2_COLORSPACE_RAW), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_COLORSPACE_RAW) == (11), "V4L2_COLORSPACE_RAW != 11"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_COLORSPACE_RAW 11 + #endif + #if defined(V4L2_COLORSPACE_DCI_P3) || (defined(HAVE_DECL_V4L2_COLORSPACE_DCI_P3) && HAVE_DECL_V4L2_COLORSPACE_DCI_P3) +- XLAT(V4L2_COLORSPACE_DCI_P3), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_COLORSPACE_DCI_P3) == (12), "V4L2_COLORSPACE_DCI_P3 != 12"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_COLORSPACE_DCI_P3 12 + #endif ++ ++#ifndef XLAT_MACROS_ONLY ++ ++# ifdef IN_MPERS ++ ++extern const struct xlat v4l2_colorspaces[]; ++ ++# else ++ ++# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) ++static ++# endif ++const struct xlat v4l2_colorspaces[] = { ++ [V4L2_COLORSPACE_DEFAULT] = XLAT(V4L2_COLORSPACE_DEFAULT), ++ [V4L2_COLORSPACE_SMPTE170M] = XLAT(V4L2_COLORSPACE_SMPTE170M), ++ [V4L2_COLORSPACE_SMPTE240M] = XLAT(V4L2_COLORSPACE_SMPTE240M), ++ [V4L2_COLORSPACE_REC709] = XLAT(V4L2_COLORSPACE_REC709), ++ [V4L2_COLORSPACE_BT878] = XLAT(V4L2_COLORSPACE_BT878), ++ [V4L2_COLORSPACE_470_SYSTEM_M] = XLAT(V4L2_COLORSPACE_470_SYSTEM_M), ++ [V4L2_COLORSPACE_470_SYSTEM_BG] = XLAT(V4L2_COLORSPACE_470_SYSTEM_BG), ++ [V4L2_COLORSPACE_JPEG] = XLAT(V4L2_COLORSPACE_JPEG), ++ [V4L2_COLORSPACE_SRGB] = XLAT(V4L2_COLORSPACE_SRGB), ++ [V4L2_COLORSPACE_OPRGB] = XLAT(V4L2_COLORSPACE_OPRGB), ++ [V4L2_COLORSPACE_BT2020] = XLAT(V4L2_COLORSPACE_BT2020), ++ [V4L2_COLORSPACE_RAW] = XLAT(V4L2_COLORSPACE_RAW), ++ [V4L2_COLORSPACE_DCI_P3] = XLAT(V4L2_COLORSPACE_DCI_P3), + XLAT_END + }; + diff --git a/SOURCES/0075-xlat-update-V4L2_CTRL_TYPE_-constants.patch b/SOURCES/0075-xlat-update-V4L2_CTRL_TYPE_-constants.patch new file mode 100644 index 0000000..51a5414 --- /dev/null +++ b/SOURCES/0075-xlat-update-V4L2_CTRL_TYPE_-constants.patch @@ -0,0 +1,216 @@ +From 58f5965175a46cf205e20be8e692646f9a9f5836 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Thu, 1 Nov 2018 18:22:50 +0100 +Subject: [PATCH 75/76] xlat: update V4L2_CTRL_TYPE_* constants + +* xlat/v4l2_control_types.in: Add fallback definitions for constants, +and #sorted. +* configure.ac (AC_CHECK_MEMBERS): Check for struct +v4l2_ext_control.string field. +* v4l2.c (print_v4l2_ext_control): Change guard macro +to HAVE_STRUCT_V4L2_EXT_CONTROL_STRING. +--- + configure.ac | 1 + + v4l2.c | 2 +- + xlat/v4l2_control_types.in | 24 ++++++++++++------------ + 3 files changed, 14 insertions(+), 13 deletions(-) + +Index: strace-5.1/configure.ac +=================================================================== +--- strace-5.1.orig/configure.ac 2020-01-29 12:39:56.946464178 +0100 ++++ strace-5.1/configure.ac 2020-01-29 12:41:14.883725929 +0100 +@@ -779,6 +779,7 @@ + + AC_CHECK_MEMBERS(m4_normalize([ + struct v4l2_capability.device_caps, ++ struct v4l2_ext_control.string, + struct v4l2_format.fmt.pix_mp, + struct v4l2_format.fmt.sdr, + struct v4l2_format.fmt.sliced, +Index: strace-5.1/v4l2.c +=================================================================== +--- strace-5.1.orig/v4l2.c 2020-01-29 12:39:56.947464169 +0100 ++++ strace-5.1/v4l2.c 2020-01-29 12:41:14.883725929 +0100 +@@ -780,7 +780,7 @@ + + tprints("{id="); + printxval(v4l2_control_ids, p->id, "V4L2_CID_???"); +-# if HAVE_DECL_V4L2_CTRL_TYPE_STRING ++# if HAVE_STRUCT_V4L2_EXT_CONTROL_STRING + tprintf(", size=%u", p->size); + if (p->size > 0) { + tprints(", string="); +Index: strace-5.1/xlat/v4l2_control_types.in +=================================================================== +--- strace-5.1.orig/xlat/v4l2_control_types.in 2017-06-22 23:48:00.000000000 +0200 ++++ strace-5.1/xlat/v4l2_control_types.in 2020-01-29 12:41:14.884725919 +0100 +@@ -1,12 +1,12 @@ +-V4L2_CTRL_TYPE_INTEGER +-V4L2_CTRL_TYPE_BOOLEAN +-V4L2_CTRL_TYPE_MENU +-V4L2_CTRL_TYPE_BUTTON +-V4L2_CTRL_TYPE_INTEGER64 +-V4L2_CTRL_TYPE_CTRL_CLASS +-V4L2_CTRL_TYPE_STRING +-V4L2_CTRL_TYPE_BITMASK +-V4L2_CTRL_TYPE_INTEGER_MENU +-V4L2_CTRL_TYPE_U8 +-V4L2_CTRL_TYPE_U16 +-V4L2_CTRL_TYPE_U32 ++V4L2_CTRL_TYPE_INTEGER 1 ++V4L2_CTRL_TYPE_BOOLEAN 2 ++V4L2_CTRL_TYPE_MENU 3 ++V4L2_CTRL_TYPE_BUTTON 4 ++V4L2_CTRL_TYPE_INTEGER64 5 ++V4L2_CTRL_TYPE_CTRL_CLASS 6 ++V4L2_CTRL_TYPE_STRING 7 ++V4L2_CTRL_TYPE_BITMASK 8 ++V4L2_CTRL_TYPE_INTEGER_MENU 9 ++V4L2_CTRL_TYPE_U8 0x100 ++V4L2_CTRL_TYPE_U16 0x101 ++V4L2_CTRL_TYPE_U32 0x102 +Index: strace-5.1/xlat/v4l2_control_types.h +=================================================================== +--- strace-5.1.orig/xlat/v4l2_control_types.h 2019-05-22 15:08:31.000000000 +0200 ++++ strace-5.1/xlat/v4l2_control_types.h 2020-01-29 12:41:22.628651144 +0100 +@@ -3,55 +3,115 @@ + #include "gcc_compat.h" + #include "static_assert.h" + +- +-#ifndef XLAT_MACROS_ONLY +- +-# ifdef IN_MPERS +- +-extern const struct xlat v4l2_control_types[]; +- +-# else +- +-# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) +-static +-# endif +-const struct xlat v4l2_control_types[] = { + #if defined(V4L2_CTRL_TYPE_INTEGER) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_INTEGER) && HAVE_DECL_V4L2_CTRL_TYPE_INTEGER) +- XLAT(V4L2_CTRL_TYPE_INTEGER), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CTRL_TYPE_INTEGER) == (1), "V4L2_CTRL_TYPE_INTEGER != 1"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CTRL_TYPE_INTEGER 1 + #endif + #if defined(V4L2_CTRL_TYPE_BOOLEAN) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_BOOLEAN) && HAVE_DECL_V4L2_CTRL_TYPE_BOOLEAN) +- XLAT(V4L2_CTRL_TYPE_BOOLEAN), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CTRL_TYPE_BOOLEAN) == (2), "V4L2_CTRL_TYPE_BOOLEAN != 2"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CTRL_TYPE_BOOLEAN 2 + #endif + #if defined(V4L2_CTRL_TYPE_MENU) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_MENU) && HAVE_DECL_V4L2_CTRL_TYPE_MENU) +- XLAT(V4L2_CTRL_TYPE_MENU), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CTRL_TYPE_MENU) == (3), "V4L2_CTRL_TYPE_MENU != 3"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CTRL_TYPE_MENU 3 + #endif + #if defined(V4L2_CTRL_TYPE_BUTTON) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_BUTTON) && HAVE_DECL_V4L2_CTRL_TYPE_BUTTON) +- XLAT(V4L2_CTRL_TYPE_BUTTON), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CTRL_TYPE_BUTTON) == (4), "V4L2_CTRL_TYPE_BUTTON != 4"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CTRL_TYPE_BUTTON 4 + #endif + #if defined(V4L2_CTRL_TYPE_INTEGER64) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_INTEGER64) && HAVE_DECL_V4L2_CTRL_TYPE_INTEGER64) +- XLAT(V4L2_CTRL_TYPE_INTEGER64), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CTRL_TYPE_INTEGER64) == (5), "V4L2_CTRL_TYPE_INTEGER64 != 5"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CTRL_TYPE_INTEGER64 5 + #endif + #if defined(V4L2_CTRL_TYPE_CTRL_CLASS) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_CTRL_CLASS) && HAVE_DECL_V4L2_CTRL_TYPE_CTRL_CLASS) +- XLAT(V4L2_CTRL_TYPE_CTRL_CLASS), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CTRL_TYPE_CTRL_CLASS) == (6), "V4L2_CTRL_TYPE_CTRL_CLASS != 6"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CTRL_TYPE_CTRL_CLASS 6 + #endif + #if defined(V4L2_CTRL_TYPE_STRING) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_STRING) && HAVE_DECL_V4L2_CTRL_TYPE_STRING) +- XLAT(V4L2_CTRL_TYPE_STRING), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CTRL_TYPE_STRING) == (7), "V4L2_CTRL_TYPE_STRING != 7"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CTRL_TYPE_STRING 7 + #endif + #if defined(V4L2_CTRL_TYPE_BITMASK) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_BITMASK) && HAVE_DECL_V4L2_CTRL_TYPE_BITMASK) +- XLAT(V4L2_CTRL_TYPE_BITMASK), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CTRL_TYPE_BITMASK) == (8), "V4L2_CTRL_TYPE_BITMASK != 8"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CTRL_TYPE_BITMASK 8 + #endif + #if defined(V4L2_CTRL_TYPE_INTEGER_MENU) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_INTEGER_MENU) && HAVE_DECL_V4L2_CTRL_TYPE_INTEGER_MENU) +- XLAT(V4L2_CTRL_TYPE_INTEGER_MENU), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CTRL_TYPE_INTEGER_MENU) == (9), "V4L2_CTRL_TYPE_INTEGER_MENU != 9"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CTRL_TYPE_INTEGER_MENU 9 + #endif + #if defined(V4L2_CTRL_TYPE_U8) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_U8) && HAVE_DECL_V4L2_CTRL_TYPE_U8) +- XLAT(V4L2_CTRL_TYPE_U8), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CTRL_TYPE_U8) == (0x100), "V4L2_CTRL_TYPE_U8 != 0x100"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CTRL_TYPE_U8 0x100 + #endif + #if defined(V4L2_CTRL_TYPE_U16) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_U16) && HAVE_DECL_V4L2_CTRL_TYPE_U16) +- XLAT(V4L2_CTRL_TYPE_U16), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CTRL_TYPE_U16) == (0x101), "V4L2_CTRL_TYPE_U16 != 0x101"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CTRL_TYPE_U16 0x101 + #endif + #if defined(V4L2_CTRL_TYPE_U32) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_U32) && HAVE_DECL_V4L2_CTRL_TYPE_U32) +- XLAT(V4L2_CTRL_TYPE_U32), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CTRL_TYPE_U32) == (0x102), "V4L2_CTRL_TYPE_U32 != 0x102"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CTRL_TYPE_U32 0x102 + #endif ++ ++#ifndef XLAT_MACROS_ONLY ++ ++# ifdef IN_MPERS ++ ++extern const struct xlat v4l2_control_types[]; ++ ++# else ++ ++# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) ++static ++# endif ++const struct xlat v4l2_control_types[] = { ++ XLAT(V4L2_CTRL_TYPE_INTEGER), ++ XLAT(V4L2_CTRL_TYPE_BOOLEAN), ++ XLAT(V4L2_CTRL_TYPE_MENU), ++ XLAT(V4L2_CTRL_TYPE_BUTTON), ++ XLAT(V4L2_CTRL_TYPE_INTEGER64), ++ XLAT(V4L2_CTRL_TYPE_CTRL_CLASS), ++ XLAT(V4L2_CTRL_TYPE_STRING), ++ XLAT(V4L2_CTRL_TYPE_BITMASK), ++ XLAT(V4L2_CTRL_TYPE_INTEGER_MENU), ++ XLAT(V4L2_CTRL_TYPE_U8), ++ XLAT(V4L2_CTRL_TYPE_U16), ++ XLAT(V4L2_CTRL_TYPE_U32), + XLAT_END + }; + diff --git a/SOURCES/0076-xlat-provide-values-to-ptrace_cmds.patch b/SOURCES/0076-xlat-provide-values-to-ptrace_cmds.patch new file mode 100644 index 0000000..75cf074 --- /dev/null +++ b/SOURCES/0076-xlat-provide-values-to-ptrace_cmds.patch @@ -0,0 +1,2270 @@ +From 340e94c8e7da5173f89ea543d86002c762298a8c Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Tue, 28 Jan 2020 21:29:38 +0100 +Subject: [PATCH 76/76] xlat: provide values to ptrace_cmds + +Use the output of maint/gen_xlat_defs.sh and perform some re-ordering. + +* xlat/ptrace_cmds.in: Provide values to constants. +(PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS, PTRACE_SETFPREGS, +PTRACE_GETFPXREGS, PTRACE_SETFPXREGS, PTRACE_GETHBPREGS, +PTRACE_SETHBPREGS, PTRACE_GETREGS64, PTRACE_SETREGS64, PTRACE_SYSEMU, +PTRACE_SYSEMU_SINGLESTEP): Move to arch-specific section. +(PTRACE_SET_SYSCALL): Move to arm section. +(PTRACE_GETVRREGS, PTRACE_SETVRREGS): Move to powerpc section. +(PPC_PTRACE_POKEUSR_3264, PPC_PTRACE_PEEKUSR_3264, +PPC_PTRACE_POKEDATA_3264, PPC_PTRACE_POKETEXT_3264, +PPC_PTRACE_PEEKDATA_3264, PPC_PTRACE_PEEKTEXT_3264): Add constants. + +References: https://bugzilla.redhat.com/show_bug.cgi?id=1758201 +--- + xlat/ptrace_cmds.in | 437 +++++++++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 396 insertions(+), 41 deletions(-) + +Index: strace-5.1/xlat/ptrace_cmds.in +=================================================================== +--- strace-5.1.orig/xlat/ptrace_cmds.in 2018-12-13 23:07:26.000000000 +0100 ++++ strace-5.1/xlat/ptrace_cmds.in 2020-01-29 12:41:29.506584730 +0100 +@@ -1,108 +1,463 @@ +-PTRACE_TRACEME +-PTRACE_PEEKTEXT +-PTRACE_PEEKDATA +-PTRACE_PEEKUSER +-PTRACE_POKETEXT +-PTRACE_POKEDATA +-PTRACE_POKEUSER +-PTRACE_CONT +-PTRACE_KILL +-PTRACE_SINGLESTEP +-PTRACE_ATTACH +-PTRACE_DETACH +-PTRACE_SYSCALL ++/* Generated by maint/gen_xlat_defs.sh -f '#x' -p 'PTRACE_' -c 'linux/ptrace.h' -a 'asm/ptrace*.h' */ ++PTRACE_TRACEME 0 ++PTRACE_PEEKTEXT 0x1 ++PTRACE_PEEKDATA 0x2 ++PTRACE_PEEKUSER 0x3 /* PTRACE_PEEKUSR in kernel headers */ ++PTRACE_POKETEXT 0x4 ++PTRACE_POKEDATA 0x5 ++PTRACE_POKEUSER 0x6 /* PTRACE_POKEUSR in kernel headers*/ ++PTRACE_CONT 0x7 ++PTRACE_KILL 0x8 ++PTRACE_SINGLESTEP 0x9 ++PTRACE_ATTACH 0x10 ++PTRACE_DETACH 0x11 ++PTRACE_SYSCALL 0x18 ++ ++PTRACE_SETOPTIONS 0x4200 ++PTRACE_GETEVENTMSG 0x4201 ++PTRACE_GETSIGINFO 0x4202 ++PTRACE_SETSIGINFO 0x4203 ++PTRACE_GETREGSET 0x4204 ++PTRACE_SETREGSET 0x4205 ++PTRACE_SEIZE 0x4206 ++PTRACE_INTERRUPT 0x4207 ++PTRACE_LISTEN 0x4208 ++PTRACE_PEEKSIGINFO 0x4209 ++PTRACE_GETSIGMASK 0x420a ++PTRACE_SETSIGMASK 0x420b ++PTRACE_SECCOMP_GET_FILTER 0x420c ++PTRACE_SECCOMP_GET_METADATA 0x420d ++PTRACE_GET_SYSCALL_INFO 0x420e ++ ++/* arch-specific */ ++#if defined __arm__ || defined __m68k__ || defined __mips__ || defined __powerpc__ || defined __sh__ || defined __sparc__ || defined __x86_64__ || defined __i386__ || defined __xtensa__ ++PTRACE_GETREGS 0xc ++#elif defined __hppa__ || defined __ia64__ ++PTRACE_GETREGS 0x12 ++#else + PTRACE_GETREGS ++#endif ++ ++#if defined __arm__ || defined __m68k__ || defined __mips__ || defined __powerpc__ || defined __sh__ || defined __sparc__ || defined __x86_64__ || defined __i386__ || defined __xtensa__ ++PTRACE_SETREGS 0xd ++#elif defined __hppa__ || defined __ia64__ ++PTRACE_SETREGS 0x13 ++#else + PTRACE_SETREGS ++#endif ++ ++#if defined __arm__ || defined __hppa__ || defined __m68k__ || defined __mips__ || defined __powerpc__ || defined __sh__ || defined __sparc__ || defined __x86_64__ || defined __i386__ ++PTRACE_GETFPREGS 0xe ++#else + PTRACE_GETFPREGS ++#endif ++ ++#if defined __arm__ || defined __hppa__ || defined __m68k__ || defined __mips__ || defined __powerpc__ || defined __sh__ || defined __sparc__ || defined __x86_64__ || defined __i386__ ++PTRACE_SETFPREGS 0xf ++#else + PTRACE_SETFPREGS ++#endif ++ ++#if defined __mips__ || defined __x86_64__ || defined __i386__ ++PTRACE_GETFPXREGS 0x12 ++#else + PTRACE_GETFPXREGS ++#endif ++ ++#if defined __mips__ || defined __x86_64__ || defined __i386__ ++PTRACE_SETFPXREGS 0x13 ++#else + PTRACE_SETFPXREGS +-PTRACE_GETVRREGS +-PTRACE_SETVRREGS +-PTRACE_SETOPTIONS +-PTRACE_GETEVENTMSG +-PTRACE_GETSIGINFO +-PTRACE_SETSIGINFO +-PTRACE_GETREGSET +-PTRACE_SETREGSET +-PTRACE_SET_SYSCALL +-PTRACE_SEIZE +-PTRACE_INTERRUPT +-PTRACE_LISTEN +-PTRACE_PEEKSIGINFO +-PTRACE_GETSIGMASK +-PTRACE_SETSIGMASK +-PTRACE_SECCOMP_GET_FILTER +-PTRACE_SECCOMP_GET_METADATA +-PTRACE_GET_SYSCALL_INFO +-/* arch-specific */ ++#endif ++ ++#if defined __xtensa__ ++PTRACE_GETHBPREGS 0x14 ++#elif defined __arm__ ++PTRACE_GETHBPREGS 0x1d ++#else ++PTRACE_GETHBPREGS ++#endif ++ ++#if defined __xtensa__ ++PTRACE_SETHBPREGS 0x15 ++#elif defined __arm__ ++PTRACE_SETHBPREGS 0x1e ++#else ++PTRACE_SETHBPREGS ++#endif ++ ++#if defined __arm__ || defined __ia64__ || defined __mips__ || defined __s390__ || defined __x86_64__ || defined __i386__ ++PTRACE_OLDSETOPTIONS 0x15 ++#else ++PTRACE_OLDSETOPTIONS ++#endif ++ ++#if defined __powerpc__ || defined __sparc__ ++PTRACE_GETREGS64 0x16 ++#else ++PTRACE_GETREGS64 ++#endif ++#if defined __powerpc__ || defined __sparc__ ++PTRACE_SETREGS64 0x17 ++#else ++PTRACE_SETREGS64 ++#endif ++ ++#if defined __arm__ || defined __unicore32__ ++PTRACE_GET_THREAD_AREA 0x16 ++#elif defined __arc__ || defined __m68k__ || defined __mips__ || defined __x86_64__ || defined __i386__ ++PTRACE_GET_THREAD_AREA 0x19 ++#else + PTRACE_GET_THREAD_AREA ++#endif ++ ++#if defined __mips__ || defined __x86_64__ || defined __i386__ ++PTRACE_SET_THREAD_AREA 0x1a ++#else + PTRACE_SET_THREAD_AREA +-PTRACE_OLDSETOPTIONS ++#endif ++ ++#if defined __arm__ || defined __c6x__ || defined __sh__ ++PTRACE_GETFDPIC 0x1f ++#else + PTRACE_GETFDPIC ++#endif ++ ++#if defined __powerpc__ ++PTRACE_SYSEMU 0x1d ++#elif defined __arm64__ || defined __aarch64__ || defined __x86_64__ || defined __i386__ ++PTRACE_SYSEMU 0x1f ++#else ++PTRACE_SYSEMU ++#endif ++ ++#if defined __powerpc__ ++PTRACE_SYSEMU_SINGLESTEP 0x1e ++#elif defined __arm64__ || defined __aarch64__ || defined __x86_64__ || defined __i386__ ++PTRACE_SYSEMU_SINGLESTEP 0x20 ++#else ++PTRACE_SYSEMU_SINGLESTEP ++#endif ++ ++#if defined __hppa__ || defined __ia64__ || defined __s390__ ++PTRACE_SINGLEBLOCK 0xc ++#elif defined __m68k__ || defined __x86_64__ || defined __i386__ ++PTRACE_SINGLEBLOCK 0x21 ++#elif defined __powerpc__ ++PTRACE_SINGLEBLOCK 0x100 ++#else + PTRACE_SINGLEBLOCK ++#endif ++ + /* arm */ ++#if defined __arm__ ++PTRACE_GETWMMXREGS 0x12 ++#else + PTRACE_GETWMMXREGS ++#endif ++#if defined __arm__ ++PTRACE_SETWMMXREGS 0x13 ++#else + PTRACE_SETWMMXREGS ++#endif ++#if defined __arm__ ++PTRACE_SET_SYSCALL 0x17 ++#else ++PTRACE_SET_SYSCALL ++#endif ++#if defined __arm__ ++PTRACE_GETCRUNCHREGS 0x19 ++#else + PTRACE_GETCRUNCHREGS ++#endif ++#if defined __arm__ ++PTRACE_SETCRUNCHREGS 0x1a ++#else + PTRACE_SETCRUNCHREGS ++#endif ++#if defined __arm__ ++PTRACE_GETVFPREGS 0x1b ++#else + PTRACE_GETVFPREGS ++#endif ++#if defined __arm__ ++PTRACE_SETVFPREGS 0x1c ++#else + PTRACE_SETVFPREGS +-PTRACE_GETHBPREGS +-PTRACE_SETHBPREGS ++#endif ++ + /* ia64 */ ++#if defined __ia64__ ++PTRACE_OLD_GETSIGINFO 0xd ++#else + PTRACE_OLD_GETSIGINFO ++#endif ++#if defined __ia64__ ++PTRACE_OLD_SETSIGINFO 0xe ++#else + PTRACE_OLD_SETSIGINFO ++#endif ++ + /* mips */ ++#if defined __mips__ ++PTRACE_PEEKTEXT_3264 0xc0 ++#else + PTRACE_PEEKTEXT_3264 ++#endif ++#if defined __mips__ ++PTRACE_PEEKDATA_3264 0xc1 ++#else + PTRACE_PEEKDATA_3264 ++#endif ++#if defined __mips__ ++PTRACE_POKETEXT_3264 0xc2 ++#else + PTRACE_POKETEXT_3264 ++#endif ++#if defined __mips__ ++PTRACE_POKEDATA_3264 0xc3 ++#else + PTRACE_POKEDATA_3264 ++#endif ++#if defined __mips__ ++PTRACE_GET_THREAD_AREA_3264 0xc4 ++#else + PTRACE_GET_THREAD_AREA_3264 ++#endif ++#if defined __mips__ ++PTRACE_GET_WATCH_REGS 0xd0 ++#else + PTRACE_GET_WATCH_REGS ++#endif ++#if defined __mips__ ++PTRACE_SET_WATCH_REGS 0xd1 ++#else + PTRACE_SET_WATCH_REGS ++#endif ++ + /* powerpc */ ++#if defined __powerpc__ ++PTRACE_GETVRREGS 0x12 ++#else ++PTRACE_GETVRREGS ++#endif ++#if defined __powerpc__ ++PTRACE_SETVRREGS 0x13 ++#else ++PTRACE_SETVRREGS ++#endif ++#if defined __powerpc__ ++PTRACE_GETEVRREGS 0x14 ++#else + PTRACE_GETEVRREGS ++#endif ++#if defined __powerpc__ ++PTRACE_SETEVRREGS 0x15 ++#else + PTRACE_SETEVRREGS ++#endif ++#if defined __powerpc__ ++PTRACE_GETVSRREGS 0x1b ++#else + PTRACE_GETVSRREGS ++#endif ++#if defined __powerpc__ ++PTRACE_SETVSRREGS 0x1c ++#else + PTRACE_SETVSRREGS ++#endif ++#if defined __powerpc__ ++PTRACE_GET_DEBUGREG 0x19 ++#else + PTRACE_GET_DEBUGREG ++#endif ++#if defined __powerpc__ ++PTRACE_SET_DEBUGREG 0x1a ++#else + PTRACE_SET_DEBUGREG +-PPC_PTRACE_GETHWDBGINFO ++#endif ++#if defined __powerpc__ ++PPC_PTRACE_DELHWDEBUG 0x87 ++#else ++ ++#endif ++#if defined __powerpc__ ++PPC_PTRACE_SETHWDEBUG 0x88 ++#else + PPC_PTRACE_SETHWDEBUG +-PPC_PTRACE_DELHWDEBUG ++#endif ++#if defined __powerpc__ ++PPC_PTRACE_GETHWDBGINFO 0x89 ++#else ++PPC_PTRACE_GETHWDBGINFO ++#endif ++#if defined __powerpc__ ++PPC_PTRACE_POKEUSR_3264 0x90 ++#else ++PPC_PTRACE_POKEUSR_3264 ++#endif ++#if defined __powerpc__ ++PPC_PTRACE_PEEKUSR_3264 0x91 ++#else ++PPC_PTRACE_PEEKUSR_3264 ++#endif ++#if defined __powerpc__ ++PPC_PTRACE_POKEDATA_3264 0x92 ++#else ++PPC_PTRACE_POKEDATA_3264 ++#endif ++#if defined __powerpc__ ++PPC_PTRACE_POKETEXT_3264 0x93 ++#else ++PPC_PTRACE_POKETEXT_3264 ++#endif ++#if defined __powerpc__ ++PPC_PTRACE_PEEKDATA_3264 0x94 ++#else ++PPC_PTRACE_PEEKDATA_3264 ++#endif ++#if defined __powerpc__ ++PPC_PTRACE_PEEKTEXT_3264 0x95 ++#else ++PPC_PTRACE_PEEKTEXT_3264 ++#endif ++ + /* s390 */ ++#if defined __s390__ ++PTRACE_PEEKUSR_AREA 0x5000 ++#else + PTRACE_PEEKUSR_AREA ++#endif ++#if defined __s390__ ++PTRACE_POKEUSR_AREA 0x5001 ++#else + PTRACE_POKEUSR_AREA ++#endif ++#if defined __s390__ ++PTRACE_PEEKTEXT_AREA 0x5002 ++#else + PTRACE_PEEKTEXT_AREA ++#endif ++#if defined __s390__ ++PTRACE_PEEKDATA_AREA 0x5003 ++#else + PTRACE_PEEKDATA_AREA ++#endif ++#if defined __s390__ ++PTRACE_POKETEXT_AREA 0x5004 ++#else + PTRACE_POKETEXT_AREA ++#endif ++#if defined __s390__ ++PTRACE_POKEDATA_AREA 0x5005 ++#else + PTRACE_POKEDATA_AREA ++#endif ++#if defined __s390__ ++PTRACE_GET_LAST_BREAK 0x5006 ++#else + PTRACE_GET_LAST_BREAK ++#endif ++#if defined __s390__ ++PTRACE_PEEK_SYSTEM_CALL 0x5007 ++#else + PTRACE_PEEK_SYSTEM_CALL ++#endif ++#if defined __s390__ ++PTRACE_POKE_SYSTEM_CALL 0x5008 ++#else + PTRACE_POKE_SYSTEM_CALL ++#endif ++#if defined __s390__ ++PTRACE_ENABLE_TE 0x5009 ++#else + PTRACE_ENABLE_TE ++#endif ++#if defined __s390__ ++PTRACE_DISABLE_TE 0x5010 ++#else + PTRACE_DISABLE_TE ++#endif ++#if defined __s390__ ++PTRACE_TE_ABORT_RAND 0x5011 ++#else + PTRACE_TE_ABORT_RAND ++#endif ++ + /* sh */ ++#if defined __sh__ ++PTRACE_GETDSPREGS 0x37 ++#else + PTRACE_GETDSPREGS ++#endif ++#if defined __sh__ ++PTRACE_SETDSPREGS 0x38 ++#else + PTRACE_SETDSPREGS ++#endif ++ + /* sparc */ ++#if defined __sparc__ ++PTRACE_SPARC_DETACH 0xb ++#else + PTRACE_SPARC_DETACH ++#endif ++#if defined __sparc__ ++PTRACE_READDATA 0x10 ++#else + PTRACE_READDATA ++#endif ++#if defined __sparc__ ++PTRACE_WRITEDATA 0x11 ++#else + PTRACE_WRITEDATA ++#endif ++#if defined __sparc__ ++PTRACE_READTEXT 0x12 ++#else + PTRACE_READTEXT ++#endif ++#if defined __sparc__ ++PTRACE_WRITETEXT 0x13 ++#else + PTRACE_WRITETEXT ++#endif ++#if defined __sparc__ ++PTRACE_GETFPAREGS 0x14 ++#else + PTRACE_GETFPAREGS ++#endif ++#if defined __sparc__ ++PTRACE_SETFPAREGS 0x15 ++#else + PTRACE_SETFPAREGS +-PTRACE_GETREGS64 +-PTRACE_SETREGS64 ++#endif ++#if defined __sparc__ ++PTRACE_GETFPREGS64 0x19 ++#else + PTRACE_GETFPREGS64 ++#endif ++#if defined __sparc__ ++PTRACE_SETFPREGS64 0x1a ++#else + PTRACE_SETFPREGS64 ++#endif ++ + /* x86 */ ++#if defined __x86_64__ || defined __i386__ ++PTRACE_ARCH_PRCTL 0x1e ++#else + PTRACE_ARCH_PRCTL +-PTRACE_SYSEMU +-PTRACE_SYSEMU_SINGLESTEP ++#endif ++ + /* xtensa */ ++#if defined __xtensa__ ++PTRACE_GETXTREGS 0x12 ++#else + PTRACE_GETXTREGS ++#endif ++#if defined __xtensa__ ++PTRACE_SETXTREGS 0x13 ++#else + PTRACE_SETXTREGS ++#endif +Index: strace-5.1/xlat/ptrace_cmds.h +=================================================================== +--- strace-5.1.orig/xlat/ptrace_cmds.h 2019-05-22 15:08:31.000000000 +0200 ++++ strace-5.1/xlat/ptrace_cmds.h 2020-01-29 12:41:37.579506778 +0100 +@@ -3,316 +3,1653 @@ + #include "gcc_compat.h" + #include "static_assert.h" + +- +-#ifndef XLAT_MACROS_ONLY +- +-# ifndef IN_MPERS +- +-const struct xlat ptrace_cmds[] = { + #if defined(PTRACE_TRACEME) || (defined(HAVE_DECL_PTRACE_TRACEME) && HAVE_DECL_PTRACE_TRACEME) +- XLAT(PTRACE_TRACEME), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_TRACEME) == (0), "PTRACE_TRACEME != 0"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_TRACEME 0 + #endif + #if defined(PTRACE_PEEKTEXT) || (defined(HAVE_DECL_PTRACE_PEEKTEXT) && HAVE_DECL_PTRACE_PEEKTEXT) +- XLAT(PTRACE_PEEKTEXT), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_PEEKTEXT) == (0x1), "PTRACE_PEEKTEXT != 0x1"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_PEEKTEXT 0x1 + #endif + #if defined(PTRACE_PEEKDATA) || (defined(HAVE_DECL_PTRACE_PEEKDATA) && HAVE_DECL_PTRACE_PEEKDATA) +- XLAT(PTRACE_PEEKDATA), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_PEEKDATA) == (0x2), "PTRACE_PEEKDATA != 0x2"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_PEEKDATA 0x2 + #endif + #if defined(PTRACE_PEEKUSER) || (defined(HAVE_DECL_PTRACE_PEEKUSER) && HAVE_DECL_PTRACE_PEEKUSER) +- XLAT(PTRACE_PEEKUSER), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_PEEKUSER) == (0x3), "PTRACE_PEEKUSER != 0x3"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_PEEKUSER 0x3 + #endif + #if defined(PTRACE_POKETEXT) || (defined(HAVE_DECL_PTRACE_POKETEXT) && HAVE_DECL_PTRACE_POKETEXT) +- XLAT(PTRACE_POKETEXT), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_POKETEXT) == (0x4), "PTRACE_POKETEXT != 0x4"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_POKETEXT 0x4 + #endif + #if defined(PTRACE_POKEDATA) || (defined(HAVE_DECL_PTRACE_POKEDATA) && HAVE_DECL_PTRACE_POKEDATA) +- XLAT(PTRACE_POKEDATA), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_POKEDATA) == (0x5), "PTRACE_POKEDATA != 0x5"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_POKEDATA 0x5 + #endif + #if defined(PTRACE_POKEUSER) || (defined(HAVE_DECL_PTRACE_POKEUSER) && HAVE_DECL_PTRACE_POKEUSER) +- XLAT(PTRACE_POKEUSER), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_POKEUSER) == (0x6), "PTRACE_POKEUSER != 0x6"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_POKEUSER 0x6 + #endif + #if defined(PTRACE_CONT) || (defined(HAVE_DECL_PTRACE_CONT) && HAVE_DECL_PTRACE_CONT) +- XLAT(PTRACE_CONT), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_CONT) == (0x7), "PTRACE_CONT != 0x7"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_CONT 0x7 + #endif + #if defined(PTRACE_KILL) || (defined(HAVE_DECL_PTRACE_KILL) && HAVE_DECL_PTRACE_KILL) +- XLAT(PTRACE_KILL), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_KILL) == (0x8), "PTRACE_KILL != 0x8"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_KILL 0x8 + #endif + #if defined(PTRACE_SINGLESTEP) || (defined(HAVE_DECL_PTRACE_SINGLESTEP) && HAVE_DECL_PTRACE_SINGLESTEP) +- XLAT(PTRACE_SINGLESTEP), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SINGLESTEP) == (0x9), "PTRACE_SINGLESTEP != 0x9"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SINGLESTEP 0x9 + #endif + #if defined(PTRACE_ATTACH) || (defined(HAVE_DECL_PTRACE_ATTACH) && HAVE_DECL_PTRACE_ATTACH) +- XLAT(PTRACE_ATTACH), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_ATTACH) == (0x10), "PTRACE_ATTACH != 0x10"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_ATTACH 0x10 + #endif + #if defined(PTRACE_DETACH) || (defined(HAVE_DECL_PTRACE_DETACH) && HAVE_DECL_PTRACE_DETACH) +- XLAT(PTRACE_DETACH), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_DETACH) == (0x11), "PTRACE_DETACH != 0x11"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_DETACH 0x11 + #endif + #if defined(PTRACE_SYSCALL) || (defined(HAVE_DECL_PTRACE_SYSCALL) && HAVE_DECL_PTRACE_SYSCALL) +- XLAT(PTRACE_SYSCALL), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SYSCALL) == (0x18), "PTRACE_SYSCALL != 0x18"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SYSCALL 0x18 ++#endif ++#if defined(PTRACE_SETOPTIONS) || (defined(HAVE_DECL_PTRACE_SETOPTIONS) && HAVE_DECL_PTRACE_SETOPTIONS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SETOPTIONS) == (0x4200), "PTRACE_SETOPTIONS != 0x4200"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SETOPTIONS 0x4200 ++#endif ++#if defined(PTRACE_GETEVENTMSG) || (defined(HAVE_DECL_PTRACE_GETEVENTMSG) && HAVE_DECL_PTRACE_GETEVENTMSG) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETEVENTMSG) == (0x4201), "PTRACE_GETEVENTMSG != 0x4201"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETEVENTMSG 0x4201 ++#endif ++#if defined(PTRACE_GETSIGINFO) || (defined(HAVE_DECL_PTRACE_GETSIGINFO) && HAVE_DECL_PTRACE_GETSIGINFO) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETSIGINFO) == (0x4202), "PTRACE_GETSIGINFO != 0x4202"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETSIGINFO 0x4202 ++#endif ++#if defined(PTRACE_SETSIGINFO) || (defined(HAVE_DECL_PTRACE_SETSIGINFO) && HAVE_DECL_PTRACE_SETSIGINFO) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SETSIGINFO) == (0x4203), "PTRACE_SETSIGINFO != 0x4203"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SETSIGINFO 0x4203 ++#endif ++#if defined(PTRACE_GETREGSET) || (defined(HAVE_DECL_PTRACE_GETREGSET) && HAVE_DECL_PTRACE_GETREGSET) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETREGSET) == (0x4204), "PTRACE_GETREGSET != 0x4204"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETREGSET 0x4204 ++#endif ++#if defined(PTRACE_SETREGSET) || (defined(HAVE_DECL_PTRACE_SETREGSET) && HAVE_DECL_PTRACE_SETREGSET) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SETREGSET) == (0x4205), "PTRACE_SETREGSET != 0x4205"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SETREGSET 0x4205 ++#endif ++#if defined(PTRACE_SEIZE) || (defined(HAVE_DECL_PTRACE_SEIZE) && HAVE_DECL_PTRACE_SEIZE) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SEIZE) == (0x4206), "PTRACE_SEIZE != 0x4206"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SEIZE 0x4206 ++#endif ++#if defined(PTRACE_INTERRUPT) || (defined(HAVE_DECL_PTRACE_INTERRUPT) && HAVE_DECL_PTRACE_INTERRUPT) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_INTERRUPT) == (0x4207), "PTRACE_INTERRUPT != 0x4207"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_INTERRUPT 0x4207 ++#endif ++#if defined(PTRACE_LISTEN) || (defined(HAVE_DECL_PTRACE_LISTEN) && HAVE_DECL_PTRACE_LISTEN) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_LISTEN) == (0x4208), "PTRACE_LISTEN != 0x4208"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_LISTEN 0x4208 ++#endif ++#if defined(PTRACE_PEEKSIGINFO) || (defined(HAVE_DECL_PTRACE_PEEKSIGINFO) && HAVE_DECL_PTRACE_PEEKSIGINFO) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_PEEKSIGINFO) == (0x4209), "PTRACE_PEEKSIGINFO != 0x4209"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_PEEKSIGINFO 0x4209 ++#endif ++#if defined(PTRACE_GETSIGMASK) || (defined(HAVE_DECL_PTRACE_GETSIGMASK) && HAVE_DECL_PTRACE_GETSIGMASK) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETSIGMASK) == (0x420a), "PTRACE_GETSIGMASK != 0x420a"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETSIGMASK 0x420a ++#endif ++#if defined(PTRACE_SETSIGMASK) || (defined(HAVE_DECL_PTRACE_SETSIGMASK) && HAVE_DECL_PTRACE_SETSIGMASK) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SETSIGMASK) == (0x420b), "PTRACE_SETSIGMASK != 0x420b"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SETSIGMASK 0x420b ++#endif ++#if defined(PTRACE_SECCOMP_GET_FILTER) || (defined(HAVE_DECL_PTRACE_SECCOMP_GET_FILTER) && HAVE_DECL_PTRACE_SECCOMP_GET_FILTER) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SECCOMP_GET_FILTER) == (0x420c), "PTRACE_SECCOMP_GET_FILTER != 0x420c"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SECCOMP_GET_FILTER 0x420c ++#endif ++#if defined(PTRACE_SECCOMP_GET_METADATA) || (defined(HAVE_DECL_PTRACE_SECCOMP_GET_METADATA) && HAVE_DECL_PTRACE_SECCOMP_GET_METADATA) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SECCOMP_GET_METADATA) == (0x420d), "PTRACE_SECCOMP_GET_METADATA != 0x420d"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SECCOMP_GET_METADATA 0x420d + #endif ++#if defined(PTRACE_GET_SYSCALL_INFO) || (defined(HAVE_DECL_PTRACE_GET_SYSCALL_INFO) && HAVE_DECL_PTRACE_GET_SYSCALL_INFO) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GET_SYSCALL_INFO) == (0x420e), "PTRACE_GET_SYSCALL_INFO != 0x420e"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GET_SYSCALL_INFO 0x420e ++#endif ++#if defined __arm__ || defined __m68k__ || defined __mips__ || defined __powerpc__ || defined __sh__ || defined __sparc__ || defined __x86_64__ || defined __i386__ || defined __xtensa__ + #if defined(PTRACE_GETREGS) || (defined(HAVE_DECL_PTRACE_GETREGS) && HAVE_DECL_PTRACE_GETREGS) +- XLAT(PTRACE_GETREGS), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETREGS) == (0xc), "PTRACE_GETREGS != 0xc"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETREGS 0xc + #endif ++#elif defined __hppa__ || defined __ia64__ ++#if defined(PTRACE_GETREGS) || (defined(HAVE_DECL_PTRACE_GETREGS) && HAVE_DECL_PTRACE_GETREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETREGS) == (0x12), "PTRACE_GETREGS != 0x12"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETREGS 0x12 ++#endif ++#else ++#endif ++#if defined __arm__ || defined __m68k__ || defined __mips__ || defined __powerpc__ || defined __sh__ || defined __sparc__ || defined __x86_64__ || defined __i386__ || defined __xtensa__ + #if defined(PTRACE_SETREGS) || (defined(HAVE_DECL_PTRACE_SETREGS) && HAVE_DECL_PTRACE_SETREGS) +- XLAT(PTRACE_SETREGS), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SETREGS) == (0xd), "PTRACE_SETREGS != 0xd"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SETREGS 0xd + #endif ++#elif defined __hppa__ || defined __ia64__ ++#if defined(PTRACE_SETREGS) || (defined(HAVE_DECL_PTRACE_SETREGS) && HAVE_DECL_PTRACE_SETREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SETREGS) == (0x13), "PTRACE_SETREGS != 0x13"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SETREGS 0x13 ++#endif ++#else ++#endif ++#if defined __arm__ || defined __hppa__ || defined __m68k__ || defined __mips__ || defined __powerpc__ || defined __sh__ || defined __sparc__ || defined __x86_64__ || defined __i386__ + #if defined(PTRACE_GETFPREGS) || (defined(HAVE_DECL_PTRACE_GETFPREGS) && HAVE_DECL_PTRACE_GETFPREGS) +- XLAT(PTRACE_GETFPREGS), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETFPREGS) == (0xe), "PTRACE_GETFPREGS != 0xe"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETFPREGS 0xe + #endif ++#else ++#endif ++#if defined __arm__ || defined __hppa__ || defined __m68k__ || defined __mips__ || defined __powerpc__ || defined __sh__ || defined __sparc__ || defined __x86_64__ || defined __i386__ + #if defined(PTRACE_SETFPREGS) || (defined(HAVE_DECL_PTRACE_SETFPREGS) && HAVE_DECL_PTRACE_SETFPREGS) +- XLAT(PTRACE_SETFPREGS), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SETFPREGS) == (0xf), "PTRACE_SETFPREGS != 0xf"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SETFPREGS 0xf ++#endif ++#else + #endif ++#if defined __mips__ || defined __x86_64__ || defined __i386__ + #if defined(PTRACE_GETFPXREGS) || (defined(HAVE_DECL_PTRACE_GETFPXREGS) && HAVE_DECL_PTRACE_GETFPXREGS) +- XLAT(PTRACE_GETFPXREGS), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETFPXREGS) == (0x12), "PTRACE_GETFPXREGS != 0x12"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETFPXREGS 0x12 ++#endif ++#else + #endif ++#if defined __mips__ || defined __x86_64__ || defined __i386__ + #if defined(PTRACE_SETFPXREGS) || (defined(HAVE_DECL_PTRACE_SETFPXREGS) && HAVE_DECL_PTRACE_SETFPXREGS) +- XLAT(PTRACE_SETFPXREGS), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SETFPXREGS) == (0x13), "PTRACE_SETFPXREGS != 0x13"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SETFPXREGS 0x13 ++#endif ++#else ++#endif ++#if defined __xtensa__ ++#if defined(PTRACE_GETHBPREGS) || (defined(HAVE_DECL_PTRACE_GETHBPREGS) && HAVE_DECL_PTRACE_GETHBPREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETHBPREGS) == (0x14), "PTRACE_GETHBPREGS != 0x14"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETHBPREGS 0x14 ++#endif ++#elif defined __arm__ ++#if defined(PTRACE_GETHBPREGS) || (defined(HAVE_DECL_PTRACE_GETHBPREGS) && HAVE_DECL_PTRACE_GETHBPREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETHBPREGS) == (0x1d), "PTRACE_GETHBPREGS != 0x1d"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETHBPREGS 0x1d ++#endif ++#else ++#endif ++#if defined __xtensa__ ++#if defined(PTRACE_SETHBPREGS) || (defined(HAVE_DECL_PTRACE_SETHBPREGS) && HAVE_DECL_PTRACE_SETHBPREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SETHBPREGS) == (0x15), "PTRACE_SETHBPREGS != 0x15"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SETHBPREGS 0x15 ++#endif ++#elif defined __arm__ ++#if defined(PTRACE_SETHBPREGS) || (defined(HAVE_DECL_PTRACE_SETHBPREGS) && HAVE_DECL_PTRACE_SETHBPREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SETHBPREGS) == (0x1e), "PTRACE_SETHBPREGS != 0x1e"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SETHBPREGS 0x1e ++#endif ++#else ++#endif ++#if defined __arm__ || defined __ia64__ || defined __mips__ || defined __s390__ || defined __x86_64__ || defined __i386__ ++#if defined(PTRACE_OLDSETOPTIONS) || (defined(HAVE_DECL_PTRACE_OLDSETOPTIONS) && HAVE_DECL_PTRACE_OLDSETOPTIONS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_OLDSETOPTIONS) == (0x15), "PTRACE_OLDSETOPTIONS != 0x15"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_OLDSETOPTIONS 0x15 ++#endif ++#else ++#endif ++#if defined __powerpc__ || defined __sparc__ ++#if defined(PTRACE_GETREGS64) || (defined(HAVE_DECL_PTRACE_GETREGS64) && HAVE_DECL_PTRACE_GETREGS64) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETREGS64) == (0x16), "PTRACE_GETREGS64 != 0x16"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETREGS64 0x16 ++#endif ++#else ++#endif ++#if defined __powerpc__ || defined __sparc__ ++#if defined(PTRACE_SETREGS64) || (defined(HAVE_DECL_PTRACE_SETREGS64) && HAVE_DECL_PTRACE_SETREGS64) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SETREGS64) == (0x17), "PTRACE_SETREGS64 != 0x17"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SETREGS64 0x17 ++#endif ++#else ++#endif ++#if defined __arm__ || defined __unicore32__ ++#if defined(PTRACE_GET_THREAD_AREA) || (defined(HAVE_DECL_PTRACE_GET_THREAD_AREA) && HAVE_DECL_PTRACE_GET_THREAD_AREA) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GET_THREAD_AREA) == (0x16), "PTRACE_GET_THREAD_AREA != 0x16"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GET_THREAD_AREA 0x16 ++#endif ++#elif defined __arc__ || defined __m68k__ || defined __mips__ || defined __x86_64__ || defined __i386__ ++#if defined(PTRACE_GET_THREAD_AREA) || (defined(HAVE_DECL_PTRACE_GET_THREAD_AREA) && HAVE_DECL_PTRACE_GET_THREAD_AREA) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GET_THREAD_AREA) == (0x19), "PTRACE_GET_THREAD_AREA != 0x19"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GET_THREAD_AREA 0x19 ++#endif ++#else ++#endif ++#if defined __mips__ || defined __x86_64__ || defined __i386__ ++#if defined(PTRACE_SET_THREAD_AREA) || (defined(HAVE_DECL_PTRACE_SET_THREAD_AREA) && HAVE_DECL_PTRACE_SET_THREAD_AREA) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SET_THREAD_AREA) == (0x1a), "PTRACE_SET_THREAD_AREA != 0x1a"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SET_THREAD_AREA 0x1a ++#endif ++#else ++#endif ++#if defined __arm__ || defined __c6x__ || defined __sh__ ++#if defined(PTRACE_GETFDPIC) || (defined(HAVE_DECL_PTRACE_GETFDPIC) && HAVE_DECL_PTRACE_GETFDPIC) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETFDPIC) == (0x1f), "PTRACE_GETFDPIC != 0x1f"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETFDPIC 0x1f ++#endif ++#else ++#endif ++#if defined __powerpc__ ++#if defined(PTRACE_SYSEMU) || (defined(HAVE_DECL_PTRACE_SYSEMU) && HAVE_DECL_PTRACE_SYSEMU) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SYSEMU) == (0x1d), "PTRACE_SYSEMU != 0x1d"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SYSEMU 0x1d ++#endif ++#elif defined __arm64__ || defined __aarch64__ || defined __x86_64__ || defined __i386__ ++#if defined(PTRACE_SYSEMU) || (defined(HAVE_DECL_PTRACE_SYSEMU) && HAVE_DECL_PTRACE_SYSEMU) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SYSEMU) == (0x1f), "PTRACE_SYSEMU != 0x1f"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SYSEMU 0x1f ++#endif ++#else ++#endif ++#if defined __powerpc__ ++#if defined(PTRACE_SYSEMU_SINGLESTEP) || (defined(HAVE_DECL_PTRACE_SYSEMU_SINGLESTEP) && HAVE_DECL_PTRACE_SYSEMU_SINGLESTEP) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SYSEMU_SINGLESTEP) == (0x1e), "PTRACE_SYSEMU_SINGLESTEP != 0x1e"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SYSEMU_SINGLESTEP 0x1e ++#endif ++#elif defined __arm64__ || defined __aarch64__ || defined __x86_64__ || defined __i386__ ++#if defined(PTRACE_SYSEMU_SINGLESTEP) || (defined(HAVE_DECL_PTRACE_SYSEMU_SINGLESTEP) && HAVE_DECL_PTRACE_SYSEMU_SINGLESTEP) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SYSEMU_SINGLESTEP) == (0x20), "PTRACE_SYSEMU_SINGLESTEP != 0x20"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SYSEMU_SINGLESTEP 0x20 ++#endif ++#else ++#endif ++#if defined __hppa__ || defined __ia64__ || defined __s390__ ++#if defined(PTRACE_SINGLEBLOCK) || (defined(HAVE_DECL_PTRACE_SINGLEBLOCK) && HAVE_DECL_PTRACE_SINGLEBLOCK) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SINGLEBLOCK) == (0xc), "PTRACE_SINGLEBLOCK != 0xc"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SINGLEBLOCK 0xc ++#endif ++#elif defined __m68k__ || defined __x86_64__ || defined __i386__ ++#if defined(PTRACE_SINGLEBLOCK) || (defined(HAVE_DECL_PTRACE_SINGLEBLOCK) && HAVE_DECL_PTRACE_SINGLEBLOCK) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SINGLEBLOCK) == (0x21), "PTRACE_SINGLEBLOCK != 0x21"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SINGLEBLOCK 0x21 ++#endif ++#elif defined __powerpc__ ++#if defined(PTRACE_SINGLEBLOCK) || (defined(HAVE_DECL_PTRACE_SINGLEBLOCK) && HAVE_DECL_PTRACE_SINGLEBLOCK) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SINGLEBLOCK) == (0x100), "PTRACE_SINGLEBLOCK != 0x100"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SINGLEBLOCK 0x100 ++#endif ++#else ++#endif ++#if defined __arm__ ++#if defined(PTRACE_GETWMMXREGS) || (defined(HAVE_DECL_PTRACE_GETWMMXREGS) && HAVE_DECL_PTRACE_GETWMMXREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETWMMXREGS) == (0x12), "PTRACE_GETWMMXREGS != 0x12"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETWMMXREGS 0x12 ++#endif ++#else ++#endif ++#if defined __arm__ ++#if defined(PTRACE_SETWMMXREGS) || (defined(HAVE_DECL_PTRACE_SETWMMXREGS) && HAVE_DECL_PTRACE_SETWMMXREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SETWMMXREGS) == (0x13), "PTRACE_SETWMMXREGS != 0x13"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SETWMMXREGS 0x13 ++#endif ++#else ++#endif ++#if defined __arm__ ++#if defined(PTRACE_SET_SYSCALL) || (defined(HAVE_DECL_PTRACE_SET_SYSCALL) && HAVE_DECL_PTRACE_SET_SYSCALL) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SET_SYSCALL) == (0x17), "PTRACE_SET_SYSCALL != 0x17"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SET_SYSCALL 0x17 + #endif ++#else ++#endif ++#if defined __arm__ ++#if defined(PTRACE_GETCRUNCHREGS) || (defined(HAVE_DECL_PTRACE_GETCRUNCHREGS) && HAVE_DECL_PTRACE_GETCRUNCHREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETCRUNCHREGS) == (0x19), "PTRACE_GETCRUNCHREGS != 0x19"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETCRUNCHREGS 0x19 ++#endif ++#else ++#endif ++#if defined __arm__ ++#if defined(PTRACE_SETCRUNCHREGS) || (defined(HAVE_DECL_PTRACE_SETCRUNCHREGS) && HAVE_DECL_PTRACE_SETCRUNCHREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SETCRUNCHREGS) == (0x1a), "PTRACE_SETCRUNCHREGS != 0x1a"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SETCRUNCHREGS 0x1a ++#endif ++#else ++#endif ++#if defined __arm__ ++#if defined(PTRACE_GETVFPREGS) || (defined(HAVE_DECL_PTRACE_GETVFPREGS) && HAVE_DECL_PTRACE_GETVFPREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETVFPREGS) == (0x1b), "PTRACE_GETVFPREGS != 0x1b"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETVFPREGS 0x1b ++#endif ++#else ++#endif ++#if defined __arm__ ++#if defined(PTRACE_SETVFPREGS) || (defined(HAVE_DECL_PTRACE_SETVFPREGS) && HAVE_DECL_PTRACE_SETVFPREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SETVFPREGS) == (0x1c), "PTRACE_SETVFPREGS != 0x1c"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SETVFPREGS 0x1c ++#endif ++#else ++#endif ++#if defined __ia64__ ++#if defined(PTRACE_OLD_GETSIGINFO) || (defined(HAVE_DECL_PTRACE_OLD_GETSIGINFO) && HAVE_DECL_PTRACE_OLD_GETSIGINFO) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_OLD_GETSIGINFO) == (0xd), "PTRACE_OLD_GETSIGINFO != 0xd"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_OLD_GETSIGINFO 0xd ++#endif ++#else ++#endif ++#if defined __ia64__ ++#if defined(PTRACE_OLD_SETSIGINFO) || (defined(HAVE_DECL_PTRACE_OLD_SETSIGINFO) && HAVE_DECL_PTRACE_OLD_SETSIGINFO) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_OLD_SETSIGINFO) == (0xe), "PTRACE_OLD_SETSIGINFO != 0xe"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_OLD_SETSIGINFO 0xe ++#endif ++#else ++#endif ++#if defined __mips__ ++#if defined(PTRACE_PEEKTEXT_3264) || (defined(HAVE_DECL_PTRACE_PEEKTEXT_3264) && HAVE_DECL_PTRACE_PEEKTEXT_3264) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_PEEKTEXT_3264) == (0xc0), "PTRACE_PEEKTEXT_3264 != 0xc0"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_PEEKTEXT_3264 0xc0 ++#endif ++#else ++#endif ++#if defined __mips__ ++#if defined(PTRACE_PEEKDATA_3264) || (defined(HAVE_DECL_PTRACE_PEEKDATA_3264) && HAVE_DECL_PTRACE_PEEKDATA_3264) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_PEEKDATA_3264) == (0xc1), "PTRACE_PEEKDATA_3264 != 0xc1"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_PEEKDATA_3264 0xc1 ++#endif ++#else ++#endif ++#if defined __mips__ ++#if defined(PTRACE_POKETEXT_3264) || (defined(HAVE_DECL_PTRACE_POKETEXT_3264) && HAVE_DECL_PTRACE_POKETEXT_3264) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_POKETEXT_3264) == (0xc2), "PTRACE_POKETEXT_3264 != 0xc2"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_POKETEXT_3264 0xc2 ++#endif ++#else ++#endif ++#if defined __mips__ ++#if defined(PTRACE_POKEDATA_3264) || (defined(HAVE_DECL_PTRACE_POKEDATA_3264) && HAVE_DECL_PTRACE_POKEDATA_3264) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_POKEDATA_3264) == (0xc3), "PTRACE_POKEDATA_3264 != 0xc3"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_POKEDATA_3264 0xc3 ++#endif ++#else ++#endif ++#if defined __mips__ ++#if defined(PTRACE_GET_THREAD_AREA_3264) || (defined(HAVE_DECL_PTRACE_GET_THREAD_AREA_3264) && HAVE_DECL_PTRACE_GET_THREAD_AREA_3264) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GET_THREAD_AREA_3264) == (0xc4), "PTRACE_GET_THREAD_AREA_3264 != 0xc4"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GET_THREAD_AREA_3264 0xc4 ++#endif ++#else ++#endif ++#if defined __mips__ ++#if defined(PTRACE_GET_WATCH_REGS) || (defined(HAVE_DECL_PTRACE_GET_WATCH_REGS) && HAVE_DECL_PTRACE_GET_WATCH_REGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GET_WATCH_REGS) == (0xd0), "PTRACE_GET_WATCH_REGS != 0xd0"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GET_WATCH_REGS 0xd0 ++#endif ++#else ++#endif ++#if defined __mips__ ++#if defined(PTRACE_SET_WATCH_REGS) || (defined(HAVE_DECL_PTRACE_SET_WATCH_REGS) && HAVE_DECL_PTRACE_SET_WATCH_REGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SET_WATCH_REGS) == (0xd1), "PTRACE_SET_WATCH_REGS != 0xd1"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SET_WATCH_REGS 0xd1 ++#endif ++#else ++#endif ++#if defined __powerpc__ + #if defined(PTRACE_GETVRREGS) || (defined(HAVE_DECL_PTRACE_GETVRREGS) && HAVE_DECL_PTRACE_GETVRREGS) +- XLAT(PTRACE_GETVRREGS), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETVRREGS) == (0x12), "PTRACE_GETVRREGS != 0x12"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETVRREGS 0x12 + #endif ++#else ++#endif ++#if defined __powerpc__ + #if defined(PTRACE_SETVRREGS) || (defined(HAVE_DECL_PTRACE_SETVRREGS) && HAVE_DECL_PTRACE_SETVRREGS) +- XLAT(PTRACE_SETVRREGS), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SETVRREGS) == (0x13), "PTRACE_SETVRREGS != 0x13"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SETVRREGS 0x13 + #endif +-#if defined(PTRACE_SETOPTIONS) || (defined(HAVE_DECL_PTRACE_SETOPTIONS) && HAVE_DECL_PTRACE_SETOPTIONS) +- XLAT(PTRACE_SETOPTIONS), ++#else + #endif +-#if defined(PTRACE_GETEVENTMSG) || (defined(HAVE_DECL_PTRACE_GETEVENTMSG) && HAVE_DECL_PTRACE_GETEVENTMSG) +- XLAT(PTRACE_GETEVENTMSG), ++#if defined __powerpc__ ++#if defined(PTRACE_GETEVRREGS) || (defined(HAVE_DECL_PTRACE_GETEVRREGS) && HAVE_DECL_PTRACE_GETEVRREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETEVRREGS) == (0x14), "PTRACE_GETEVRREGS != 0x14"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETEVRREGS 0x14 + #endif +-#if defined(PTRACE_GETSIGINFO) || (defined(HAVE_DECL_PTRACE_GETSIGINFO) && HAVE_DECL_PTRACE_GETSIGINFO) +- XLAT(PTRACE_GETSIGINFO), ++#else + #endif +-#if defined(PTRACE_SETSIGINFO) || (defined(HAVE_DECL_PTRACE_SETSIGINFO) && HAVE_DECL_PTRACE_SETSIGINFO) +- XLAT(PTRACE_SETSIGINFO), ++#if defined __powerpc__ ++#if defined(PTRACE_SETEVRREGS) || (defined(HAVE_DECL_PTRACE_SETEVRREGS) && HAVE_DECL_PTRACE_SETEVRREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SETEVRREGS) == (0x15), "PTRACE_SETEVRREGS != 0x15"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SETEVRREGS 0x15 + #endif +-#if defined(PTRACE_GETREGSET) || (defined(HAVE_DECL_PTRACE_GETREGSET) && HAVE_DECL_PTRACE_GETREGSET) +- XLAT(PTRACE_GETREGSET), ++#else + #endif +-#if defined(PTRACE_SETREGSET) || (defined(HAVE_DECL_PTRACE_SETREGSET) && HAVE_DECL_PTRACE_SETREGSET) +- XLAT(PTRACE_SETREGSET), ++#if defined __powerpc__ ++#if defined(PTRACE_GETVSRREGS) || (defined(HAVE_DECL_PTRACE_GETVSRREGS) && HAVE_DECL_PTRACE_GETVSRREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETVSRREGS) == (0x1b), "PTRACE_GETVSRREGS != 0x1b"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETVSRREGS 0x1b + #endif +-#if defined(PTRACE_SET_SYSCALL) || (defined(HAVE_DECL_PTRACE_SET_SYSCALL) && HAVE_DECL_PTRACE_SET_SYSCALL) +- XLAT(PTRACE_SET_SYSCALL), ++#else + #endif +-#if defined(PTRACE_SEIZE) || (defined(HAVE_DECL_PTRACE_SEIZE) && HAVE_DECL_PTRACE_SEIZE) +- XLAT(PTRACE_SEIZE), ++#if defined __powerpc__ ++#if defined(PTRACE_SETVSRREGS) || (defined(HAVE_DECL_PTRACE_SETVSRREGS) && HAVE_DECL_PTRACE_SETVSRREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SETVSRREGS) == (0x1c), "PTRACE_SETVSRREGS != 0x1c"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SETVSRREGS 0x1c + #endif +-#if defined(PTRACE_INTERRUPT) || (defined(HAVE_DECL_PTRACE_INTERRUPT) && HAVE_DECL_PTRACE_INTERRUPT) +- XLAT(PTRACE_INTERRUPT), ++#else + #endif +-#if defined(PTRACE_LISTEN) || (defined(HAVE_DECL_PTRACE_LISTEN) && HAVE_DECL_PTRACE_LISTEN) +- XLAT(PTRACE_LISTEN), ++#if defined __powerpc__ ++#if defined(PTRACE_GET_DEBUGREG) || (defined(HAVE_DECL_PTRACE_GET_DEBUGREG) && HAVE_DECL_PTRACE_GET_DEBUGREG) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GET_DEBUGREG) == (0x19), "PTRACE_GET_DEBUGREG != 0x19"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GET_DEBUGREG 0x19 + #endif +-#if defined(PTRACE_PEEKSIGINFO) || (defined(HAVE_DECL_PTRACE_PEEKSIGINFO) && HAVE_DECL_PTRACE_PEEKSIGINFO) +- XLAT(PTRACE_PEEKSIGINFO), ++#else + #endif +-#if defined(PTRACE_GETSIGMASK) || (defined(HAVE_DECL_PTRACE_GETSIGMASK) && HAVE_DECL_PTRACE_GETSIGMASK) +- XLAT(PTRACE_GETSIGMASK), ++#if defined __powerpc__ ++#if defined(PTRACE_SET_DEBUGREG) || (defined(HAVE_DECL_PTRACE_SET_DEBUGREG) && HAVE_DECL_PTRACE_SET_DEBUGREG) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SET_DEBUGREG) == (0x1a), "PTRACE_SET_DEBUGREG != 0x1a"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SET_DEBUGREG 0x1a + #endif +-#if defined(PTRACE_SETSIGMASK) || (defined(HAVE_DECL_PTRACE_SETSIGMASK) && HAVE_DECL_PTRACE_SETSIGMASK) +- XLAT(PTRACE_SETSIGMASK), ++#else + #endif +-#if defined(PTRACE_SECCOMP_GET_FILTER) || (defined(HAVE_DECL_PTRACE_SECCOMP_GET_FILTER) && HAVE_DECL_PTRACE_SECCOMP_GET_FILTER) +- XLAT(PTRACE_SECCOMP_GET_FILTER), ++#if defined __powerpc__ ++#if defined(PPC_PTRACE_DELHWDEBUG) || (defined(HAVE_DECL_PPC_PTRACE_DELHWDEBUG) && HAVE_DECL_PPC_PTRACE_DELHWDEBUG) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PPC_PTRACE_DELHWDEBUG) == (0x87), "PPC_PTRACE_DELHWDEBUG != 0x87"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PPC_PTRACE_DELHWDEBUG 0x87 + #endif +-#if defined(PTRACE_SECCOMP_GET_METADATA) || (defined(HAVE_DECL_PTRACE_SECCOMP_GET_METADATA) && HAVE_DECL_PTRACE_SECCOMP_GET_METADATA) +- XLAT(PTRACE_SECCOMP_GET_METADATA), ++#else + #endif +-#if defined(PTRACE_GET_SYSCALL_INFO) || (defined(HAVE_DECL_PTRACE_GET_SYSCALL_INFO) && HAVE_DECL_PTRACE_GET_SYSCALL_INFO) +- XLAT(PTRACE_GET_SYSCALL_INFO), ++#if defined __powerpc__ ++#if defined(PPC_PTRACE_SETHWDEBUG) || (defined(HAVE_DECL_PPC_PTRACE_SETHWDEBUG) && HAVE_DECL_PPC_PTRACE_SETHWDEBUG) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PPC_PTRACE_SETHWDEBUG) == (0x88), "PPC_PTRACE_SETHWDEBUG != 0x88"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PPC_PTRACE_SETHWDEBUG 0x88 ++#endif ++#else ++#endif ++#if defined __powerpc__ ++#if defined(PPC_PTRACE_GETHWDBGINFO) || (defined(HAVE_DECL_PPC_PTRACE_GETHWDBGINFO) && HAVE_DECL_PPC_PTRACE_GETHWDBGINFO) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PPC_PTRACE_GETHWDBGINFO) == (0x89), "PPC_PTRACE_GETHWDBGINFO != 0x89"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PPC_PTRACE_GETHWDBGINFO 0x89 ++#endif ++#else ++#endif ++#if defined __powerpc__ ++#if defined(PPC_PTRACE_POKEUSR_3264) || (defined(HAVE_DECL_PPC_PTRACE_POKEUSR_3264) && HAVE_DECL_PPC_PTRACE_POKEUSR_3264) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PPC_PTRACE_POKEUSR_3264) == (0x90), "PPC_PTRACE_POKEUSR_3264 != 0x90"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PPC_PTRACE_POKEUSR_3264 0x90 ++#endif ++#else ++#endif ++#if defined __powerpc__ ++#if defined(PPC_PTRACE_PEEKUSR_3264) || (defined(HAVE_DECL_PPC_PTRACE_PEEKUSR_3264) && HAVE_DECL_PPC_PTRACE_PEEKUSR_3264) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PPC_PTRACE_PEEKUSR_3264) == (0x91), "PPC_PTRACE_PEEKUSR_3264 != 0x91"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PPC_PTRACE_PEEKUSR_3264 0x91 ++#endif ++#else ++#endif ++#if defined __powerpc__ ++#if defined(PPC_PTRACE_POKEDATA_3264) || (defined(HAVE_DECL_PPC_PTRACE_POKEDATA_3264) && HAVE_DECL_PPC_PTRACE_POKEDATA_3264) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PPC_PTRACE_POKEDATA_3264) == (0x92), "PPC_PTRACE_POKEDATA_3264 != 0x92"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PPC_PTRACE_POKEDATA_3264 0x92 ++#endif ++#else ++#endif ++#if defined __powerpc__ ++#if defined(PPC_PTRACE_POKETEXT_3264) || (defined(HAVE_DECL_PPC_PTRACE_POKETEXT_3264) && HAVE_DECL_PPC_PTRACE_POKETEXT_3264) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PPC_PTRACE_POKETEXT_3264) == (0x93), "PPC_PTRACE_POKETEXT_3264 != 0x93"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PPC_PTRACE_POKETEXT_3264 0x93 ++#endif ++#else ++#endif ++#if defined __powerpc__ ++#if defined(PPC_PTRACE_PEEKDATA_3264) || (defined(HAVE_DECL_PPC_PTRACE_PEEKDATA_3264) && HAVE_DECL_PPC_PTRACE_PEEKDATA_3264) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PPC_PTRACE_PEEKDATA_3264) == (0x94), "PPC_PTRACE_PEEKDATA_3264 != 0x94"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PPC_PTRACE_PEEKDATA_3264 0x94 ++#endif ++#else ++#endif ++#if defined __powerpc__ ++#if defined(PPC_PTRACE_PEEKTEXT_3264) || (defined(HAVE_DECL_PPC_PTRACE_PEEKTEXT_3264) && HAVE_DECL_PPC_PTRACE_PEEKTEXT_3264) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PPC_PTRACE_PEEKTEXT_3264) == (0x95), "PPC_PTRACE_PEEKTEXT_3264 != 0x95"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PPC_PTRACE_PEEKTEXT_3264 0x95 ++#endif ++#else ++#endif ++#if defined __s390__ ++#if defined(PTRACE_PEEKUSR_AREA) || (defined(HAVE_DECL_PTRACE_PEEKUSR_AREA) && HAVE_DECL_PTRACE_PEEKUSR_AREA) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_PEEKUSR_AREA) == (0x5000), "PTRACE_PEEKUSR_AREA != 0x5000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_PEEKUSR_AREA 0x5000 ++#endif ++#else ++#endif ++#if defined __s390__ ++#if defined(PTRACE_POKEUSR_AREA) || (defined(HAVE_DECL_PTRACE_POKEUSR_AREA) && HAVE_DECL_PTRACE_POKEUSR_AREA) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_POKEUSR_AREA) == (0x5001), "PTRACE_POKEUSR_AREA != 0x5001"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_POKEUSR_AREA 0x5001 ++#endif ++#else ++#endif ++#if defined __s390__ ++#if defined(PTRACE_PEEKTEXT_AREA) || (defined(HAVE_DECL_PTRACE_PEEKTEXT_AREA) && HAVE_DECL_PTRACE_PEEKTEXT_AREA) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_PEEKTEXT_AREA) == (0x5002), "PTRACE_PEEKTEXT_AREA != 0x5002"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_PEEKTEXT_AREA 0x5002 ++#endif ++#else ++#endif ++#if defined __s390__ ++#if defined(PTRACE_PEEKDATA_AREA) || (defined(HAVE_DECL_PTRACE_PEEKDATA_AREA) && HAVE_DECL_PTRACE_PEEKDATA_AREA) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_PEEKDATA_AREA) == (0x5003), "PTRACE_PEEKDATA_AREA != 0x5003"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_PEEKDATA_AREA 0x5003 ++#endif ++#else ++#endif ++#if defined __s390__ ++#if defined(PTRACE_POKETEXT_AREA) || (defined(HAVE_DECL_PTRACE_POKETEXT_AREA) && HAVE_DECL_PTRACE_POKETEXT_AREA) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_POKETEXT_AREA) == (0x5004), "PTRACE_POKETEXT_AREA != 0x5004"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_POKETEXT_AREA 0x5004 ++#endif ++#else ++#endif ++#if defined __s390__ ++#if defined(PTRACE_POKEDATA_AREA) || (defined(HAVE_DECL_PTRACE_POKEDATA_AREA) && HAVE_DECL_PTRACE_POKEDATA_AREA) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_POKEDATA_AREA) == (0x5005), "PTRACE_POKEDATA_AREA != 0x5005"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_POKEDATA_AREA 0x5005 ++#endif ++#else ++#endif ++#if defined __s390__ ++#if defined(PTRACE_GET_LAST_BREAK) || (defined(HAVE_DECL_PTRACE_GET_LAST_BREAK) && HAVE_DECL_PTRACE_GET_LAST_BREAK) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GET_LAST_BREAK) == (0x5006), "PTRACE_GET_LAST_BREAK != 0x5006"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GET_LAST_BREAK 0x5006 ++#endif ++#else ++#endif ++#if defined __s390__ ++#if defined(PTRACE_PEEK_SYSTEM_CALL) || (defined(HAVE_DECL_PTRACE_PEEK_SYSTEM_CALL) && HAVE_DECL_PTRACE_PEEK_SYSTEM_CALL) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_PEEK_SYSTEM_CALL) == (0x5007), "PTRACE_PEEK_SYSTEM_CALL != 0x5007"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_PEEK_SYSTEM_CALL 0x5007 ++#endif ++#else ++#endif ++#if defined __s390__ ++#if defined(PTRACE_POKE_SYSTEM_CALL) || (defined(HAVE_DECL_PTRACE_POKE_SYSTEM_CALL) && HAVE_DECL_PTRACE_POKE_SYSTEM_CALL) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_POKE_SYSTEM_CALL) == (0x5008), "PTRACE_POKE_SYSTEM_CALL != 0x5008"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_POKE_SYSTEM_CALL 0x5008 ++#endif ++#else ++#endif ++#if defined __s390__ ++#if defined(PTRACE_ENABLE_TE) || (defined(HAVE_DECL_PTRACE_ENABLE_TE) && HAVE_DECL_PTRACE_ENABLE_TE) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_ENABLE_TE) == (0x5009), "PTRACE_ENABLE_TE != 0x5009"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_ENABLE_TE 0x5009 ++#endif ++#else ++#endif ++#if defined __s390__ ++#if defined(PTRACE_DISABLE_TE) || (defined(HAVE_DECL_PTRACE_DISABLE_TE) && HAVE_DECL_PTRACE_DISABLE_TE) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_DISABLE_TE) == (0x5010), "PTRACE_DISABLE_TE != 0x5010"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_DISABLE_TE 0x5010 ++#endif ++#else ++#endif ++#if defined __s390__ ++#if defined(PTRACE_TE_ABORT_RAND) || (defined(HAVE_DECL_PTRACE_TE_ABORT_RAND) && HAVE_DECL_PTRACE_TE_ABORT_RAND) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_TE_ABORT_RAND) == (0x5011), "PTRACE_TE_ABORT_RAND != 0x5011"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_TE_ABORT_RAND 0x5011 + #endif ++#else ++#endif ++#if defined __sh__ ++#if defined(PTRACE_GETDSPREGS) || (defined(HAVE_DECL_PTRACE_GETDSPREGS) && HAVE_DECL_PTRACE_GETDSPREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETDSPREGS) == (0x37), "PTRACE_GETDSPREGS != 0x37"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETDSPREGS 0x37 ++#endif ++#else ++#endif ++#if defined __sh__ ++#if defined(PTRACE_SETDSPREGS) || (defined(HAVE_DECL_PTRACE_SETDSPREGS) && HAVE_DECL_PTRACE_SETDSPREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SETDSPREGS) == (0x38), "PTRACE_SETDSPREGS != 0x38"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SETDSPREGS 0x38 ++#endif ++#else ++#endif ++#if defined __sparc__ ++#if defined(PTRACE_SPARC_DETACH) || (defined(HAVE_DECL_PTRACE_SPARC_DETACH) && HAVE_DECL_PTRACE_SPARC_DETACH) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SPARC_DETACH) == (0xb), "PTRACE_SPARC_DETACH != 0xb"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SPARC_DETACH 0xb ++#endif ++#else ++#endif ++#if defined __sparc__ ++#if defined(PTRACE_READDATA) || (defined(HAVE_DECL_PTRACE_READDATA) && HAVE_DECL_PTRACE_READDATA) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_READDATA) == (0x10), "PTRACE_READDATA != 0x10"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_READDATA 0x10 ++#endif ++#else ++#endif ++#if defined __sparc__ ++#if defined(PTRACE_WRITEDATA) || (defined(HAVE_DECL_PTRACE_WRITEDATA) && HAVE_DECL_PTRACE_WRITEDATA) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_WRITEDATA) == (0x11), "PTRACE_WRITEDATA != 0x11"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_WRITEDATA 0x11 ++#endif ++#else ++#endif ++#if defined __sparc__ ++#if defined(PTRACE_READTEXT) || (defined(HAVE_DECL_PTRACE_READTEXT) && HAVE_DECL_PTRACE_READTEXT) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_READTEXT) == (0x12), "PTRACE_READTEXT != 0x12"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_READTEXT 0x12 ++#endif ++#else ++#endif ++#if defined __sparc__ ++#if defined(PTRACE_WRITETEXT) || (defined(HAVE_DECL_PTRACE_WRITETEXT) && HAVE_DECL_PTRACE_WRITETEXT) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_WRITETEXT) == (0x13), "PTRACE_WRITETEXT != 0x13"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_WRITETEXT 0x13 ++#endif ++#else ++#endif ++#if defined __sparc__ ++#if defined(PTRACE_GETFPAREGS) || (defined(HAVE_DECL_PTRACE_GETFPAREGS) && HAVE_DECL_PTRACE_GETFPAREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETFPAREGS) == (0x14), "PTRACE_GETFPAREGS != 0x14"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETFPAREGS 0x14 ++#endif ++#else ++#endif ++#if defined __sparc__ ++#if defined(PTRACE_SETFPAREGS) || (defined(HAVE_DECL_PTRACE_SETFPAREGS) && HAVE_DECL_PTRACE_SETFPAREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SETFPAREGS) == (0x15), "PTRACE_SETFPAREGS != 0x15"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SETFPAREGS 0x15 ++#endif ++#else ++#endif ++#if defined __sparc__ ++#if defined(PTRACE_GETFPREGS64) || (defined(HAVE_DECL_PTRACE_GETFPREGS64) && HAVE_DECL_PTRACE_GETFPREGS64) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETFPREGS64) == (0x19), "PTRACE_GETFPREGS64 != 0x19"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETFPREGS64 0x19 ++#endif ++#else ++#endif ++#if defined __sparc__ ++#if defined(PTRACE_SETFPREGS64) || (defined(HAVE_DECL_PTRACE_SETFPREGS64) && HAVE_DECL_PTRACE_SETFPREGS64) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SETFPREGS64) == (0x1a), "PTRACE_SETFPREGS64 != 0x1a"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SETFPREGS64 0x1a ++#endif ++#else ++#endif ++#if defined __x86_64__ || defined __i386__ ++#if defined(PTRACE_ARCH_PRCTL) || (defined(HAVE_DECL_PTRACE_ARCH_PRCTL) && HAVE_DECL_PTRACE_ARCH_PRCTL) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_ARCH_PRCTL) == (0x1e), "PTRACE_ARCH_PRCTL != 0x1e"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_ARCH_PRCTL 0x1e ++#endif ++#else ++#endif ++#if defined __xtensa__ ++#if defined(PTRACE_GETXTREGS) || (defined(HAVE_DECL_PTRACE_GETXTREGS) && HAVE_DECL_PTRACE_GETXTREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_GETXTREGS) == (0x12), "PTRACE_GETXTREGS != 0x12"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_GETXTREGS 0x12 ++#endif ++#else ++#endif ++#if defined __xtensa__ ++#if defined(PTRACE_SETXTREGS) || (defined(HAVE_DECL_PTRACE_SETXTREGS) && HAVE_DECL_PTRACE_SETXTREGS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((PTRACE_SETXTREGS) == (0x13), "PTRACE_SETXTREGS != 0x13"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define PTRACE_SETXTREGS 0x13 ++#endif ++#else ++#endif ++ ++#ifndef XLAT_MACROS_ONLY + ++# ifndef IN_MPERS ++ ++const struct xlat ptrace_cmds[] = { ++ ++ XLAT(PTRACE_TRACEME), ++ XLAT(PTRACE_PEEKTEXT), ++ XLAT(PTRACE_PEEKDATA), ++ XLAT(PTRACE_PEEKUSER), ++ XLAT(PTRACE_POKETEXT), ++ XLAT(PTRACE_POKEDATA), ++ XLAT(PTRACE_POKEUSER), ++ XLAT(PTRACE_CONT), ++ XLAT(PTRACE_KILL), ++ XLAT(PTRACE_SINGLESTEP), ++ XLAT(PTRACE_ATTACH), ++ XLAT(PTRACE_DETACH), ++ XLAT(PTRACE_SYSCALL), ++ ++ XLAT(PTRACE_SETOPTIONS), ++ XLAT(PTRACE_GETEVENTMSG), ++ XLAT(PTRACE_GETSIGINFO), ++ XLAT(PTRACE_SETSIGINFO), ++ XLAT(PTRACE_GETREGSET), ++ XLAT(PTRACE_SETREGSET), ++ XLAT(PTRACE_SEIZE), ++ XLAT(PTRACE_INTERRUPT), ++ XLAT(PTRACE_LISTEN), ++ XLAT(PTRACE_PEEKSIGINFO), ++ XLAT(PTRACE_GETSIGMASK), ++ XLAT(PTRACE_SETSIGMASK), ++ XLAT(PTRACE_SECCOMP_GET_FILTER), ++ XLAT(PTRACE_SECCOMP_GET_METADATA), ++ XLAT(PTRACE_GET_SYSCALL_INFO), ++ ++ ++#if defined __arm__ || defined __m68k__ || defined __mips__ || defined __powerpc__ || defined __sh__ || defined __sparc__ || defined __x86_64__ || defined __i386__ || defined __xtensa__ ++ XLAT(PTRACE_GETREGS), ++#elif defined __hppa__ || defined __ia64__ ++ XLAT(PTRACE_GETREGS), ++#else ++#if defined(PTRACE_GETREGS) || (defined(HAVE_DECL_PTRACE_GETREGS) && HAVE_DECL_PTRACE_GETREGS) ++ XLAT(PTRACE_GETREGS), ++#endif ++#endif ++ ++#if defined __arm__ || defined __m68k__ || defined __mips__ || defined __powerpc__ || defined __sh__ || defined __sparc__ || defined __x86_64__ || defined __i386__ || defined __xtensa__ ++ XLAT(PTRACE_SETREGS), ++#elif defined __hppa__ || defined __ia64__ ++ XLAT(PTRACE_SETREGS), ++#else ++#if defined(PTRACE_SETREGS) || (defined(HAVE_DECL_PTRACE_SETREGS) && HAVE_DECL_PTRACE_SETREGS) ++ XLAT(PTRACE_SETREGS), ++#endif ++#endif ++ ++#if defined __arm__ || defined __hppa__ || defined __m68k__ || defined __mips__ || defined __powerpc__ || defined __sh__ || defined __sparc__ || defined __x86_64__ || defined __i386__ ++ XLAT(PTRACE_GETFPREGS), ++#else ++#if defined(PTRACE_GETFPREGS) || (defined(HAVE_DECL_PTRACE_GETFPREGS) && HAVE_DECL_PTRACE_GETFPREGS) ++ XLAT(PTRACE_GETFPREGS), ++#endif ++#endif ++ ++#if defined __arm__ || defined __hppa__ || defined __m68k__ || defined __mips__ || defined __powerpc__ || defined __sh__ || defined __sparc__ || defined __x86_64__ || defined __i386__ ++ XLAT(PTRACE_SETFPREGS), ++#else ++#if defined(PTRACE_SETFPREGS) || (defined(HAVE_DECL_PTRACE_SETFPREGS) && HAVE_DECL_PTRACE_SETFPREGS) ++ XLAT(PTRACE_SETFPREGS), ++#endif ++#endif ++ ++#if defined __mips__ || defined __x86_64__ || defined __i386__ ++ XLAT(PTRACE_GETFPXREGS), ++#else ++#if defined(PTRACE_GETFPXREGS) || (defined(HAVE_DECL_PTRACE_GETFPXREGS) && HAVE_DECL_PTRACE_GETFPXREGS) ++ XLAT(PTRACE_GETFPXREGS), ++#endif ++#endif ++ ++#if defined __mips__ || defined __x86_64__ || defined __i386__ ++ XLAT(PTRACE_SETFPXREGS), ++#else ++#if defined(PTRACE_SETFPXREGS) || (defined(HAVE_DECL_PTRACE_SETFPXREGS) && HAVE_DECL_PTRACE_SETFPXREGS) ++ XLAT(PTRACE_SETFPXREGS), ++#endif ++#endif ++ ++#if defined __xtensa__ ++ XLAT(PTRACE_GETHBPREGS), ++#elif defined __arm__ ++ XLAT(PTRACE_GETHBPREGS), ++#else ++#if defined(PTRACE_GETHBPREGS) || (defined(HAVE_DECL_PTRACE_GETHBPREGS) && HAVE_DECL_PTRACE_GETHBPREGS) ++ XLAT(PTRACE_GETHBPREGS), ++#endif ++#endif ++ ++#if defined __xtensa__ ++ XLAT(PTRACE_SETHBPREGS), ++#elif defined __arm__ ++ XLAT(PTRACE_SETHBPREGS), ++#else ++#if defined(PTRACE_SETHBPREGS) || (defined(HAVE_DECL_PTRACE_SETHBPREGS) && HAVE_DECL_PTRACE_SETHBPREGS) ++ XLAT(PTRACE_SETHBPREGS), ++#endif ++#endif ++ ++#if defined __arm__ || defined __ia64__ || defined __mips__ || defined __s390__ || defined __x86_64__ || defined __i386__ ++ XLAT(PTRACE_OLDSETOPTIONS), ++#else ++#if defined(PTRACE_OLDSETOPTIONS) || (defined(HAVE_DECL_PTRACE_OLDSETOPTIONS) && HAVE_DECL_PTRACE_OLDSETOPTIONS) ++ XLAT(PTRACE_OLDSETOPTIONS), ++#endif ++#endif ++ ++#if defined __powerpc__ || defined __sparc__ ++ XLAT(PTRACE_GETREGS64), ++#else ++#if defined(PTRACE_GETREGS64) || (defined(HAVE_DECL_PTRACE_GETREGS64) && HAVE_DECL_PTRACE_GETREGS64) ++ XLAT(PTRACE_GETREGS64), ++#endif ++#endif ++#if defined __powerpc__ || defined __sparc__ ++ XLAT(PTRACE_SETREGS64), ++#else ++#if defined(PTRACE_SETREGS64) || (defined(HAVE_DECL_PTRACE_SETREGS64) && HAVE_DECL_PTRACE_SETREGS64) ++ XLAT(PTRACE_SETREGS64), ++#endif ++#endif ++ ++#if defined __arm__ || defined __unicore32__ ++ XLAT(PTRACE_GET_THREAD_AREA), ++#elif defined __arc__ || defined __m68k__ || defined __mips__ || defined __x86_64__ || defined __i386__ ++ XLAT(PTRACE_GET_THREAD_AREA), ++#else + #if defined(PTRACE_GET_THREAD_AREA) || (defined(HAVE_DECL_PTRACE_GET_THREAD_AREA) && HAVE_DECL_PTRACE_GET_THREAD_AREA) + XLAT(PTRACE_GET_THREAD_AREA), + #endif ++#endif ++ ++#if defined __mips__ || defined __x86_64__ || defined __i386__ ++ XLAT(PTRACE_SET_THREAD_AREA), ++#else + #if defined(PTRACE_SET_THREAD_AREA) || (defined(HAVE_DECL_PTRACE_SET_THREAD_AREA) && HAVE_DECL_PTRACE_SET_THREAD_AREA) + XLAT(PTRACE_SET_THREAD_AREA), + #endif +-#if defined(PTRACE_OLDSETOPTIONS) || (defined(HAVE_DECL_PTRACE_OLDSETOPTIONS) && HAVE_DECL_PTRACE_OLDSETOPTIONS) +- XLAT(PTRACE_OLDSETOPTIONS), + #endif ++ ++#if defined __arm__ || defined __c6x__ || defined __sh__ ++ XLAT(PTRACE_GETFDPIC), ++#else + #if defined(PTRACE_GETFDPIC) || (defined(HAVE_DECL_PTRACE_GETFDPIC) && HAVE_DECL_PTRACE_GETFDPIC) + XLAT(PTRACE_GETFDPIC), + #endif ++#endif ++ ++#if defined __powerpc__ ++ XLAT(PTRACE_SYSEMU), ++#elif defined __arm64__ || defined __aarch64__ || defined __x86_64__ || defined __i386__ ++ XLAT(PTRACE_SYSEMU), ++#else ++#if defined(PTRACE_SYSEMU) || (defined(HAVE_DECL_PTRACE_SYSEMU) && HAVE_DECL_PTRACE_SYSEMU) ++ XLAT(PTRACE_SYSEMU), ++#endif ++#endif ++ ++#if defined __powerpc__ ++ XLAT(PTRACE_SYSEMU_SINGLESTEP), ++#elif defined __arm64__ || defined __aarch64__ || defined __x86_64__ || defined __i386__ ++ XLAT(PTRACE_SYSEMU_SINGLESTEP), ++#else ++#if defined(PTRACE_SYSEMU_SINGLESTEP) || (defined(HAVE_DECL_PTRACE_SYSEMU_SINGLESTEP) && HAVE_DECL_PTRACE_SYSEMU_SINGLESTEP) ++ XLAT(PTRACE_SYSEMU_SINGLESTEP), ++#endif ++#endif ++ ++#if defined __hppa__ || defined __ia64__ || defined __s390__ ++ XLAT(PTRACE_SINGLEBLOCK), ++#elif defined __m68k__ || defined __x86_64__ || defined __i386__ ++ XLAT(PTRACE_SINGLEBLOCK), ++#elif defined __powerpc__ ++ XLAT(PTRACE_SINGLEBLOCK), ++#else + #if defined(PTRACE_SINGLEBLOCK) || (defined(HAVE_DECL_PTRACE_SINGLEBLOCK) && HAVE_DECL_PTRACE_SINGLEBLOCK) + XLAT(PTRACE_SINGLEBLOCK), + #endif ++#endif ++ + ++#if defined __arm__ ++ XLAT(PTRACE_GETWMMXREGS), ++#else + #if defined(PTRACE_GETWMMXREGS) || (defined(HAVE_DECL_PTRACE_GETWMMXREGS) && HAVE_DECL_PTRACE_GETWMMXREGS) + XLAT(PTRACE_GETWMMXREGS), + #endif ++#endif ++#if defined __arm__ ++ XLAT(PTRACE_SETWMMXREGS), ++#else + #if defined(PTRACE_SETWMMXREGS) || (defined(HAVE_DECL_PTRACE_SETWMMXREGS) && HAVE_DECL_PTRACE_SETWMMXREGS) + XLAT(PTRACE_SETWMMXREGS), + #endif ++#endif ++#if defined __arm__ ++ XLAT(PTRACE_SET_SYSCALL), ++#else ++#if defined(PTRACE_SET_SYSCALL) || (defined(HAVE_DECL_PTRACE_SET_SYSCALL) && HAVE_DECL_PTRACE_SET_SYSCALL) ++ XLAT(PTRACE_SET_SYSCALL), ++#endif ++#endif ++#if defined __arm__ ++ XLAT(PTRACE_GETCRUNCHREGS), ++#else + #if defined(PTRACE_GETCRUNCHREGS) || (defined(HAVE_DECL_PTRACE_GETCRUNCHREGS) && HAVE_DECL_PTRACE_GETCRUNCHREGS) + XLAT(PTRACE_GETCRUNCHREGS), + #endif ++#endif ++#if defined __arm__ ++ XLAT(PTRACE_SETCRUNCHREGS), ++#else + #if defined(PTRACE_SETCRUNCHREGS) || (defined(HAVE_DECL_PTRACE_SETCRUNCHREGS) && HAVE_DECL_PTRACE_SETCRUNCHREGS) + XLAT(PTRACE_SETCRUNCHREGS), + #endif ++#endif ++#if defined __arm__ ++ XLAT(PTRACE_GETVFPREGS), ++#else + #if defined(PTRACE_GETVFPREGS) || (defined(HAVE_DECL_PTRACE_GETVFPREGS) && HAVE_DECL_PTRACE_GETVFPREGS) + XLAT(PTRACE_GETVFPREGS), + #endif ++#endif ++#if defined __arm__ ++ XLAT(PTRACE_SETVFPREGS), ++#else + #if defined(PTRACE_SETVFPREGS) || (defined(HAVE_DECL_PTRACE_SETVFPREGS) && HAVE_DECL_PTRACE_SETVFPREGS) + XLAT(PTRACE_SETVFPREGS), + #endif +-#if defined(PTRACE_GETHBPREGS) || (defined(HAVE_DECL_PTRACE_GETHBPREGS) && HAVE_DECL_PTRACE_GETHBPREGS) +- XLAT(PTRACE_GETHBPREGS), +-#endif +-#if defined(PTRACE_SETHBPREGS) || (defined(HAVE_DECL_PTRACE_SETHBPREGS) && HAVE_DECL_PTRACE_SETHBPREGS) +- XLAT(PTRACE_SETHBPREGS), + #endif + ++ ++#if defined __ia64__ ++ XLAT(PTRACE_OLD_GETSIGINFO), ++#else + #if defined(PTRACE_OLD_GETSIGINFO) || (defined(HAVE_DECL_PTRACE_OLD_GETSIGINFO) && HAVE_DECL_PTRACE_OLD_GETSIGINFO) + XLAT(PTRACE_OLD_GETSIGINFO), + #endif ++#endif ++#if defined __ia64__ ++ XLAT(PTRACE_OLD_SETSIGINFO), ++#else + #if defined(PTRACE_OLD_SETSIGINFO) || (defined(HAVE_DECL_PTRACE_OLD_SETSIGINFO) && HAVE_DECL_PTRACE_OLD_SETSIGINFO) + XLAT(PTRACE_OLD_SETSIGINFO), + #endif ++#endif ++ + ++#if defined __mips__ ++ XLAT(PTRACE_PEEKTEXT_3264), ++#else + #if defined(PTRACE_PEEKTEXT_3264) || (defined(HAVE_DECL_PTRACE_PEEKTEXT_3264) && HAVE_DECL_PTRACE_PEEKTEXT_3264) + XLAT(PTRACE_PEEKTEXT_3264), + #endif ++#endif ++#if defined __mips__ ++ XLAT(PTRACE_PEEKDATA_3264), ++#else + #if defined(PTRACE_PEEKDATA_3264) || (defined(HAVE_DECL_PTRACE_PEEKDATA_3264) && HAVE_DECL_PTRACE_PEEKDATA_3264) + XLAT(PTRACE_PEEKDATA_3264), + #endif ++#endif ++#if defined __mips__ ++ XLAT(PTRACE_POKETEXT_3264), ++#else + #if defined(PTRACE_POKETEXT_3264) || (defined(HAVE_DECL_PTRACE_POKETEXT_3264) && HAVE_DECL_PTRACE_POKETEXT_3264) + XLAT(PTRACE_POKETEXT_3264), + #endif ++#endif ++#if defined __mips__ ++ XLAT(PTRACE_POKEDATA_3264), ++#else + #if defined(PTRACE_POKEDATA_3264) || (defined(HAVE_DECL_PTRACE_POKEDATA_3264) && HAVE_DECL_PTRACE_POKEDATA_3264) + XLAT(PTRACE_POKEDATA_3264), + #endif ++#endif ++#if defined __mips__ ++ XLAT(PTRACE_GET_THREAD_AREA_3264), ++#else + #if defined(PTRACE_GET_THREAD_AREA_3264) || (defined(HAVE_DECL_PTRACE_GET_THREAD_AREA_3264) && HAVE_DECL_PTRACE_GET_THREAD_AREA_3264) + XLAT(PTRACE_GET_THREAD_AREA_3264), + #endif ++#endif ++#if defined __mips__ ++ XLAT(PTRACE_GET_WATCH_REGS), ++#else + #if defined(PTRACE_GET_WATCH_REGS) || (defined(HAVE_DECL_PTRACE_GET_WATCH_REGS) && HAVE_DECL_PTRACE_GET_WATCH_REGS) + XLAT(PTRACE_GET_WATCH_REGS), + #endif ++#endif ++#if defined __mips__ ++ XLAT(PTRACE_SET_WATCH_REGS), ++#else + #if defined(PTRACE_SET_WATCH_REGS) || (defined(HAVE_DECL_PTRACE_SET_WATCH_REGS) && HAVE_DECL_PTRACE_SET_WATCH_REGS) + XLAT(PTRACE_SET_WATCH_REGS), + #endif ++#endif + ++ ++#if defined __powerpc__ ++ XLAT(PTRACE_GETVRREGS), ++#else ++#if defined(PTRACE_GETVRREGS) || (defined(HAVE_DECL_PTRACE_GETVRREGS) && HAVE_DECL_PTRACE_GETVRREGS) ++ XLAT(PTRACE_GETVRREGS), ++#endif ++#endif ++#if defined __powerpc__ ++ XLAT(PTRACE_SETVRREGS), ++#else ++#if defined(PTRACE_SETVRREGS) || (defined(HAVE_DECL_PTRACE_SETVRREGS) && HAVE_DECL_PTRACE_SETVRREGS) ++ XLAT(PTRACE_SETVRREGS), ++#endif ++#endif ++#if defined __powerpc__ ++ XLAT(PTRACE_GETEVRREGS), ++#else + #if defined(PTRACE_GETEVRREGS) || (defined(HAVE_DECL_PTRACE_GETEVRREGS) && HAVE_DECL_PTRACE_GETEVRREGS) + XLAT(PTRACE_GETEVRREGS), + #endif ++#endif ++#if defined __powerpc__ ++ XLAT(PTRACE_SETEVRREGS), ++#else + #if defined(PTRACE_SETEVRREGS) || (defined(HAVE_DECL_PTRACE_SETEVRREGS) && HAVE_DECL_PTRACE_SETEVRREGS) + XLAT(PTRACE_SETEVRREGS), + #endif ++#endif ++#if defined __powerpc__ ++ XLAT(PTRACE_GETVSRREGS), ++#else + #if defined(PTRACE_GETVSRREGS) || (defined(HAVE_DECL_PTRACE_GETVSRREGS) && HAVE_DECL_PTRACE_GETVSRREGS) + XLAT(PTRACE_GETVSRREGS), + #endif ++#endif ++#if defined __powerpc__ ++ XLAT(PTRACE_SETVSRREGS), ++#else + #if defined(PTRACE_SETVSRREGS) || (defined(HAVE_DECL_PTRACE_SETVSRREGS) && HAVE_DECL_PTRACE_SETVSRREGS) + XLAT(PTRACE_SETVSRREGS), + #endif ++#endif ++#if defined __powerpc__ ++ XLAT(PTRACE_GET_DEBUGREG), ++#else + #if defined(PTRACE_GET_DEBUGREG) || (defined(HAVE_DECL_PTRACE_GET_DEBUGREG) && HAVE_DECL_PTRACE_GET_DEBUGREG) + XLAT(PTRACE_GET_DEBUGREG), + #endif ++#endif ++#if defined __powerpc__ ++ XLAT(PTRACE_SET_DEBUGREG), ++#else + #if defined(PTRACE_SET_DEBUGREG) || (defined(HAVE_DECL_PTRACE_SET_DEBUGREG) && HAVE_DECL_PTRACE_SET_DEBUGREG) + XLAT(PTRACE_SET_DEBUGREG), + #endif +-#if defined(PPC_PTRACE_GETHWDBGINFO) || (defined(HAVE_DECL_PPC_PTRACE_GETHWDBGINFO) && HAVE_DECL_PPC_PTRACE_GETHWDBGINFO) +- XLAT(PPC_PTRACE_GETHWDBGINFO), + #endif ++#if defined __powerpc__ ++ XLAT(PPC_PTRACE_DELHWDEBUG), ++#else ++ ++#endif ++#if defined __powerpc__ ++ XLAT(PPC_PTRACE_SETHWDEBUG), ++#else + #if defined(PPC_PTRACE_SETHWDEBUG) || (defined(HAVE_DECL_PPC_PTRACE_SETHWDEBUG) && HAVE_DECL_PPC_PTRACE_SETHWDEBUG) + XLAT(PPC_PTRACE_SETHWDEBUG), + #endif +-#if defined(PPC_PTRACE_DELHWDEBUG) || (defined(HAVE_DECL_PPC_PTRACE_DELHWDEBUG) && HAVE_DECL_PPC_PTRACE_DELHWDEBUG) +- XLAT(PPC_PTRACE_DELHWDEBUG), ++#endif ++#if defined __powerpc__ ++ XLAT(PPC_PTRACE_GETHWDBGINFO), ++#else ++#if defined(PPC_PTRACE_GETHWDBGINFO) || (defined(HAVE_DECL_PPC_PTRACE_GETHWDBGINFO) && HAVE_DECL_PPC_PTRACE_GETHWDBGINFO) ++ XLAT(PPC_PTRACE_GETHWDBGINFO), ++#endif ++#endif ++#if defined __powerpc__ ++ XLAT(PPC_PTRACE_POKEUSR_3264), ++#else ++#if defined(PPC_PTRACE_POKEUSR_3264) || (defined(HAVE_DECL_PPC_PTRACE_POKEUSR_3264) && HAVE_DECL_PPC_PTRACE_POKEUSR_3264) ++ XLAT(PPC_PTRACE_POKEUSR_3264), ++#endif ++#endif ++#if defined __powerpc__ ++ XLAT(PPC_PTRACE_PEEKUSR_3264), ++#else ++#if defined(PPC_PTRACE_PEEKUSR_3264) || (defined(HAVE_DECL_PPC_PTRACE_PEEKUSR_3264) && HAVE_DECL_PPC_PTRACE_PEEKUSR_3264) ++ XLAT(PPC_PTRACE_PEEKUSR_3264), ++#endif ++#endif ++#if defined __powerpc__ ++ XLAT(PPC_PTRACE_POKEDATA_3264), ++#else ++#if defined(PPC_PTRACE_POKEDATA_3264) || (defined(HAVE_DECL_PPC_PTRACE_POKEDATA_3264) && HAVE_DECL_PPC_PTRACE_POKEDATA_3264) ++ XLAT(PPC_PTRACE_POKEDATA_3264), ++#endif ++#endif ++#if defined __powerpc__ ++ XLAT(PPC_PTRACE_POKETEXT_3264), ++#else ++#if defined(PPC_PTRACE_POKETEXT_3264) || (defined(HAVE_DECL_PPC_PTRACE_POKETEXT_3264) && HAVE_DECL_PPC_PTRACE_POKETEXT_3264) ++ XLAT(PPC_PTRACE_POKETEXT_3264), ++#endif ++#endif ++#if defined __powerpc__ ++ XLAT(PPC_PTRACE_PEEKDATA_3264), ++#else ++#if defined(PPC_PTRACE_PEEKDATA_3264) || (defined(HAVE_DECL_PPC_PTRACE_PEEKDATA_3264) && HAVE_DECL_PPC_PTRACE_PEEKDATA_3264) ++ XLAT(PPC_PTRACE_PEEKDATA_3264), ++#endif ++#endif ++#if defined __powerpc__ ++ XLAT(PPC_PTRACE_PEEKTEXT_3264), ++#else ++#if defined(PPC_PTRACE_PEEKTEXT_3264) || (defined(HAVE_DECL_PPC_PTRACE_PEEKTEXT_3264) && HAVE_DECL_PPC_PTRACE_PEEKTEXT_3264) ++ XLAT(PPC_PTRACE_PEEKTEXT_3264), ++#endif + #endif + ++ ++#if defined __s390__ ++ XLAT(PTRACE_PEEKUSR_AREA), ++#else + #if defined(PTRACE_PEEKUSR_AREA) || (defined(HAVE_DECL_PTRACE_PEEKUSR_AREA) && HAVE_DECL_PTRACE_PEEKUSR_AREA) + XLAT(PTRACE_PEEKUSR_AREA), + #endif ++#endif ++#if defined __s390__ ++ XLAT(PTRACE_POKEUSR_AREA), ++#else + #if defined(PTRACE_POKEUSR_AREA) || (defined(HAVE_DECL_PTRACE_POKEUSR_AREA) && HAVE_DECL_PTRACE_POKEUSR_AREA) + XLAT(PTRACE_POKEUSR_AREA), + #endif ++#endif ++#if defined __s390__ ++ XLAT(PTRACE_PEEKTEXT_AREA), ++#else + #if defined(PTRACE_PEEKTEXT_AREA) || (defined(HAVE_DECL_PTRACE_PEEKTEXT_AREA) && HAVE_DECL_PTRACE_PEEKTEXT_AREA) + XLAT(PTRACE_PEEKTEXT_AREA), + #endif ++#endif ++#if defined __s390__ ++ XLAT(PTRACE_PEEKDATA_AREA), ++#else + #if defined(PTRACE_PEEKDATA_AREA) || (defined(HAVE_DECL_PTRACE_PEEKDATA_AREA) && HAVE_DECL_PTRACE_PEEKDATA_AREA) + XLAT(PTRACE_PEEKDATA_AREA), + #endif ++#endif ++#if defined __s390__ ++ XLAT(PTRACE_POKETEXT_AREA), ++#else + #if defined(PTRACE_POKETEXT_AREA) || (defined(HAVE_DECL_PTRACE_POKETEXT_AREA) && HAVE_DECL_PTRACE_POKETEXT_AREA) + XLAT(PTRACE_POKETEXT_AREA), + #endif ++#endif ++#if defined __s390__ ++ XLAT(PTRACE_POKEDATA_AREA), ++#else + #if defined(PTRACE_POKEDATA_AREA) || (defined(HAVE_DECL_PTRACE_POKEDATA_AREA) && HAVE_DECL_PTRACE_POKEDATA_AREA) + XLAT(PTRACE_POKEDATA_AREA), + #endif ++#endif ++#if defined __s390__ ++ XLAT(PTRACE_GET_LAST_BREAK), ++#else + #if defined(PTRACE_GET_LAST_BREAK) || (defined(HAVE_DECL_PTRACE_GET_LAST_BREAK) && HAVE_DECL_PTRACE_GET_LAST_BREAK) + XLAT(PTRACE_GET_LAST_BREAK), + #endif ++#endif ++#if defined __s390__ ++ XLAT(PTRACE_PEEK_SYSTEM_CALL), ++#else + #if defined(PTRACE_PEEK_SYSTEM_CALL) || (defined(HAVE_DECL_PTRACE_PEEK_SYSTEM_CALL) && HAVE_DECL_PTRACE_PEEK_SYSTEM_CALL) + XLAT(PTRACE_PEEK_SYSTEM_CALL), + #endif ++#endif ++#if defined __s390__ ++ XLAT(PTRACE_POKE_SYSTEM_CALL), ++#else + #if defined(PTRACE_POKE_SYSTEM_CALL) || (defined(HAVE_DECL_PTRACE_POKE_SYSTEM_CALL) && HAVE_DECL_PTRACE_POKE_SYSTEM_CALL) + XLAT(PTRACE_POKE_SYSTEM_CALL), + #endif ++#endif ++#if defined __s390__ ++ XLAT(PTRACE_ENABLE_TE), ++#else + #if defined(PTRACE_ENABLE_TE) || (defined(HAVE_DECL_PTRACE_ENABLE_TE) && HAVE_DECL_PTRACE_ENABLE_TE) + XLAT(PTRACE_ENABLE_TE), + #endif ++#endif ++#if defined __s390__ ++ XLAT(PTRACE_DISABLE_TE), ++#else + #if defined(PTRACE_DISABLE_TE) || (defined(HAVE_DECL_PTRACE_DISABLE_TE) && HAVE_DECL_PTRACE_DISABLE_TE) + XLAT(PTRACE_DISABLE_TE), + #endif ++#endif ++#if defined __s390__ ++ XLAT(PTRACE_TE_ABORT_RAND), ++#else + #if defined(PTRACE_TE_ABORT_RAND) || (defined(HAVE_DECL_PTRACE_TE_ABORT_RAND) && HAVE_DECL_PTRACE_TE_ABORT_RAND) + XLAT(PTRACE_TE_ABORT_RAND), + #endif ++#endif + ++ ++#if defined __sh__ ++ XLAT(PTRACE_GETDSPREGS), ++#else + #if defined(PTRACE_GETDSPREGS) || (defined(HAVE_DECL_PTRACE_GETDSPREGS) && HAVE_DECL_PTRACE_GETDSPREGS) + XLAT(PTRACE_GETDSPREGS), + #endif ++#endif ++#if defined __sh__ ++ XLAT(PTRACE_SETDSPREGS), ++#else + #if defined(PTRACE_SETDSPREGS) || (defined(HAVE_DECL_PTRACE_SETDSPREGS) && HAVE_DECL_PTRACE_SETDSPREGS) + XLAT(PTRACE_SETDSPREGS), + #endif ++#endif ++ + ++#if defined __sparc__ ++ XLAT(PTRACE_SPARC_DETACH), ++#else + #if defined(PTRACE_SPARC_DETACH) || (defined(HAVE_DECL_PTRACE_SPARC_DETACH) && HAVE_DECL_PTRACE_SPARC_DETACH) + XLAT(PTRACE_SPARC_DETACH), + #endif ++#endif ++#if defined __sparc__ ++ XLAT(PTRACE_READDATA), ++#else + #if defined(PTRACE_READDATA) || (defined(HAVE_DECL_PTRACE_READDATA) && HAVE_DECL_PTRACE_READDATA) + XLAT(PTRACE_READDATA), + #endif ++#endif ++#if defined __sparc__ ++ XLAT(PTRACE_WRITEDATA), ++#else + #if defined(PTRACE_WRITEDATA) || (defined(HAVE_DECL_PTRACE_WRITEDATA) && HAVE_DECL_PTRACE_WRITEDATA) + XLAT(PTRACE_WRITEDATA), + #endif ++#endif ++#if defined __sparc__ ++ XLAT(PTRACE_READTEXT), ++#else + #if defined(PTRACE_READTEXT) || (defined(HAVE_DECL_PTRACE_READTEXT) && HAVE_DECL_PTRACE_READTEXT) + XLAT(PTRACE_READTEXT), + #endif ++#endif ++#if defined __sparc__ ++ XLAT(PTRACE_WRITETEXT), ++#else + #if defined(PTRACE_WRITETEXT) || (defined(HAVE_DECL_PTRACE_WRITETEXT) && HAVE_DECL_PTRACE_WRITETEXT) + XLAT(PTRACE_WRITETEXT), + #endif ++#endif ++#if defined __sparc__ ++ XLAT(PTRACE_GETFPAREGS), ++#else + #if defined(PTRACE_GETFPAREGS) || (defined(HAVE_DECL_PTRACE_GETFPAREGS) && HAVE_DECL_PTRACE_GETFPAREGS) + XLAT(PTRACE_GETFPAREGS), + #endif ++#endif ++#if defined __sparc__ ++ XLAT(PTRACE_SETFPAREGS), ++#else + #if defined(PTRACE_SETFPAREGS) || (defined(HAVE_DECL_PTRACE_SETFPAREGS) && HAVE_DECL_PTRACE_SETFPAREGS) + XLAT(PTRACE_SETFPAREGS), + #endif +-#if defined(PTRACE_GETREGS64) || (defined(HAVE_DECL_PTRACE_GETREGS64) && HAVE_DECL_PTRACE_GETREGS64) +- XLAT(PTRACE_GETREGS64), +-#endif +-#if defined(PTRACE_SETREGS64) || (defined(HAVE_DECL_PTRACE_SETREGS64) && HAVE_DECL_PTRACE_SETREGS64) +- XLAT(PTRACE_SETREGS64), + #endif ++#if defined __sparc__ ++ XLAT(PTRACE_GETFPREGS64), ++#else + #if defined(PTRACE_GETFPREGS64) || (defined(HAVE_DECL_PTRACE_GETFPREGS64) && HAVE_DECL_PTRACE_GETFPREGS64) + XLAT(PTRACE_GETFPREGS64), + #endif ++#endif ++#if defined __sparc__ ++ XLAT(PTRACE_SETFPREGS64), ++#else + #if defined(PTRACE_SETFPREGS64) || (defined(HAVE_DECL_PTRACE_SETFPREGS64) && HAVE_DECL_PTRACE_SETFPREGS64) + XLAT(PTRACE_SETFPREGS64), + #endif ++#endif + ++ ++#if defined __x86_64__ || defined __i386__ ++ XLAT(PTRACE_ARCH_PRCTL), ++#else + #if defined(PTRACE_ARCH_PRCTL) || (defined(HAVE_DECL_PTRACE_ARCH_PRCTL) && HAVE_DECL_PTRACE_ARCH_PRCTL) + XLAT(PTRACE_ARCH_PRCTL), + #endif +-#if defined(PTRACE_SYSEMU) || (defined(HAVE_DECL_PTRACE_SYSEMU) && HAVE_DECL_PTRACE_SYSEMU) +- XLAT(PTRACE_SYSEMU), +-#endif +-#if defined(PTRACE_SYSEMU_SINGLESTEP) || (defined(HAVE_DECL_PTRACE_SYSEMU_SINGLESTEP) && HAVE_DECL_PTRACE_SYSEMU_SINGLESTEP) +- XLAT(PTRACE_SYSEMU_SINGLESTEP), + #endif + ++ ++#if defined __xtensa__ ++ XLAT(PTRACE_GETXTREGS), ++#else + #if defined(PTRACE_GETXTREGS) || (defined(HAVE_DECL_PTRACE_GETXTREGS) && HAVE_DECL_PTRACE_GETXTREGS) + XLAT(PTRACE_GETXTREGS), + #endif ++#endif ++#if defined __xtensa__ ++ XLAT(PTRACE_SETXTREGS), ++#else + #if defined(PTRACE_SETXTREGS) || (defined(HAVE_DECL_PTRACE_SETXTREGS) && HAVE_DECL_PTRACE_SETXTREGS) + XLAT(PTRACE_SETXTREGS), + #endif ++#endif + XLAT_END + }; + diff --git a/SOURCES/0077-macros.h-introduce-sizeof_field-macro.patch b/SOURCES/0077-macros.h-introduce-sizeof_field-macro.patch new file mode 100644 index 0000000..4e84b4c --- /dev/null +++ b/SOURCES/0077-macros.h-introduce-sizeof_field-macro.patch @@ -0,0 +1,33 @@ +From ed47b3a326d40e864926c0a456903bdbd3c23e87 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Fri, 1 Nov 2019 01:57:16 +0100 +Subject: [PATCH] macros.h: introduce sizeof_field macro + +Handy for field size checks. + +* macros.h (sizeof_field): New macro. +(offsetofend): Use it. +--- + macros.h | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/macros.h b/macros.h +index c58ac6a..d7e191f 100644 +--- a/macros.h ++++ b/macros.h +@@ -37,9 +37,11 @@ + # define ROUNDUP(val_, div_) (ROUNDUP_DIV((val_), (div_)) * (div_)) + # endif + ++# define sizeof_field(type_, member_) (sizeof(((type_ *)0)->member_)) ++ + # ifndef offsetofend + # define offsetofend(type_, member_) \ +- (offsetof(type_, member_) + sizeof(((type_ *)0)->member_)) ++ (offsetof(type_, member_) + sizeof_field(type_, member_)) + # endif + + # ifndef cast_ptr +-- +2.1.4 + diff --git a/SOURCES/0078-v4l2-improve-buffer-flag-decoding.patch b/SOURCES/0078-v4l2-improve-buffer-flag-decoding.patch new file mode 100644 index 0000000..9175fec --- /dev/null +++ b/SOURCES/0078-v4l2-improve-buffer-flag-decoding.patch @@ -0,0 +1,458 @@ +From 97a57bbf35066d436230fe004f9f44e524a6e807 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Sun, 25 Nov 2018 16:14:11 +0100 +Subject: [PATCH 77/82] v4l2: improve buffer flag decoding + +* xlat/v4l2_buf_flags.in: Add fallback values. +* xlat/v4l2_buf_flags_masks.in: New file. +* xlat/v4l2_buf_flags_ts_src.in: Likewise. +* xlat/v4l2_buf_flags_ts_type.in: Likewise. +* v4l2.c: Include xlat/v4l2_buf_flags_ts_type.h, +xlat/v4l2_buf_flags_ts_src.h, xlat/v4l2_buf_flags_masks.h. +(print_v4l2_buffer_flags): New function. +(print_v4l2_buffer): Call print_v4l2_buffer_flags for printing flags field. +--- + v4l2.c | 25 ++++++++++++++++++++++++- + xlat/v4l2_buf_flags.in | 33 ++++++++++++++------------------- + xlat/v4l2_buf_flags_masks.in | 2 ++ + xlat/v4l2_buf_flags_ts_src.in | 3 +++ + xlat/v4l2_buf_flags_ts_type.in | 4 ++++ + 5 files changed, 47 insertions(+), 20 deletions(-) + create mode 100644 xlat/v4l2_buf_flags_masks.in + create mode 100644 xlat/v4l2_buf_flags_ts_src.in + create mode 100644 xlat/v4l2_buf_flags_ts_type.in + +Index: strace-5.1/v4l2.c +=================================================================== +--- strace-5.1.orig/v4l2.c 2020-01-29 12:41:14.883725929 +0100 ++++ strace-5.1/v4l2.c 2020-01-29 14:19:20.356865977 +0100 +@@ -385,6 +385,29 @@ + } + + #include "xlat/v4l2_buf_flags.h" ++#include "xlat/v4l2_buf_flags_ts_type.h" ++#include "xlat/v4l2_buf_flags_ts_src.h" ++ ++#define XLAT_MACROS_ONLY ++# include "xlat/v4l2_buf_flags_masks.h" ++#undef XLAT_MACROS_ONLY ++ ++static void ++print_v4l2_buffer_flags(uint32_t val) ++{ ++ const uint32_t ts_type = val & V4L2_BUF_FLAG_TIMESTAMP_MASK; ++ const uint32_t ts_src = val & V4L2_BUF_FLAG_TSTAMP_SRC_MASK; ++ const uint32_t flags = val & ~ts_type & ~ts_src; ++ ++ ++ printflags(v4l2_buf_flags, flags, "V4L2_BUF_FLAG_???"); ++ tprints("|"); ++ printxval(v4l2_buf_flags_ts_type, ts_type, ++ "V4L2_BUF_FLAG_TIMESTAMP_???"); ++ tprints("|"); ++ printxval(v4l2_buf_flags_ts_type, ts_src, ++ "V4L2_BUF_FLAG_TSTAMP_SRC_???"); ++} + + static int + print_v4l2_buffer(struct tcb *const tcp, const unsigned int code, +@@ -419,7 +442,7 @@ + + tprintf(", length=%u, bytesused=%u, flags=", + b.length, b.bytesused); +- printflags(v4l2_buf_flags, b.flags, "V4L2_BUF_FLAG_???"); ++ print_v4l2_buffer_flags(b.flags); + if (code == VIDIOC_DQBUF) { + tprints(", timestamp = "); + MPERS_FUNC_NAME(print_struct_timeval)(&b.timestamp); +Index: strace-5.1/xlat/v4l2_buf_flags.in +=================================================================== +--- strace-5.1.orig/xlat/v4l2_buf_flags.in 2017-04-07 03:21:36.000000000 +0200 ++++ strace-5.1/xlat/v4l2_buf_flags.in 2020-01-29 14:19:20.357865967 +0100 +@@ -1,19 +1,14 @@ +-V4L2_BUF_FLAG_MAPPED +-V4L2_BUF_FLAG_QUEUED +-V4L2_BUF_FLAG_DONE +-V4L2_BUF_FLAG_KEYFRAME +-V4L2_BUF_FLAG_PFRAME +-V4L2_BUF_FLAG_BFRAME +-V4L2_BUF_FLAG_TIMECODE +-V4L2_BUF_FLAG_INPUT +-V4L2_BUF_FLAG_PREPARED +-V4L2_BUF_FLAG_NO_CACHE_INVALIDATE +-V4L2_BUF_FLAG_NO_CACHE_CLEAN +-V4L2_BUF_FLAG_TIMESTAMP_MASK +-V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN +-V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC +-V4L2_BUF_FLAG_TIMESTAMP_COPY +-V4L2_BUF_FLAG_TSTAMP_SRC_MASK +-V4L2_BUF_FLAG_TSTAMP_SRC_EOF +-V4L2_BUF_FLAG_TSTAMP_SRC_SOE +-V4L2_BUF_FLAG_LAST ++V4L2_BUF_FLAG_MAPPED 0x00000001 ++V4L2_BUF_FLAG_QUEUED 0x00000002 ++V4L2_BUF_FLAG_DONE 0x00000004 ++V4L2_BUF_FLAG_KEYFRAME 0x00000008 ++V4L2_BUF_FLAG_PFRAME 0x00000010 ++V4L2_BUF_FLAG_BFRAME 0x00000020 ++V4L2_BUF_FLAG_ERROR 0x00000040 ++V4L2_BUF_FLAG_IN_REQUEST 0x00000080 ++V4L2_BUF_FLAG_TIMECODE 0x00000100 ++V4L2_BUF_FLAG_PREPARED 0x00000400 ++V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x00000800 ++V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x00001000 ++V4L2_BUF_FLAG_LAST 0x00100000 ++V4L2_BUF_FLAG_REQUEST_FD 0x00800000 +Index: strace-5.1/xlat/v4l2_buf_flags_masks.in +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-5.1/xlat/v4l2_buf_flags_masks.in 2020-01-29 14:19:20.358865958 +0100 +@@ -0,0 +1,2 @@ ++V4L2_BUF_FLAG_TIMESTAMP_MASK 0x0000e000 ++V4L2_BUF_FLAG_TSTAMP_SRC_MASK 0x00070000 +Index: strace-5.1/xlat/v4l2_buf_flags_ts_src.in +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-5.1/xlat/v4l2_buf_flags_ts_src.in 2020-01-29 14:19:20.358865958 +0100 +@@ -0,0 +1,3 @@ ++/* V4L2_BUF_FLAG_TSTAMP_SRC_MASK 0x00070000 */ ++V4L2_BUF_FLAG_TSTAMP_SRC_EOF 0x00000000 ++V4L2_BUF_FLAG_TSTAMP_SRC_SOE 0x00010000 +Index: strace-5.1/xlat/v4l2_buf_flags_ts_type.in +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-5.1/xlat/v4l2_buf_flags_ts_type.in 2020-01-29 14:19:20.358865958 +0100 +@@ -0,0 +1,4 @@ ++/* V4L2_BUF_FLAG_TIMESTAMP_MASK 0x0000e000 */ ++V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN 0x00000000 ++V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC 0x00002000 ++V4L2_BUF_FLAG_TIMESTAMP_COPY 0x00004000 +Index: strace-5.1/xlat/v4l2_buf_flags_masks.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-5.1/xlat/v4l2_buf_flags_masks.h 2020-01-29 14:20:25.816233898 +0100 +@@ -0,0 +1,40 @@ ++/* Generated by ./xlat/gen.sh from ./xlat/v4l2_buf_flags_masks.in; do not edit. */ ++ ++#include "gcc_compat.h" ++#include "static_assert.h" ++ ++#if defined(V4L2_BUF_FLAG_TIMESTAMP_MASK) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_MASK) && HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_MASK) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_FLAG_TIMESTAMP_MASK) == (0x0000e000), "V4L2_BUF_FLAG_TIMESTAMP_MASK != 0x0000e000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_FLAG_TIMESTAMP_MASK 0x0000e000 ++#endif ++#if defined(V4L2_BUF_FLAG_TSTAMP_SRC_MASK) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_MASK) && HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_MASK) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_FLAG_TSTAMP_SRC_MASK) == (0x00070000), "V4L2_BUF_FLAG_TSTAMP_SRC_MASK != 0x00070000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_FLAG_TSTAMP_SRC_MASK 0x00070000 ++#endif ++ ++#ifndef XLAT_MACROS_ONLY ++ ++# ifdef IN_MPERS ++ ++extern const struct xlat v4l2_buf_flags_masks[]; ++ ++# else ++ ++# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) ++static ++# endif ++const struct xlat v4l2_buf_flags_masks[] = { ++ XLAT(V4L2_BUF_FLAG_TIMESTAMP_MASK), ++ XLAT(V4L2_BUF_FLAG_TSTAMP_SRC_MASK), ++ XLAT_END ++}; ++ ++# endif /* !IN_MPERS */ ++ ++#endif /* !XLAT_MACROS_ONLY */ +Index: strace-5.1/xlat/v4l2_buf_flags_ts_src.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-5.1/xlat/v4l2_buf_flags_ts_src.h 2020-01-29 14:20:26.039231745 +0100 +@@ -0,0 +1,41 @@ ++/* Generated by ./xlat/gen.sh from ./xlat/v4l2_buf_flags_ts_src.in; do not edit. */ ++ ++#include "gcc_compat.h" ++#include "static_assert.h" ++ ++#if defined(V4L2_BUF_FLAG_TSTAMP_SRC_EOF) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_EOF) && HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_EOF) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_FLAG_TSTAMP_SRC_EOF) == (0x00000000), "V4L2_BUF_FLAG_TSTAMP_SRC_EOF != 0x00000000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_FLAG_TSTAMP_SRC_EOF 0x00000000 ++#endif ++#if defined(V4L2_BUF_FLAG_TSTAMP_SRC_SOE) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_SOE) && HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_SOE) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_FLAG_TSTAMP_SRC_SOE) == (0x00010000), "V4L2_BUF_FLAG_TSTAMP_SRC_SOE != 0x00010000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_FLAG_TSTAMP_SRC_SOE 0x00010000 ++#endif ++ ++#ifndef XLAT_MACROS_ONLY ++ ++# ifdef IN_MPERS ++ ++extern const struct xlat v4l2_buf_flags_ts_src[]; ++ ++# else ++ ++# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) ++static ++# endif ++const struct xlat v4l2_buf_flags_ts_src[] = { ++ ++ XLAT(V4L2_BUF_FLAG_TSTAMP_SRC_EOF), ++ XLAT(V4L2_BUF_FLAG_TSTAMP_SRC_SOE), ++ XLAT_END ++}; ++ ++# endif /* !IN_MPERS */ ++ ++#endif /* !XLAT_MACROS_ONLY */ +Index: strace-5.1/xlat/v4l2_buf_flags_ts_type.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-5.1/xlat/v4l2_buf_flags_ts_type.h 2020-01-29 14:20:26.244229766 +0100 +@@ -0,0 +1,49 @@ ++/* Generated by ./xlat/gen.sh from ./xlat/v4l2_buf_flags_ts_type.in; do not edit. */ ++ ++#include "gcc_compat.h" ++#include "static_assert.h" ++ ++#if defined(V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN) && HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN) == (0x00000000), "V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN != 0x00000000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN 0x00000000 ++#endif ++#if defined(V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC) && HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC) == (0x00002000), "V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC != 0x00002000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC 0x00002000 ++#endif ++#if defined(V4L2_BUF_FLAG_TIMESTAMP_COPY) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_COPY) && HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_COPY) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_FLAG_TIMESTAMP_COPY) == (0x00004000), "V4L2_BUF_FLAG_TIMESTAMP_COPY != 0x00004000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_FLAG_TIMESTAMP_COPY 0x00004000 ++#endif ++ ++#ifndef XLAT_MACROS_ONLY ++ ++# ifdef IN_MPERS ++ ++extern const struct xlat v4l2_buf_flags_ts_type[]; ++ ++# else ++ ++# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) ++static ++# endif ++const struct xlat v4l2_buf_flags_ts_type[] = { ++ ++ XLAT(V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN), ++ XLAT(V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC), ++ XLAT(V4L2_BUF_FLAG_TIMESTAMP_COPY), ++ XLAT_END ++}; ++ ++# endif /* !IN_MPERS */ ++ ++#endif /* !XLAT_MACROS_ONLY */ +Index: strace-5.1/xlat/v4l2_buf_flags.h +=================================================================== +--- strace-5.1.orig/xlat/v4l2_buf_flags.h 2019-05-22 15:08:31.000000000 +0200 ++++ strace-5.1/xlat/v4l2_buf_flags.h 2020-01-29 14:20:53.627965347 +0100 +@@ -3,76 +3,131 @@ + #include "gcc_compat.h" + #include "static_assert.h" + +- +-#ifndef XLAT_MACROS_ONLY +- +-# ifdef IN_MPERS +- +-extern const struct xlat v4l2_buf_flags[]; +- +-# else +- +-# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) +-static +-# endif +-const struct xlat v4l2_buf_flags[] = { + #if defined(V4L2_BUF_FLAG_MAPPED) || (defined(HAVE_DECL_V4L2_BUF_FLAG_MAPPED) && HAVE_DECL_V4L2_BUF_FLAG_MAPPED) +- XLAT(V4L2_BUF_FLAG_MAPPED), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_FLAG_MAPPED) == (0x00000001), "V4L2_BUF_FLAG_MAPPED != 0x00000001"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_FLAG_MAPPED 0x00000001 + #endif + #if defined(V4L2_BUF_FLAG_QUEUED) || (defined(HAVE_DECL_V4L2_BUF_FLAG_QUEUED) && HAVE_DECL_V4L2_BUF_FLAG_QUEUED) +- XLAT(V4L2_BUF_FLAG_QUEUED), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_FLAG_QUEUED) == (0x00000002), "V4L2_BUF_FLAG_QUEUED != 0x00000002"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_FLAG_QUEUED 0x00000002 + #endif + #if defined(V4L2_BUF_FLAG_DONE) || (defined(HAVE_DECL_V4L2_BUF_FLAG_DONE) && HAVE_DECL_V4L2_BUF_FLAG_DONE) +- XLAT(V4L2_BUF_FLAG_DONE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_FLAG_DONE) == (0x00000004), "V4L2_BUF_FLAG_DONE != 0x00000004"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_FLAG_DONE 0x00000004 + #endif + #if defined(V4L2_BUF_FLAG_KEYFRAME) || (defined(HAVE_DECL_V4L2_BUF_FLAG_KEYFRAME) && HAVE_DECL_V4L2_BUF_FLAG_KEYFRAME) +- XLAT(V4L2_BUF_FLAG_KEYFRAME), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_FLAG_KEYFRAME) == (0x00000008), "V4L2_BUF_FLAG_KEYFRAME != 0x00000008"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_FLAG_KEYFRAME 0x00000008 + #endif + #if defined(V4L2_BUF_FLAG_PFRAME) || (defined(HAVE_DECL_V4L2_BUF_FLAG_PFRAME) && HAVE_DECL_V4L2_BUF_FLAG_PFRAME) +- XLAT(V4L2_BUF_FLAG_PFRAME), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_FLAG_PFRAME) == (0x00000010), "V4L2_BUF_FLAG_PFRAME != 0x00000010"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_FLAG_PFRAME 0x00000010 + #endif + #if defined(V4L2_BUF_FLAG_BFRAME) || (defined(HAVE_DECL_V4L2_BUF_FLAG_BFRAME) && HAVE_DECL_V4L2_BUF_FLAG_BFRAME) +- XLAT(V4L2_BUF_FLAG_BFRAME), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_FLAG_BFRAME) == (0x00000020), "V4L2_BUF_FLAG_BFRAME != 0x00000020"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_FLAG_BFRAME 0x00000020 ++#endif ++#if defined(V4L2_BUF_FLAG_ERROR) || (defined(HAVE_DECL_V4L2_BUF_FLAG_ERROR) && HAVE_DECL_V4L2_BUF_FLAG_ERROR) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_FLAG_ERROR) == (0x00000040), "V4L2_BUF_FLAG_ERROR != 0x00000040"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_FLAG_ERROR 0x00000040 ++#endif ++#if defined(V4L2_BUF_FLAG_IN_REQUEST) || (defined(HAVE_DECL_V4L2_BUF_FLAG_IN_REQUEST) && HAVE_DECL_V4L2_BUF_FLAG_IN_REQUEST) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_FLAG_IN_REQUEST) == (0x00000080), "V4L2_BUF_FLAG_IN_REQUEST != 0x00000080"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_FLAG_IN_REQUEST 0x00000080 + #endif + #if defined(V4L2_BUF_FLAG_TIMECODE) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TIMECODE) && HAVE_DECL_V4L2_BUF_FLAG_TIMECODE) +- XLAT(V4L2_BUF_FLAG_TIMECODE), +-#endif +-#if defined(V4L2_BUF_FLAG_INPUT) || (defined(HAVE_DECL_V4L2_BUF_FLAG_INPUT) && HAVE_DECL_V4L2_BUF_FLAG_INPUT) +- XLAT(V4L2_BUF_FLAG_INPUT), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_FLAG_TIMECODE) == (0x00000100), "V4L2_BUF_FLAG_TIMECODE != 0x00000100"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_FLAG_TIMECODE 0x00000100 + #endif + #if defined(V4L2_BUF_FLAG_PREPARED) || (defined(HAVE_DECL_V4L2_BUF_FLAG_PREPARED) && HAVE_DECL_V4L2_BUF_FLAG_PREPARED) +- XLAT(V4L2_BUF_FLAG_PREPARED), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_FLAG_PREPARED) == (0x00000400), "V4L2_BUF_FLAG_PREPARED != 0x00000400"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_FLAG_PREPARED 0x00000400 + #endif + #if defined(V4L2_BUF_FLAG_NO_CACHE_INVALIDATE) || (defined(HAVE_DECL_V4L2_BUF_FLAG_NO_CACHE_INVALIDATE) && HAVE_DECL_V4L2_BUF_FLAG_NO_CACHE_INVALIDATE) +- XLAT(V4L2_BUF_FLAG_NO_CACHE_INVALIDATE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_FLAG_NO_CACHE_INVALIDATE) == (0x00000800), "V4L2_BUF_FLAG_NO_CACHE_INVALIDATE != 0x00000800"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x00000800 + #endif + #if defined(V4L2_BUF_FLAG_NO_CACHE_CLEAN) || (defined(HAVE_DECL_V4L2_BUF_FLAG_NO_CACHE_CLEAN) && HAVE_DECL_V4L2_BUF_FLAG_NO_CACHE_CLEAN) +- XLAT(V4L2_BUF_FLAG_NO_CACHE_CLEAN), +-#endif +-#if defined(V4L2_BUF_FLAG_TIMESTAMP_MASK) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_MASK) && HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_MASK) +- XLAT(V4L2_BUF_FLAG_TIMESTAMP_MASK), +-#endif +-#if defined(V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN) && HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN) +- XLAT(V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN), +-#endif +-#if defined(V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC) && HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC) +- XLAT(V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC), +-#endif +-#if defined(V4L2_BUF_FLAG_TIMESTAMP_COPY) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_COPY) && HAVE_DECL_V4L2_BUF_FLAG_TIMESTAMP_COPY) +- XLAT(V4L2_BUF_FLAG_TIMESTAMP_COPY), +-#endif +-#if defined(V4L2_BUF_FLAG_TSTAMP_SRC_MASK) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_MASK) && HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_MASK) +- XLAT(V4L2_BUF_FLAG_TSTAMP_SRC_MASK), +-#endif +-#if defined(V4L2_BUF_FLAG_TSTAMP_SRC_EOF) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_EOF) && HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_EOF) +- XLAT(V4L2_BUF_FLAG_TSTAMP_SRC_EOF), +-#endif +-#if defined(V4L2_BUF_FLAG_TSTAMP_SRC_SOE) || (defined(HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_SOE) && HAVE_DECL_V4L2_BUF_FLAG_TSTAMP_SRC_SOE) +- XLAT(V4L2_BUF_FLAG_TSTAMP_SRC_SOE), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_FLAG_NO_CACHE_CLEAN) == (0x00001000), "V4L2_BUF_FLAG_NO_CACHE_CLEAN != 0x00001000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x00001000 + #endif + #if defined(V4L2_BUF_FLAG_LAST) || (defined(HAVE_DECL_V4L2_BUF_FLAG_LAST) && HAVE_DECL_V4L2_BUF_FLAG_LAST) +- XLAT(V4L2_BUF_FLAG_LAST), ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_FLAG_LAST) == (0x00100000), "V4L2_BUF_FLAG_LAST != 0x00100000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_FLAG_LAST 0x00100000 ++#endif ++#if defined(V4L2_BUF_FLAG_REQUEST_FD) || (defined(HAVE_DECL_V4L2_BUF_FLAG_REQUEST_FD) && HAVE_DECL_V4L2_BUF_FLAG_REQUEST_FD) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_BUF_FLAG_REQUEST_FD) == (0x00800000), "V4L2_BUF_FLAG_REQUEST_FD != 0x00800000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_BUF_FLAG_REQUEST_FD 0x00800000 + #endif ++ ++#ifndef XLAT_MACROS_ONLY ++ ++# ifdef IN_MPERS ++ ++extern const struct xlat v4l2_buf_flags[]; ++ ++# else ++ ++# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) ++static ++# endif ++const struct xlat v4l2_buf_flags[] = { ++ XLAT(V4L2_BUF_FLAG_MAPPED), ++ XLAT(V4L2_BUF_FLAG_QUEUED), ++ XLAT(V4L2_BUF_FLAG_DONE), ++ XLAT(V4L2_BUF_FLAG_KEYFRAME), ++ XLAT(V4L2_BUF_FLAG_PFRAME), ++ XLAT(V4L2_BUF_FLAG_BFRAME), ++ XLAT(V4L2_BUF_FLAG_ERROR), ++ XLAT(V4L2_BUF_FLAG_IN_REQUEST), ++ XLAT(V4L2_BUF_FLAG_TIMECODE), ++ XLAT(V4L2_BUF_FLAG_PREPARED), ++ XLAT(V4L2_BUF_FLAG_NO_CACHE_INVALIDATE), ++ XLAT(V4L2_BUF_FLAG_NO_CACHE_CLEAN), ++ XLAT(V4L2_BUF_FLAG_LAST), ++ XLAT(V4L2_BUF_FLAG_REQUEST_FD), + XLAT_END + }; + diff --git a/SOURCES/0079-v4l2-add-shorthand-macros-for-v4l2-type-checks.patch b/SOURCES/0079-v4l2-add-shorthand-macros-for-v4l2-type-checks.patch new file mode 100644 index 0000000..114cb37 --- /dev/null +++ b/SOURCES/0079-v4l2-add-shorthand-macros-for-v4l2-type-checks.patch @@ -0,0 +1,45 @@ +From f7860e788d1ae58f35f72d3de8ad9f6d684de71b Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Fri, 1 Nov 2019 02:18:31 +0100 +Subject: [PATCH 78/82] v4l2: add shorthand macros for v4l2 type checks + +Some wrappers for common static_assert checks. + +* v4l2.c (CHECK_V4L2_STRUCT_SIZE, CHECK_V4L2_RESERVED_SIZE. +CHECK_V4L2_STRUCT_RESERVED_SIZE): New macros. +--- + v4l2.c | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/v4l2.c b/v4l2.c +index 1e01fa6..b45f7f8 100644 +--- a/v4l2.c ++++ b/v4l2.c +@@ -15,6 +15,24 @@ + #include + #include + ++#include "static_assert.h" ++ ++#define CHECK_V4L2_STRUCT_SIZE(s_) \ ++ static_assert(sizeof(struct s_) == sizeof(struct_##s_), \ ++ "Unexpected struct " #s_ " size") ++#define CHECK_V4L2_STRUCT_SIZE_LE(s_) \ ++ static_assert(sizeof(struct s_) <= sizeof(struct_##s_), \ ++ "Unexpected struct " #s_ " size, " \ ++ "please update the decoder") ++#define CHECK_V4L2_RESERVED_SIZE(s_) \ ++ static_assert(sizeof_field(struct s_, reserved) \ ++ >= sizeof_field(struct_##s_, reserved), \ ++ "Unexpected struct " #s_ ".reserved size, " \ ++ "please update the decoder") ++#define CHECK_V4L2_STRUCT_RESERVED_SIZE(s_) \ ++ CHECK_V4L2_STRUCT_SIZE(s_); \ ++ CHECK_V4L2_RESERVED_SIZE(s_) ++ + #include DEF_MPERS_TYPE(struct_v4l2_buffer) + #include DEF_MPERS_TYPE(struct_v4l2_clip) + #ifdef VIDIOC_CREATE_BUFS +-- +2.1.4 + diff --git a/SOURCES/0080-v4l2-bundle-struct-v4l2_create_buffers-definition.patch b/SOURCES/0080-v4l2-bundle-struct-v4l2_create_buffers-definition.patch new file mode 100644 index 0000000..bbef2e2 --- /dev/null +++ b/SOURCES/0080-v4l2-bundle-struct-v4l2_create_buffers-definition.patch @@ -0,0 +1,106 @@ +From 99067b14797a6877c3a98017c56e60c239930919 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Fri, 1 Nov 2019 02:00:53 +0100 +Subject: [PATCH 80/86] v4l2: bundle struct v4l2_create_buffers definition + +* configure.ac (AC_CHECK_TYPES): Add a check for +struct v4l2_create_buffers definition. +* v4l2.c (DEF_MPERS_TYPE(struct_v4l2_create_buffers)): Remove +VIDIOC_CREATE_BUFS guard. +(struct_v4l2_create_buffers): typedef to a structure definition and not +struct v4l2_create_buffers. +[HAVE_STRUCT_V4L2_CREATE_BUFFERS]: Check struct v4l2_create_buffers +with CHECK_V4L2_STRUCT_RESERVED_SIZE. +--- + configure.ac | 7 +++++++ + v4l2.c | 25 ++++++++++++++++--------- + 2 files changed, 23 insertions(+), 9 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 63f57f9..e47ba38 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -774,6 +774,13 @@ AC_CHECK_DECLS(m4_normalize([ + #include + #include ]) + ++AC_CHECK_TYPES(m4_normalize([ ++ struct v4l2_create_buffers ++]),,, [#include ++#include ++#include ++#include ]) ++ + AC_CHECK_MEMBERS(m4_normalize([ + struct v4l2_capability.device_caps, + struct v4l2_ext_control.string, +diff --git a/v4l2.c b/v4l2.c +index b45f7f8..561aee2 100644 +--- a/v4l2.c ++++ b/v4l2.c +@@ -35,9 +35,7 @@ + + #include DEF_MPERS_TYPE(struct_v4l2_buffer) + #include DEF_MPERS_TYPE(struct_v4l2_clip) +-#ifdef VIDIOC_CREATE_BUFS +-# include DEF_MPERS_TYPE(struct_v4l2_create_buffers) +-#endif ++#include DEF_MPERS_TYPE(struct_v4l2_create_buffers) + #include DEF_MPERS_TYPE(struct_v4l2_ext_control) + #include DEF_MPERS_TYPE(struct_v4l2_ext_controls) + #include DEF_MPERS_TYPE(struct_v4l2_format) +@@ -47,9 +45,22 @@ + + typedef struct v4l2_buffer struct_v4l2_buffer; + typedef struct v4l2_clip struct_v4l2_clip; +-#ifdef VIDIOC_CREATE_BUFS +-typedef struct v4l2_create_buffers struct_v4l2_create_buffers; ++ ++typedef struct { ++ uint32_t index; ++ uint32_t count; ++ uint32_t memory; ++ struct_v4l2_format format; ++ /** V4L2_BUF_CAP_SUPPORTS_*, added by Linux commit v4.20-rc1~51^2~14 */ ++ uint32_t capabilities; ++ uint32_t reserved[7]; ++} struct_v4l2_create_buffers; ++ ++#ifdef HAVE_STRUCT_V4L2_CREATE_BUFFERS ++CHECK_V4L2_STRUCT_RESERVED_SIZE(v4l2_create_buffers); + #endif ++ ++ + typedef struct v4l2_ext_control struct_v4l2_ext_control; + typedef struct v4l2_ext_controls struct_v4l2_ext_controls; + typedef struct v4l2_format struct_v4l2_format; +@@ -967,7 +978,6 @@ print_v4l2_frmivalenum(struct tcb *const tcp, const kernel_ulong_t arg) + } + #endif /* VIDIOC_ENUM_FRAMEINTERVALS */ + +-#ifdef VIDIOC_CREATE_BUFS + static int + print_v4l2_create_buffers(struct tcb *const tcp, const kernel_ulong_t arg) + { +@@ -999,7 +1009,6 @@ print_v4l2_create_buffers(struct tcb *const tcp, const kernel_ulong_t arg) + + return RVAL_IOCTL_DECODED | RVAL_STR; + } +-#endif /* VIDIOC_CREATE_BUFS */ + + MPERS_PRINTER_DECL(int, v4l2_ioctl, struct tcb *const tcp, + const unsigned int code, const kernel_ulong_t arg) +@@ -1102,10 +1111,8 @@ MPERS_PRINTER_DECL(int, v4l2_ioctl, struct tcb *const tcp, + return print_v4l2_frmivalenum(tcp, arg); + #endif /* VIDIOC_ENUM_FRAMEINTERVALS */ + +-#ifdef VIDIOC_CREATE_BUFS + case VIDIOC_CREATE_BUFS: /* RW */ + return print_v4l2_create_buffers(tcp, arg); +-#endif /* VIDIOC_CREATE_BUFS */ + + default: + return RVAL_DECODED; +-- +2.1.4 + diff --git a/SOURCES/0081-v4l2-provide-struct-v4l2_capability-definition.patch b/SOURCES/0081-v4l2-provide-struct-v4l2_capability-definition.patch new file mode 100644 index 0000000..4f912bd --- /dev/null +++ b/SOURCES/0081-v4l2-provide-struct-v4l2_capability-definition.patch @@ -0,0 +1,68 @@ +From c04dd1ccf463ccd56ea1273e137206d2988d4acb Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Fri, 1 Nov 2019 02:09:03 +0100 +Subject: [PATCH 80/82] v4l2: provide struct v4l2_capability definition + +* v4l2.c (struct_v4l2_capability): New typedef. +[HAVE_STRUCT_V4L2_CAPABILITY]: Check struct v4l2_capability +with CHECK_V4L2_STRUCT_RESERVED_SIZE. +(print_v4l2_capability): Change type of caps variable +to struct_v4l2_capability; drop HAVE_STRUCT_V4L2_CAPABILITY_DEVICE_CAPS +guarg; print device_caps field only if it's non-zero. +--- + v4l2.c | 25 +++++++++++++++++++------ + 1 file changed, 19 insertions(+), 6 deletions(-) + +diff --git a/v4l2.c b/v4l2.c +index 85c667d..292ebae 100644 +--- a/v4l2.c ++++ b/v4l2.c +@@ -46,6 +46,19 @@ + typedef struct v4l2_buffer struct_v4l2_buffer; + typedef struct v4l2_clip struct_v4l2_clip; + ++ ++typedef struct { ++ uint8_t driver[16]; ++ uint8_t card[32]; ++ uint8_t bus_info[32]; ++ uint32_t version; ++ uint32_t capabilities; ++ uint32_t device_caps; /**< Added by v3.4-rc1~110^2^2~259 */ ++ uint32_t reserved[3]; ++} struct_v4l2_capability; ++CHECK_V4L2_STRUCT_RESERVED_SIZE(v4l2_capability); ++ ++ + typedef struct { + uint32_t index; + uint32_t count; +@@ -146,7 +159,7 @@ print_pixelformat(uint32_t fourcc, const struct xlat *xlat) + static int + print_v4l2_capability(struct tcb *const tcp, const kernel_ulong_t arg) + { +- struct v4l2_capability caps; ++ struct_v4l2_capability caps; + + if (entering(tcp)) + return 0; +@@ -162,11 +175,11 @@ print_v4l2_capability(struct tcb *const tcp, const kernel_ulong_t arg) + caps.version & 0xFF); + printflags(v4l2_device_capabilities_flags, caps.capabilities, + "V4L2_CAP_???"); +-#ifdef HAVE_STRUCT_V4L2_CAPABILITY_DEVICE_CAPS +- tprints(", device_caps="); +- printflags(v4l2_device_capabilities_flags, caps.device_caps, +- "V4L2_CAP_???"); +-#endif ++ if (caps.device_caps) { ++ tprints(", device_caps="); ++ printflags(v4l2_device_capabilities_flags, caps.device_caps, ++ "V4L2_CAP_???"); ++ } + tprints("}"); + return RVAL_IOCTL_DECODED; + } +-- +2.1.4 + diff --git a/SOURCES/0082-v4l2-bundle-struct-v4l2_format-and-related-types.patch b/SOURCES/0082-v4l2-bundle-struct-v4l2_format-and-related-types.patch new file mode 100644 index 0000000..23a9e01 --- /dev/null +++ b/SOURCES/0082-v4l2-bundle-struct-v4l2_format-and-related-types.patch @@ -0,0 +1,315 @@ +From 5eb20ba1d23117ad46ffb2ecb822ba5b8c8b524c Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Fri, 1 Nov 2019 02:35:21 +0100 +Subject: [PATCH] v4l2: bundle struct v4l2_format and related types + +* configure.ac (AC_CHECK_TYPES): Check for struct v4l2_meta_format, +struct v4l2_pix_format_mplane, struct v4l2_plane_pix_format, +and struct v4l2_sdr_format. +* v4l2.c (struct_v4l2_clip, struct_v4l2_format): Typedef to an anonymous +type definition. +(struct_v4l2_pix_format, struct_v4l2_plane_pix_format, +struct_v4l2_pix_format_mplane, struct_v4l2_window, +struct_v4l2_vbi_format, struct_v4l2_sliced_vbi_format, +struct_v4l2_sliced_vbi_cap, struct_v4l2_sdr_format, +struct_v4l2_meta_format): New typedefs. +(print_v4l2_format_fmt): Remove guard macros, decode +fmt.win.global_alpha and fmt.sdr.buffersize only when they are non-zero. +--- + configure.ac | 6 +- + tests/ioctl_v4l2.c | 2 +- + v4l2.c | 167 ++++++++++++++++++++++++++++++++++++++++++++++++----- + 3 files changed, 158 insertions(+), 17 deletions(-) + +Index: strace-5.1/configure.ac +=================================================================== +--- strace-5.1.orig/configure.ac 2020-01-29 21:42:47.753314395 +0100 ++++ strace-5.1/configure.ac 2020-01-29 21:43:02.012183510 +0100 +@@ -778,7 +778,11 @@ + #include ]) + + AC_CHECK_TYPES(m4_normalize([ +- struct v4l2_create_buffers ++ struct v4l2_create_buffers, ++ struct v4l2_meta_format, ++ struct v4l2_pix_format_mplane, ++ struct v4l2_plane_pix_format, ++ struct v4l2_sdr_format + ]),,, [#include + #include + #include +Index: strace-5.1/tests/ioctl_v4l2.c +=================================================================== +--- strace-5.1.orig/tests/ioctl_v4l2.c 2020-01-29 21:42:45.139338389 +0100 ++++ strace-5.1/tests/ioctl_v4l2.c 2020-01-29 21:43:02.013183500 +0100 +@@ -216,7 +216,7 @@ + printf(", "); + printf("{sizeimage=%u, bytesperline=%u}", + f->fmt.pix_mp.plane_fmt[i].sizeimage, +- f->fmt.pix_mp.plane_fmt[i].bytesperline); ++ *((unsigned *) &(f->fmt.pix_mp.plane_fmt[i].bytesperline))); + } + errno = saved_errno; + printf("], num_planes=%u}}) = -1 EBADF (%m)\n", +Index: strace-5.1/v4l2.c +=================================================================== +--- strace-5.1.orig/v4l2.c 2020-01-29 21:42:47.753314395 +0100 ++++ strace-5.1/v4l2.c 2020-01-29 21:43:02.014183491 +0100 +@@ -44,7 +44,6 @@ + #include DEF_MPERS_TYPE(struct_v4l2_standard) + + typedef struct v4l2_buffer struct_v4l2_buffer; +-typedef struct v4l2_clip struct_v4l2_clip; + + + typedef struct { +@@ -60,6 +59,153 @@ + + + typedef struct { ++ uint32_t width; ++ uint32_t height; ++ uint32_t pixelformat; ++ uint32_t field; ++ uint32_t bytesperline; ++ uint32_t sizeimage; ++ uint32_t colorspace; /**< enum v4l2_colorspace */ ++ uint32_t priv; ++ /** Format flags (V4L2_PIX_FMT_FLAG_*), added by v3.17-rc1~112^2~326 */ ++ uint32_t flags; ++ union { ++ /** enum v4l2_ycbcr_encoding, added by v3.19-rc1~29^2~72 */ ++ uint32_t ycbcr_enc; ++ /** enum v4l2_hsv_encoding, added by v4.10-rc1~71^2^2~352 */ ++ uint32_t hsv_enc; ++ }; ++ /** enum v4l2_quantization, added by v3.19-rc1~29^2~72 */ ++ uint32_t quantization; ++ /** enum v4l2_xfer_func, added by Linux commit v4.2-rc1~107^2~136 */ ++ uint32_t xfer_func; ++} struct_v4l2_pix_format; ++CHECK_V4L2_STRUCT_SIZE_LE(v4l2_pix_format); ++ ++/** Added by Linux commit v2.6.39-rc1~86^2~437 */ ++typedef struct { ++ uint32_t sizeimage; ++ uint32_t bytesperline; /**< Type has changed in v4.1-rc1~59^2~1^2~88 */ ++ uint16_t reserved[6]; ++} struct_v4l2_plane_pix_format; ++#ifdef HAVE_STRUCT_V4L2_PLANE_PIX_FORMAT ++CHECK_V4L2_STRUCT_RESERVED_SIZE(v4l2_plane_pix_format); ++#endif ++ ++/** Added by Linux commit v2.6.39-rc1~86^2~437 */ ++typedef struct { ++ uint32_t width; ++ uint32_t height; ++ uint32_t pixelformat; ++ uint32_t field; ++ uint32_t colorspace; ++ ++ struct_v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES]; ++ uint8_t num_planes; ++ /** Format flags (V4L2_PIX_FMT_FLAG_*), added by v3.17-rc1~112^2~326 */ ++ uint8_t flags; ++ union { ++ /** enum v4l2_ycbcr_encoding, added by v3.19-rc1~29^2~72 */ ++ uint8_t ycbcr_enc; ++ /** enum v4l2_hsv_encoding, added by v4.10-rc1~71^2^2~352 */ ++ uint8_t hsv_enc; ++ }; ++ /** enum v4l2_quantization, added by v3.19-rc1~29^2~72 */ ++ uint8_t quantization; ++ /** enum v4l2_xfer_func, added by Linux commit v4.2-rc1~107^2~136 */ ++ uint8_t xfer_func; ++ uint8_t reserved[7]; ++} ATTRIBUTE_PACKED struct_v4l2_pix_format_mplane; ++#ifdef HAVE_STRUCT_V4L2_PIX_FORMAT_MPLANE ++CHECK_V4L2_STRUCT_RESERVED_SIZE(v4l2_pix_format_mplane); ++#endif ++ ++typedef struct strace_v4l2_clip { ++ struct v4l2_rect c; ++ struct strace_v4l2_clip *next; ++} struct_v4l2_clip; ++CHECK_V4L2_STRUCT_SIZE(v4l2_clip); ++ ++typedef struct { ++ struct v4l2_rect w; ++ uint32_t field; /* enum v4l2_field */ ++ uint32_t chromakey; ++ struct_v4l2_clip *clips; ++ uint32_t clipcount; ++ void *bitmap; ++ uint8_t global_alpha; /**< Added by v2.6.22-rc1~1118^2~179 */ ++} struct_v4l2_window; ++CHECK_V4L2_STRUCT_SIZE_LE(v4l2_window); ++ ++typedef struct { ++ uint32_t sampling_rate; ++ uint32_t offset; ++ uint32_t samples_per_line; ++ uint32_t sample_format; /* V4L2_PIX_FMT_* */ ++ int32_t start[2]; ++ uint32_t count[2]; ++ uint32_t flags; /* V4L2_VBI_* */ ++ uint32_t reserved[2]; ++} struct_v4l2_vbi_format; ++CHECK_V4L2_STRUCT_RESERVED_SIZE(v4l2_vbi_format); ++ ++/** Added by Linux commit v2.6.16.28-rc1~3732 */ ++typedef struct { ++ uint16_t service_set; ++ uint16_t service_lines[2][24]; ++ uint32_t io_size; ++ uint32_t reserved[2]; ++} struct_v4l2_sliced_vbi_format; ++CHECK_V4L2_STRUCT_RESERVED_SIZE(v4l2_sliced_vbi_format); ++ ++typedef struct { ++ uint16_t service_set; ++ uint16_t service_lines[2][24]; ++ uint32_t type; /**< enum v4l2_buf_type, added by v2.6.19-rc1~643^2~52 */ ++ uint32_t reserved[3]; ++} struct_v4l2_sliced_vbi_cap; ++CHECK_V4L2_STRUCT_RESERVED_SIZE(v4l2_sliced_vbi_cap); ++ ++/** Added by Linux commits v3.15-rc1~85^2~213, v3.15-rc1~85^2~41 */ ++typedef struct { ++ uint32_t pixelformat; ++ uint32_t buffersize; /**< Added by Linux commit v3.17-rc1~112^2~230 */ ++ uint8_t reserved[24]; ++} ATTRIBUTE_PACKED struct_v4l2_sdr_format; ++#ifdef HAVE_STRUCT_V4L2_SDR_FORMAT ++CHECK_V4L2_STRUCT_RESERVED_SIZE(v4l2_sdr_format); ++#endif ++ ++/** Added by Linux commit v4.12-rc1~85^2~71 */ ++typedef struct { ++ uint32_t dataformat; ++ uint32_t buffersize; ++} ATTRIBUTE_PACKED struct_v4l2_meta_format; ++#ifdef HAVE_STRUCT_V4L2_META_FORMAT ++CHECK_V4L2_STRUCT_SIZE(v4l2_meta_format); ++#endif ++ ++typedef struct { ++ uint32_t type; ++ union { ++ struct_v4l2_pix_format pix; ++ /** Added by Linux commit v2.6.39-rc1~86^2~437 */ ++ struct_v4l2_pix_format_mplane pix_mp; ++ struct_v4l2_window win; ++ struct_v4l2_vbi_format vbi; ++ /** Added by Linux commit v2.6.16.28-rc1~3732 */ ++ struct_v4l2_sliced_vbi_format sliced; ++ /** Added by v3.15-rc1~85^2~213, v3.15-rc1~85^2~41 */ ++ struct_v4l2_sdr_format sdr; ++ /** Added by Linux commit v4.12-rc1~85^2~71 */ ++ struct_v4l2_meta_format meta; ++ uint8_t raw_data[200]; ++ } fmt; ++} struct_v4l2_format; ++CHECK_V4L2_STRUCT_SIZE(v4l2_format); ++ ++ ++typedef struct { + uint32_t index; + uint32_t count; + uint32_t memory; +@@ -76,7 +222,6 @@ + + typedef struct v4l2_ext_control struct_v4l2_ext_control; + typedef struct v4l2_ext_controls struct_v4l2_ext_controls; +-typedef struct v4l2_format struct_v4l2_format; + typedef struct v4l2_framebuffer struct_v4l2_framebuffer; + typedef struct v4l2_input struct_v4l2_input; + typedef struct v4l2_standard struct_v4l2_standard; +@@ -246,7 +391,6 @@ + "V4L2_COLORSPACE_???"); + tprints("}"); + break; +-#if HAVE_STRUCT_V4L2_FORMAT_FMT_PIX_MP + case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: + case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: { + unsigned int i, max; +@@ -275,7 +419,6 @@ + (unsigned) f->fmt.pix_mp.num_planes); + break; + } +-#endif + /* OUTPUT_OVERLAY since Linux v2.6.22-rc1~1118^2~179 */ + case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: + case V4L2_BUF_TYPE_VIDEO_OVERLAY: { +@@ -290,9 +433,8 @@ + tfetch_mem, print_v4l2_clip, 0); + tprintf(", clipcount=%u, bitmap=", f->fmt.win.clipcount); + printaddr(ptr_to_kulong(f->fmt.win.bitmap)); +-#ifdef HAVE_STRUCT_V4L2_WINDOW_GLOBAL_ALPHA +- tprintf(", global_alpha=%#x", f->fmt.win.global_alpha); +-#endif ++ if (f->fmt.win.global_alpha) ++ tprintf(", global_alpha=%#x", f->fmt.win.global_alpha); + tprints("}"); + break; + } +@@ -312,7 +454,6 @@ + tprints("}"); + break; + /* both since Linux v2.6.14-rc2~64 */ +-#if HAVE_STRUCT_V4L2_FORMAT_FMT_SLICED + case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: + case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: { + unsigned int i, j; +@@ -340,8 +481,6 @@ + tprints("]}"); + break; + } +-#endif +-#if HAVE_STRUCT_V4L2_FORMAT_FMT_SDR + /* since Linux v4.4-rc1~118^2~14 */ + case V4L2_BUF_TYPE_SDR_OUTPUT: + /* since Linux v3.15-rc1~85^2~213 */ +@@ -349,13 +488,11 @@ + tprints(prefix); + tprints("fmt.sdr={pixelformat="); + print_pixelformat(f->fmt.sdr.pixelformat, v4l2_sdr_fmts); +-# ifdef HAVE_STRUCT_V4L2_SDR_FORMAT_BUFFERSIZE +- tprintf(", buffersize=%u", +- f->fmt.sdr.buffersize); +-# endif ++ if (f->fmt.sdr.buffersize) ++ tprintf(", buffersize=%u", ++ f->fmt.sdr.buffersize); + tprints("}"); + break; +-#endif + } + return ret; + } +Index: strace-5.1/tests-m32/ioctl_v4l2.c +=================================================================== +--- strace-5.1.orig/tests-m32/ioctl_v4l2.c 2020-01-29 21:42:45.139338389 +0100 ++++ strace-5.1/tests-m32/ioctl_v4l2.c 2020-01-29 21:43:19.544022581 +0100 +@@ -216,7 +216,7 @@ + printf(", "); + printf("{sizeimage=%u, bytesperline=%u}", + f->fmt.pix_mp.plane_fmt[i].sizeimage, +- f->fmt.pix_mp.plane_fmt[i].bytesperline); ++ *((unsigned *) &(f->fmt.pix_mp.plane_fmt[i].bytesperline))); + } + errno = saved_errno; + printf("], num_planes=%u}}) = -1 EBADF (%m)\n", +Index: strace-5.1/tests-mx32/ioctl_v4l2.c +=================================================================== +--- strace-5.1.orig/tests-mx32/ioctl_v4l2.c 2020-01-29 21:42:45.139338389 +0100 ++++ strace-5.1/tests-mx32/ioctl_v4l2.c 2020-01-29 21:43:19.546022563 +0100 +@@ -216,7 +216,7 @@ + printf(", "); + printf("{sizeimage=%u, bytesperline=%u}", + f->fmt.pix_mp.plane_fmt[i].sizeimage, +- f->fmt.pix_mp.plane_fmt[i].bytesperline); ++ *((unsigned *) &(f->fmt.pix_mp.plane_fmt[i].bytesperline))); + } + errno = saved_errno; + printf("], num_planes=%u}}) = -1 EBADF (%m)\n", diff --git a/SOURCES/0083-v4l2-decode-v4l2_vbi_flags-as-flags.patch b/SOURCES/0083-v4l2-decode-v4l2_vbi_flags-as-flags.patch new file mode 100644 index 0000000..20ee070 --- /dev/null +++ b/SOURCES/0083-v4l2-decode-v4l2_vbi_flags-as-flags.patch @@ -0,0 +1,27 @@ +From d7d26d2ce96cf3b76063fab9b3e573f1474e85d2 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Fri, 1 Nov 2019 02:40:20 +0100 +Subject: [PATCH 82/82] v4l2: decode v4l2_vbi_flags as flags + +* v4l2.c (print_v4l2_format_fmt): Use printflags instead of printxval +for fmt.vbi.flags field decoding. +--- + v4l2.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/v4l2.c b/v4l2.c +index 6cb85e6..45d6e64 100644 +--- a/v4l2.c ++++ b/v4l2.c +@@ -450,7 +450,7 @@ print_v4l2_format_fmt(struct tcb *const tcp, const char *prefix, + f->fmt.vbi.start[0], f->fmt.vbi.start[1], + f->fmt.vbi.count[0], f->fmt.vbi.count[1]); + tprints("flags="); +- printxval(v4l2_vbi_flags, f->fmt.vbi.flags, "V4L2_VBI_???"); ++ printflags(v4l2_vbi_flags, f->fmt.vbi.flags, "V4L2_VBI_???"); + tprints("}"); + break; + /* both since Linux v2.6.14-rc2~64 */ +-- +2.1.4 + diff --git a/SOURCES/0084-v4l2-always-decode-VIDIOC_-_EXT_CTRLS-ioctl-commands.patch b/SOURCES/0084-v4l2-always-decode-VIDIOC_-_EXT_CTRLS-ioctl-commands.patch new file mode 100644 index 0000000..6d8c6f4 --- /dev/null +++ b/SOURCES/0084-v4l2-always-decode-VIDIOC_-_EXT_CTRLS-ioctl-commands.patch @@ -0,0 +1,118 @@ +From b6276ef70616c326b02c6798b9e3824b42c2f83b Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Wed, 29 Jan 2020 17:27:42 +0100 +Subject: [PATCH 84/86] v4l2: always decode VIDIOC_*_EXT_CTRLS ioctl commands + +* v4l2.c (struct_v4l2_area, struct_v4l2_ext_control, +struct_v4l2_ext_controls): New type definitions. +(print_v4l2_ext_control, print_v4l2_ext_controls): Do not guard with +VIDIOC_S_EXT_CTRLS anymore. +(v4l2_ioctl) : Likewise. +(print_v4l2_ext_control): Do not guard size and string field printing +with HAVE_STRUCT_V4L2_EXT_CONTROL_STRING. +--- + v4l2.c | 50 ++++++++++++++++++++++++++++++++++++++++---------- + 1 file changed, 40 insertions(+), 10 deletions(-) + +diff --git a/v4l2.c b/v4l2.c +index d2b80e4..6240337 100644 +--- a/v4l2.c ++++ b/v4l2.c +@@ -220,8 +220,42 @@ CHECK_V4L2_STRUCT_RESERVED_SIZE(v4l2_create_buffers); + #endif + + +-typedef struct v4l2_ext_control struct_v4l2_ext_control; +-typedef struct v4l2_ext_controls struct_v4l2_ext_controls; ++/** Added by Linux v5.5-rc1~143^2^2~225 */ ++typedef struct { ++ __u32 width; ++ __u32 height; ++} struct_v4l2_area; ++ ++/** Added by Linux commit v2.6.18-rc1~862^2~18 */ ++typedef struct { ++ uint32_t id; ++ uint32_t size; /* Added by v2.6.32-rc1~679^2~72 */ ++ uint32_t reserved2[1]; ++ union { ++ int32_t value; ++ int64_t value64; ++ char *string; /**< Added by v2.6.32-rc1~679^2~72 */ ++ uint8_t *p_u8; /**< Added by v3.17-rc1~112^2~343 */ ++ uint16_t *p_u16; /**< Added by v3.17-rc1~112^2~343 */ ++ uint32_t *p_u32; /**< Added by v3.17-rc1~112^2~112 */ ++ struct_v4l2_area *p_area; /**< Added by v5.5-rc1~143^2^2~51 */ ++ void *ptr; /**< Added by v3.17-rc1~112^2~363 */ ++ }; ++} ATTRIBUTE_PACKED struct_v4l2_ext_control; ++ ++/** Added by Linux commit v2.6.18-rc1~862^2~18 */ ++typedef struct { ++ union { ++ uint32_t ctrl_class; ++ uint32_t which; ++ }; ++ uint32_t count; ++ uint32_t error_idx; ++ int32_t request_fd; /**< Added by Linux commit v4.20-rc1~51^2~44 */ ++ uint32_t reserved[1]; ++ struct_v4l2_ext_control *controls; ++} struct_v4l2_ext_controls; ++ + typedef struct v4l2_framebuffer struct_v4l2_framebuffer; + typedef struct v4l2_input struct_v4l2_input; + typedef struct v4l2_standard struct_v4l2_standard; +@@ -974,7 +1008,6 @@ print_v4l2_crop(struct tcb *const tcp, const kernel_ulong_t arg, + return RVAL_IOCTL_DECODED; + } + +-#ifdef VIDIOC_S_EXT_CTRLS + static bool + print_v4l2_ext_control(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data) + { +@@ -982,14 +1015,14 @@ print_v4l2_ext_control(struct tcb *tcp, void *elem_buf, size_t elem_size, void * + + tprints("{id="); + printxval(v4l2_control_ids, p->id, "V4L2_CID_???"); +-# if HAVE_STRUCT_V4L2_EXT_CONTROL_STRING + tprintf(", size=%u", p->size); + if (p->size > 0) { + tprints(", string="); + printstrn(tcp, ptr_to_kulong(p->string), p->size); +- } else +-# endif +- tprintf(", value=%d, value64=%" PRId64, p->value, (int64_t) p->value64); ++ } else { ++ tprintf(", value=%d, value64=%" PRId64, ++ p->value, (int64_t) p->value64); ++ } + tprints("}"); + + return true; +@@ -1042,7 +1075,6 @@ print_v4l2_ext_controls(struct tcb *const tcp, const kernel_ulong_t arg, + /* entering */ + return 0; + } +-#endif /* VIDIOC_S_EXT_CTRLS */ + + #ifdef VIDIOC_ENUM_FRAMESIZES + # include "xlat/v4l2_framesize_types.h" +@@ -1243,13 +1275,11 @@ MPERS_PRINTER_DECL(int, v4l2_ioctl, struct tcb *const tcp, + case VIDIOC_S_CROP: /* W */ + return print_v4l2_crop(tcp, arg, code == VIDIOC_G_CROP); + +-#ifdef VIDIOC_S_EXT_CTRLS + case VIDIOC_S_EXT_CTRLS: /* RW */ + case VIDIOC_TRY_EXT_CTRLS: /* RW */ + case VIDIOC_G_EXT_CTRLS: /* RW */ + return print_v4l2_ext_controls(tcp, arg, + code == VIDIOC_G_EXT_CTRLS); +-#endif /* VIDIOC_S_EXT_CTRLS */ + + #ifdef VIDIOC_ENUM_FRAMESIZES + case VIDIOC_ENUM_FRAMESIZES: /* RW */ +-- +2.1.4 + diff --git a/SOURCES/0085-v4l2-decode-frame-intervals-sizes-unconditionally.patch b/SOURCES/0085-v4l2-decode-frame-intervals-sizes-unconditionally.patch new file mode 100644 index 0000000..fb23f5e --- /dev/null +++ b/SOURCES/0085-v4l2-decode-frame-intervals-sizes-unconditionally.patch @@ -0,0 +1,250 @@ +From 8cdc7e8c7e08da82b8b3b7516f957f13e541af59 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Wed, 29 Jan 2020 18:48:31 +0100 +Subject: [PATCH 85/86] v4l2: decode frame intervals/sizes unconditionally + +--- + v4l2.c | 62 ++++++++++++++++++++++++++++++++-------- + xlat/v4l2_frameinterval_types.in | 6 ++-- + xlat/v4l2_framesize_types.in | 6 ++-- + 3 files changed, 56 insertions(+), 18 deletions(-) + +Index: strace-5.1/v4l2.c +=================================================================== +--- strace-5.1.orig/v4l2.c 2020-01-29 21:08:39.766035121 +0100 ++++ strace-5.1/v4l2.c 2020-01-29 21:08:41.137022537 +0100 +@@ -206,6 +206,52 @@ + + + typedef struct { ++ uint32_t width; ++ uint32_t height; ++} struct_v4l2_frmsize_discrete; ++ ++typedef struct { ++ uint32_t min_width; ++ uint32_t max_width; ++ uint32_t step_width; ++ uint32_t min_height; ++ uint32_t max_height; ++ uint32_t step_height; ++} struct_v4l2_frmsize_stepwise; ++ ++/** Added by Linux commit v2.6.19-rc1~183 */ ++typedef struct { ++ uint32_t index; ++ uint32_t pixel_format; ++ uint32_t type; /**< enum v4l2_frmsizetypes */ ++ union { ++ struct_v4l2_frmsize_discrete discrete; ++ struct_v4l2_frmsize_stepwise stepwise; ++ }; ++ uint32_t reserved[2]; ++} struct_v4l2_frmsizeenum; ++ ++typedef struct { ++ struct v4l2_fract min; ++ struct v4l2_fract max; ++ struct v4l2_fract step; ++} struct_v4l2_frmival_stepwise; ++ ++typedef struct { ++ uint32_t index; ++ uint32_t pixel_format; ++ uint32_t width; ++ uint32_t height; ++ uint32_t type; /**< enum v4l2_frmivaltypes */ ++ union { ++ struct v4l2_fract discrete; ++ struct_v4l2_frmival_stepwise stepwise; ++ }; ++ uint32_t reserved[2]; ++} struct_v4l2_frmivalenum; ++ ++ ++typedef struct { + uint32_t index; + uint32_t count; + uint32_t memory; +@@ -1076,13 +1122,12 @@ + return 0; + } + +-#ifdef VIDIOC_ENUM_FRAMESIZES +-# include "xlat/v4l2_framesize_types.h" ++#include "xlat/v4l2_framesize_types.h" + + static int + print_v4l2_frmsizeenum(struct tcb *const tcp, const kernel_ulong_t arg) + { +- struct v4l2_frmsizeenum s; ++ struct_v4l2_frmsizeenum s; + + if (entering(tcp)) { + tprints(", "); +@@ -1114,15 +1159,13 @@ + tprints("}"); + return RVAL_IOCTL_DECODED; + } +-#endif /* VIDIOC_ENUM_FRAMESIZES */ + +-#ifdef VIDIOC_ENUM_FRAMEINTERVALS +-# include "xlat/v4l2_frameinterval_types.h" ++#include "xlat/v4l2_frameinterval_types.h" + + static int + print_v4l2_frmivalenum(struct tcb *const tcp, const kernel_ulong_t arg) + { +- struct v4l2_frmivalenum f; ++ struct_v4l2_frmivalenum f; + + if (entering(tcp)) { + tprints(", "); +@@ -1158,7 +1201,6 @@ + + return RVAL_IOCTL_DECODED; + } +-#endif /* VIDIOC_ENUM_FRAMEINTERVALS */ + + static int + print_v4l2_create_buffers(struct tcb *const tcp, const kernel_ulong_t arg) +@@ -1281,15 +1323,11 @@ + return print_v4l2_ext_controls(tcp, arg, + code == VIDIOC_G_EXT_CTRLS); + +-#ifdef VIDIOC_ENUM_FRAMESIZES + case VIDIOC_ENUM_FRAMESIZES: /* RW */ + return print_v4l2_frmsizeenum(tcp, arg); +-#endif /* VIDIOC_ENUM_FRAMESIZES */ + +-#ifdef VIDIOC_ENUM_FRAMEINTERVALS + case VIDIOC_ENUM_FRAMEINTERVALS: /* RW */ + return print_v4l2_frmivalenum(tcp, arg); +-#endif /* VIDIOC_ENUM_FRAMEINTERVALS */ + + case VIDIOC_CREATE_BUFS: /* RW */ + return print_v4l2_create_buffers(tcp, arg); +Index: strace-5.1/xlat/v4l2_frameinterval_types.in +=================================================================== +--- strace-5.1.orig/xlat/v4l2_frameinterval_types.in 2020-01-29 21:08:21.012207266 +0100 ++++ strace-5.1/xlat/v4l2_frameinterval_types.in 2020-01-29 21:08:41.137022537 +0100 +@@ -1,3 +1,3 @@ +-V4L2_FRMIVAL_TYPE_DISCRETE +-V4L2_FRMIVAL_TYPE_CONTINUOUS +-V4L2_FRMIVAL_TYPE_STEPWISE ++V4L2_FRMIVAL_TYPE_DISCRETE 1 ++V4L2_FRMIVAL_TYPE_CONTINUOUS 2 ++V4L2_FRMIVAL_TYPE_STEPWISE 3 +Index: strace-5.1/xlat/v4l2_framesize_types.in +=================================================================== +--- strace-5.1.orig/xlat/v4l2_framesize_types.in 2020-01-29 21:08:21.012207266 +0100 ++++ strace-5.1/xlat/v4l2_framesize_types.in 2020-01-29 21:08:41.137022537 +0100 +@@ -1,3 +1,3 @@ +-V4L2_FRMSIZE_TYPE_DISCRETE +-V4L2_FRMSIZE_TYPE_CONTINUOUS +-V4L2_FRMSIZE_TYPE_STEPWISE ++V4L2_FRMSIZE_TYPE_DISCRETE 1 ++V4L2_FRMSIZE_TYPE_CONTINUOUS 2 ++V4L2_FRMSIZE_TYPE_STEPWISE 3 +Index: strace-5.1/xlat/v4l2_frameinterval_types.h +=================================================================== +--- strace-5.1.orig/xlat/v4l2_frameinterval_types.h 2019-05-22 15:08:30.000000000 +0200 ++++ strace-5.1/xlat/v4l2_frameinterval_types.h 2020-01-29 21:12:03.513076783 +0100 +@@ -3,6 +3,27 @@ + #include "gcc_compat.h" + #include "static_assert.h" + ++#if defined(V4L2_FRMIVAL_TYPE_DISCRETE) || (defined(HAVE_DECL_V4L2_FRMIVAL_TYPE_DISCRETE) && HAVE_DECL_V4L2_FRMIVAL_TYPE_DISCRETE) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_FRMIVAL_TYPE_DISCRETE) == (1), "V4L2_FRMIVAL_TYPE_DISCRETE != 1"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_FRMIVAL_TYPE_DISCRETE 1 ++#endif ++#if defined(V4L2_FRMIVAL_TYPE_CONTINUOUS) || (defined(HAVE_DECL_V4L2_FRMIVAL_TYPE_CONTINUOUS) && HAVE_DECL_V4L2_FRMIVAL_TYPE_CONTINUOUS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_FRMIVAL_TYPE_CONTINUOUS) == (2), "V4L2_FRMIVAL_TYPE_CONTINUOUS != 2"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_FRMIVAL_TYPE_CONTINUOUS 2 ++#endif ++#if defined(V4L2_FRMIVAL_TYPE_STEPWISE) || (defined(HAVE_DECL_V4L2_FRMIVAL_TYPE_STEPWISE) && HAVE_DECL_V4L2_FRMIVAL_TYPE_STEPWISE) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_FRMIVAL_TYPE_STEPWISE) == (3), "V4L2_FRMIVAL_TYPE_STEPWISE != 3"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_FRMIVAL_TYPE_STEPWISE 3 ++#endif + + #ifndef XLAT_MACROS_ONLY + +@@ -16,15 +37,9 @@ + static + # endif + const struct xlat v4l2_frameinterval_types[] = { +-#if defined(V4L2_FRMIVAL_TYPE_DISCRETE) || (defined(HAVE_DECL_V4L2_FRMIVAL_TYPE_DISCRETE) && HAVE_DECL_V4L2_FRMIVAL_TYPE_DISCRETE) +- XLAT(V4L2_FRMIVAL_TYPE_DISCRETE), +-#endif +-#if defined(V4L2_FRMIVAL_TYPE_CONTINUOUS) || (defined(HAVE_DECL_V4L2_FRMIVAL_TYPE_CONTINUOUS) && HAVE_DECL_V4L2_FRMIVAL_TYPE_CONTINUOUS) +- XLAT(V4L2_FRMIVAL_TYPE_CONTINUOUS), +-#endif +-#if defined(V4L2_FRMIVAL_TYPE_STEPWISE) || (defined(HAVE_DECL_V4L2_FRMIVAL_TYPE_STEPWISE) && HAVE_DECL_V4L2_FRMIVAL_TYPE_STEPWISE) +- XLAT(V4L2_FRMIVAL_TYPE_STEPWISE), +-#endif ++ XLAT(V4L2_FRMIVAL_TYPE_DISCRETE), ++ XLAT(V4L2_FRMIVAL_TYPE_CONTINUOUS), ++ XLAT(V4L2_FRMIVAL_TYPE_STEPWISE), + XLAT_END + }; + +Index: strace-5.1/xlat/v4l2_framesize_types.h +=================================================================== +--- strace-5.1.orig/xlat/v4l2_framesize_types.h 2019-05-22 15:08:31.000000000 +0200 ++++ strace-5.1/xlat/v4l2_framesize_types.h 2020-01-29 21:12:03.681075121 +0100 +@@ -3,6 +3,27 @@ + #include "gcc_compat.h" + #include "static_assert.h" + ++#if defined(V4L2_FRMSIZE_TYPE_DISCRETE) || (defined(HAVE_DECL_V4L2_FRMSIZE_TYPE_DISCRETE) && HAVE_DECL_V4L2_FRMSIZE_TYPE_DISCRETE) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_FRMSIZE_TYPE_DISCRETE) == (1), "V4L2_FRMSIZE_TYPE_DISCRETE != 1"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_FRMSIZE_TYPE_DISCRETE 1 ++#endif ++#if defined(V4L2_FRMSIZE_TYPE_CONTINUOUS) || (defined(HAVE_DECL_V4L2_FRMSIZE_TYPE_CONTINUOUS) && HAVE_DECL_V4L2_FRMSIZE_TYPE_CONTINUOUS) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_FRMSIZE_TYPE_CONTINUOUS) == (2), "V4L2_FRMSIZE_TYPE_CONTINUOUS != 2"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_FRMSIZE_TYPE_CONTINUOUS 2 ++#endif ++#if defined(V4L2_FRMSIZE_TYPE_STEPWISE) || (defined(HAVE_DECL_V4L2_FRMSIZE_TYPE_STEPWISE) && HAVE_DECL_V4L2_FRMSIZE_TYPE_STEPWISE) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_FRMSIZE_TYPE_STEPWISE) == (3), "V4L2_FRMSIZE_TYPE_STEPWISE != 3"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_FRMSIZE_TYPE_STEPWISE 3 ++#endif + + #ifndef XLAT_MACROS_ONLY + +@@ -16,15 +37,9 @@ + static + # endif + const struct xlat v4l2_framesize_types[] = { +-#if defined(V4L2_FRMSIZE_TYPE_DISCRETE) || (defined(HAVE_DECL_V4L2_FRMSIZE_TYPE_DISCRETE) && HAVE_DECL_V4L2_FRMSIZE_TYPE_DISCRETE) +- XLAT(V4L2_FRMSIZE_TYPE_DISCRETE), +-#endif +-#if defined(V4L2_FRMSIZE_TYPE_CONTINUOUS) || (defined(HAVE_DECL_V4L2_FRMSIZE_TYPE_CONTINUOUS) && HAVE_DECL_V4L2_FRMSIZE_TYPE_CONTINUOUS) +- XLAT(V4L2_FRMSIZE_TYPE_CONTINUOUS), +-#endif +-#if defined(V4L2_FRMSIZE_TYPE_STEPWISE) || (defined(HAVE_DECL_V4L2_FRMSIZE_TYPE_STEPWISE) && HAVE_DECL_V4L2_FRMSIZE_TYPE_STEPWISE) +- XLAT(V4L2_FRMSIZE_TYPE_STEPWISE), +-#endif ++ XLAT(V4L2_FRMSIZE_TYPE_DISCRETE), ++ XLAT(V4L2_FRMSIZE_TYPE_CONTINUOUS), ++ XLAT(V4L2_FRMSIZE_TYPE_STEPWISE), + XLAT_END + }; + diff --git a/SOURCES/0086-v4l2-provide-V4L2_CTRL_FLAG_NEXT_CTRL-in-an-xlat.patch b/SOURCES/0086-v4l2-provide-V4L2_CTRL_FLAG_NEXT_CTRL-in-an-xlat.patch new file mode 100644 index 0000000..36a3438 --- /dev/null +++ b/SOURCES/0086-v4l2-provide-V4L2_CTRL_FLAG_NEXT_CTRL-in-an-xlat.patch @@ -0,0 +1,173 @@ +From d35fd59ebd129d26cc7bf3180a58182e41361c2e Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Wed, 29 Jan 2020 19:45:29 +0100 +Subject: [PATCH 86/86] v4l2: provide V4L2_CTRL_FLAG_NEXT_CTRL in an xlat + +--- + tests/ioctl_v4l2.c | 9 ++++----- + v4l2.c | 3 +-- + 2 files changed, 5 insertions(+), 7 deletions(-) + +Index: strace-5.1/tests/ioctl_v4l2.c +=================================================================== +--- strace-5.1.orig/tests/ioctl_v4l2.c 2020-01-29 21:14:03.918926110 +0100 ++++ strace-5.1/tests/ioctl_v4l2.c 2020-01-29 21:15:20.737200682 +0100 +@@ -14,6 +14,10 @@ + #include + #include + ++#ifndef V4L2_CTRL_FLAG_NEXT_CTRL ++# define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 ++#endif ++ + #define cc0(arg) ((unsigned int) (unsigned char) (arg)) + #define cc1(arg) ((unsigned int) (unsigned char) ((unsigned int) (arg) >> 8)) + #define cc2(arg) ((unsigned int) (unsigned char) ((unsigned int) (arg) >> 16)) +@@ -748,14 +752,9 @@ + struct v4l2_queryctrl *const p_v4l2_queryctrl = + page_end - sizeof(*p_v4l2_queryctrl); + ioctl(-1, VIDIOC_QUERYCTRL, p_v4l2_queryctrl); +-#ifdef V4L2_CTRL_FLAG_NEXT_CTRL + printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=V4L2_CTRL_FLAG_NEXT_CTRL" + "|%#x /* V4L2_CID_??? */}) = -1 EBADF (%m)\n", + p_v4l2_queryctrl->id & ~V4L2_CTRL_FLAG_NEXT_CTRL); +-#else +- printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=%#x /* V4L2_CID_??? */})" +- " = -1 EBADF (%m)\n", p_v4l2_queryctrl->id); +-#endif + + TAIL_ALLOC_OBJECT_CONST_PTR(struct v4l2_queryctrl, p_queryctrl); + p_queryctrl->id = V4L2_CID_SATURATION; +Index: strace-5.1/v4l2.c +=================================================================== +--- strace-5.1.orig/v4l2.c 2020-01-29 21:15:19.011216936 +0100 ++++ strace-5.1/v4l2.c 2020-01-29 21:15:20.738200672 +0100 +@@ -954,6 +954,7 @@ + + #include "xlat/v4l2_control_types.h" + #include "xlat/v4l2_control_flags.h" ++#include "xlat/v4l2_control_query_flags.h" + + static int + print_v4l2_queryctrl(struct tcb *const tcp, const kernel_ulong_t arg) +@@ -975,7 +976,6 @@ + } + + if (entering(tcp) || get_tcb_priv_ulong(tcp)) { +-#ifdef V4L2_CTRL_FLAG_NEXT_CTRL + const unsigned long next = c.id & V4L2_CTRL_FLAG_NEXT_CTRL; + set_tcb_priv_ulong(tcp, next); + if (next) { +@@ -983,7 +983,6 @@ + tprints("|"); + c.id &= ~V4L2_CTRL_FLAG_NEXT_CTRL; + } +-#endif + printxval(v4l2_control_ids, c.id, "V4L2_CID_???"); + } + +Index: strace-5.1/tests-m32/ioctl_v4l2.c +=================================================================== +--- strace-5.1.orig/tests-m32/ioctl_v4l2.c 2020-01-29 21:14:03.918926110 +0100 ++++ strace-5.1/tests-m32/ioctl_v4l2.c 2020-01-29 21:15:20.739200663 +0100 +@@ -14,6 +14,10 @@ + #include + #include + ++#ifndef V4L2_CTRL_FLAG_NEXT_CTRL ++# define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 ++#endif ++ + #define cc0(arg) ((unsigned int) (unsigned char) (arg)) + #define cc1(arg) ((unsigned int) (unsigned char) ((unsigned int) (arg) >> 8)) + #define cc2(arg) ((unsigned int) (unsigned char) ((unsigned int) (arg) >> 16)) +@@ -748,14 +752,9 @@ + struct v4l2_queryctrl *const p_v4l2_queryctrl = + page_end - sizeof(*p_v4l2_queryctrl); + ioctl(-1, VIDIOC_QUERYCTRL, p_v4l2_queryctrl); +-#ifdef V4L2_CTRL_FLAG_NEXT_CTRL + printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=V4L2_CTRL_FLAG_NEXT_CTRL" + "|%#x /* V4L2_CID_??? */}) = -1 EBADF (%m)\n", + p_v4l2_queryctrl->id & ~V4L2_CTRL_FLAG_NEXT_CTRL); +-#else +- printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=%#x /* V4L2_CID_??? */})" +- " = -1 EBADF (%m)\n", p_v4l2_queryctrl->id); +-#endif + + TAIL_ALLOC_OBJECT_CONST_PTR(struct v4l2_queryctrl, p_queryctrl); + p_queryctrl->id = V4L2_CID_SATURATION; +Index: strace-5.1/tests-mx32/ioctl_v4l2.c +=================================================================== +--- strace-5.1.orig/tests-mx32/ioctl_v4l2.c 2020-01-29 21:14:03.918926110 +0100 ++++ strace-5.1/tests-mx32/ioctl_v4l2.c 2020-01-29 21:15:20.740200653 +0100 +@@ -14,6 +14,10 @@ + #include + #include + ++#ifndef V4L2_CTRL_FLAG_NEXT_CTRL ++# define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 ++#endif ++ + #define cc0(arg) ((unsigned int) (unsigned char) (arg)) + #define cc1(arg) ((unsigned int) (unsigned char) ((unsigned int) (arg) >> 8)) + #define cc2(arg) ((unsigned int) (unsigned char) ((unsigned int) (arg) >> 16)) +@@ -748,14 +752,9 @@ + struct v4l2_queryctrl *const p_v4l2_queryctrl = + page_end - sizeof(*p_v4l2_queryctrl); + ioctl(-1, VIDIOC_QUERYCTRL, p_v4l2_queryctrl); +-#ifdef V4L2_CTRL_FLAG_NEXT_CTRL + printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=V4L2_CTRL_FLAG_NEXT_CTRL" + "|%#x /* V4L2_CID_??? */}) = -1 EBADF (%m)\n", + p_v4l2_queryctrl->id & ~V4L2_CTRL_FLAG_NEXT_CTRL); +-#else +- printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=%#x /* V4L2_CID_??? */})" +- " = -1 EBADF (%m)\n", p_v4l2_queryctrl->id); +-#endif + + TAIL_ALLOC_OBJECT_CONST_PTR(struct v4l2_queryctrl, p_queryctrl); + p_queryctrl->id = V4L2_CID_SATURATION; +Index: strace-5.1/xlat/v4l2_control_query_flags.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-5.1/xlat/v4l2_control_query_flags.h 2020-01-29 21:16:03.273800088 +0100 +@@ -0,0 +1,40 @@ ++/* Generated by ./xlat/gen.sh from ./xlat/v4l2_control_query_flags.in; do not edit. */ ++ ++#include "gcc_compat.h" ++#include "static_assert.h" ++ ++#if defined(V4L2_CTRL_FLAG_NEXT_CTRL) || (defined(HAVE_DECL_V4L2_CTRL_FLAG_NEXT_CTRL) && HAVE_DECL_V4L2_CTRL_FLAG_NEXT_CTRL) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CTRL_FLAG_NEXT_CTRL) == (0x80000000), "V4L2_CTRL_FLAG_NEXT_CTRL != 0x80000000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 ++#endif ++#if defined(V4L2_CTRL_FLAG_NEXT_COMPOUND) || (defined(HAVE_DECL_V4L2_CTRL_FLAG_NEXT_COMPOUND) && HAVE_DECL_V4L2_CTRL_FLAG_NEXT_COMPOUND) ++DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE ++static_assert((V4L2_CTRL_FLAG_NEXT_COMPOUND) == (0x40000000), "V4L2_CTRL_FLAG_NEXT_COMPOUND != 0x40000000"); ++DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE ++#else ++# define V4L2_CTRL_FLAG_NEXT_COMPOUND 0x40000000 ++#endif ++ ++#ifndef XLAT_MACROS_ONLY ++ ++# ifdef IN_MPERS ++ ++extern const struct xlat v4l2_control_query_flags[]; ++ ++# else ++ ++# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS) ++static ++# endif ++const struct xlat v4l2_control_query_flags[] = { ++ XLAT(V4L2_CTRL_FLAG_NEXT_CTRL), ++ XLAT(V4L2_CTRL_FLAG_NEXT_COMPOUND), ++ XLAT_END ++}; ++ ++# endif /* !IN_MPERS */ ++ ++#endif /* !XLAT_MACROS_ONLY */ diff --git a/SOURCES/0200-strace-provide-O_TMPFILE-fallback-definition.patch b/SOURCES/0200-strace-provide-O_TMPFILE-fallback-definition.patch new file mode 100644 index 0000000..5615ead --- /dev/null +++ b/SOURCES/0200-strace-provide-O_TMPFILE-fallback-definition.patch @@ -0,0 +1,19 @@ +Some buildroots provide version of kernel-headers package that do not yet +contains O_TMPFILE definition. Since (looks like) there were none discrepancies +in O_TMPFILE definition in RHEL, work that around by providing a fallback +definition of O_TMPFILE. +Index: strace-5.2/open.c +=================================================================== +--- strace-5.2.orig/open.c 2019-07-11 19:51:22.000000000 +0200 ++++ strace-5.2/open.c 2019-07-22 17:49:41.508766666 +0200 +@@ -28,6 +28,10 @@ + # endif + #endif + ++#ifndef O_TMPFILE ++# define O_TMPFILE (__O_TMPFILE | O_DIRECTORY) ++#endif ++ + #include "xlat/open_access_modes.h" + #include "xlat/open_mode_flags.h" + diff --git a/SOURCES/0201-limit-qual_fault-scope-on-aarch64.patch b/SOURCES/0201-limit-qual_fault-scope-on-aarch64.patch new file mode 100644 index 0000000..30df75a --- /dev/null +++ b/SOURCES/0201-limit-qual_fault-scope-on-aarch64.patch @@ -0,0 +1,39 @@ +Index: strace-5.1/tests/qual_fault.test +=================================================================== +--- strace-5.1.orig/tests/qual_fault.test 2018-12-10 01:00:00.000000000 +0100 ++++ strace-5.1/tests/qual_fault.test 2019-06-13 16:59:58.498626547 +0200 +@@ -75,18 +75,31 @@ + done + } + +-for err in '' ENOSYS 22 einval; do ++case "$STRACE_ARCH" in ++ aarch64) ++ ERRS='EnoSys 22' ++ NUMBERS1='2' ++ NUMBERS2='3' ++ ;; ++ *) ++ 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 \ diff --git a/SOURCES/strace-provide-O_TMPFILE-fallback-definition.patch b/SOURCES/strace-provide-O_TMPFILE-fallback-definition.patch deleted file mode 100644 index 5615ead..0000000 --- a/SOURCES/strace-provide-O_TMPFILE-fallback-definition.patch +++ /dev/null @@ -1,19 +0,0 @@ -Some buildroots provide version of kernel-headers package that do not yet -contains O_TMPFILE definition. Since (looks like) there were none discrepancies -in O_TMPFILE definition in RHEL, work that around by providing a fallback -definition of O_TMPFILE. -Index: strace-5.2/open.c -=================================================================== ---- strace-5.2.orig/open.c 2019-07-11 19:51:22.000000000 +0200 -+++ strace-5.2/open.c 2019-07-22 17:49:41.508766666 +0200 -@@ -28,6 +28,10 @@ - # endif - #endif - -+#ifndef O_TMPFILE -+# define O_TMPFILE (__O_TMPFILE | O_DIRECTORY) -+#endif -+ - #include "xlat/open_access_modes.h" - #include "xlat/open_mode_flags.h" - diff --git a/SPECS/strace.spec b/SPECS/strace.spec index 247977c..97df1ad 100644 --- a/SPECS/strace.spec +++ b/SPECS/strace.spec @@ -3,34 +3,13 @@ Summary: Tracks and displays system calls associated with a running process Name: %{?scl_prefix}strace Version: 5.1 -Release: 4%{?dist} +Release: 7%{?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}/strace-%{version}.tar.xz -# RHEL-only -Patch0: 0000-limit-qual_fault-scope-on-aarch64.patch -# v5.2-3-g7ada13f "evdev: avoid bit vector decoding on non-successful and 0 return codes" -Patch1: 0001-evdev-avoid-bit-vector-decoding-on-non-successful-an.patch -# v5.2-4-g96194ed "evdev: fix array size calculation in decode_bitset_" -Patch2: 0002-evdev-fix-array-size-calculation-in-decode_bitset_.patch -# v5.2-5-gcdd8206 "tests: test evdev bitset decoding more thoroughly" -Patch3: 0003-tests-test-evdev-bitset-decoding-more-thoroughly.patch -# v5.2-92-gc108f0b "sockaddr: properly decode sockaddr_hci addresses without hci_channel" -Patch4: 0004-sockaddr-properly-decode-sockaddr_hci-addresses-with.patch -## Reported by covscan -# v5.2-84-g91281fec "v4l2: avoid shifting left a signed number by 31 bit" -Patch5: 0005-v4l2-avoid-shifting-left-a-signed-number-by-31-bit.patch -# v5.2~21 "syscall.c: avoid infinite loop in subcalls parsing" -Patch6: 0006-syscall.c-avoid-infinite-loop-in-subcalls-parsing.patch -# v5.2~19 "kvm: avoid bogus vcpu_info assignment in vcpu_register" -Patch7: 0007-kvm-avoid-bogus-vcpu_info-assignment-in-vcpu_registe.patch - -## RHEL-only: headers on some builders do not provide O_TMPFILE -Patch10: strace-provide-O_TMPFILE-fallback-definition.patch - %define alternatives_cmd %{!?scl:%{_sbindir}}%{?scl:%{_root_sbindir}}/alternatives %define alternatives_cmdline %{alternatives_cmd}%{?scl: --altdir %{_sysconfdir}/alternatives --admindir %{_scl_root}/var/lib/alternatives} @@ -51,6 +30,122 @@ BuildRequires: %{?scl_prefix}elfutils-devel, %{?scl_prefix}binutils-devel %{?!buildroot:BuildRoot: %_tmppath/buildroot-%name-%version-%release} %define maybe_use_defattr %{?suse_version:%%defattr(-,root,root)} +## 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 + +## 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 + +## 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 + +## Missing stack traces on attach (https://bugzilla.redhat.com/1788636) +## RHEL 7: https://bugzilla.redhat.com/1790052 +## RHEL 8: https://bugzilla.redhat.com/1790053 +## 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 + +## 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 + +## 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 + +## "some devtoolset-9-strace internal tests fail on rhel-alt-7.6" +## https://bugzilla.redhat.com/1758201 +# v5.4~102 "xlat: provide fallback definitions for UFFD_FEATURE_* constants" +Patch53: 0053-xlat-provide-fallback-definitions-for-UFFD_FEATURE_-.patch +# v5.4~101 "xlat: provide fallback definitions for netlink_ack_flags constants" +Patch54: 0054-xlat-provide-fallback-definitions-for-netlink_ack_fl.patch +# v5.4~100 "xlat: provide fallback definitions for XDP_FLAGS_* constants" +Patch55: 0055-xlat-provide-fallback-definitions-for-XDP_FLAGS_-con.patch +# v5.4~99 "xlat: update MDB_FLAGS_* constants" +Patch56: 0056-xlat-update-MDB_FLAGS_-constants.patch +# v5.4~98 "rtnl_rule: decode fib_rule_uid_range without use of " +Patch57: 0057-rtnl_rule-decode-fib_rule_uid_range-without-use-of-l.patch +# v5.4~95 "xlat: provide fallback definitions for ABS_MT_* constants" +Patch58: 0058-xlat-provide-fallback-definitions-for-ABS_MT_-consta.patch +# v5.4~94 "tests: introduce TEST_NLATTR_OBJECT_MINSZ" +Patch59: 0059-tests-introduce-TEST_NLATTR_OBJECT_MINSZ.patch +# v5.4~93 "evdev: remove additional indentation level for switch case labels" +Patch60: 0060-evdev-remove-additional-indentation-level-for-switch.patch +# v5.4~92 "macros.h: include " +Patch61: 0061-macros.h-include-stddef.h.patch +# v5.4~91 "Enable building of netlink_crypto decoder without linux/cryptouser.h" +Patch62: 0062-Enable-building-of-netlink_crypto-decoder-without-li.patch +# v5.4~90 "rtnl_link: use internal rtnl_link_stats* and ifla_port_vsi definitions" +Patch63: 0063-rtnl_link-use-internal-rtnl_link_stats-and-ifla_port.patch +# v5.4~89 "rtnl_link: print pad field in the struct ifla_port_vsi decoder" +Patch64: 0064-rtnl_link-print-pad-field-in-the-struct-ifla_port_vs.patch +# v5.4~88 "rtnl_mdb: decode messages regardless of availability of kernel headers" +Patch65: 0065-rtnl_mdb-decode-messages-regardless-of-availability-.patch +# v5.4~87 "rtnl_neightbl: always decode struct ndt_config and struct ndt_stats" +Patch66: 0066-rtnl_neightbl-always-decode-struct-ndt_config-and-st.patch +# v5.4~86 "rtnl_route: decode struct rta_mfc_stats and struct rtvia unconditionally" +Patch67: 0067-rtnl_route-decode-struct-rta_mfc_stats-and-struct-rt.patch +# v5.4~76 "evdev: do not rely on EVIOC* constants provided in " +Patch68: 0068-evdev-do-not-rely-on-EVIOC-constants-provided-in-lin.patch +# v5.4~83 "xlat: update v4l2_format_description_flags" +Patch69: 0069-xlat-update-v4l2_format_description_flags.patch +# v5.4~75 "evdev: decode struct input_absinfo regardless of in-kernel definitions" +Patch70: 0070-evdev-decode-struct-input_absinfo-regardless-of-in-k.patch +# v5.4~74 "xlat: provide fallback definitions for V4L2_CAP_* constants" +Patch71: 0071-xlat-provide-fallback-definitions-for-V4L2_CAP_-cons.patch +# v5.4~73 "xlat: update V4L2_BUF_TYPE_* constants" +Patch72: 0072-xlat-update-V4L2_BUF_TYPE_-constants.patch +# v5.4~72 "xlat: Provide fallback definitions for V4L2_FIELD_* constants" +Patch73: 0073-xlat-Provide-fallback-definitions-for-V4L2_FIELD_-co.patch +# v5.4~71 "xlat: update V4L2_COLORSPACE_* constants" +Patch74: 0074-xlat-update-V4L2_COLORSPACE_-constants.patch +# v5.4~70 "xlat: update V4L2_CTRL_TYPE_* constants" +Patch75: 0075-xlat-update-V4L2_CTRL_TYPE_-constants.patch +# v5.4-84-g841f2a4 "xlat: provide values to ptrace_cmds" +Patch76: 0076-xlat-provide-values-to-ptrace_cmds.patch +# v5.4-42-gca83c22 "macros.h: introduce sizeof_field macro" +Patch77: 0077-macros.h-introduce-sizeof_field-macro.patch +# Not yet upstreamed patches +Patch78: 0078-v4l2-improve-buffer-flag-decoding.patch +Patch79: 0079-v4l2-add-shorthand-macros-for-v4l2-type-checks.patch +Patch80: 0080-v4l2-bundle-struct-v4l2_create_buffers-definition.patch +Patch81: 0081-v4l2-provide-struct-v4l2_capability-definition.patch +Patch82: 0082-v4l2-bundle-struct-v4l2_format-and-related-types.patch +Patch83: 0083-v4l2-decode-v4l2_vbi_flags-as-flags.patch +Patch84: 0084-v4l2-always-decode-VIDIOC_-_EXT_CTRLS-ioctl-commands.patch +Patch85: 0085-v4l2-decode-frame-intervals-sizes-unconditionally.patch +Patch86: 0086-v4l2-provide-V4L2_CTRL_FLAG_NEXT_CTRL-in-an-xlat.patch + +## RHEL7-only: headers on some builders do not provide O_TMPFILE +Patch200: 0200-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 + + %description The strace program intercepts and records the system calls called and received by a running process. Strace can print a record of each @@ -64,17 +159,56 @@ received by a process. %prep %setup -q -n strace-%{version} -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch10 -p1 - -chmod a+x tests/*.test +%patch30 -p1 +%patch31 -p1 +%patch33 -p1 +%patch35 -p1 +%patch36 -p1 +%patch37 -p1 +%patch38 -p1 +%patch39 -p1 +%patch40 -p1 +%patch41 -p1 +%patch42 -p1 +%patch43 -p1 +%patch44 -p1 +%patch53 -p1 +%patch54 -p1 +%patch55 -p1 +%patch56 -p1 +%patch57 -p1 +%patch58 -p1 +%patch59 -p1 +%patch60 -p1 +%patch61 -p1 +%patch62 -p1 +%patch63 -p1 +%patch64 -p1 +%patch65 -p1 +%patch66 -p1 +%patch67 -p1 +%patch68 -p1 +%patch69 -p1 +%patch70 -p1 +%patch71 -p1 +%patch72 -p1 +%patch73 -p1 +%patch74 -p1 +%patch75 -p1 +%patch76 -p1 +%patch77 -p1 +%patch78 -p1 +%patch79 -p1 +%patch80 -p1 +%patch81 -p1 +%patch82 -p1 +%patch83 -p1 +%patch84 -p1 +%patch85 -p1 +%patch86 -p1 + +%patch200 -p1 +%patch201 -p1 echo -n %version-%release > .tarball-version echo -n 2019 > .year @@ -96,14 +230,14 @@ LDFLAGS="$RPM_LD_FLAGS -L%{_libdir} -L%{_libdir}/elfutils" export LDLFAGS # -DHAVE_S390_COMPAT_REGS is needed due to lack of v3.10-rc1~201^2~11 -CFLAGS="$RPM_OPT_FLAGS $LDFLAGS" +CFLAGS=" $RPM_OPT_FLAGS $LDFLAGS " # Removing explicit -m64 as it breaks mpers -[ "x${CFLAGS#*-m64}" = "x${CFLAGS}" ] || CFLAGS=$(echo "$CFLAGS" | sed 's/-m64//g') +[ "x${CFLAGS#* -m64 }" = "x${CFLAGS}" ] || CFLAGS=$(echo "$CFLAGS" | sed 's/ -m64 / /g') export CFLAGS -CPPFLAGS="-I%{_includedir} %{optflags}" +CPPFLAGS=" -I%{_includedir} %{optflags} " # Removing explicit -m64 as it breaks mpers -[ "x${CPPFLAGS#*-m64}" = "x${CPPFLAGS}" ] || CPPFLAGS=$(echo "$CPPFLAGS" | sed 's/-m64//g') +[ "x${CPPFLAGS#* -m64 }" = "x${CPPFLAGS}" ] || CPPFLAGS=$(echo "$CPPFLAGS" | sed 's/ -m64 / /g') export CPPFLAGS CFLAGS_FOR_BUILD="$RPM_OPT_FLAGS"; export CFLAGS_FOR_BUILD @@ -125,21 +259,33 @@ done wait %check +# This is needed since patch does not set x bit to the newly created files +chmod u+x tests/*.test tests-m32/*.test tests-mx32/*.test + %{buildroot}%{_bindir}/strace -V -# Temporary until we dig deeper into the failures -# For now, it seems that the failures on s390x builders (that, for some reason, -# use el6 kernel) are covered by the following issues: + + +# Skip tests on s390x el6 kernel, test failures there are covered +# by the following issues: # * https://bugzilla.redhat.com/show_bug.cgi?id=1220802#c6 # * Absence of Linux commit v3.2-rc1~109^2~34 -%ifnarch s390x - -make -j2 -k check VERBOSE=1 TIMEOUT_DURATION=5400 -echo 'BEGIN OF TEST SUITE INFORMATION' -tail -n 99999 -- tests*/test-suite.log tests*/ksysent.log -find tests* -type f -name '*.log' -print0 | - xargs -r0 grep -H '^KERNEL BUG:' -- ||: -echo 'END OF TEST SUITE INFORMATION' -%endif +uname_r="$(uname -r)" +if [ "x${uname_r#2.6.32}" != "x${uname_r}" ] && \ + [ "x${uname_r%s390x}" != "x${uname_r}" ] +then + echo "Skipping tests, kernel (${uname_r}) is too broken" +else + # 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 + echo 'BEGIN OF TEST SUITE INFORMATION' + tail -n 99999 -- tests*/test-suite.log tests*/ksysent.log + find tests* -type f -name '*.log' -print0 | + xargs -r0 grep -H '^KERNEL BUG:' -- ||: + echo 'END OF TEST SUITE INFORMATION' +fi + %files %maybe_use_defattr @@ -149,6 +295,22 @@ echo 'END OF TEST SUITE INFORMATION' %{_mandir}/man1/* %changelog +* Mon Jan 27 2020 Eugene Syromiatnikov - 5.1-7 +- Do not depend on kernel headers for decoding (#1758201). + +* Mon Jan 27 2020 Eugene Syromiatnikov - 5.1-6 +- Fix expected alignment for IPC tests (#1795273): + 4377e3a1 "tests: fix expected output for some ipc tests", and + a75c7c4b "tests: fix -a argument in ipc_msgbuf-Xraw test". + +* Mon Jan 27 2020 Eugene Syromiatnikov - 5.1-5 +- Fix printing stack traces for early syscalls on process attach (#1790057): + 69b2c33a "unwind-libdw: fix initialization of libdwfl cache", + 35e080ae "syscall: do not capture stack trace while the tracee executes + strace code", and + 8e515c74 "tests: add strace-k-p test". +- Add commit v5.4~97 "xlat: use unsgined type for mount_flags fallback values" + * Fri Aug 30 2019 Eugene Syromiatnikov - 5.1-4 - Properly decode struct sockaddr_hci without hci_channel field. - Include upstream patches that fix issues reported by covscan: