From b484cad3a1df2daefca3a88a4733a91558b3f3f4 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Apr 28 2020 09:35:39 +0000 Subject: import strace-4.24-9.el8 --- diff --git a/SOURCES/0002-evdev-fix-decoding-of-EVIOCGBIT-0.patch b/SOURCES/0002-evdev-fix-decoding-of-EVIOCGBIT-0.patch index fea7c27..6f8f541 100644 --- a/SOURCES/0002-evdev-fix-decoding-of-EVIOCGBIT-0.patch +++ b/SOURCES/0002-evdev-fix-decoding-of-EVIOCGBIT-0.patch @@ -35,8 +35,8 @@ Fixes: v4.10~89 "Add decoding for evdev ioctls" Index: strace-4.24/defs.h =================================================================== ---- strace-4.24.orig/defs.h 2019-03-11 12:34:15.719549018 +0100 -+++ strace-4.24/defs.h 2019-03-11 12:47:05.976567233 +0100 +--- strace-4.24.orig/defs.h 2020-01-27 17:13:39.441001784 +0100 ++++ strace-4.24/defs.h 2020-01-27 17:14:03.150778494 +0100 @@ -330,6 +330,7 @@ /** Number of elements in evdev_abs array without the terminating record. */ extern const size_t evdev_abs_size; @@ -47,8 +47,8 @@ Index: strace-4.24/defs.h extern const struct xlat ipc_private[]; Index: strace-4.24/evdev.c =================================================================== ---- strace-4.24.orig/evdev.c 2019-03-11 12:34:21.911484926 +0100 -+++ strace-4.24/evdev.c 2019-03-11 12:47:05.976567233 +0100 +--- strace-4.24.orig/evdev.c 2020-01-27 17:14:01.715792008 +0100 ++++ strace-4.24/evdev.c 2020-01-27 17:14:03.151778485 +0100 @@ -30,6 +30,7 @@ #include "defs.h" @@ -80,8 +80,8 @@ Index: strace-4.24/evdev.c KEY_MAX, "KEY_???", XT_INDEXED); Index: strace-4.24/ioctl.c =================================================================== ---- strace-4.24.orig/ioctl.c 2019-03-11 12:34:15.719549018 +0100 -+++ strace-4.24/ioctl.c 2019-03-11 12:47:05.976567233 +0100 +--- strace-4.24.orig/ioctl.c 2020-01-27 17:13:39.441001784 +0100 ++++ strace-4.24/ioctl.c 2020-01-27 17:14:03.152778475 +0100 @@ -33,8 +33,6 @@ #include #include "xlat/ioctl_dirs.h" @@ -105,8 +105,8 @@ Index: strace-4.24/ioctl.c } else if (nr >= 0x40 && nr <= 0x40 + 0x3f) { Index: strace-4.24/tests/ioctl_evdev.c =================================================================== ---- strace-4.24.orig/tests/ioctl_evdev.c 2019-03-11 12:34:15.719549018 +0100 -+++ strace-4.24/tests/ioctl_evdev.c 2019-03-11 12:47:05.977567222 +0100 +--- strace-4.24.orig/tests/ioctl_evdev.c 2020-01-27 17:13:39.441001784 +0100 ++++ strace-4.24/tests/ioctl_evdev.c 2020-01-27 17:14:03.153778466 +0100 @@ -138,7 +138,7 @@ TEST_NULL_ARG_EX(EVIOCGABS(0x3f), "EVIOCGABS(0x3f /* ABS_??? */)"); TEST_NULL_ARG_EX(EVIOCSABS(0x3f), "EVIOCSABS(0x3f /* ABS_??? */)"); @@ -118,7 +118,7 @@ Index: strace-4.24/tests/ioctl_evdev.c TEST_NULL_ARG(EVIOCGBIT(EV_ABS, 3)); Index: strace-4.24/xlat/evdev_sync.in =================================================================== ---- strace-4.24.orig/xlat/evdev_sync.in 2019-03-11 12:34:15.719549018 +0100 +--- strace-4.24.orig/xlat/evdev_sync.in 2020-01-27 17:13:39.441001784 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -#value_indexed @@ -128,8 +128,8 @@ Index: strace-4.24/xlat/evdev_sync.in -SYN_DROPPED 3 Index: strace-4.24/xlat/evdev_ev.h =================================================================== ---- strace-4.24.orig/xlat/evdev_ev.h 2018-08-14 02:44:11.000000000 +0200 -+++ strace-4.24/xlat/evdev_ev.h 2019-03-11 12:48:32.390670458 +0100 +--- strace-4.24.orig/xlat/evdev_ev.h 2020-01-27 17:13:39.441001784 +0100 ++++ strace-4.24/xlat/evdev_ev.h 2020-01-27 17:14:03.155778447 +0100 @@ -90,13 +90,8 @@ #ifndef XLAT_MACROS_ONLY @@ -145,3 +145,29 @@ Index: strace-4.24/xlat/evdev_ev.h const struct xlat evdev_ev[] = { XLAT(EV_SYN), XLAT(EV_KEY), +Index: strace-4.24/tests-m32/ioctl_evdev.c +=================================================================== +--- strace-4.24.orig/tests-m32/ioctl_evdev.c 2018-06-14 13:00:00.000000000 +0200 ++++ strace-4.24/tests-m32/ioctl_evdev.c 2020-01-27 17:14:28.812536821 +0100 +@@ -138,7 +138,7 @@ + TEST_NULL_ARG_EX(EVIOCGABS(0x3f), "EVIOCGABS(0x3f /* ABS_??? */)"); + TEST_NULL_ARG_EX(EVIOCSABS(0x3f), "EVIOCSABS(0x3f /* ABS_??? */)"); + +- TEST_NULL_ARG(EVIOCGBIT(EV_SYN, 0)); ++ TEST_NULL_ARG(EVIOCGBIT(0, 0)); + TEST_NULL_ARG(EVIOCGBIT(EV_KEY, 1)); + TEST_NULL_ARG(EVIOCGBIT(EV_REL, 2)); + TEST_NULL_ARG(EVIOCGBIT(EV_ABS, 3)); +Index: strace-4.24/tests-mx32/ioctl_evdev.c +=================================================================== +--- strace-4.24.orig/tests-mx32/ioctl_evdev.c 2018-06-14 13:00:00.000000000 +0200 ++++ strace-4.24/tests-mx32/ioctl_evdev.c 2020-01-27 17:14:31.013516093 +0100 +@@ -138,7 +138,7 @@ + TEST_NULL_ARG_EX(EVIOCGABS(0x3f), "EVIOCGABS(0x3f /* ABS_??? */)"); + TEST_NULL_ARG_EX(EVIOCSABS(0x3f), "EVIOCSABS(0x3f /* ABS_??? */)"); + +- TEST_NULL_ARG(EVIOCGBIT(EV_SYN, 0)); ++ TEST_NULL_ARG(EVIOCGBIT(0, 0)); + TEST_NULL_ARG(EVIOCGBIT(EV_KEY, 1)); + TEST_NULL_ARG(EVIOCGBIT(EV_REL, 2)); + TEST_NULL_ARG(EVIOCGBIT(EV_ABS, 3)); diff --git a/SOURCES/0025-tests-check-tracing-of-looping-threads.patch b/SOURCES/0025-tests-check-tracing-of-looping-threads.patch index 5c86420..827fa4a 100644 --- a/SOURCES/0025-tests-check-tracing-of-looping-threads.patch +++ b/SOURCES/0025-tests-check-tracing-of-looping-threads.patch @@ -47,8 +47,8 @@ Additional changes: Index: strace-4.24/tests/Makefile.am =================================================================== ---- strace-4.24.orig/tests/Makefile.am 2019-03-10 05:50:05.488993755 +0100 -+++ strace-4.24/tests/Makefile.am 2019-03-10 06:01:56.696871947 +0100 +--- strace-4.24.orig/tests/Makefile.am 2020-01-27 17:41:26.653586903 +0100 ++++ strace-4.24/tests/Makefile.am 2020-01-27 20:17:51.315382082 +0100 @@ -108,6 +108,7 @@ ksysent \ list_sigaction_signum \ @@ -86,7 +86,7 @@ Index: strace-4.24/tests/Makefile.am Index: strace-4.24/tests/looping_threads.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ strace-4.24/tests/looping_threads.c 2019-03-10 06:01:56.697871937 +0100 ++++ strace-4.24/tests/looping_threads.c 2020-01-27 17:41:26.671586776 +0100 @@ -0,0 +1,121 @@ +/* + * Check tracing of looping threads. @@ -212,7 +212,7 @@ Index: strace-4.24/tests/looping_threads.c Index: strace-4.24/tests/looping_threads.test =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ strace-4.24/tests/looping_threads.test 2019-03-10 06:01:56.697871937 +0100 ++++ strace-4.24/tests/looping_threads.test 2020-01-27 17:41:26.671586776 +0100 @@ -0,0 +1,38 @@ +#!/bin/sh +# @@ -255,7 +255,7 @@ Index: strace-4.24/tests/looping_threads.test Index: strace-4.24/tests-m32/looping_threads.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ strace-4.24/tests-m32/looping_threads.c 2019-03-10 06:02:29.984538615 +0100 ++++ strace-4.24/tests-m32/looping_threads.c 2020-01-27 17:41:26.671586776 +0100 @@ -0,0 +1,121 @@ +/* + * Check tracing of looping threads. @@ -381,7 +381,7 @@ Index: strace-4.24/tests-m32/looping_threads.c Index: strace-4.24/tests-mx32/looping_threads.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ strace-4.24/tests-mx32/looping_threads.c 2019-03-10 06:02:32.320515223 +0100 ++++ strace-4.24/tests-mx32/looping_threads.c 2020-01-27 17:41:26.671586776 +0100 @@ -0,0 +1,121 @@ +/* + * Check tracing of looping threads. @@ -506,8 +506,8 @@ Index: strace-4.24/tests-mx32/looping_threads.c +} Index: strace-4.24/tests/Makefile.in =================================================================== ---- strace-4.24.orig/tests/Makefile.in 2019-03-10 05:56:10.763336015 +0100 -+++ strace-4.24/tests/Makefile.in 2019-03-10 06:05:55.655479092 +0100 +--- strace-4.24.orig/tests/Makefile.in 2020-01-27 17:41:26.655586889 +0100 ++++ strace-4.24/tests/Makefile.in 2020-01-27 20:17:47.817414191 +0100 @@ -155,7 +155,7 @@ ioctl_perf-success$(EXEEXT) ioctl_rtc-v$(EXEEXT) \ is_linux_mips_n64$(EXEEXT) kill_child$(EXEEXT) \ @@ -600,8 +600,8 @@ Index: strace-4.24/tests/Makefile.in @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lstat64-lstat64.Po@am__quote@ Index: strace-4.24/tests-m32/Makefile.in =================================================================== ---- strace-4.24.orig/tests-m32/Makefile.in 2019-03-10 05:57:09.322749620 +0100 -+++ strace-4.24/tests-m32/Makefile.in 2019-03-10 06:06:47.107963863 +0100 +--- strace-4.24.orig/tests-m32/Makefile.in 2020-01-27 17:41:26.657586875 +0100 ++++ strace-4.24/tests-m32/Makefile.in 2020-01-27 20:17:47.817414191 +0100 @@ -155,7 +155,7 @@ ioctl_perf-success$(EXEEXT) ioctl_rtc-v$(EXEEXT) \ is_linux_mips_n64$(EXEEXT) kill_child$(EXEEXT) \ @@ -694,8 +694,8 @@ Index: strace-4.24/tests-m32/Makefile.in @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lstat64-lstat64.Po@am__quote@ Index: strace-4.24/tests-mx32/Makefile.in =================================================================== ---- strace-4.24.orig/tests-mx32/Makefile.in 2019-03-10 05:57:19.939643305 +0100 -+++ strace-4.24/tests-mx32/Makefile.in 2019-03-10 06:06:42.992005079 +0100 +--- strace-4.24.orig/tests-mx32/Makefile.in 2020-01-27 17:41:26.658586868 +0100 ++++ strace-4.24/tests-mx32/Makefile.in 2020-01-27 20:17:47.817414191 +0100 @@ -155,7 +155,7 @@ ioctl_perf-success$(EXEEXT) ioctl_rtc-v$(EXEEXT) \ is_linux_mips_n64$(EXEEXT) kill_child$(EXEEXT) \ @@ -786,3 +786,89 @@ Index: strace-4.24/tests-mx32/Makefile.in @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lseek.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lstat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lstat64-lstat64.Po@am__quote@ +Index: strace-4.24/tests-m32/looping_threads.test +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests-m32/looping_threads.test 2020-01-27 20:18:24.992072957 +0100 +@@ -0,0 +1,38 @@ ++#!/bin/sh ++# ++# Check tracing of looping threads. ++# ++# Copyright (c) 2009-2019 The strace developers. ++# All rights reserved. ++# ++# SPDX-License-Identifier: GPL-2.0-or-later ++ ++. "${srcdir=.}/init.sh" ++. "${srcdir=.}/PTRACE_SEIZE.sh" ++ ++run_prog ../orphaned_process_group > /dev/null ++ ++run_prog_skip_if_failed date +%s > /dev/null ++s0="$(date +%s)" ++ ++check_prog nproc ++inc="$(nproc)" ++[ "$inc" -ge 1 ] || inc=1 ++ ++timeout_2="$(($TIMEOUT_DURATION/2))" ++timeout_8="$(($TIMEOUT_DURATION/8))" ++nproc=1 ++ ++run_prog "../$NAME" "$timeout_8" "$nproc" ++ ++while :; do ++ run_strace -f -qq -enone -esignal=none "../$NAME" "$timeout_2" "$nproc" ++ ++ s1="$(date +%s)" ++ [ "$(($s1-$s0))" -lt "$timeout_8" ] || ++ break ++ ++ nproc="$(($nproc+$inc))" ++done ++ ++warn_ "$ME_: nproc=$nproc elapsed=$(($s1-$s0))" +Index: strace-4.24/tests-mx32/looping_threads.test +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests-mx32/looping_threads.test 2020-01-27 20:18:26.879055636 +0100 +@@ -0,0 +1,38 @@ ++#!/bin/sh ++# ++# Check tracing of looping threads. ++# ++# Copyright (c) 2009-2019 The strace developers. ++# All rights reserved. ++# ++# SPDX-License-Identifier: GPL-2.0-or-later ++ ++. "${srcdir=.}/init.sh" ++. "${srcdir=.}/PTRACE_SEIZE.sh" ++ ++run_prog ../orphaned_process_group > /dev/null ++ ++run_prog_skip_if_failed date +%s > /dev/null ++s0="$(date +%s)" ++ ++check_prog nproc ++inc="$(nproc)" ++[ "$inc" -ge 1 ] || inc=1 ++ ++timeout_2="$(($TIMEOUT_DURATION/2))" ++timeout_8="$(($TIMEOUT_DURATION/8))" ++nproc=1 ++ ++run_prog "../$NAME" "$timeout_8" "$nproc" ++ ++while :; do ++ run_strace -f -qq -enone -esignal=none "../$NAME" "$timeout_2" "$nproc" ++ ++ s1="$(date +%s)" ++ [ "$(($s1-$s0))" -lt "$timeout_8" ] || ++ break ++ ++ nproc="$(($nproc+$inc))" ++done ++ ++warn_ "$ME_: nproc=$nproc elapsed=$(($s1-$s0))" diff --git a/SOURCES/0028-Wire-up-rseq-syscall-on-architectures-that-use-gener.patch b/SOURCES/0028-Wire-up-rseq-syscall-on-architectures-that-use-gener.patch deleted file mode 100644 index d53e2e5..0000000 --- a/SOURCES/0028-Wire-up-rseq-syscall-on-architectures-that-use-gener.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 0b051a218d5e7e51677c26c691dcf619a7d894e9 Mon Sep 17 00:00:00 2001 -From: "Dmitry V. Levin" -Date: Mon, 11 Feb 2019 23:35:07 +0000 -Subject: [PATCH] Wire up rseq syscall on architectures that use generic - unistd.h - -* linux/32/syscallent.h [293]: Wire up rseq syscall introduced by linux -commit v4.19-rc1~109^2~47. -* linux/64/syscallent.h [293]: Likewise. -* NEWS: Mention this. ---- - NEWS | 2 ++ - linux/32/syscallent.h | 1 + - linux/64/syscallent.h | 1 + - 3 files changed, 4 insertions(+) - -Index: strace-4.24/linux/32/syscallent.h -=================================================================== ---- strace-4.24.orig/linux/32/syscallent.h 2019-06-13 01:05:32.297055881 +0200 -+++ strace-4.24/linux/32/syscallent.h 2019-06-13 01:05:42.887824722 +0200 -@@ -283,6 +283,7 @@ - [290] = { 1, 0, SEN(pkey_free), "pkey_free" }, - [291] = { 5, TD|TF|TSTA, SEN(statx), "statx" }, - [292] = { 6, 0, SEN(io_pgetevents), "io_pgetevents" }, -+[293] = { 4, 0, SEN(rseq), "rseq" }, - - #undef sys_ARCH_mmap - #undef ARCH_WANT_SYNC_FILE_RANGE2 -Index: strace-4.24/linux/64/syscallent.h -=================================================================== ---- strace-4.24.orig/linux/64/syscallent.h 2019-06-13 01:05:32.297055881 +0200 -+++ strace-4.24/linux/64/syscallent.h 2019-06-13 01:05:42.888824700 +0200 -@@ -276,3 +276,4 @@ - [290] = { 1, 0, SEN(pkey_free), "pkey_free" }, - [291] = { 5, TD|TF|TSTA, SEN(statx), "statx" }, - [292] = { 6, 0, SEN(io_pgetevents), "io_pgetevents" }, -+[293] = { 4, 0, SEN(rseq), "rseq" }, diff --git a/SOURCES/0028-macros-add-ROUNDUP-macro.patch b/SOURCES/0028-macros-add-ROUNDUP-macro.patch new file mode 100644 index 0000000..41d0c08 --- /dev/null +++ b/SOURCES/0028-macros-add-ROUNDUP-macro.patch @@ -0,0 +1,25 @@ +From cbbf708b4d2f8a66b07cf805f82edbe892c0bbf7 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Sun, 2 Sep 2018 18:15:40 +0200 +Subject: [PATCH] macros: add ROUNDUP macro + +* macros.h (ROUNDUP): New macro. +--- + macros.h | 4 ++++ + 1 file changed, 4 insertions(+) + +Index: strace-4.24/macros.h +=================================================================== +--- strace-4.24.orig/macros.h 2019-08-01 18:40:47.322659137 +0200 ++++ strace-4.24/macros.h 2019-08-01 19:49:00.405972298 +0200 +@@ -28,6 +28,10 @@ + #endif + #define CLAMP(val, min, max) MIN(MAX(min, val), max) + ++#ifndef ROUNDUP ++# define ROUNDUP(val_, div_) ((((val_) + (div_) - 1) / (div_)) * (div_)) ++#endif ++ + #ifndef offsetofend + # define offsetofend(type_, member_) \ + (offsetof(type_, member_) + sizeof(((type_ *)0)->member_)) diff --git a/SOURCES/0029-Wire-up-kexec_file_load-syscall-on-architectures-tha.patch b/SOURCES/0029-Wire-up-kexec_file_load-syscall-on-architectures-tha.patch deleted file mode 100644 index 3bf9c97..0000000 --- a/SOURCES/0029-Wire-up-kexec_file_load-syscall-on-architectures-tha.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 898f0ad0bc498c45734bc95917b74cfdc6466c26 Mon Sep 17 00:00:00 2001 -From: "Dmitry V. Levin" -Date: Mon, 11 Feb 2019 23:35:07 +0000 -Subject: [PATCH] Wire up kexec_file_load syscall on architectures that use - generic unistd.h - -* linux/32/syscallent.h [294]: Wire up kexec_file_load syscall -introduced by linux commit v5.0-rc1~35^2~41^2~15. -* linux/64/syscallent.h [294]: Likewise. -* NEWS: Mention this. - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1676045 ---- - NEWS | 2 +- - linux/32/syscallent.h | 1 + - linux/64/syscallent.h | 1 + - 3 files changed, 3 insertions(+), 1 deletion(-) - -Index: strace-4.24/linux/32/syscallent.h -=================================================================== ---- strace-4.24.orig/linux/32/syscallent.h 2019-06-13 01:05:42.887824722 +0200 -+++ strace-4.24/linux/32/syscallent.h 2019-06-13 01:06:00.405442367 +0200 -@@ -284,6 +284,7 @@ - [291] = { 5, TD|TF|TSTA, SEN(statx), "statx" }, - [292] = { 6, 0, SEN(io_pgetevents), "io_pgetevents" }, - [293] = { 4, 0, SEN(rseq), "rseq" }, -+[294] = { 5, TD, SEN(kexec_file_load), "kexec_file_load" }, - - #undef sys_ARCH_mmap - #undef ARCH_WANT_SYNC_FILE_RANGE2 -Index: strace-4.24/linux/64/syscallent.h -=================================================================== ---- strace-4.24.orig/linux/64/syscallent.h 2019-06-13 01:05:42.888824700 +0200 -+++ strace-4.24/linux/64/syscallent.h 2019-06-13 01:06:00.405442367 +0200 -@@ -277,3 +277,4 @@ - [291] = { 5, TD|TF|TSTA, SEN(statx), "statx" }, - [292] = { 6, 0, SEN(io_pgetevents), "io_pgetevents" }, - [293] = { 4, 0, SEN(rseq), "rseq" }, -+[294] = { 5, TD, SEN(kexec_file_load), "kexec_file_load" }, diff --git a/SOURCES/0029-util-update-dumpstr.patch b/SOURCES/0029-util-update-dumpstr.patch new file mode 100644 index 0000000..a4f38eb --- /dev/null +++ b/SOURCES/0029-util-update-dumpstr.patch @@ -0,0 +1,49 @@ +From 79acbcf2550f3a55108240558efb8b9c36eb8399 Mon Sep 17 00:00:00 2001 +From: Eugene Syromyatnikov +Date: Tue, 19 Feb 2019 03:10:11 +0100 +Subject: [PATCH] util: update dumpstr + +Use a buffer of a limited size, use proper type for dump amount, avoid +hard-coding of byte counts, calculate output buffer size more accurately +and minimise its rewriting, pad offset with zeros in accordance +with expected output amount. + +* defs.h (dumpstr): Change the type of len argument from int to +kernel_ulong_t. +* macros.h (ROUNDUP_DIV): New macro. +(ROUNDUP): Rewrite using ROUNDUP_DIV. +* util.c (ILOG2_ITER_): New macro. +(ilog2_64, ilog2_32): New functions. +(ilog2_klong): New macro, wrapper around ilog2_32/ilog2_64, so (potentially +more expensive) ilog2_64 is not used for ilog2 calculation +of a kernel_ulong_t-typed variable on architectures with 32-bit kernel long. +(dumpstr): Update. + +Co-Authored-by: Dmitry V. Levin +--- + defs.h | 2 +- + macros.h | 6 +- + util.c | 205 ++++++++++++++++++++++++++++++++++++++++++++++++++------------- + 3 files changed, 169 insertions(+), 44 deletions(-) + +diff --git a/macros.h b/macros.h +index 7f019480..61abf826 100644 +--- a/macros.h ++++ b/macros.h +@@ -28,8 +28,12 @@ + #endif + #define CLAMP(val, min, max) MIN(MAX(min, val), max) + ++#ifndef ROUNDUP_DIV ++# define ROUNDUP_DIV(val_, div_) (((val_) + (div_) - 1) / (div_)) ++#endif ++ + #ifndef ROUNDUP +-# define ROUNDUP(val_, div_) ((((val_) + (div_) - 1) / (div_)) * (div_)) ++# define ROUNDUP(val_, div_) (ROUNDUP_DIV((val_), (div_)) * (div_)) + #endif + + #ifndef offsetofend +-- +2.13.6 + 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/0030-limit-qual_fault-test-on-aarch64.patch b/SOURCES/0030-limit-qual_fault-test-on-aarch64.patch deleted file mode 100644 index 49c2e90..0000000 --- a/SOURCES/0030-limit-qual_fault-test-on-aarch64.patch +++ /dev/null @@ -1,42 +0,0 @@ -Limit the scope of qual_fault.tests on aarch64 as otherwise it takes -unacceptable amount of time on available builders (more than an hour). -Index: strace-4.24/tests/qual_fault.test -=================================================================== ---- strace-4.24.orig/tests/qual_fault.test 2019-06-13 17:37:10.708269613 +0200 -+++ strace-4.24/tests/qual_fault.test 2019-06-13 17:41:29.358829506 +0200 -@@ -75,18 +75,32 @@ - done - } - --for err in '' ENOSYS 22 einval; do -+ -+case "$STRACE_ARCH" in -+ aarch64) -+ NUMBERS1='2' -+ NUMBERS2='3' -+ ERRS='EnoSys 22' -+ ;; -+ *) -+ ERRS='ENOSYS 22 einval' -+ NUMBERS1='1 2 3 5 7 11' -+ NUMBERS2='1 2 3 5 7 11' -+ ;; -+esac -+ -+for err in '' $(echo $ERRS); do - for fault in writev desc,51; do - check_fault_injection \ - writev $fault "$err" '' '' 1 -efault=chdir - check_fault_injection \ - writev $fault "$err" '' '' 1 -efault=chdir -efault=none -- for F in 1 2 3 5 7 11; do -+ for F in $(echo $NUMBERS1); do - check_fault_injection \ - writev $fault "$err" $F '' 1 - check_fault_injection \ - writev $fault "$err" $F + 1 -- for S in 1 2 3 5 7 11; do -+ for S in $(echo $NUMBERS2); do - check_fault_injection \ - writev $fault "$err" $F $S 1 - check_fault_injection \ diff --git a/SOURCES/0031-avoid-zero-length-VLA-in-evdev_c.patch b/SOURCES/0031-avoid-zero-length-VLA-in-evdev_c.patch deleted file mode 100644 index a5141e7..0000000 --- a/SOURCES/0031-avoid-zero-length-VLA-in-evdev_c.patch +++ /dev/null @@ -1,62 +0,0 @@ -Index: strace-4.24/evdev.c -=================================================================== ---- strace-4.24.orig/evdev.c 2019-06-13 23:42:43.294304862 +0200 -+++ strace-4.24/evdev.c 2019-06-13 23:43:35.588294946 +0200 -@@ -143,6 +143,14 @@ - return RVAL_IOCTL_DECODED; - } - -+# ifndef ROUNDUP_DIV -+# define ROUNDUP_DIV(val_, div_) (((val_) + (div_) - 1) / (div_)) -+# endif -+ -+# ifndef ROUNDUP -+# define ROUNDUP(val_, div_) (ROUNDUP_DIV((val_), (div_)) * (div_)) -+# endif -+ - static int - decode_bitset_(struct tcb *const tcp, const kernel_ulong_t arg, - const struct xlat decode_nr[], const unsigned int max_nr, -@@ -151,25 +159,36 @@ - tprints(", "); - - unsigned int size; -- if ((kernel_ulong_t) tcp->u_rval > max_nr / 8) -- size = max_nr; -+ unsigned int size_bits; -+ -+ if ((kernel_ulong_t) tcp->u_rval > max_nr / CHAR_BIT) -+ size_bits = max_nr; - else -- size = tcp->u_rval * 8; -+ size_bits = tcp->u_rval * CHAR_BIT; -+ -+ size = ROUNDUP(ROUNDUP_DIV(size_bits, CHAR_BIT), current_wordsize); -+ -+ if (syserror(tcp) || !size) { -+ printaddr(arg); -+ -+ return RVAL_IOCTL_DECODED; -+ } -+ - char decoded_arg[size]; - -- if (umove_or_printaddr(tcp, arg, &decoded_arg)) -+ if (umoven_or_printaddr(tcp, arg, size, decoded_arg)) - return RVAL_IOCTL_DECODED; - - 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; 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/0032-tests-check-decoding-of-successful-evdev-ioctl.patch b/SOURCES/0032-tests-check-decoding-of-successful-evdev-ioctl.patch new file mode 100644 index 0000000..44d5630 --- /dev/null +++ b/SOURCES/0032-tests-check-decoding-of-successful-evdev-ioctl.patch @@ -0,0 +1,1243 @@ +From e286b9cbc0bd542bb441c5acb65fef5f58b71aef Mon Sep 17 00:00:00 2001 +From: Zhibin Li <08826794brmt@gmail.com> +Date: Wed, 1 Aug 2018 17:54:35 +0800 +Subject: [PATCH] tests: check decoding of successful evdev ioctl + +* tests/ioctl_evdev-success.c: New file. +* tests/ioctl_evdev-success-v.c: Likewise. +* tests/ioctl_evdev-success.test: New test. +* tests/ioctl_evdev-success-v.test: Likewise. +* tests/.gitignore: Add ioctl_evdev-success and ioctl_evdev-success-v. +* tests/Makefile.am (check_PROGRAMS): Likewise. +(DECODER_TESTS): Add the two tests mentioned above. + +Skipped files (not present in the tarball): + tests/.gitignore + +Additional changes: + tests/Makefile.in (generated from tests/Makefile.am) + tests-m32/Makefile.am (generated from tests/Makefile.am) + tests-m32/Makefile.in (generated from tests-m32/Makefile.am) + tests-m32/ioctl_evdev-success-v.c (copy of tests/ioctl_evdev-success-v.c) + tests-m32/ioctl_evdev-success-v.test (copy of tests/ioctl_evdev-success-v.test) + tests-m32/ioctl_evdev-success.c (copy of tests/ioctl_evdev-success.c) + tests-m32/ioctl_evdev-success.test (copy of tests/ioctl_evdev-success.test) + tests-mx32/Makefile.am (generated from tests/Makefile.am) + tests-mx32/Makefile.in (generated from tests-mx32/Makefile.am) + tests-mx32/ioctl_evdev-success-v.c (copy of tests/ioctl_evdev-success-v.c) + tests-mx32/ioctl_evdev-success-v.test (copy of tests/ioctl_evdev-success-v.test) + tests-mx32/ioctl_evdev-success.c (copy of tests/ioctl_evdev-success.c) + tests-mx32/ioctl_evdev-success.test (copy of tests/ioctl_evdev-success.test) +--- + tests/.gitignore | 2 + + tests/Makefile.am | 4 + + tests/ioctl_evdev-success-v.c | 2 + + tests/ioctl_evdev-success-v.test | 13 +++ + tests/ioctl_evdev-success.c | 232 +++++++++++++++++++++++++++++++++++++++ + tests/ioctl_evdev-success.test | 13 +++ + 6 files changed, 266 insertions(+) + create mode 100644 tests/ioctl_evdev-success-v.c + create mode 100755 tests/ioctl_evdev-success-v.test + create mode 100644 tests/ioctl_evdev-success.c + create mode 100755 tests/ioctl_evdev-success.test + +Index: strace-4.24/tests/Makefile.am +=================================================================== +--- strace-4.24.orig/tests/Makefile.am 2020-01-27 17:41:26.696586601 +0100 ++++ strace-4.24/tests/Makefile.am 2020-01-27 18:52:08.799318174 +0100 +@@ -98,6 +98,8 @@ + int_0x80 \ + ioctl_dm-v \ + ioctl_evdev-v \ ++ ioctl_evdev-success \ ++ ioctl_evdev-success-v \ + ioctl_loop-nv \ + ioctl_loop-v \ + ioctl_nsfs \ +@@ -231,6 +233,8 @@ + futex.test \ + getuid.test \ + ioctl.test \ ++ ioctl_evdev-success.test \ ++ ioctl_evdev-success-v.test \ + ioctl_perf-success.test \ + ipc_msgbuf.test \ + kern_features-fault.test \ +Index: strace-4.24/tests-m32/Makefile.am +=================================================================== +--- strace-4.24.orig/tests-m32/Makefile.am 2020-01-27 17:13:38.520010457 +0100 ++++ strace-4.24/tests-m32/Makefile.am 2020-01-27 18:52:08.799318174 +0100 +@@ -118,6 +118,8 @@ + int_0x80 \ + ioctl_dm-v \ + ioctl_evdev-v \ ++ ioctl_evdev-success \ ++ ioctl_evdev-success-v \ + ioctl_loop-nv \ + ioctl_loop-v \ + ioctl_nsfs \ +@@ -247,6 +249,8 @@ + futex.test \ + getuid.test \ + ioctl.test \ ++ ioctl_evdev-success.test \ ++ ioctl_evdev-success-v.test \ + ioctl_perf-success.test \ + ipc_msgbuf.test \ + kern_features-fault.test \ +Index: strace-4.24/tests-mx32/Makefile.am +=================================================================== +--- strace-4.24.orig/tests-mx32/Makefile.am 2020-01-27 17:13:38.520010457 +0100 ++++ strace-4.24/tests-mx32/Makefile.am 2020-01-27 18:52:08.799318174 +0100 +@@ -118,6 +118,8 @@ + int_0x80 \ + ioctl_dm-v \ + ioctl_evdev-v \ ++ ioctl_evdev-success \ ++ ioctl_evdev-success-v \ + ioctl_loop-nv \ + ioctl_loop-v \ + ioctl_nsfs \ +@@ -247,6 +249,8 @@ + futex.test \ + getuid.test \ + ioctl.test \ ++ ioctl_evdev-success.test \ ++ ioctl_evdev-success-v.test \ + ioctl_perf-success.test \ + ipc_msgbuf.test \ + kern_features-fault.test \ +Index: strace-4.24/tests/ioctl_evdev-success-v.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests/ioctl_evdev-success-v.c 2020-01-27 17:41:26.745586256 +0100 +@@ -0,0 +1,2 @@ ++#define VERBOSE 1 ++#include "ioctl_evdev-success.c" +Index: strace-4.24/tests-m32/ioctl_evdev-success-v.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests-m32/ioctl_evdev-success-v.c 2020-01-27 17:41:26.745586256 +0100 +@@ -0,0 +1,2 @@ ++#define VERBOSE 1 ++#include "ioctl_evdev-success.c" +Index: strace-4.24/tests-mx32/ioctl_evdev-success-v.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests-mx32/ioctl_evdev-success-v.c 2020-01-27 17:41:26.745586256 +0100 +@@ -0,0 +1,2 @@ ++#define VERBOSE 1 ++#include "ioctl_evdev-success.c" +Index: strace-4.24/tests/ioctl_evdev-success-v.test +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests/ioctl_evdev-success-v.test 2020-01-27 18:52:13.048280185 +0100 +@@ -0,0 +1,13 @@ ++#!/bin/sh -efu ++ ++. "${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" +Index: strace-4.24/tests-m32/ioctl_evdev-success-v.test +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests-m32/ioctl_evdev-success-v.test 2020-01-27 18:52:13.048280185 +0100 +@@ -0,0 +1,13 @@ ++#!/bin/sh -efu ++ ++. "${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" +Index: strace-4.24/tests-mx32/ioctl_evdev-success-v.test +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests-mx32/ioctl_evdev-success-v.test 2020-01-27 18:52:13.048280185 +0100 +@@ -0,0 +1,13 @@ ++#!/bin/sh -efu ++ ++. "${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" +Index: strace-4.24/tests/ioctl_evdev-success.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests/ioctl_evdev-success.c 2020-01-27 18:52:13.048280185 +0100 +@@ -0,0 +1,232 @@ ++#include "tests.h" ++ ++#ifdef HAVE_LINUX_INPUT_H ++ ++# include ++# include ++# include ++# include ++# include ++# include "print_fields.h" ++ ++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); ++}; ++ ++static long ++invoke_test_syscall(unsigned long cmd, void *p) ++{ ++ long rc = ioctl(-1, cmd, p); ++ errstr = sprintrc(rc); ++ static char inj_errstr[4096]; ++ ++ snprintf(inj_errstr, sizeof(inj_errstr), "%s (INJECTED)", errstr); ++ errstr = inj_errstr; ++ return rc; ++} ++ ++static void ++test_evdev(struct evdev_check *check, void *arg) ++{ ++ long rc = invoke_test_syscall(check->cmd, check->arg_ptr); ++ printf("ioctl(-1, %s, ", check->cmd_str); ++ if (check->print_arg) ++ check->print_arg(rc, check->arg_ptr, arg); ++ else ++ printf("%p", check->arg_ptr); ++ printf(") = %s\n", errstr); ++} ++ ++static void ++print_input_absinfo(long rc, void *ptr, void *arg) ++{ ++ struct input_absinfo *absinfo = ptr; ++ ++ if (rc < 0) { ++ printf("%p", absinfo); ++ return; ++ } ++ PRINT_FIELD_U("{", *absinfo, value); ++ PRINT_FIELD_U(", ", *absinfo, minimum); ++# if VERBOSE ++ PRINT_FIELD_U(", ", *absinfo, maximum); ++ PRINT_FIELD_U(", ", *absinfo, fuzz); ++ PRINT_FIELD_U(", ", *absinfo, flat); ++# ifdef HAVE_STRUCT_INPUT_ABSINFO_RESOLUTION ++ PRINT_FIELD_U(", ", *absinfo, resolution); ++# endif ++# else ++ printf(", ..."); ++# endif ++ printf("}"); ++} ++ ++static void ++print_input_id(long rc, void *ptr, void *arg) ++{ ++ struct input_id *id = ptr; ++ ++ if (rc < 0) { ++ printf("%p", id); ++ return; ++ } ++ printf("{ID_BUS=%" PRIu16 ++ ", ID_VENDOR=%" PRIu16 ++ ", ID_PRODUCT=%" PRIu16 ++ ", ID_VERSION=%" PRIu16 "}", ++ id->bustype, id->vendor, id->product, id->version); ++} ++ ++# ifdef EVIOCGMTSLOTS ++static void ++print_mtslots(long rc, void *ptr, void *arg) ++{ ++ int *buffer = ptr; ++ const char **str = arg; ++ int num = atoi(*(str + 1)); ++ ++ if (rc < 0) { ++ printf("%p", buffer); ++ return; ++ } ++ ++ printf("{code=%s", *str); ++ printf(", values=["); ++ for (unsigned int i = 1; i <= (unsigned) num; i++) ++ printf("%s%s", i > 1 ? ", " : "", *(str + i + 1)); ++ printf("]}"); ++} ++# endif ++ ++static void ++print_getbit(long rc, void *ptr, void *arg) ++{ ++ const char **str = arg; ++ int num = atoi(*str); ++ ++ if (rc < 0) { ++ printf("%p", ptr); ++ return; ++ } ++ ++ printf("["); ++ printf("%s", *(str + 1)); ++ for (unsigned int i = 2; i <= (unsigned) num; i++) { ++# if ! VERBOSE ++ if (i > 4) { ++ printf(", ..."); ++ break; ++ } ++# endif ++ printf(", "); ++ printf("%s", *(str + i)); ++ } ++ printf("]"); ++} ++ ++int ++main(int argc, char **argv) ++{ ++ unsigned long num_skip; ++ long inject_retval; ++ bool locked = false; ++ ++ if (argc == 1) ++ return 0; ++ ++ if (argc < 3) ++ error_msg_and_fail("Usage: %s NUM_SKIP INJECT_RETVAL", argv[0]); ++ ++ num_skip = strtoul(argv[1], NULL, 0); ++ inject_retval = strtol(argv[2], NULL, 0); ++ ++ if (inject_retval < 0) ++ error_msg_and_fail("Expected non-negative INJECT_RETVAL, " ++ "but got %ld", inject_retval); ++ ++ for (unsigned int i = 0; i < num_skip; i++) { ++ long rc = ioctl(-1, EVIOCGID, NULL); ++ printf("ioctl(-1, EVIOCGID, NULL) = %s%s\n", ++ sprintrc(rc), ++ rc == inject_retval ? " (INJECTED)" : ""); ++ ++ if (rc != inject_retval) ++ continue; ++ ++ locked = true; ++ break; ++ } ++ ++ if (!locked) ++ error_msg_and_fail("Hasn't locked on ioctl(-1" ++ ", EVIOCGID, NULL) returning %lu", ++ inject_retval); ++ ++ 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 */ ++ /* mtslots_str[1] is "2" so the number of values is 2 */ ++ const char *mtslots_str[] = { "ABS_MT_SLOT", "2", "1", "3" }; ++ ++ /* invalid flag */ ++ int invalid_mtslot[] = { -1, 1 }; ++ char invalid_str[4096]; ++ snprintf(invalid_str, sizeof(invalid_str), "%#x /* ABS_MT_??? */", invalid_mtslot[0]); ++ const char *invalid_mtslot_str[] = { invalid_str, "1", "1" }; ++# endif ++ ++ /* 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" }; ++ ++ /* 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" }; ++ ++ /* set zero bit */ ++ unsigned long ev_zero[] = { 0x0 }; ++ const char *ev_zero_str[] = { "0", " 0 " }; ++ ++ /* 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" }; ++ ++ struct { ++ struct evdev_check check; ++ 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_zero, print_getbit }, &ev_zero_str }, ++ { { ARG_STR(EVIOCGBIT(EV_KEY, 0)), key, print_getbit }, &key_str}, ++# ifdef EVIOCGMTSLOTS ++ { { ARG_STR(EVIOCGMTSLOTS(12)), mtslots, print_mtslots }, &mtslots_str }, ++ { { ARG_STR(EVIOCGMTSLOTS(8)), invalid_mtslot, print_mtslots }, &invalid_mtslot_str } ++# endif ++ }; ++ for (unsigned int i = 0; i < ARRAY_SIZE(a); i++) { ++ test_evdev(&a[i].check, a[i].ptr); ++ } ++ ++ puts("+++ exited with 0 +++"); ++ return 0; ++} ++#else ++ ++SKIP_MAIN_UNDEFINED("HAVE_LINUX_INPUT_H") ++ ++#endif +Index: strace-4.24/tests-m32/ioctl_evdev-success.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests-m32/ioctl_evdev-success.c 2020-01-27 18:52:13.048280185 +0100 +@@ -0,0 +1,232 @@ ++#include "tests.h" ++ ++#ifdef HAVE_LINUX_INPUT_H ++ ++# include ++# include ++# include ++# include ++# include ++# include "print_fields.h" ++ ++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); ++}; ++ ++static long ++invoke_test_syscall(unsigned long cmd, void *p) ++{ ++ long rc = ioctl(-1, cmd, p); ++ errstr = sprintrc(rc); ++ static char inj_errstr[4096]; ++ ++ snprintf(inj_errstr, sizeof(inj_errstr), "%s (INJECTED)", errstr); ++ errstr = inj_errstr; ++ return rc; ++} ++ ++static void ++test_evdev(struct evdev_check *check, void *arg) ++{ ++ long rc = invoke_test_syscall(check->cmd, check->arg_ptr); ++ printf("ioctl(-1, %s, ", check->cmd_str); ++ if (check->print_arg) ++ check->print_arg(rc, check->arg_ptr, arg); ++ else ++ printf("%p", check->arg_ptr); ++ printf(") = %s\n", errstr); ++} ++ ++static void ++print_input_absinfo(long rc, void *ptr, void *arg) ++{ ++ struct input_absinfo *absinfo = ptr; ++ ++ if (rc < 0) { ++ printf("%p", absinfo); ++ return; ++ } ++ PRINT_FIELD_U("{", *absinfo, value); ++ PRINT_FIELD_U(", ", *absinfo, minimum); ++# if VERBOSE ++ PRINT_FIELD_U(", ", *absinfo, maximum); ++ PRINT_FIELD_U(", ", *absinfo, fuzz); ++ PRINT_FIELD_U(", ", *absinfo, flat); ++# ifdef HAVE_STRUCT_INPUT_ABSINFO_RESOLUTION ++ PRINT_FIELD_U(", ", *absinfo, resolution); ++# endif ++# else ++ printf(", ..."); ++# endif ++ printf("}"); ++} ++ ++static void ++print_input_id(long rc, void *ptr, void *arg) ++{ ++ struct input_id *id = ptr; ++ ++ if (rc < 0) { ++ printf("%p", id); ++ return; ++ } ++ printf("{ID_BUS=%" PRIu16 ++ ", ID_VENDOR=%" PRIu16 ++ ", ID_PRODUCT=%" PRIu16 ++ ", ID_VERSION=%" PRIu16 "}", ++ id->bustype, id->vendor, id->product, id->version); ++} ++ ++# ifdef EVIOCGMTSLOTS ++static void ++print_mtslots(long rc, void *ptr, void *arg) ++{ ++ int *buffer = ptr; ++ const char **str = arg; ++ int num = atoi(*(str + 1)); ++ ++ if (rc < 0) { ++ printf("%p", buffer); ++ return; ++ } ++ ++ printf("{code=%s", *str); ++ printf(", values=["); ++ for (unsigned int i = 1; i <= (unsigned) num; i++) ++ printf("%s%s", i > 1 ? ", " : "", *(str + i + 1)); ++ printf("]}"); ++} ++# endif ++ ++static void ++print_getbit(long rc, void *ptr, void *arg) ++{ ++ const char **str = arg; ++ int num = atoi(*str); ++ ++ if (rc < 0) { ++ printf("%p", ptr); ++ return; ++ } ++ ++ printf("["); ++ printf("%s", *(str + 1)); ++ for (unsigned int i = 2; i <= (unsigned) num; i++) { ++# if ! VERBOSE ++ if (i > 4) { ++ printf(", ..."); ++ break; ++ } ++# endif ++ printf(", "); ++ printf("%s", *(str + i)); ++ } ++ printf("]"); ++} ++ ++int ++main(int argc, char **argv) ++{ ++ unsigned long num_skip; ++ long inject_retval; ++ bool locked = false; ++ ++ if (argc == 1) ++ return 0; ++ ++ if (argc < 3) ++ error_msg_and_fail("Usage: %s NUM_SKIP INJECT_RETVAL", argv[0]); ++ ++ num_skip = strtoul(argv[1], NULL, 0); ++ inject_retval = strtol(argv[2], NULL, 0); ++ ++ if (inject_retval < 0) ++ error_msg_and_fail("Expected non-negative INJECT_RETVAL, " ++ "but got %ld", inject_retval); ++ ++ for (unsigned int i = 0; i < num_skip; i++) { ++ long rc = ioctl(-1, EVIOCGID, NULL); ++ printf("ioctl(-1, EVIOCGID, NULL) = %s%s\n", ++ sprintrc(rc), ++ rc == inject_retval ? " (INJECTED)" : ""); ++ ++ if (rc != inject_retval) ++ continue; ++ ++ locked = true; ++ break; ++ } ++ ++ if (!locked) ++ error_msg_and_fail("Hasn't locked on ioctl(-1" ++ ", EVIOCGID, NULL) returning %lu", ++ inject_retval); ++ ++ 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 */ ++ /* mtslots_str[1] is "2" so the number of values is 2 */ ++ const char *mtslots_str[] = { "ABS_MT_SLOT", "2", "1", "3" }; ++ ++ /* invalid flag */ ++ int invalid_mtslot[] = { -1, 1 }; ++ char invalid_str[4096]; ++ snprintf(invalid_str, sizeof(invalid_str), "%#x /* ABS_MT_??? */", invalid_mtslot[0]); ++ const char *invalid_mtslot_str[] = { invalid_str, "1", "1" }; ++# endif ++ ++ /* 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" }; ++ ++ /* 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" }; ++ ++ /* set zero bit */ ++ unsigned long ev_zero[] = { 0x0 }; ++ const char *ev_zero_str[] = { "0", " 0 " }; ++ ++ /* 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" }; ++ ++ struct { ++ struct evdev_check check; ++ 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_zero, print_getbit }, &ev_zero_str }, ++ { { ARG_STR(EVIOCGBIT(EV_KEY, 0)), key, print_getbit }, &key_str}, ++# ifdef EVIOCGMTSLOTS ++ { { ARG_STR(EVIOCGMTSLOTS(12)), mtslots, print_mtslots }, &mtslots_str }, ++ { { ARG_STR(EVIOCGMTSLOTS(8)), invalid_mtslot, print_mtslots }, &invalid_mtslot_str } ++# endif ++ }; ++ for (unsigned int i = 0; i < ARRAY_SIZE(a); i++) { ++ test_evdev(&a[i].check, a[i].ptr); ++ } ++ ++ puts("+++ exited with 0 +++"); ++ return 0; ++} ++#else ++ ++SKIP_MAIN_UNDEFINED("HAVE_LINUX_INPUT_H") ++ ++#endif +Index: strace-4.24/tests-mx32/ioctl_evdev-success.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests-mx32/ioctl_evdev-success.c 2020-01-27 18:52:13.048280185 +0100 +@@ -0,0 +1,232 @@ ++#include "tests.h" ++ ++#ifdef HAVE_LINUX_INPUT_H ++ ++# include ++# include ++# include ++# include ++# include ++# include "print_fields.h" ++ ++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); ++}; ++ ++static long ++invoke_test_syscall(unsigned long cmd, void *p) ++{ ++ long rc = ioctl(-1, cmd, p); ++ errstr = sprintrc(rc); ++ static char inj_errstr[4096]; ++ ++ snprintf(inj_errstr, sizeof(inj_errstr), "%s (INJECTED)", errstr); ++ errstr = inj_errstr; ++ return rc; ++} ++ ++static void ++test_evdev(struct evdev_check *check, void *arg) ++{ ++ long rc = invoke_test_syscall(check->cmd, check->arg_ptr); ++ printf("ioctl(-1, %s, ", check->cmd_str); ++ if (check->print_arg) ++ check->print_arg(rc, check->arg_ptr, arg); ++ else ++ printf("%p", check->arg_ptr); ++ printf(") = %s\n", errstr); ++} ++ ++static void ++print_input_absinfo(long rc, void *ptr, void *arg) ++{ ++ struct input_absinfo *absinfo = ptr; ++ ++ if (rc < 0) { ++ printf("%p", absinfo); ++ return; ++ } ++ PRINT_FIELD_U("{", *absinfo, value); ++ PRINT_FIELD_U(", ", *absinfo, minimum); ++# if VERBOSE ++ PRINT_FIELD_U(", ", *absinfo, maximum); ++ PRINT_FIELD_U(", ", *absinfo, fuzz); ++ PRINT_FIELD_U(", ", *absinfo, flat); ++# ifdef HAVE_STRUCT_INPUT_ABSINFO_RESOLUTION ++ PRINT_FIELD_U(", ", *absinfo, resolution); ++# endif ++# else ++ printf(", ..."); ++# endif ++ printf("}"); ++} ++ ++static void ++print_input_id(long rc, void *ptr, void *arg) ++{ ++ struct input_id *id = ptr; ++ ++ if (rc < 0) { ++ printf("%p", id); ++ return; ++ } ++ printf("{ID_BUS=%" PRIu16 ++ ", ID_VENDOR=%" PRIu16 ++ ", ID_PRODUCT=%" PRIu16 ++ ", ID_VERSION=%" PRIu16 "}", ++ id->bustype, id->vendor, id->product, id->version); ++} ++ ++# ifdef EVIOCGMTSLOTS ++static void ++print_mtslots(long rc, void *ptr, void *arg) ++{ ++ int *buffer = ptr; ++ const char **str = arg; ++ int num = atoi(*(str + 1)); ++ ++ if (rc < 0) { ++ printf("%p", buffer); ++ return; ++ } ++ ++ printf("{code=%s", *str); ++ printf(", values=["); ++ for (unsigned int i = 1; i <= (unsigned) num; i++) ++ printf("%s%s", i > 1 ? ", " : "", *(str + i + 1)); ++ printf("]}"); ++} ++# endif ++ ++static void ++print_getbit(long rc, void *ptr, void *arg) ++{ ++ const char **str = arg; ++ int num = atoi(*str); ++ ++ if (rc < 0) { ++ printf("%p", ptr); ++ return; ++ } ++ ++ printf("["); ++ printf("%s", *(str + 1)); ++ for (unsigned int i = 2; i <= (unsigned) num; i++) { ++# if ! VERBOSE ++ if (i > 4) { ++ printf(", ..."); ++ break; ++ } ++# endif ++ printf(", "); ++ printf("%s", *(str + i)); ++ } ++ printf("]"); ++} ++ ++int ++main(int argc, char **argv) ++{ ++ unsigned long num_skip; ++ long inject_retval; ++ bool locked = false; ++ ++ if (argc == 1) ++ return 0; ++ ++ if (argc < 3) ++ error_msg_and_fail("Usage: %s NUM_SKIP INJECT_RETVAL", argv[0]); ++ ++ num_skip = strtoul(argv[1], NULL, 0); ++ inject_retval = strtol(argv[2], NULL, 0); ++ ++ if (inject_retval < 0) ++ error_msg_and_fail("Expected non-negative INJECT_RETVAL, " ++ "but got %ld", inject_retval); ++ ++ for (unsigned int i = 0; i < num_skip; i++) { ++ long rc = ioctl(-1, EVIOCGID, NULL); ++ printf("ioctl(-1, EVIOCGID, NULL) = %s%s\n", ++ sprintrc(rc), ++ rc == inject_retval ? " (INJECTED)" : ""); ++ ++ if (rc != inject_retval) ++ continue; ++ ++ locked = true; ++ break; ++ } ++ ++ if (!locked) ++ error_msg_and_fail("Hasn't locked on ioctl(-1" ++ ", EVIOCGID, NULL) returning %lu", ++ inject_retval); ++ ++ 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 */ ++ /* mtslots_str[1] is "2" so the number of values is 2 */ ++ const char *mtslots_str[] = { "ABS_MT_SLOT", "2", "1", "3" }; ++ ++ /* invalid flag */ ++ int invalid_mtslot[] = { -1, 1 }; ++ char invalid_str[4096]; ++ snprintf(invalid_str, sizeof(invalid_str), "%#x /* ABS_MT_??? */", invalid_mtslot[0]); ++ const char *invalid_mtslot_str[] = { invalid_str, "1", "1" }; ++# endif ++ ++ /* 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" }; ++ ++ /* 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" }; ++ ++ /* set zero bit */ ++ unsigned long ev_zero[] = { 0x0 }; ++ const char *ev_zero_str[] = { "0", " 0 " }; ++ ++ /* 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" }; ++ ++ struct { ++ struct evdev_check check; ++ 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_zero, print_getbit }, &ev_zero_str }, ++ { { ARG_STR(EVIOCGBIT(EV_KEY, 0)), key, print_getbit }, &key_str}, ++# ifdef EVIOCGMTSLOTS ++ { { ARG_STR(EVIOCGMTSLOTS(12)), mtslots, print_mtslots }, &mtslots_str }, ++ { { ARG_STR(EVIOCGMTSLOTS(8)), invalid_mtslot, print_mtslots }, &invalid_mtslot_str } ++# endif ++ }; ++ for (unsigned int i = 0; i < ARRAY_SIZE(a); i++) { ++ test_evdev(&a[i].check, a[i].ptr); ++ } ++ ++ puts("+++ exited with 0 +++"); ++ return 0; ++} ++#else ++ ++SKIP_MAIN_UNDEFINED("HAVE_LINUX_INPUT_H") ++ ++#endif +Index: strace-4.24/tests/ioctl_evdev-success.test +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests/ioctl_evdev-success.test 2020-01-27 18:52:13.048280185 +0100 +@@ -0,0 +1,13 @@ ++#!/bin/sh -efu ++ ++. "${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" +Index: strace-4.24/tests-m32/ioctl_evdev-success.test +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests-m32/ioctl_evdev-success.test 2020-01-27 18:52:13.048280185 +0100 +@@ -0,0 +1,13 @@ ++#!/bin/sh -efu ++ ++. "${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" +Index: strace-4.24/tests-mx32/ioctl_evdev-success.test +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests-mx32/ioctl_evdev-success.test 2020-01-27 18:52:13.048280185 +0100 +@@ -0,0 +1,13 @@ ++#!/bin/sh -efu ++ ++. "${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" +Index: strace-4.24/tests/Makefile.in +=================================================================== +--- strace-4.24.orig/tests/Makefile.in 2020-01-27 17:41:26.673586762 +0100 ++++ strace-4.24/tests/Makefile.in 2020-01-27 18:52:08.799318174 +0100 +@@ -150,7 +150,8 @@ + filter-unavailable$(EXEEXT) fork-f$(EXEEXT) fsync-y$(EXEEXT) \ + getpid$(EXEEXT) getppid$(EXEEXT) gettid$(EXEEXT) \ + inject-nf$(EXEEXT) int_0x80$(EXEEXT) ioctl_dm-v$(EXEEXT) \ +- ioctl_evdev-v$(EXEEXT) ioctl_loop-nv$(EXEEXT) \ ++ ioctl_evdev-v$(EXEEXT) ioctl_evdev-success$(EXEEXT) \ ++ ioctl_evdev-success-v$(EXEEXT) ioctl_loop-nv$(EXEEXT) \ + ioctl_loop-v$(EXEEXT) ioctl_nsfs$(EXEEXT) \ + ioctl_perf-success$(EXEEXT) ioctl_rtc-v$(EXEEXT) \ + is_linux_mips_n64$(EXEEXT) kill_child$(EXEEXT) \ +@@ -974,6 +975,14 @@ + ioctl_evdev_OBJECTS = ioctl_evdev.$(OBJEXT) + ioctl_evdev_LDADD = $(LDADD) + ioctl_evdev_DEPENDENCIES = libtests.a ++ioctl_evdev_success_SOURCES = ioctl_evdev-success.c ++ioctl_evdev_success_OBJECTS = ioctl_evdev-success.$(OBJEXT) ++ioctl_evdev_success_LDADD = $(LDADD) ++ioctl_evdev_success_DEPENDENCIES = libtests.a ++ioctl_evdev_success_v_SOURCES = ioctl_evdev-success-v.c ++ioctl_evdev_success_v_OBJECTS = ioctl_evdev-success-v.$(OBJEXT) ++ioctl_evdev_success_v_LDADD = $(LDADD) ++ioctl_evdev_success_v_DEPENDENCIES = libtests.a + ioctl_evdev_v_SOURCES = ioctl_evdev-v.c + ioctl_evdev_v_OBJECTS = ioctl_evdev-v.$(OBJEXT) + ioctl_evdev_v_LDADD = $(LDADD) +@@ -2740,11 +2749,12 @@ + getuid.c getuid32.c getxxid.c group_req.c inet-cmsg.c \ + init_module.c inject-nf.c inotify.c inotify_init1.c int_0x80.c \ + ioctl.c ioctl_block.c ioctl_dm.c ioctl_dm-v.c ioctl_evdev.c \ +- ioctl_evdev-v.c ioctl_inotify.c ioctl_kvm_run.c \ +- ioctl_kvm_run-v.c ioctl_kvm_run_auxstr_vcpu.c ioctl_loop.c \ +- ioctl_loop-nv.c ioctl_loop-v.c ioctl_mtd.c ioctl_nsfs.c \ +- ioctl_perf.c ioctl_perf-success.c ioctl_ptp.c ioctl_rtc.c \ +- ioctl_rtc-v.c ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ ++ ioctl_evdev-success.c ioctl_evdev-success-v.c ioctl_evdev-v.c \ ++ ioctl_inotify.c ioctl_kvm_run.c ioctl_kvm_run-v.c \ ++ ioctl_kvm_run_auxstr_vcpu.c ioctl_loop.c ioctl_loop-nv.c \ ++ ioctl_loop-v.c ioctl_mtd.c ioctl_nsfs.c ioctl_perf.c \ ++ ioctl_perf-success.c ioctl_ptp.c ioctl_rtc.c ioctl_rtc-v.c \ ++ ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ + ioctl_sock_gifconf.c ioctl_uffdio.c ioctl_v4l2.c ioperm.c \ + iopl.c ioprio.c ip_mreq.c ipc.c ipc_msg.c ipc_msg-Xabbrev.c \ + ipc_msg-Xraw.c ipc_msg-Xverbose.c ipc_msgbuf.c \ +@@ -2887,11 +2897,12 @@ + getuid.c getuid32.c getxxid.c group_req.c inet-cmsg.c \ + init_module.c inject-nf.c inotify.c inotify_init1.c int_0x80.c \ + ioctl.c ioctl_block.c ioctl_dm.c ioctl_dm-v.c ioctl_evdev.c \ +- ioctl_evdev-v.c ioctl_inotify.c ioctl_kvm_run.c \ +- ioctl_kvm_run-v.c ioctl_kvm_run_auxstr_vcpu.c ioctl_loop.c \ +- ioctl_loop-nv.c ioctl_loop-v.c ioctl_mtd.c ioctl_nsfs.c \ +- ioctl_perf.c ioctl_perf-success.c ioctl_ptp.c ioctl_rtc.c \ +- ioctl_rtc-v.c ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ ++ ioctl_evdev-success.c ioctl_evdev-success-v.c ioctl_evdev-v.c \ ++ ioctl_inotify.c ioctl_kvm_run.c ioctl_kvm_run-v.c \ ++ ioctl_kvm_run_auxstr_vcpu.c ioctl_loop.c ioctl_loop-nv.c \ ++ ioctl_loop-v.c ioctl_mtd.c ioctl_nsfs.c ioctl_perf.c \ ++ ioctl_perf-success.c ioctl_ptp.c ioctl_rtc.c ioctl_rtc-v.c \ ++ ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ + ioctl_sock_gifconf.c ioctl_uffdio.c ioctl_v4l2.c ioperm.c \ + iopl.c ioprio.c ip_mreq.c ipc.c ipc_msg.c ipc_msg-Xabbrev.c \ + ipc_msg-Xraw.c ipc_msg-Xverbose.c ipc_msgbuf.c \ +@@ -4173,6 +4184,8 @@ + futex.test \ + getuid.test \ + ioctl.test \ ++ ioctl_evdev-success.test \ ++ ioctl_evdev-success-v.test \ + ioctl_perf-success.test \ + ipc_msgbuf.test \ + kern_features-fault.test \ +@@ -4998,6 +5011,14 @@ + @rm -f ioctl_evdev$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ioctl_evdev_OBJECTS) $(ioctl_evdev_LDADD) $(LIBS) + ++ioctl_evdev-success$(EXEEXT): $(ioctl_evdev_success_OBJECTS) $(ioctl_evdev_success_DEPENDENCIES) $(EXTRA_ioctl_evdev_success_DEPENDENCIES) ++ @rm -f ioctl_evdev-success$(EXEEXT) ++ $(AM_V_CCLD)$(LINK) $(ioctl_evdev_success_OBJECTS) $(ioctl_evdev_success_LDADD) $(LIBS) ++ ++ioctl_evdev-success-v$(EXEEXT): $(ioctl_evdev_success_v_OBJECTS) $(ioctl_evdev_success_v_DEPENDENCIES) $(EXTRA_ioctl_evdev_success_v_DEPENDENCIES) ++ @rm -f ioctl_evdev-success-v$(EXEEXT) ++ $(AM_V_CCLD)$(LINK) $(ioctl_evdev_success_v_OBJECTS) $(ioctl_evdev_success_v_LDADD) $(LIBS) ++ + ioctl_evdev-v$(EXEEXT): $(ioctl_evdev_v_OBJECTS) $(ioctl_evdev_v_DEPENDENCIES) $(EXTRA_ioctl_evdev_v_DEPENDENCIES) + @rm -f ioctl_evdev-v$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ioctl_evdev_v_OBJECTS) $(ioctl_evdev_v_LDADD) $(LIBS) +@@ -6833,6 +6854,8 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_block.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_dm-v.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_dm.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_evdev-success-v.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_evdev-success.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_evdev-v.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_evdev.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_inotify.Po@am__quote@ +Index: strace-4.24/tests-m32/Makefile.in +=================================================================== +--- strace-4.24.orig/tests-m32/Makefile.in 2020-01-27 18:52:08.799318174 +0100 ++++ strace-4.24/tests-m32/Makefile.in 2020-01-27 18:53:26.448623928 +0100 +@@ -150,7 +150,8 @@ + filter-unavailable$(EXEEXT) fork-f$(EXEEXT) fsync-y$(EXEEXT) \ + getpid$(EXEEXT) getppid$(EXEEXT) gettid$(EXEEXT) \ + inject-nf$(EXEEXT) int_0x80$(EXEEXT) ioctl_dm-v$(EXEEXT) \ +- ioctl_evdev-v$(EXEEXT) ioctl_loop-nv$(EXEEXT) \ ++ ioctl_evdev-v$(EXEEXT) ioctl_evdev-success$(EXEEXT) \ ++ ioctl_evdev-success-v$(EXEEXT) ioctl_loop-nv$(EXEEXT) \ + ioctl_loop-v$(EXEEXT) ioctl_nsfs$(EXEEXT) \ + ioctl_perf-success$(EXEEXT) ioctl_rtc-v$(EXEEXT) \ + is_linux_mips_n64$(EXEEXT) kill_child$(EXEEXT) \ +@@ -974,6 +975,14 @@ + ioctl_evdev_OBJECTS = ioctl_evdev.$(OBJEXT) + ioctl_evdev_LDADD = $(LDADD) + ioctl_evdev_DEPENDENCIES = libtests.a ++ioctl_evdev_success_SOURCES = ioctl_evdev-success.c ++ioctl_evdev_success_OBJECTS = ioctl_evdev-success.$(OBJEXT) ++ioctl_evdev_success_LDADD = $(LDADD) ++ioctl_evdev_success_DEPENDENCIES = libtests.a ++ioctl_evdev_success_v_SOURCES = ioctl_evdev-success-v.c ++ioctl_evdev_success_v_OBJECTS = ioctl_evdev-success-v.$(OBJEXT) ++ioctl_evdev_success_v_LDADD = $(LDADD) ++ioctl_evdev_success_v_DEPENDENCIES = libtests.a + ioctl_evdev_v_SOURCES = ioctl_evdev-v.c + ioctl_evdev_v_OBJECTS = ioctl_evdev-v.$(OBJEXT) + ioctl_evdev_v_LDADD = $(LDADD) +@@ -2740,11 +2749,12 @@ + getuid.c getuid32.c getxxid.c group_req.c inet-cmsg.c \ + init_module.c inject-nf.c inotify.c inotify_init1.c int_0x80.c \ + ioctl.c ioctl_block.c ioctl_dm.c ioctl_dm-v.c ioctl_evdev.c \ +- ioctl_evdev-v.c ioctl_inotify.c ioctl_kvm_run.c \ +- ioctl_kvm_run-v.c ioctl_kvm_run_auxstr_vcpu.c ioctl_loop.c \ +- ioctl_loop-nv.c ioctl_loop-v.c ioctl_mtd.c ioctl_nsfs.c \ +- ioctl_perf.c ioctl_perf-success.c ioctl_ptp.c ioctl_rtc.c \ +- ioctl_rtc-v.c ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ ++ ioctl_evdev-success.c ioctl_evdev-success-v.c ioctl_evdev-v.c \ ++ ioctl_inotify.c ioctl_kvm_run.c ioctl_kvm_run-v.c \ ++ ioctl_kvm_run_auxstr_vcpu.c ioctl_loop.c ioctl_loop-nv.c \ ++ ioctl_loop-v.c ioctl_mtd.c ioctl_nsfs.c ioctl_perf.c \ ++ ioctl_perf-success.c ioctl_ptp.c ioctl_rtc.c ioctl_rtc-v.c \ ++ ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ + ioctl_sock_gifconf.c ioctl_uffdio.c ioctl_v4l2.c ioperm.c \ + iopl.c ioprio.c ip_mreq.c ipc.c ipc_msg.c ipc_msg-Xabbrev.c \ + ipc_msg-Xraw.c ipc_msg-Xverbose.c ipc_msgbuf.c \ +@@ -2887,11 +2897,12 @@ + getuid.c getuid32.c getxxid.c group_req.c inet-cmsg.c \ + init_module.c inject-nf.c inotify.c inotify_init1.c int_0x80.c \ + ioctl.c ioctl_block.c ioctl_dm.c ioctl_dm-v.c ioctl_evdev.c \ +- ioctl_evdev-v.c ioctl_inotify.c ioctl_kvm_run.c \ +- ioctl_kvm_run-v.c ioctl_kvm_run_auxstr_vcpu.c ioctl_loop.c \ +- ioctl_loop-nv.c ioctl_loop-v.c ioctl_mtd.c ioctl_nsfs.c \ +- ioctl_perf.c ioctl_perf-success.c ioctl_ptp.c ioctl_rtc.c \ +- ioctl_rtc-v.c ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ ++ ioctl_evdev-success.c ioctl_evdev-success-v.c ioctl_evdev-v.c \ ++ ioctl_inotify.c ioctl_kvm_run.c ioctl_kvm_run-v.c \ ++ ioctl_kvm_run_auxstr_vcpu.c ioctl_loop.c ioctl_loop-nv.c \ ++ ioctl_loop-v.c ioctl_mtd.c ioctl_nsfs.c ioctl_perf.c \ ++ ioctl_perf-success.c ioctl_ptp.c ioctl_rtc.c ioctl_rtc-v.c \ ++ ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ + ioctl_sock_gifconf.c ioctl_uffdio.c ioctl_v4l2.c ioperm.c \ + iopl.c ioprio.c ip_mreq.c ipc.c ipc_msg.c ipc_msg-Xabbrev.c \ + ipc_msg-Xraw.c ipc_msg-Xverbose.c ipc_msgbuf.c \ +@@ -4173,6 +4184,8 @@ + futex.test \ + getuid.test \ + ioctl.test \ ++ ioctl_evdev-success.test \ ++ ioctl_evdev-success-v.test \ + ioctl_perf-success.test \ + ipc_msgbuf.test \ + kern_features-fault.test \ +@@ -4998,6 +5011,14 @@ + @rm -f ioctl_evdev$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ioctl_evdev_OBJECTS) $(ioctl_evdev_LDADD) $(LIBS) + ++ioctl_evdev-success$(EXEEXT): $(ioctl_evdev_success_OBJECTS) $(ioctl_evdev_success_DEPENDENCIES) $(EXTRA_ioctl_evdev_success_DEPENDENCIES) ++ @rm -f ioctl_evdev-success$(EXEEXT) ++ $(AM_V_CCLD)$(LINK) $(ioctl_evdev_success_OBJECTS) $(ioctl_evdev_success_LDADD) $(LIBS) ++ ++ioctl_evdev-success-v$(EXEEXT): $(ioctl_evdev_success_v_OBJECTS) $(ioctl_evdev_success_v_DEPENDENCIES) $(EXTRA_ioctl_evdev_success_v_DEPENDENCIES) ++ @rm -f ioctl_evdev-success-v$(EXEEXT) ++ $(AM_V_CCLD)$(LINK) $(ioctl_evdev_success_v_OBJECTS) $(ioctl_evdev_success_v_LDADD) $(LIBS) ++ + ioctl_evdev-v$(EXEEXT): $(ioctl_evdev_v_OBJECTS) $(ioctl_evdev_v_DEPENDENCIES) $(EXTRA_ioctl_evdev_v_DEPENDENCIES) + @rm -f ioctl_evdev-v$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ioctl_evdev_v_OBJECTS) $(ioctl_evdev_v_LDADD) $(LIBS) +@@ -6833,6 +6854,8 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_block.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_dm-v.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_dm.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_evdev-success-v.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_evdev-success.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_evdev-v.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_evdev.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_inotify.Po@am__quote@ +Index: strace-4.24/tests-mx32/Makefile.in +=================================================================== +--- strace-4.24.orig/tests-mx32/Makefile.in 2020-01-27 18:52:08.799318174 +0100 ++++ strace-4.24/tests-mx32/Makefile.in 2020-01-27 18:53:20.750674873 +0100 +@@ -150,7 +150,8 @@ + filter-unavailable$(EXEEXT) fork-f$(EXEEXT) fsync-y$(EXEEXT) \ + getpid$(EXEEXT) getppid$(EXEEXT) gettid$(EXEEXT) \ + inject-nf$(EXEEXT) int_0x80$(EXEEXT) ioctl_dm-v$(EXEEXT) \ +- ioctl_evdev-v$(EXEEXT) ioctl_loop-nv$(EXEEXT) \ ++ ioctl_evdev-v$(EXEEXT) ioctl_evdev-success$(EXEEXT) \ ++ ioctl_evdev-success-v$(EXEEXT) ioctl_loop-nv$(EXEEXT) \ + ioctl_loop-v$(EXEEXT) ioctl_nsfs$(EXEEXT) \ + ioctl_perf-success$(EXEEXT) ioctl_rtc-v$(EXEEXT) \ + is_linux_mips_n64$(EXEEXT) kill_child$(EXEEXT) \ +@@ -974,6 +975,14 @@ + ioctl_evdev_OBJECTS = ioctl_evdev.$(OBJEXT) + ioctl_evdev_LDADD = $(LDADD) + ioctl_evdev_DEPENDENCIES = libtests.a ++ioctl_evdev_success_SOURCES = ioctl_evdev-success.c ++ioctl_evdev_success_OBJECTS = ioctl_evdev-success.$(OBJEXT) ++ioctl_evdev_success_LDADD = $(LDADD) ++ioctl_evdev_success_DEPENDENCIES = libtests.a ++ioctl_evdev_success_v_SOURCES = ioctl_evdev-success-v.c ++ioctl_evdev_success_v_OBJECTS = ioctl_evdev-success-v.$(OBJEXT) ++ioctl_evdev_success_v_LDADD = $(LDADD) ++ioctl_evdev_success_v_DEPENDENCIES = libtests.a + ioctl_evdev_v_SOURCES = ioctl_evdev-v.c + ioctl_evdev_v_OBJECTS = ioctl_evdev-v.$(OBJEXT) + ioctl_evdev_v_LDADD = $(LDADD) +@@ -2740,11 +2749,12 @@ + getuid.c getuid32.c getxxid.c group_req.c inet-cmsg.c \ + init_module.c inject-nf.c inotify.c inotify_init1.c int_0x80.c \ + ioctl.c ioctl_block.c ioctl_dm.c ioctl_dm-v.c ioctl_evdev.c \ +- ioctl_evdev-v.c ioctl_inotify.c ioctl_kvm_run.c \ +- ioctl_kvm_run-v.c ioctl_kvm_run_auxstr_vcpu.c ioctl_loop.c \ +- ioctl_loop-nv.c ioctl_loop-v.c ioctl_mtd.c ioctl_nsfs.c \ +- ioctl_perf.c ioctl_perf-success.c ioctl_ptp.c ioctl_rtc.c \ +- ioctl_rtc-v.c ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ ++ ioctl_evdev-success.c ioctl_evdev-success-v.c ioctl_evdev-v.c \ ++ ioctl_inotify.c ioctl_kvm_run.c ioctl_kvm_run-v.c \ ++ ioctl_kvm_run_auxstr_vcpu.c ioctl_loop.c ioctl_loop-nv.c \ ++ ioctl_loop-v.c ioctl_mtd.c ioctl_nsfs.c ioctl_perf.c \ ++ ioctl_perf-success.c ioctl_ptp.c ioctl_rtc.c ioctl_rtc-v.c \ ++ ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ + ioctl_sock_gifconf.c ioctl_uffdio.c ioctl_v4l2.c ioperm.c \ + iopl.c ioprio.c ip_mreq.c ipc.c ipc_msg.c ipc_msg-Xabbrev.c \ + ipc_msg-Xraw.c ipc_msg-Xverbose.c ipc_msgbuf.c \ +@@ -2887,11 +2897,12 @@ + getuid.c getuid32.c getxxid.c group_req.c inet-cmsg.c \ + init_module.c inject-nf.c inotify.c inotify_init1.c int_0x80.c \ + ioctl.c ioctl_block.c ioctl_dm.c ioctl_dm-v.c ioctl_evdev.c \ +- ioctl_evdev-v.c ioctl_inotify.c ioctl_kvm_run.c \ +- ioctl_kvm_run-v.c ioctl_kvm_run_auxstr_vcpu.c ioctl_loop.c \ +- ioctl_loop-nv.c ioctl_loop-v.c ioctl_mtd.c ioctl_nsfs.c \ +- ioctl_perf.c ioctl_perf-success.c ioctl_ptp.c ioctl_rtc.c \ +- ioctl_rtc-v.c ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ ++ ioctl_evdev-success.c ioctl_evdev-success-v.c ioctl_evdev-v.c \ ++ ioctl_inotify.c ioctl_kvm_run.c ioctl_kvm_run-v.c \ ++ ioctl_kvm_run_auxstr_vcpu.c ioctl_loop.c ioctl_loop-nv.c \ ++ ioctl_loop-v.c ioctl_mtd.c ioctl_nsfs.c ioctl_perf.c \ ++ ioctl_perf-success.c ioctl_ptp.c ioctl_rtc.c ioctl_rtc-v.c \ ++ ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ + ioctl_sock_gifconf.c ioctl_uffdio.c ioctl_v4l2.c ioperm.c \ + iopl.c ioprio.c ip_mreq.c ipc.c ipc_msg.c ipc_msg-Xabbrev.c \ + ipc_msg-Xraw.c ipc_msg-Xverbose.c ipc_msgbuf.c \ +@@ -4173,6 +4184,8 @@ + futex.test \ + getuid.test \ + ioctl.test \ ++ ioctl_evdev-success.test \ ++ ioctl_evdev-success-v.test \ + ioctl_perf-success.test \ + ipc_msgbuf.test \ + kern_features-fault.test \ +@@ -4998,6 +5011,14 @@ + @rm -f ioctl_evdev$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ioctl_evdev_OBJECTS) $(ioctl_evdev_LDADD) $(LIBS) + ++ioctl_evdev-success$(EXEEXT): $(ioctl_evdev_success_OBJECTS) $(ioctl_evdev_success_DEPENDENCIES) $(EXTRA_ioctl_evdev_success_DEPENDENCIES) ++ @rm -f ioctl_evdev-success$(EXEEXT) ++ $(AM_V_CCLD)$(LINK) $(ioctl_evdev_success_OBJECTS) $(ioctl_evdev_success_LDADD) $(LIBS) ++ ++ioctl_evdev-success-v$(EXEEXT): $(ioctl_evdev_success_v_OBJECTS) $(ioctl_evdev_success_v_DEPENDENCIES) $(EXTRA_ioctl_evdev_success_v_DEPENDENCIES) ++ @rm -f ioctl_evdev-success-v$(EXEEXT) ++ $(AM_V_CCLD)$(LINK) $(ioctl_evdev_success_v_OBJECTS) $(ioctl_evdev_success_v_LDADD) $(LIBS) ++ + ioctl_evdev-v$(EXEEXT): $(ioctl_evdev_v_OBJECTS) $(ioctl_evdev_v_DEPENDENCIES) $(EXTRA_ioctl_evdev_v_DEPENDENCIES) + @rm -f ioctl_evdev-v$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ioctl_evdev_v_OBJECTS) $(ioctl_evdev_v_LDADD) $(LIBS) +@@ -6833,6 +6854,8 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_block.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_dm-v.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_dm.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_evdev-success-v.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_evdev-success.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_evdev-v.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_evdev.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_inotify.Po@am__quote@ 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..e2abf52 --- /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-4.24/tests/ioctl_evdev-success-v.test +=================================================================== +--- strace-4.24.orig/tests/ioctl_evdev-success-v.test 2019-08-01 18:40:58.009521546 +0200 ++++ strace-4.24/tests/ioctl_evdev-success-v.test 2019-08-01 19:21:32.297062218 +0200 +@@ -3,11 +3,14 @@ + . "${srcdir=.}/scno_tampering.sh" + + : ${IOCTL_INJECT_START=256} +-: ${IOCTL_INJECT_RETVAL=8} + + run_prog +-run_strace -a16 -v -e trace=ioctl \ +- -e inject=ioctl:retval="${IOCTL_INJECT_RETVAL}":when="${IOCTL_INJECT_START}+" \ +- ../ioctl_evdev-success-v "${IOCTL_INJECT_START}" "${IOCTL_INJECT_RETVAL}"> "$EXP" +-grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT" +-match_diff "$OUT" "$EXP" ++ ++for ret in 0 2 8 15 16; do ++ run_strace -a16 -v -e trace=ioctl \ ++ -e inject=ioctl:retval="${ret}":when="${IOCTL_INJECT_START}+" \ ++ ../ioctl_evdev-success-v \ ++ "${IOCTL_INJECT_START}" "${ret}"> "$EXP.$ret" ++ grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT.$ret" ++ match_diff "$OUT.$ret" "$EXP.$ret" ++done +Index: strace-4.24/tests/ioctl_evdev-success.c +=================================================================== +--- strace-4.24.orig/tests/ioctl_evdev-success.c 2019-08-01 18:40:58.009521546 +0200 ++++ strace-4.24/tests/ioctl_evdev-success.c 2019-08-01 19:21:32.297062218 +0200 +@@ -2,6 +2,7 @@ + + #ifdef HAVE_LINUX_INPUT_H + ++# include + # include + # include + # include +@@ -9,17 +10,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); +@@ -31,7 +34,7 @@ + } + + static void +-test_evdev(struct evdev_check *check, void *arg) ++test_evdev(struct evdev_check *check, const void *arg) + { + long rc = invoke_test_syscall(check->cmd, check->arg_ptr); + printf("ioctl(-1, %s, ", check->cmd_str); +@@ -43,9 +46,9 @@ + } + + static void +-print_input_absinfo(long rc, void *ptr, void *arg) ++print_input_absinfo(long rc, const void *ptr, const void *arg) + { +- struct input_absinfo *absinfo = ptr; ++ const struct input_absinfo *absinfo = ptr; + + if (rc < 0) { + printf("%p", absinfo); +@@ -67,9 +70,9 @@ + } + + static void +-print_input_id(long rc, void *ptr, void *arg) ++print_input_id(long rc, const void *ptr, const void *arg) + { +- struct input_id *id = ptr; ++ const struct input_id *id = ptr; + + if (rc < 0) { + printf("%p", id); +@@ -84,10 +87,10 @@ + + # ifdef EVIOCGMTSLOTS + static void +-print_mtslots(long rc, void *ptr, void *arg) ++print_mtslots(long rc, const void *ptr, const void *arg) + { +- int *buffer = ptr; +- const char **str = arg; ++ const int *buffer = ptr; ++ const char * const * str = arg; + int num = atoi(*(str + 1)); + + if (rc < 0) { +@@ -104,27 +107,26 @@ + # endif + + static void +-print_getbit(long rc, void *ptr, void *arg) ++print_getbit(long rc, const void *ptr, const void *arg) + { +- const char **str = arg; +- int num = atoi(*str); ++ const char * const *str = arg; + +- if (rc < 0) { ++ if (rc <= 0) { + printf("%p", ptr); + return; + } + + printf("["); +- printf("%s", *(str + 1)); +- for (unsigned int i = 2; i <= (unsigned) num; i++) { ++ for (unsigned long i = 0; str[i]; i++) { + # if ! VERBOSE +- if (i > 4) { ++ if (i >= 4) { + printf(", ..."); + break; + } + # endif +- printf(", "); +- printf("%s", *(str + i)); ++ if (i) ++ printf(", "); ++ printf("%s", str[i]); + } + printf("]"); + } +@@ -170,6 +172,7 @@ + TAIL_ALLOC_OBJECT_CONST_PTR(struct input_id, id); + TAIL_ALLOC_OBJECT_CONST_PTR(struct input_absinfo, absinfo); + TAIL_ALLOC_OBJECT_CONST_PTR(int, bad_addr_slot); ++ + # ifdef EVIOCGMTSLOTS + int mtslots[] = { ABS_MT_SLOT, 1, 3 }; + /* we use the second element to indicate the number of values */ +@@ -183,36 +186,65 @@ + const char *invalid_mtslot_str[] = { invalid_str, "1", "1" }; + # endif + ++ enum { ULONG_BIT = sizeof(unsigned long) * 8 }; ++ + /* set more than 4 bits */ +- unsigned long ev_more[] = { 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED | 1 << EV_SND | 1 << EV_PWR }; +- /* we use the first element to indicate the number of set bits */ +- /* ev_more_str[0] is "5" so the number of set bits is 5 */ +- const char *ev_more_str[] = { "5", "EV_ABS", "EV_MSC", "EV_LED", "EV_SND", "EV_PWR" }; ++ static const unsigned long ev_more[NUM_WORDS] = { ++ 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED | 1 << EV_SND ++ | 1 << EV_PWR }; ++ static const char * const ev_more_str_2[] = { ++ "EV_ABS", "EV_MSC", NULL }; ++ static const char * const ev_more_str_3[] = { ++ "EV_ABS", "EV_MSC", "EV_LED", "EV_SND", "EV_PWR", NULL }; + + /* set less than 4 bits */ +- unsigned long ev_less[] = { 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED }; +- const char *ev_less_str[] = { "3", "EV_ABS", "EV_MSC", "EV_LED" }; ++ static const unsigned long ev_less[NUM_WORDS] = { ++ 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED }; ++ static const char * const ev_less_str_2[] = { ++ "EV_ABS", "EV_MSC", NULL }; ++ static const char * const ev_less_str_3[] = { ++ "EV_ABS", "EV_MSC", "EV_LED", NULL }; + + /* set zero bit */ +- unsigned long ev_zero[] = { 0x0 }; +- const char *ev_zero_str[] = { "0", " 0 " }; ++ static const unsigned long ev_zero[NUM_WORDS] = { 0x0 }; ++ static const char * const ev_zero_str[] = { " 0 ", NULL }; + + /* KEY_MAX is 0x2ff which is greater than retval * 8 */ +- unsigned long key[] = { 1 << KEY_1 | 1 << KEY_2, 0 }; +- const char *key_str[] = { "2", "KEY_1", "KEY_2" }; ++ static const unsigned long key[NUM_WORDS] = { ++ 1 << KEY_1 | 1 << KEY_2, ++ [ KEY_F12 / ULONG_BIT ] = 1 << (KEY_F12 % ULONG_BIT) }; ++ ++ static const char * const key_str_8[] = { ++ "KEY_1", "KEY_2", NULL }; ++ static const char * const key_str_16[] = { ++ "KEY_1", "KEY_2", "KEY_F12", NULL }; ++ ++ assert(sizeof(ev_more) >= (unsigned long) inject_retval); ++ assert(sizeof(ev_less) >= (unsigned long) inject_retval); ++ assert(sizeof(ev_zero) >= (unsigned long) inject_retval); ++ assert(sizeof(key) >= (unsigned long) inject_retval); + + struct { + struct evdev_check check; +- void *ptr; ++ const void *ptr; + } a[] = { + { { ARG_STR(EVIOCGID), id, print_input_id }, NULL }, + { { ARG_STR(EVIOCGABS(ABS_X)), absinfo, print_input_absinfo }, NULL }, + { { ARG_STR(EVIOCGABS(ABS_Y)), absinfo, print_input_absinfo }, NULL }, + { { ARG_STR(EVIOCGABS(ABS_Y)), absinfo, print_input_absinfo }, NULL }, +- { { ARG_STR(EVIOCGBIT(0, 0)), ev_more, print_getbit }, &ev_more_str }, +- { { ARG_STR(EVIOCGBIT(0, 0)), ev_less, print_getbit }, &ev_less_str }, ++ { { ARG_STR(EVIOCGBIT(0, 0)), ev_more, print_getbit }, ++ inject_retval * 8 <= EV_LED ++ ? (const void *) &ev_more_str_2 ++ : (const void *) &ev_more_str_3 }, ++ { { ARG_STR(EVIOCGBIT(0, 0)), ev_less, print_getbit }, ++ inject_retval * 8 <= EV_LED ++ ? (const void *) &ev_less_str_2 ++ : (const void *) &ev_less_str_3 }, + { { ARG_STR(EVIOCGBIT(0, 0)), ev_zero, print_getbit }, &ev_zero_str }, +- { { ARG_STR(EVIOCGBIT(EV_KEY, 0)), key, print_getbit }, &key_str}, ++ { { ARG_STR(EVIOCGBIT(EV_KEY, 0)), key, print_getbit }, ++ inject_retval * 8 <= KEY_F12 ++ ? (const void *) &key_str_8 ++ : (const void *) &key_str_16 }, + # ifdef EVIOCGMTSLOTS + { { ARG_STR(EVIOCGMTSLOTS(12)), mtslots, print_mtslots }, &mtslots_str }, + { { ARG_STR(EVIOCGMTSLOTS(8)), invalid_mtslot, print_mtslots }, &invalid_mtslot_str } +Index: strace-4.24/tests/ioctl_evdev-success.test +=================================================================== +--- strace-4.24.orig/tests/ioctl_evdev-success.test 2019-08-01 18:40:58.009521546 +0200 ++++ strace-4.24/tests/ioctl_evdev-success.test 2019-08-01 19:21:32.298062205 +0200 +@@ -3,11 +3,14 @@ + . "${srcdir=.}/scno_tampering.sh" + + : ${IOCTL_INJECT_START=256} +-: ${IOCTL_INJECT_RETVAL=8} + + run_prog +-run_strace -a16 -e trace=ioctl \ +- -e inject=ioctl:retval="${IOCTL_INJECT_RETVAL}":when="${IOCTL_INJECT_START}+" \ +- ../ioctl_evdev-success "${IOCTL_INJECT_START}" "${IOCTL_INJECT_RETVAL}"> "$EXP" +-grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT" +-match_diff "$OUT" "$EXP" ++ ++for ret in 0 2 8 15 16; do ++ run_strace -a16 -e trace=ioctl \ ++ -e inject=ioctl:retval="${ret}":when="${IOCTL_INJECT_START}+" \ ++ ../ioctl_evdev-success \ ++ "${IOCTL_INJECT_START}" "${ret}"> "$EXP.${ret}" ++ grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT.$ret" ++ match_diff "$OUT.$ret" "$EXP.$ret" ++done +Index: strace-4.24/tests-m32/ioctl_evdev-success-v.test +=================================================================== +--- strace-4.24.orig/tests-m32/ioctl_evdev-success-v.test 2019-08-01 18:40:58.009521546 +0200 ++++ strace-4.24/tests-m32/ioctl_evdev-success-v.test 2019-08-01 19:21:32.298062205 +0200 +@@ -3,11 +3,14 @@ + . "${srcdir=.}/scno_tampering.sh" + + : ${IOCTL_INJECT_START=256} +-: ${IOCTL_INJECT_RETVAL=8} + + run_prog +-run_strace -a16 -v -e trace=ioctl \ +- -e inject=ioctl:retval="${IOCTL_INJECT_RETVAL}":when="${IOCTL_INJECT_START}+" \ +- ../ioctl_evdev-success-v "${IOCTL_INJECT_START}" "${IOCTL_INJECT_RETVAL}"> "$EXP" +-grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT" +-match_diff "$OUT" "$EXP" ++ ++for ret in 0 2 8 15 16; do ++ run_strace -a16 -v -e trace=ioctl \ ++ -e inject=ioctl:retval="${ret}":when="${IOCTL_INJECT_START}+" \ ++ ../ioctl_evdev-success-v \ ++ "${IOCTL_INJECT_START}" "${ret}"> "$EXP.$ret" ++ grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT.$ret" ++ match_diff "$OUT.$ret" "$EXP.$ret" ++done +Index: strace-4.24/tests-m32/ioctl_evdev-success.test +=================================================================== +--- strace-4.24.orig/tests-m32/ioctl_evdev-success.test 2019-08-01 18:40:58.009521546 +0200 ++++ strace-4.24/tests-m32/ioctl_evdev-success.test 2019-08-01 19:21:32.298062205 +0200 +@@ -3,11 +3,14 @@ + . "${srcdir=.}/scno_tampering.sh" + + : ${IOCTL_INJECT_START=256} +-: ${IOCTL_INJECT_RETVAL=8} + + run_prog +-run_strace -a16 -e trace=ioctl \ +- -e inject=ioctl:retval="${IOCTL_INJECT_RETVAL}":when="${IOCTL_INJECT_START}+" \ +- ../ioctl_evdev-success "${IOCTL_INJECT_START}" "${IOCTL_INJECT_RETVAL}"> "$EXP" +-grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT" +-match_diff "$OUT" "$EXP" ++ ++for ret in 0 2 8 15 16; do ++ run_strace -a16 -e trace=ioctl \ ++ -e inject=ioctl:retval="${ret}":when="${IOCTL_INJECT_START}+" \ ++ ../ioctl_evdev-success \ ++ "${IOCTL_INJECT_START}" "${ret}"> "$EXP.${ret}" ++ grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT.$ret" ++ match_diff "$OUT.$ret" "$EXP.$ret" ++done +Index: strace-4.24/tests-mx32/ioctl_evdev-success-v.test +=================================================================== +--- strace-4.24.orig/tests-mx32/ioctl_evdev-success-v.test 2019-08-01 18:40:58.009521546 +0200 ++++ strace-4.24/tests-mx32/ioctl_evdev-success-v.test 2019-08-01 19:21:32.298062205 +0200 +@@ -3,11 +3,14 @@ + . "${srcdir=.}/scno_tampering.sh" + + : ${IOCTL_INJECT_START=256} +-: ${IOCTL_INJECT_RETVAL=8} + + run_prog +-run_strace -a16 -v -e trace=ioctl \ +- -e inject=ioctl:retval="${IOCTL_INJECT_RETVAL}":when="${IOCTL_INJECT_START}+" \ +- ../ioctl_evdev-success-v "${IOCTL_INJECT_START}" "${IOCTL_INJECT_RETVAL}"> "$EXP" +-grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT" +-match_diff "$OUT" "$EXP" ++ ++for ret in 0 2 8 15 16; do ++ run_strace -a16 -v -e trace=ioctl \ ++ -e inject=ioctl:retval="${ret}":when="${IOCTL_INJECT_START}+" \ ++ ../ioctl_evdev-success-v \ ++ "${IOCTL_INJECT_START}" "${ret}"> "$EXP.$ret" ++ grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT.$ret" ++ match_diff "$OUT.$ret" "$EXP.$ret" ++done +Index: strace-4.24/tests-mx32/ioctl_evdev-success.test +=================================================================== +--- strace-4.24.orig/tests-mx32/ioctl_evdev-success.test 2019-08-01 18:40:58.009521546 +0200 ++++ strace-4.24/tests-mx32/ioctl_evdev-success.test 2019-08-01 19:21:32.299062192 +0200 +@@ -3,11 +3,14 @@ + . "${srcdir=.}/scno_tampering.sh" + + : ${IOCTL_INJECT_START=256} +-: ${IOCTL_INJECT_RETVAL=8} + + run_prog +-run_strace -a16 -e trace=ioctl \ +- -e inject=ioctl:retval="${IOCTL_INJECT_RETVAL}":when="${IOCTL_INJECT_START}+" \ +- ../ioctl_evdev-success "${IOCTL_INJECT_START}" "${IOCTL_INJECT_RETVAL}"> "$EXP" +-grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT" +-match_diff "$OUT" "$EXP" ++ ++for ret in 0 2 8 15 16; do ++ run_strace -a16 -e trace=ioctl \ ++ -e inject=ioctl:retval="${ret}":when="${IOCTL_INJECT_START}+" \ ++ ../ioctl_evdev-success \ ++ "${IOCTL_INJECT_START}" "${ret}"> "$EXP.${ret}" ++ grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT.$ret" ++ match_diff "$OUT.$ret" "$EXP.$ret" ++done +Index: strace-4.24/tests-m32/ioctl_evdev-success.c +=================================================================== +--- strace-4.24.orig/tests-m32/ioctl_evdev-success.c 2019-08-01 18:40:58.009521546 +0200 ++++ strace-4.24/tests-m32/ioctl_evdev-success.c 2019-08-29 12:09:27.898700830 +0200 +@@ -2,6 +2,7 @@ + + #ifdef HAVE_LINUX_INPUT_H + ++# include + # include + # include + # include +@@ -9,17 +10,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); +@@ -31,7 +34,7 @@ + } + + static void +-test_evdev(struct evdev_check *check, void *arg) ++test_evdev(struct evdev_check *check, const void *arg) + { + long rc = invoke_test_syscall(check->cmd, check->arg_ptr); + printf("ioctl(-1, %s, ", check->cmd_str); +@@ -43,9 +46,9 @@ + } + + static void +-print_input_absinfo(long rc, void *ptr, void *arg) ++print_input_absinfo(long rc, const void *ptr, const void *arg) + { +- struct input_absinfo *absinfo = ptr; ++ const struct input_absinfo *absinfo = ptr; + + if (rc < 0) { + printf("%p", absinfo); +@@ -67,9 +70,9 @@ + } + + static void +-print_input_id(long rc, void *ptr, void *arg) ++print_input_id(long rc, const void *ptr, const void *arg) + { +- struct input_id *id = ptr; ++ const struct input_id *id = ptr; + + if (rc < 0) { + printf("%p", id); +@@ -84,10 +87,10 @@ + + # ifdef EVIOCGMTSLOTS + static void +-print_mtslots(long rc, void *ptr, void *arg) ++print_mtslots(long rc, const void *ptr, const void *arg) + { +- int *buffer = ptr; +- const char **str = arg; ++ const int *buffer = ptr; ++ const char * const * str = arg; + int num = atoi(*(str + 1)); + + if (rc < 0) { +@@ -104,27 +107,26 @@ + # endif + + static void +-print_getbit(long rc, void *ptr, void *arg) ++print_getbit(long rc, const void *ptr, const void *arg) + { +- const char **str = arg; +- int num = atoi(*str); ++ const char * const *str = arg; + +- if (rc < 0) { ++ if (rc <= 0) { + printf("%p", ptr); + return; + } + + printf("["); +- printf("%s", *(str + 1)); +- for (unsigned int i = 2; i <= (unsigned) num; i++) { ++ for (unsigned long i = 0; str[i]; i++) { + # if ! VERBOSE +- if (i > 4) { ++ if (i >= 4) { + printf(", ..."); + break; + } + # endif +- printf(", "); +- printf("%s", *(str + i)); ++ if (i) ++ printf(", "); ++ printf("%s", str[i]); + } + printf("]"); + } +@@ -170,6 +172,7 @@ + TAIL_ALLOC_OBJECT_CONST_PTR(struct input_id, id); + TAIL_ALLOC_OBJECT_CONST_PTR(struct input_absinfo, absinfo); + TAIL_ALLOC_OBJECT_CONST_PTR(int, bad_addr_slot); ++ + # ifdef EVIOCGMTSLOTS + int mtslots[] = { ABS_MT_SLOT, 1, 3 }; + /* we use the second element to indicate the number of values */ +@@ -183,36 +186,65 @@ + const char *invalid_mtslot_str[] = { invalid_str, "1", "1" }; + # endif + ++ enum { ULONG_BIT = sizeof(unsigned long) * 8 }; ++ + /* set more than 4 bits */ +- unsigned long ev_more[] = { 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED | 1 << EV_SND | 1 << EV_PWR }; +- /* we use the first element to indicate the number of set bits */ +- /* ev_more_str[0] is "5" so the number of set bits is 5 */ +- const char *ev_more_str[] = { "5", "EV_ABS", "EV_MSC", "EV_LED", "EV_SND", "EV_PWR" }; ++ static const unsigned long ev_more[NUM_WORDS] = { ++ 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED | 1 << EV_SND ++ | 1 << EV_PWR }; ++ static const char * const ev_more_str_2[] = { ++ "EV_ABS", "EV_MSC", NULL }; ++ static const char * const ev_more_str_3[] = { ++ "EV_ABS", "EV_MSC", "EV_LED", "EV_SND", "EV_PWR", NULL }; + + /* set less than 4 bits */ +- unsigned long ev_less[] = { 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED }; +- const char *ev_less_str[] = { "3", "EV_ABS", "EV_MSC", "EV_LED" }; ++ static const unsigned long ev_less[NUM_WORDS] = { ++ 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED }; ++ static const char * const ev_less_str_2[] = { ++ "EV_ABS", "EV_MSC", NULL }; ++ static const char * const ev_less_str_3[] = { ++ "EV_ABS", "EV_MSC", "EV_LED", NULL }; + + /* set zero bit */ +- unsigned long ev_zero[] = { 0x0 }; +- const char *ev_zero_str[] = { "0", " 0 " }; ++ static const unsigned long ev_zero[NUM_WORDS] = { 0x0 }; ++ static const char * const ev_zero_str[] = { " 0 ", NULL }; + + /* KEY_MAX is 0x2ff which is greater than retval * 8 */ +- unsigned long key[] = { 1 << KEY_1 | 1 << KEY_2, 0 }; +- const char *key_str[] = { "2", "KEY_1", "KEY_2" }; ++ static const unsigned long key[NUM_WORDS] = { ++ 1 << KEY_1 | 1 << KEY_2, ++ [ KEY_F12 / ULONG_BIT ] = 1 << (KEY_F12 % ULONG_BIT) }; ++ ++ static const char * const key_str_8[] = { ++ "KEY_1", "KEY_2", NULL }; ++ static const char * const key_str_16[] = { ++ "KEY_1", "KEY_2", "KEY_F12", NULL }; ++ ++ assert(sizeof(ev_more) >= (unsigned long) inject_retval); ++ assert(sizeof(ev_less) >= (unsigned long) inject_retval); ++ assert(sizeof(ev_zero) >= (unsigned long) inject_retval); ++ assert(sizeof(key) >= (unsigned long) inject_retval); + + struct { + struct evdev_check check; +- void *ptr; ++ const void *ptr; + } a[] = { + { { ARG_STR(EVIOCGID), id, print_input_id }, NULL }, + { { ARG_STR(EVIOCGABS(ABS_X)), absinfo, print_input_absinfo }, NULL }, + { { ARG_STR(EVIOCGABS(ABS_Y)), absinfo, print_input_absinfo }, NULL }, + { { ARG_STR(EVIOCGABS(ABS_Y)), absinfo, print_input_absinfo }, NULL }, +- { { ARG_STR(EVIOCGBIT(0, 0)), ev_more, print_getbit }, &ev_more_str }, +- { { ARG_STR(EVIOCGBIT(0, 0)), ev_less, print_getbit }, &ev_less_str }, ++ { { ARG_STR(EVIOCGBIT(0, 0)), ev_more, print_getbit }, ++ inject_retval * 8 <= EV_LED ++ ? (const void *) &ev_more_str_2 ++ : (const void *) &ev_more_str_3 }, ++ { { ARG_STR(EVIOCGBIT(0, 0)), ev_less, print_getbit }, ++ inject_retval * 8 <= EV_LED ++ ? (const void *) &ev_less_str_2 ++ : (const void *) &ev_less_str_3 }, + { { ARG_STR(EVIOCGBIT(0, 0)), ev_zero, print_getbit }, &ev_zero_str }, +- { { ARG_STR(EVIOCGBIT(EV_KEY, 0)), key, print_getbit }, &key_str}, ++ { { ARG_STR(EVIOCGBIT(EV_KEY, 0)), key, print_getbit }, ++ inject_retval * 8 <= KEY_F12 ++ ? (const void *) &key_str_8 ++ : (const void *) &key_str_16 }, + # ifdef EVIOCGMTSLOTS + { { ARG_STR(EVIOCGMTSLOTS(12)), mtslots, print_mtslots }, &mtslots_str }, + { { ARG_STR(EVIOCGMTSLOTS(8)), invalid_mtslot, print_mtslots }, &invalid_mtslot_str } +Index: strace-4.24/tests-mx32/ioctl_evdev-success.c +=================================================================== +--- strace-4.24.orig/tests-mx32/ioctl_evdev-success.c 2019-08-01 18:40:58.009521546 +0200 ++++ strace-4.24/tests-mx32/ioctl_evdev-success.c 2019-08-29 12:09:30.350669261 +0200 +@@ -2,6 +2,7 @@ + + #ifdef HAVE_LINUX_INPUT_H + ++# include + # include + # include + # include +@@ -9,17 +10,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); +@@ -31,7 +34,7 @@ + } + + static void +-test_evdev(struct evdev_check *check, void *arg) ++test_evdev(struct evdev_check *check, const void *arg) + { + long rc = invoke_test_syscall(check->cmd, check->arg_ptr); + printf("ioctl(-1, %s, ", check->cmd_str); +@@ -43,9 +46,9 @@ + } + + static void +-print_input_absinfo(long rc, void *ptr, void *arg) ++print_input_absinfo(long rc, const void *ptr, const void *arg) + { +- struct input_absinfo *absinfo = ptr; ++ const struct input_absinfo *absinfo = ptr; + + if (rc < 0) { + printf("%p", absinfo); +@@ -67,9 +70,9 @@ + } + + static void +-print_input_id(long rc, void *ptr, void *arg) ++print_input_id(long rc, const void *ptr, const void *arg) + { +- struct input_id *id = ptr; ++ const struct input_id *id = ptr; + + if (rc < 0) { + printf("%p", id); +@@ -84,10 +87,10 @@ + + # ifdef EVIOCGMTSLOTS + static void +-print_mtslots(long rc, void *ptr, void *arg) ++print_mtslots(long rc, const void *ptr, const void *arg) + { +- int *buffer = ptr; +- const char **str = arg; ++ const int *buffer = ptr; ++ const char * const * str = arg; + int num = atoi(*(str + 1)); + + if (rc < 0) { +@@ -104,27 +107,26 @@ + # endif + + static void +-print_getbit(long rc, void *ptr, void *arg) ++print_getbit(long rc, const void *ptr, const void *arg) + { +- const char **str = arg; +- int num = atoi(*str); ++ const char * const *str = arg; + +- if (rc < 0) { ++ if (rc <= 0) { + printf("%p", ptr); + return; + } + + printf("["); +- printf("%s", *(str + 1)); +- for (unsigned int i = 2; i <= (unsigned) num; i++) { ++ for (unsigned long i = 0; str[i]; i++) { + # if ! VERBOSE +- if (i > 4) { ++ if (i >= 4) { + printf(", ..."); + break; + } + # endif +- printf(", "); +- printf("%s", *(str + i)); ++ if (i) ++ printf(", "); ++ printf("%s", str[i]); + } + printf("]"); + } +@@ -170,6 +172,7 @@ + TAIL_ALLOC_OBJECT_CONST_PTR(struct input_id, id); + TAIL_ALLOC_OBJECT_CONST_PTR(struct input_absinfo, absinfo); + TAIL_ALLOC_OBJECT_CONST_PTR(int, bad_addr_slot); ++ + # ifdef EVIOCGMTSLOTS + int mtslots[] = { ABS_MT_SLOT, 1, 3 }; + /* we use the second element to indicate the number of values */ +@@ -183,36 +186,65 @@ + const char *invalid_mtslot_str[] = { invalid_str, "1", "1" }; + # endif + ++ enum { ULONG_BIT = sizeof(unsigned long) * 8 }; ++ + /* set more than 4 bits */ +- unsigned long ev_more[] = { 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED | 1 << EV_SND | 1 << EV_PWR }; +- /* we use the first element to indicate the number of set bits */ +- /* ev_more_str[0] is "5" so the number of set bits is 5 */ +- const char *ev_more_str[] = { "5", "EV_ABS", "EV_MSC", "EV_LED", "EV_SND", "EV_PWR" }; ++ static const unsigned long ev_more[NUM_WORDS] = { ++ 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED | 1 << EV_SND ++ | 1 << EV_PWR }; ++ static const char * const ev_more_str_2[] = { ++ "EV_ABS", "EV_MSC", NULL }; ++ static const char * const ev_more_str_3[] = { ++ "EV_ABS", "EV_MSC", "EV_LED", "EV_SND", "EV_PWR", NULL }; + + /* set less than 4 bits */ +- unsigned long ev_less[] = { 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED }; +- const char *ev_less_str[] = { "3", "EV_ABS", "EV_MSC", "EV_LED" }; ++ static const unsigned long ev_less[NUM_WORDS] = { ++ 1 << EV_ABS | 1 << EV_MSC | 1 << EV_LED }; ++ static const char * const ev_less_str_2[] = { ++ "EV_ABS", "EV_MSC", NULL }; ++ static const char * const ev_less_str_3[] = { ++ "EV_ABS", "EV_MSC", "EV_LED", NULL }; + + /* set zero bit */ +- unsigned long ev_zero[] = { 0x0 }; +- const char *ev_zero_str[] = { "0", " 0 " }; ++ static const unsigned long ev_zero[NUM_WORDS] = { 0x0 }; ++ static const char * const ev_zero_str[] = { " 0 ", NULL }; + + /* KEY_MAX is 0x2ff which is greater than retval * 8 */ +- unsigned long key[] = { 1 << KEY_1 | 1 << KEY_2, 0 }; +- const char *key_str[] = { "2", "KEY_1", "KEY_2" }; ++ static const unsigned long key[NUM_WORDS] = { ++ 1 << KEY_1 | 1 << KEY_2, ++ [ KEY_F12 / ULONG_BIT ] = 1 << (KEY_F12 % ULONG_BIT) }; ++ ++ static const char * const key_str_8[] = { ++ "KEY_1", "KEY_2", NULL }; ++ static const char * const key_str_16[] = { ++ "KEY_1", "KEY_2", "KEY_F12", NULL }; ++ ++ assert(sizeof(ev_more) >= (unsigned long) inject_retval); ++ assert(sizeof(ev_less) >= (unsigned long) inject_retval); ++ assert(sizeof(ev_zero) >= (unsigned long) inject_retval); ++ assert(sizeof(key) >= (unsigned long) inject_retval); + + struct { + struct evdev_check check; +- void *ptr; ++ const void *ptr; + } a[] = { + { { ARG_STR(EVIOCGID), id, print_input_id }, NULL }, + { { ARG_STR(EVIOCGABS(ABS_X)), absinfo, print_input_absinfo }, NULL }, + { { ARG_STR(EVIOCGABS(ABS_Y)), absinfo, print_input_absinfo }, NULL }, + { { ARG_STR(EVIOCGABS(ABS_Y)), absinfo, print_input_absinfo }, NULL }, +- { { ARG_STR(EVIOCGBIT(0, 0)), ev_more, print_getbit }, &ev_more_str }, +- { { ARG_STR(EVIOCGBIT(0, 0)), ev_less, print_getbit }, &ev_less_str }, ++ { { ARG_STR(EVIOCGBIT(0, 0)), ev_more, print_getbit }, ++ inject_retval * 8 <= EV_LED ++ ? (const void *) &ev_more_str_2 ++ : (const void *) &ev_more_str_3 }, ++ { { ARG_STR(EVIOCGBIT(0, 0)), ev_less, print_getbit }, ++ inject_retval * 8 <= EV_LED ++ ? (const void *) &ev_less_str_2 ++ : (const void *) &ev_less_str_3 }, + { { ARG_STR(EVIOCGBIT(0, 0)), ev_zero, print_getbit }, &ev_zero_str }, +- { { ARG_STR(EVIOCGBIT(EV_KEY, 0)), key, print_getbit }, &key_str}, ++ { { ARG_STR(EVIOCGBIT(EV_KEY, 0)), key, print_getbit }, ++ inject_retval * 8 <= KEY_F12 ++ ? (const void *) &key_str_8 ++ : (const void *) &key_str_16 }, + # ifdef EVIOCGMTSLOTS + { { ARG_STR(EVIOCGMTSLOTS(12)), mtslots, print_mtslots }, &mtslots_str }, + { { ARG_STR(EVIOCGMTSLOTS(8)), invalid_mtslot, print_mtslots }, &invalid_mtslot_str } diff --git a/SOURCES/0034-s390x-beautify-sthyi-data-tail-prints.patch b/SOURCES/0034-s390x-beautify-sthyi-data-tail-prints.patch new file mode 100644 index 0000000..a0aff24 --- /dev/null +++ b/SOURCES/0034-s390x-beautify-sthyi-data-tail-prints.patch @@ -0,0 +1,37 @@ +From f476724ea13d6fae08219aba75a7669eb3e836b3 Mon Sep 17 00:00:00 2001 +From: Janosch Frank +Date: Fri, 30 Nov 2018 16:41:39 +0100 +Subject: [PATCH] s390x: beautify sthyi data tail prints + +The test already expects a ", " before the print of struct +padding. Let's add it to s390.c to make the output look a bit nicer and +fix test runs on z/VM that have padding at the end of the STHYI structs. + +* s390.c (decode_ebcdic): Add missing comma. + +Signed-off-by: Janosch Frank +--- + s390.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/s390.c b/s390.c +index 422c08d..a00c274 100644 +--- a/s390.c ++++ b/s390.c +@@ -472,10 +472,12 @@ decode_ebcdic(const char *ebcdic, char *ascii, size_t size) + do { \ + if ((size_) > sizeof(*(hdr_)) && \ + !is_filled((char *) ((hdr_) + 1), '\0', \ +- (size_) - sizeof(*(hdr_)))) \ ++ (size_) - sizeof(*(hdr_)))) { \ ++ tprints(", "); \ + print_quoted_string((char *) ((hdr_) + 1), \ + (size_) - sizeof(*(hdr_)), \ + QUOTE_FORCE_HEX); \ ++ } \ + } while (0) + + static void +-- +2.1.4 + 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/0041-tests-add-strace-k-p-test.patch b/SOURCES/0041-tests-add-strace-k-p-test.patch new file mode 100644 index 0000000..a9c924c --- /dev/null +++ b/SOURCES/0041-tests-add-strace-k-p-test.patch @@ -0,0 +1,724 @@ +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-4.24/tests/Makefile.am +=================================================================== +--- strace-4.24.orig/tests/Makefile.am 2020-01-23 14:58:43.424959638 +0100 ++++ strace-4.24/tests/Makefile.am 2020-01-23 14:58:43.440959144 +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 +@@ -423,6 +427,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-4.24/tests/stack-fcall-attach.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests/stack-fcall-attach.c 2020-01-23 14:58:43.441959113 +0100 +@@ -0,0 +1,2 @@ ++#define ATTACH_MODE 1 ++#include "stack-fcall.c" +Index: strace-4.24/tests/stack-fcall.c +=================================================================== +--- strace-4.24.orig/tests/stack-fcall.c 2020-01-23 14:58:09.934993679 +0100 ++++ strace-4.24/tests/stack-fcall.c 2020-01-23 14:58:43.441959113 +0100 +@@ -1,7 +1,18 @@ ++#include "tests.h" ++#include + #include "stack-fcall.h" + ++#ifndef ATTACH_MODE ++# define ATTACH_MODE 0 ++#endif ++ + int main(int argc, char **argv) + { ++#if ATTACH_MODE ++ /* sleep a bit to let the tracer time to catch up */ ++ sleep(1); ++#endif ++ + f0(argc); + return 0; + } +Index: strace-4.24/tests/strace-k-p.expected +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests/strace-k-p.expected 2020-01-23 16:23:03.932457826 +0100 +@@ -0,0 +1 @@ ++(__kernel_vsyscall )?(__)?getpid f3 f2 f1 f0 main +Index: strace-4.24/tests/strace-k-p.test +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests/strace-k-p.test 2020-01-23 14:58:43.441959113 +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-4.24/tests/strace-k.test +=================================================================== +--- strace-4.24.orig/tests/strace-k.test 2020-01-23 14:58:43.001972698 +0100 ++++ strace-4.24/tests/strace-k.test 2020-01-23 14:58:43.441959113 +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 getpid -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 getpid -k -p "$tracee_pid" ++else ++ run_strace -e getpid -k $args ++fi + + expected="$srcdir/$NAME.expected" + sed -r -n '1,/\(main\+0x[a-f0-9]+\) .*/ s/^[^(]+\(([^+]+)\+0x[a-f0-9]+\) .*/\1/p' "$LOG" | +Index: strace-4.24/tests/Makefile.in +=================================================================== +--- strace-4.24.orig/tests/Makefile.in 2020-01-23 14:58:43.425959607 +0100 ++++ strace-4.24/tests/Makefile.in 2020-01-23 14:57:57.710371128 +0100 +@@ -178,9 +178,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 +@@ -2427,6 +2427,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) \ +@@ -2851,7 +2857,7 @@ + so_peercred.c so_peercred-Xabbrev.c so_peercred-Xraw.c \ + so_peercred-Xverbose.c sock_filter-v.c sock_filter-v-Xabbrev.c \ + sock_filter-v-Xraw.c sock_filter-v-Xverbose.c socketcall.c \ +- sockopt-sol_netlink.c splice.c $(stack_fcall_SOURCES) \ ++ sockopt-sol_netlink.c splice.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 \ +@@ -2999,7 +3005,7 @@ + so_peercred.c so_peercred-Xabbrev.c so_peercred-Xraw.c \ + so_peercred-Xverbose.c sock_filter-v.c sock_filter-v-Xabbrev.c \ + sock_filter-v-Xraw.c sock_filter-v-Xverbose.c socketcall.c \ +- sockopt-sol_netlink.c splice.c $(stack_fcall_SOURCES) \ ++ sockopt-sol_netlink.c splice.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 \ +@@ -3226,7 +3232,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) +@@ -3960,6 +3967,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 +@@ -4163,7 +4173,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 \ +@@ -4366,6 +4376,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 \ +@@ -6454,6 +6466,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) +@@ -7244,6 +7260,7 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-1.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-2.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-3.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-attach.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-0.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-1.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-2.Po@am__quote@ +Index: strace-4.24/tests-m32/Makefile.am +=================================================================== +--- strace-4.24.orig/tests-m32/Makefile.am 2020-01-23 14:58:43.422959699 +0100 ++++ strace-4.24/tests-m32/Makefile.am 2020-01-23 14:58:43.442959082 +0100 +@@ -173,6 +173,7 @@ + signal_receive \ + sleep \ + stack-fcall \ ++ stack-fcall-attach \ + stack-fcall-mangled \ + threads-execve \ + unblock_reset_raise \ +@@ -214,6 +215,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 +@@ -221,7 +225,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 +@@ -434,6 +438,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-4.24/tests-m32/Makefile.in +=================================================================== +--- strace-4.24.orig/tests-m32/Makefile.in 2020-01-23 14:58:43.424959638 +0100 ++++ strace-4.24/tests-m32/Makefile.in 2020-01-23 17:52:08.510416337 +0100 +@@ -177,9 +177,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 +@@ -2418,6 +2418,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) \ +@@ -2841,7 +2847,7 @@ + so_peercred.c so_peercred-Xabbrev.c so_peercred-Xraw.c \ + so_peercred-Xverbose.c sock_filter-v.c sock_filter-v-Xabbrev.c \ + sock_filter-v-Xraw.c sock_filter-v-Xverbose.c socketcall.c \ +- sockopt-sol_netlink.c splice.c $(stack_fcall_SOURCES) \ ++ sockopt-sol_netlink.c splice.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 \ +@@ -2988,7 +2994,7 @@ + so_peercred.c so_peercred-Xabbrev.c so_peercred-Xraw.c \ + so_peercred-Xverbose.c sock_filter-v.c sock_filter-v-Xabbrev.c \ + sock_filter-v-Xraw.c sock_filter-v-Xverbose.c socketcall.c \ +- sockopt-sol_netlink.c splice.c $(stack_fcall_SOURCES) \ ++ sockopt-sol_netlink.c splice.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 \ +@@ -3215,7 +3221,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) +@@ -3949,6 +3956,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 +@@ -4152,7 +4162,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 \ +@@ -4353,6 +4363,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 \ +@@ -6433,6 +6445,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) +@@ -7221,6 +7237,7 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-1.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-2.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-3.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-attach.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-0.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-1.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-2.Po@am__quote@ +Index: strace-4.24/tests-mx32/Makefile.am +=================================================================== +--- strace-4.24.orig/tests-mx32/Makefile.am 2020-01-23 14:58:43.424959638 +0100 ++++ strace-4.24/tests-mx32/Makefile.am 2020-01-23 14:58:43.443959051 +0100 +@@ -173,6 +173,7 @@ + signal_receive \ + sleep \ + stack-fcall \ ++ stack-fcall-attach \ + stack-fcall-mangled \ + threads-execve \ + unblock_reset_raise \ +@@ -214,6 +215,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 +@@ -221,7 +225,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 +@@ -434,6 +438,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-4.24/tests-mx32/Makefile.in +=================================================================== +--- strace-4.24.orig/tests-mx32/Makefile.in 2020-01-23 14:58:43.424959638 +0100 ++++ strace-4.24/tests-mx32/Makefile.in 2020-01-23 14:58:08.177047958 +0100 +@@ -177,9 +177,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 +@@ -2841,7 +2841,7 @@ + so_peercred.c so_peercred-Xabbrev.c so_peercred-Xraw.c \ + so_peercred-Xverbose.c sock_filter-v.c sock_filter-v-Xabbrev.c \ + sock_filter-v-Xraw.c sock_filter-v-Xverbose.c socketcall.c \ +- sockopt-sol_netlink.c splice.c $(stack_fcall_SOURCES) \ ++ sockopt-sol_netlink.c splice.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 \ +@@ -2988,7 +2988,7 @@ + so_peercred.c so_peercred-Xabbrev.c so_peercred-Xraw.c \ + so_peercred-Xverbose.c sock_filter-v.c sock_filter-v-Xabbrev.c \ + sock_filter-v-Xraw.c sock_filter-v-Xverbose.c socketcall.c \ +- sockopt-sol_netlink.c splice.c $(stack_fcall_SOURCES) \ ++ sockopt-sol_netlink.c splice.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 \ +Index: strace-4.24/tests-m32/stack-fcall-attach.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests-m32/stack-fcall-attach.c 2020-01-23 15:42:03.377780293 +0100 +@@ -0,0 +1,2 @@ ++#define ATTACH_MODE 1 ++#include "stack-fcall.c" +Index: strace-4.24/tests-m32/stack-fcall.c +=================================================================== +--- strace-4.24.orig/tests-m32/stack-fcall.c 2017-12-29 16:20:21.000000000 +0100 ++++ strace-4.24/tests-m32/stack-fcall.c 2020-01-23 15:42:03.381780261 +0100 +@@ -1,7 +1,18 @@ ++#include "tests.h" ++#include + #include "stack-fcall.h" + ++#ifndef ATTACH_MODE ++# define ATTACH_MODE 0 ++#endif ++ + int main(int argc, char **argv) + { ++#if ATTACH_MODE ++ /* sleep a bit to let the tracer time to catch up */ ++ sleep(1); ++#endif ++ + f0(argc); + return 0; + } +Index: strace-4.24/tests-m32/strace-k-p.expected +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests-m32/strace-k-p.expected 2020-01-23 16:22:56.367298204 +0100 +@@ -0,0 +1 @@ ++(__kernel_vsyscall )?(__)?getpid f3 f2 f1 f0 main +Index: strace-4.24/tests-m32/strace-k-p.test +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests-m32/strace-k-p.test 2020-01-23 15:42:03.383780246 +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-4.24/tests-m32/strace-k.test +=================================================================== +--- strace-4.24.orig/tests-m32/strace-k.test 2018-06-14 13:00:00.000000000 +0200 ++++ strace-4.24/tests-m32/strace-k.test 2020-01-23 15:42:03.385780230 +0100 +@@ -7,30 +7,12 @@ + # Copyright (c) 2014-2018 The strace developers. + # All rights reserved. + # +-# Redistribution and use in source and binary forms, with or without +-# modification, are permitted provided that the following conditions +-# are met: +-# 1. Redistributions of source code must retain the above copyright +-# notice, this list of conditions and the following disclaimer. +-# 2. Redistributions in binary form must reproduce the above copyright +-# notice, this list of conditions and the following disclaimer in the +-# documentation and/or other materials provided with the distribution. +-# 3. The name of the author may not be used to endorse or promote products +-# derived from this software without specific prior written permission. +-# +-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++# SPDX-License-Identifier: GPL-2.0-or-later + + . "${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' +@@ -40,7 +22,19 @@ + check_prog tr + + run_prog "${test_prog=../stack-fcall}" +-run_strace -e getpid -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 getpid -k -p "$tracee_pid" ++else ++ run_strace -e getpid -k $args ++fi + + expected="$srcdir/$NAME.expected" + sed -r -n '1,/\(main\+0x[a-f0-9]+\) .*/ s/^[^(]+\(([^+]+)\+0x[a-f0-9]+\) .*/\1/p' "$LOG" | +Index: strace-4.24/tests-mx32/stack-fcall-attach.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests-mx32/stack-fcall-attach.c 2020-01-23 15:42:10.783722024 +0100 +@@ -0,0 +1,2 @@ ++#define ATTACH_MODE 1 ++#include "stack-fcall.c" +Index: strace-4.24/tests-mx32/stack-fcall.c +=================================================================== +--- strace-4.24.orig/tests-mx32/stack-fcall.c 2017-12-29 16:20:21.000000000 +0100 ++++ strace-4.24/tests-mx32/stack-fcall.c 2020-01-23 15:42:10.797721914 +0100 +@@ -1,7 +1,18 @@ ++#include "tests.h" ++#include + #include "stack-fcall.h" + ++#ifndef ATTACH_MODE ++# define ATTACH_MODE 0 ++#endif ++ + int main(int argc, char **argv) + { ++#if ATTACH_MODE ++ /* sleep a bit to let the tracer time to catch up */ ++ sleep(1); ++#endif ++ + f0(argc); + return 0; + } +Index: strace-4.24/tests-mx32/strace-k-p.expected +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests-mx32/strace-k-p.expected 2020-01-23 16:22:53.346234461 +0100 +@@ -0,0 +1 @@ ++(__kernel_vsyscall )?(__)?getpid f3 f2 f1 f0 main +Index: strace-4.24/tests-mx32/strace-k-p.test +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ strace-4.24/tests-mx32/strace-k-p.test 2020-01-23 15:42:10.803721866 +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-4.24/tests-mx32/strace-k.test +=================================================================== +--- strace-4.24.orig/tests-mx32/strace-k.test 2018-06-14 13:00:00.000000000 +0200 ++++ strace-4.24/tests-mx32/strace-k.test 2020-01-23 15:42:10.810721811 +0100 +@@ -7,30 +7,12 @@ + # Copyright (c) 2014-2018 The strace developers. + # All rights reserved. + # +-# Redistribution and use in source and binary forms, with or without +-# modification, are permitted provided that the following conditions +-# are met: +-# 1. Redistributions of source code must retain the above copyright +-# notice, this list of conditions and the following disclaimer. +-# 2. Redistributions in binary form must reproduce the above copyright +-# notice, this list of conditions and the following disclaimer in the +-# documentation and/or other materials provided with the distribution. +-# 3. The name of the author may not be used to endorse or promote products +-# derived from this software without specific prior written permission. +-# +-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++# SPDX-License-Identifier: GPL-2.0-or-later + + . "${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' +@@ -40,7 +22,19 @@ + check_prog tr + + run_prog "${test_prog=../stack-fcall}" +-run_strace -e getpid -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 getpid -k -p "$tracee_pid" ++else ++ run_strace -e getpid -k $args ++fi + + expected="$srcdir/$NAME.expected" + sed -r -n '1,/\(main\+0x[a-f0-9]+\) .*/ s/^[^(]+\(([^+]+)\+0x[a-f0-9]+\) .*/\1/p' "$LOG" | 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..1ec639e --- /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-4.24/configure.ac +=================================================================== +--- strace-4.24.orig/configure.ac 2020-01-26 13:47:02.277446765 +0100 ++++ strace-4.24/configure.ac 2020-01-26 13:47:08.976575337 +0100 +@@ -458,6 +458,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-4.24/sockaddr.c +=================================================================== +--- strace-4.24.orig/sockaddr.c 2020-01-26 13:47:08.977575356 +0100 ++++ strace-4.24/sockaddr.c 2020-01-27 16:26:32.975222449 +0100 +@@ -355,12 +355,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-4.24/tests/net-sockaddr.c +=================================================================== +--- strace-4.24.orig/tests/net-sockaddr.c 2020-01-26 13:47:02.279446803 +0100 ++++ strace-4.24/tests/net-sockaddr.c 2020-01-26 13:47:08.979575395 +0100 +@@ -364,11 +364,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); + } + +@@ -521,9 +532,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-4.24/tests-m32/net-sockaddr.c +=================================================================== +--- strace-4.24.orig/tests-m32/net-sockaddr.c 2020-01-26 13:47:02.282446861 +0100 ++++ strace-4.24/tests-m32/net-sockaddr.c 2020-01-26 13:47:08.979575395 +0100 +@@ -384,11 +384,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); + } + +@@ -541,9 +552,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-4.24/tests-mx32/net-sockaddr.c +=================================================================== +--- strace-4.24.orig/tests-mx32/net-sockaddr.c 2020-01-26 13:47:02.282446861 +0100 ++++ strace-4.24/tests-mx32/net-sockaddr.c 2020-01-26 13:47:08.979575395 +0100 +@@ -384,11 +384,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); + } + +@@ -541,9 +552,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-4.24/configure +=================================================================== +--- strace-4.24.orig/configure 2020-01-26 13:47:02.285446919 +0100 ++++ strace-4.24/configure 2020-01-26 13:47:08.981575433 +0100 +@@ -11240,6 +11240,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-4.24/config.h.in +=================================================================== +--- strace-4.24.orig/config.h.in 2020-01-26 13:47:02.287446957 +0100 ++++ strace-4.24/config.h.in 2020-01-26 13:47:08.982575452 +0100 +@@ -1315,6 +1315,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/0045-Fix-preprocessor-indentation.patch b/SOURCES/0045-Fix-preprocessor-indentation.patch new file mode 100644 index 0000000..60e0180 --- /dev/null +++ b/SOURCES/0045-Fix-preprocessor-indentation.patch @@ -0,0 +1,288 @@ +From d6c71dd0611e7e337edaf36c35ad51a90f404b14 Mon Sep 17 00:00:00 2001 +From: "Dmitry V. Levin" +Date: Sun, 30 Dec 2018 15:35:21 +0000 +Subject: [PATCH] Fix preprocessor indentation + +Indent the C preprocessor directives to reflect their nesting +using the following script: + +$ cppi -l $(git grep -El '^[[:space:]]*#[[:space:]]*(if|ifdef|ifndef|elif|else|endif|define|pragma)[[:space:]]' |grep -v '\.sh$') |while read f; do + cppi < "$f" > "$f".cppi; mv "$f".cppi "$f" +done +--- + bpf_attr.h | 106 ++++++++++++++++++++++++++++++------------------------------- + 1 file changed, 53 insertions(+), 53 deletions(-) + +diff --git a/bpf_attr.h b/bpf_attr.h +index 925221d..dc7694c 100644 +--- a/bpf_attr.h ++++ b/bpf_attr.h +@@ -6,7 +6,7 @@ + */ + + #ifndef STRACE_BPF_ATTR_H +-#define STRACE_BPF_ATTR_H ++# define STRACE_BPF_ATTR_H + + /* + * The policy is that all fields of type uint64_t in this header file +@@ -19,21 +19,21 @@ + * v4.16-rc1~123^2~109^2~5^2~4. + */ + +-#ifndef BPF_OBJ_NAME_LEN +-# define BPF_OBJ_NAME_LEN 16U +-#else +-# if BPF_OBJ_NAME_LEN != 16U +-# error "Unexpected value of BPF_OBJ_NAME_LEN" ++# ifndef BPF_OBJ_NAME_LEN ++# define BPF_OBJ_NAME_LEN 16U ++# else ++# if BPF_OBJ_NAME_LEN != 16U ++# error "Unexpected value of BPF_OBJ_NAME_LEN" ++# endif + # endif +-#endif + +-#ifndef BPF_TAG_SIZE +-# define BPF_TAG_SIZE 8 +-#else +-# if BPF_TAG_SIZE != 8 +-# error "Unexpected value of BPF_TAG_SIZE" ++# ifndef BPF_TAG_SIZE ++# define BPF_TAG_SIZE 8 ++# else ++# if BPF_TAG_SIZE != 8 ++# error "Unexpected value of BPF_TAG_SIZE" ++# endif + # endif +-#endif + + struct BPF_MAP_CREATE_struct { + uint32_t map_type; +@@ -47,9 +47,9 @@ struct BPF_MAP_CREATE_struct { + uint32_t map_ifindex; + }; + +-#define BPF_MAP_CREATE_struct_size \ ++# define BPF_MAP_CREATE_struct_size \ + sizeof(struct BPF_MAP_CREATE_struct) +-#define expected_BPF_MAP_CREATE_struct_size 48 ++# define expected_BPF_MAP_CREATE_struct_size 48 + + struct BPF_MAP_LOOKUP_ELEM_struct { + uint32_t map_fd; +@@ -57,9 +57,9 @@ struct BPF_MAP_LOOKUP_ELEM_struct { + uint64_t ATTRIBUTE_ALIGNED(8) value; + }; + +-#define BPF_MAP_LOOKUP_ELEM_struct_size \ ++# define BPF_MAP_LOOKUP_ELEM_struct_size \ + sizeof(struct BPF_MAP_LOOKUP_ELEM_struct) +-#define expected_BPF_MAP_LOOKUP_ELEM_struct_size 24 ++# define expected_BPF_MAP_LOOKUP_ELEM_struct_size 24 + + struct BPF_MAP_UPDATE_ELEM_struct { + uint32_t map_fd; +@@ -68,18 +68,18 @@ struct BPF_MAP_UPDATE_ELEM_struct { + uint64_t ATTRIBUTE_ALIGNED(8) flags; + }; + +-#define BPF_MAP_UPDATE_ELEM_struct_size \ ++# define BPF_MAP_UPDATE_ELEM_struct_size \ + sizeof(struct BPF_MAP_UPDATE_ELEM_struct) +-#define expected_BPF_MAP_UPDATE_ELEM_struct_size 32 ++# define expected_BPF_MAP_UPDATE_ELEM_struct_size 32 + + struct BPF_MAP_DELETE_ELEM_struct { + uint32_t map_fd; + uint64_t ATTRIBUTE_ALIGNED(8) key; + }; + +-#define BPF_MAP_DELETE_ELEM_struct_size \ ++# define BPF_MAP_DELETE_ELEM_struct_size \ + sizeof(struct BPF_MAP_DELETE_ELEM_struct) +-#define expected_BPF_MAP_DELETE_ELEM_struct_size 16 ++# define expected_BPF_MAP_DELETE_ELEM_struct_size 16 + + struct BPF_MAP_GET_NEXT_KEY_struct { + uint32_t map_fd; +@@ -87,9 +87,9 @@ struct BPF_MAP_GET_NEXT_KEY_struct { + uint64_t ATTRIBUTE_ALIGNED(8) next_key; + }; + +-#define BPF_MAP_GET_NEXT_KEY_struct_size \ ++# define BPF_MAP_GET_NEXT_KEY_struct_size \ + sizeof(struct BPF_MAP_GET_NEXT_KEY_struct) +-#define expected_BPF_MAP_GET_NEXT_KEY_struct_size 24 ++# define expected_BPF_MAP_GET_NEXT_KEY_struct_size 24 + + struct BPF_PROG_LOAD_struct { + uint32_t prog_type; +@@ -106,9 +106,9 @@ struct BPF_PROG_LOAD_struct { + uint32_t expected_attach_type; + }; + +-#define BPF_PROG_LOAD_struct_size \ ++# define BPF_PROG_LOAD_struct_size \ + offsetofend(struct BPF_PROG_LOAD_struct, expected_attach_type) +-#define expected_BPF_PROG_LOAD_struct_size 72 ++# define expected_BPF_PROG_LOAD_struct_size 72 + + struct BPF_OBJ_PIN_struct { + uint64_t ATTRIBUTE_ALIGNED(8) pathname; +@@ -116,12 +116,12 @@ struct BPF_OBJ_PIN_struct { + uint32_t file_flags; + }; + +-#define BPF_OBJ_PIN_struct_size \ ++# define BPF_OBJ_PIN_struct_size \ + sizeof(struct BPF_OBJ_PIN_struct) +-#define expected_BPF_OBJ_PIN_struct_size 16 ++# define expected_BPF_OBJ_PIN_struct_size 16 + +-#define BPF_OBJ_GET_struct BPF_OBJ_PIN_struct +-#define BPF_OBJ_GET_struct_size BPF_OBJ_PIN_struct_size ++# define BPF_OBJ_GET_struct BPF_OBJ_PIN_struct ++# define BPF_OBJ_GET_struct_size BPF_OBJ_PIN_struct_size + + struct BPF_PROG_ATTACH_struct { + uint32_t target_fd; +@@ -130,9 +130,9 @@ struct BPF_PROG_ATTACH_struct { + uint32_t attach_flags; + }; + +-#define BPF_PROG_ATTACH_struct_size \ ++# define BPF_PROG_ATTACH_struct_size \ + sizeof(struct BPF_PROG_ATTACH_struct) +-#define expected_BPF_PROG_ATTACH_struct_size 16 ++# define expected_BPF_PROG_ATTACH_struct_size 16 + + struct BPF_PROG_DETACH_struct { + uint32_t target_fd; +@@ -140,9 +140,9 @@ struct BPF_PROG_DETACH_struct { + uint32_t attach_type; + }; + +-#define BPF_PROG_DETACH_struct_size \ ++# define BPF_PROG_DETACH_struct_size \ + sizeof(struct BPF_PROG_DETACH_struct) +-#define expected_BPF_PROG_DETACH_struct_size 12 ++# define expected_BPF_PROG_DETACH_struct_size 12 + + struct BPF_PROG_TEST_RUN_struct /* test */ { + uint32_t prog_fd; +@@ -155,9 +155,9 @@ struct BPF_PROG_TEST_RUN_struct /* test */ { + uint32_t duration; + }; + +-#define BPF_PROG_TEST_RUN_struct_size \ ++# define BPF_PROG_TEST_RUN_struct_size \ + sizeof(struct BPF_PROG_TEST_RUN_struct) +-#define expected_BPF_PROG_TEST_RUN_struct_size 40 ++# define expected_BPF_PROG_TEST_RUN_struct_size 40 + + struct BPF_PROG_GET_NEXT_ID_struct { + uint32_t start_id; +@@ -165,12 +165,12 @@ struct BPF_PROG_GET_NEXT_ID_struct { + uint32_t open_flags; + }; + +-#define BPF_PROG_GET_NEXT_ID_struct_size \ ++# define BPF_PROG_GET_NEXT_ID_struct_size \ + sizeof(struct BPF_PROG_GET_NEXT_ID_struct) +-#define expected_BPF_PROG_GET_NEXT_ID_struct_size 12 ++# define expected_BPF_PROG_GET_NEXT_ID_struct_size 12 + +-#define BPF_MAP_GET_NEXT_ID_struct BPF_PROG_GET_NEXT_ID_struct +-#define BPF_MAP_GET_NEXT_ID_struct_size BPF_PROG_GET_NEXT_ID_struct_size ++# define BPF_MAP_GET_NEXT_ID_struct BPF_PROG_GET_NEXT_ID_struct ++# define BPF_MAP_GET_NEXT_ID_struct_size BPF_PROG_GET_NEXT_ID_struct_size + + struct BPF_PROG_GET_FD_BY_ID_struct { + uint32_t prog_id; +@@ -178,9 +178,9 @@ struct BPF_PROG_GET_FD_BY_ID_struct { + uint32_t open_flags; + }; + +-#define BPF_PROG_GET_FD_BY_ID_struct_size \ ++# define BPF_PROG_GET_FD_BY_ID_struct_size \ + sizeof(struct BPF_PROG_GET_FD_BY_ID_struct) +-#define expected_BPF_PROG_GET_FD_BY_ID_struct_size 12 ++# define expected_BPF_PROG_GET_FD_BY_ID_struct_size 12 + + struct BPF_MAP_GET_FD_BY_ID_struct { + uint32_t map_id; +@@ -188,9 +188,9 @@ struct BPF_MAP_GET_FD_BY_ID_struct { + uint32_t open_flags; + }; + +-#define BPF_MAP_GET_FD_BY_ID_struct_size \ ++# define BPF_MAP_GET_FD_BY_ID_struct_size \ + sizeof(struct BPF_MAP_GET_FD_BY_ID_struct) +-#define expected_BPF_MAP_GET_FD_BY_ID_struct_size 12 ++# define expected_BPF_MAP_GET_FD_BY_ID_struct_size 12 + + struct BPF_OBJ_GET_INFO_BY_FD_struct /* info */ { + uint32_t bpf_fd; +@@ -198,9 +198,9 @@ struct BPF_OBJ_GET_INFO_BY_FD_struct /* info */ { + uint64_t ATTRIBUTE_ALIGNED(8) info; + }; + +-#define BPF_OBJ_GET_INFO_BY_FD_struct_size \ ++# define BPF_OBJ_GET_INFO_BY_FD_struct_size \ + sizeof(struct BPF_OBJ_GET_INFO_BY_FD_struct) +-#define expected_BPF_OBJ_GET_INFO_BY_FD_struct_size 16 ++# define expected_BPF_OBJ_GET_INFO_BY_FD_struct_size 16 + + struct BPF_PROG_QUERY_struct /* query */ { + uint32_t target_fd; +@@ -211,18 +211,18 @@ struct BPF_PROG_QUERY_struct /* query */ { + uint32_t prog_cnt; + }; + +-#define BPF_PROG_QUERY_struct_size \ ++# define BPF_PROG_QUERY_struct_size \ + offsetofend(struct BPF_PROG_QUERY_struct, prog_cnt) +-#define expected_BPF_PROG_QUERY_struct_size 28 ++# define expected_BPF_PROG_QUERY_struct_size 28 + + struct BPF_RAW_TRACEPOINT_OPEN_struct /* raw_tracepoint */ { + uint64_t ATTRIBUTE_ALIGNED(8) name; + uint32_t prog_fd; + }; + +-#define BPF_RAW_TRACEPOINT_OPEN_struct_size \ ++# define BPF_RAW_TRACEPOINT_OPEN_struct_size \ + offsetofend(struct BPF_RAW_TRACEPOINT_OPEN_struct, prog_fd) +-#define expected_BPF_RAW_TRACEPOINT_OPEN_struct_size 12 ++# define expected_BPF_RAW_TRACEPOINT_OPEN_struct_size 12 + + struct bpf_map_info_struct { + uint32_t type; +@@ -241,9 +241,9 @@ struct bpf_map_info_struct { + uint64_t ATTRIBUTE_ALIGNED(8) netns_ino; /* skip check */ + }; + +-#define bpf_map_info_struct_size \ ++# define bpf_map_info_struct_size \ + sizeof(struct bpf_map_info_struct) +-#define expected_bpf_map_info_struct_size 64 ++# define expected_bpf_map_info_struct_size 64 + + struct bpf_prog_info_struct { + uint32_t type; +@@ -267,8 +267,8 @@ struct bpf_prog_info_struct { + uint64_t ATTRIBUTE_ALIGNED(8) netns_ino; /* skip check */ + }; + +-#define bpf_prog_info_struct_size \ ++# define bpf_prog_info_struct_size \ + sizeof(struct bpf_prog_info_struct) +-#define expected_bpf_prog_info_struct_size 104 ++# define expected_bpf_prog_info_struct_size 104 + + #endif /* !STRACE_BPF_ATTR_H */ +-- +2.1.4 + diff --git a/SOURCES/0046-bpf-exclude-bit-fields-from-the-check.patch b/SOURCES/0046-bpf-exclude-bit-fields-from-the-check.patch new file mode 100644 index 0000000..4356351 --- /dev/null +++ b/SOURCES/0046-bpf-exclude-bit-fields-from-the-check.patch @@ -0,0 +1,28 @@ +From 579f27020c59c426a8fef8b970da9907f59809f8 Mon Sep 17 00:00:00 2001 +From: "Dmitry V. Levin" +Date: Tue, 12 Mar 2019 11:17:20 +0000 +Subject: [PATCH] bpf: exclude bit fields from the check + +Currently we have no instruments to check the size and offsets +of bit fields. + +* gen_bpf_attr_check.sh: Do not print bit fields. +* m4/gen_bpf_attr_m4.awk: Likewise. +--- + gen_bpf_attr_check.sh | 2 +- + m4/gen_bpf_attr_m4.awk | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +Index: strace-4.24/gen_bpf_attr_check.sh +=================================================================== +--- strace-4.24.orig/gen_bpf_attr_check.sh 2020-01-30 13:18:02.606944355 +0100 ++++ strace-4.24/gen_bpf_attr_check.sh 2020-01-30 13:31:03.710562191 +0100 +@@ -30,7 +30,7 @@ + enum="$enum${enum:+.}" + ENUM="$ENUM${ENUM:+_}" + sed -n '/^struct '"$struct"' [^{]*{/,/^};$/p' < "$input" | +- sed -n 's/^[[:space:]]\+[^][;]*[[:space:]]\([^][[:space:];]\+\)\(\[[^;]*\]\)\?;$/\1/p' | ++ sed -n 's/^[[:space:]]\+[^][;:]*[[:space:]]\([^][[:space:];:]\+\)\(\[[^;:]*\]\)\?;$/\1/p' | + while read field; do + FIELD="$(printf %s "$field" |tr '[:lower:]' '[:upper:]')" + cat < +Date: Tue, 12 Mar 2019 11:17:20 +0000 +Subject: [PATCH] bpf: print struct bpf_prog_info.gpl_compatible + +This bit field was added by Linux commit v4.18-rc1~114^2~376^2~6. + +* bpf_attr.h (struct bpf_prog_info_struct): Add gpl_compatible field. +* bpf.c (print_bpf_prog_info): Print gpl_compatible field. +* tests/bpf-obj_get_info_by_fd.c (main): Update expected output. +--- + bpf.c | 5 ++++- + bpf_attr.h | 1 + + tests/bpf-obj_get_info_by_fd.c | 3 +++ + 3 files changed, 8 insertions(+), 1 deletion(-) + +Index: strace-4.24/bpf.c +=================================================================== +--- strace-4.24.orig/bpf.c 2020-01-28 00:12:27.629445789 +0100 ++++ strace-4.24/bpf.c 2020-01-28 00:14:36.905228319 +0100 +@@ -528,11 +528,14 @@ + + /* + * ifindex, netns_dev, and netns_ino fields were introduced +- * by Linux commit v4.16-rc1~123^2~227^2~5^2~2. ++ * by Linux commit v4.16-rc1~123^2~227^2~5^2~2, and ++ * gpl_compatible was added later by Linux commit ++ * v4.18-rc1~114^2~376^2~6. + */ + if (len <= offsetof(struct bpf_prog_info_struct, ifindex)) + goto print_bpf_prog_info_end; + PRINT_FIELD_IFINDEX(", ", info, ifindex); ++ tprintf(", gpl_compatible=%u", info.gpl_compatible); + PRINT_FIELD_DEV(", ", info, netns_dev); + PRINT_FIELD_U(", ", info, netns_ino); + +Index: strace-4.24/bpf_attr.h +=================================================================== +--- strace-4.24.orig/bpf_attr.h 2020-01-28 00:14:12.107461855 +0100 ++++ strace-4.24/bpf_attr.h 2020-01-28 00:14:36.905228319 +0100 +@@ -259,6 +259,7 @@ + uint64_t ATTRIBUTE_ALIGNED(8) map_ids; + char name[BPF_OBJ_NAME_LEN]; + uint32_t ifindex; ++ uint32_t gpl_compatible:1; + /* + * The kernel UAPI is broken by Linux commit + * v4.16-rc1~123^2~227^2~5^2~2 . +Index: strace-4.24/tests/bpf-obj_get_info_by_fd.c +=================================================================== +--- strace-4.24.orig/tests/bpf-obj_get_info_by_fd.c 2020-01-28 00:12:27.629445789 +0100 ++++ strace-4.24/tests/bpf-obj_get_info_by_fd.c 2020-01-28 00:14:36.905228319 +0100 +@@ -461,6 +461,9 @@ + offsetof(struct bpf_prog_info_struct, ifindex)) + printf(", ifindex=%u", prog_info->ifindex); + if (bpf_prog_get_info_attr.info_len > ++ offsetofend(struct bpf_prog_info_struct, ifindex)) ++ printf(", gpl_compatible=%u", prog_info->gpl_compatible); ++ if (bpf_prog_get_info_attr.info_len > + offsetof(struct bpf_prog_info_struct, netns_dev)) + printf(", netns_dev=makedev(%u, %u)", + major(prog_info->netns_dev), +Index: strace-4.24/tests-m32/bpf-obj_get_info_by_fd.c +=================================================================== +--- strace-4.24.orig/tests-m32/bpf-obj_get_info_by_fd.c 2020-01-27 17:41:26.542587684 +0100 ++++ strace-4.24/tests-m32/bpf-obj_get_info_by_fd.c 2020-01-28 00:15:16.441855977 +0100 +@@ -461,6 +461,9 @@ + offsetof(struct bpf_prog_info_struct, ifindex)) + printf(", ifindex=%u", prog_info->ifindex); + if (bpf_prog_get_info_attr.info_len > ++ offsetofend(struct bpf_prog_info_struct, ifindex)) ++ printf(", gpl_compatible=%u", prog_info->gpl_compatible); ++ if (bpf_prog_get_info_attr.info_len > + offsetof(struct bpf_prog_info_struct, netns_dev)) + printf(", netns_dev=makedev(%u, %u)", + major(prog_info->netns_dev), +Index: strace-4.24/tests-m32/bpf.c +=================================================================== +--- strace-4.24.orig/tests-m32/bpf.c 2018-07-11 02:00:57.000000000 +0200 ++++ strace-4.24/tests-m32/bpf.c 2020-01-28 00:15:08.917926835 +0100 +@@ -5,27 +5,7 @@ + * Copyright (c) 2015-2018 The strace developers. + * All rights reserved. + * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions +- * are met: +- * 1. Redistributions of source code must retain the above copyright +- * notice, this list of conditions and the following disclaimer. +- * 2. Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimer in the +- * documentation and/or other materials provided with the distribution. +- * 3. The name of the author may not be used to endorse or promote products +- * derived from this software without specific prior written permission. +- * +- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ * SPDX-License-Identifier: GPL-2.0-or-later + */ + + #include "tests.h" +Index: strace-4.24/tests-mx32/bpf-obj_get_info_by_fd.c +=================================================================== +--- strace-4.24.orig/tests-mx32/bpf-obj_get_info_by_fd.c 2020-01-27 17:41:26.542587684 +0100 ++++ strace-4.24/tests-mx32/bpf-obj_get_info_by_fd.c 2020-01-28 00:15:18.824833536 +0100 +@@ -461,6 +461,9 @@ + offsetof(struct bpf_prog_info_struct, ifindex)) + printf(", ifindex=%u", prog_info->ifindex); + if (bpf_prog_get_info_attr.info_len > ++ offsetofend(struct bpf_prog_info_struct, ifindex)) ++ printf(", gpl_compatible=%u", prog_info->gpl_compatible); ++ if (bpf_prog_get_info_attr.info_len > + offsetof(struct bpf_prog_info_struct, netns_dev)) + printf(", netns_dev=makedev(%u, %u)", + major(prog_info->netns_dev), +Index: strace-4.24/tests-mx32/bpf.c +=================================================================== +--- strace-4.24.orig/tests-mx32/bpf.c 2018-07-11 02:00:57.000000000 +0200 ++++ strace-4.24/tests-mx32/bpf.c 2020-01-28 00:15:10.852908612 +0100 +@@ -5,27 +5,7 @@ + * Copyright (c) 2015-2018 The strace developers. + * All rights reserved. + * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions +- * are met: +- * 1. Redistributions of source code must retain the above copyright +- * notice, this list of conditions and the following disclaimer. +- * 2. Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimer in the +- * documentation and/or other materials provided with the distribution. +- * 3. The name of the author may not be used to endorse or promote products +- * derived from this software without specific prior written permission. +- * +- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ * SPDX-License-Identifier: GPL-2.0-or-later + */ + + #include "tests.h" diff --git a/SOURCES/0048-bpf-add-support-for-btf_-fields-in-BPF_MAP_CREATE.patch b/SOURCES/0048-bpf-add-support-for-btf_-fields-in-BPF_MAP_CREATE.patch new file mode 100644 index 0000000..3dc1ffe --- /dev/null +++ b/SOURCES/0048-bpf-add-support-for-btf_-fields-in-BPF_MAP_CREATE.patch @@ -0,0 +1,199 @@ +From 14a9b6ca66109fc1231eb16e98a9ce4262fb610c Mon Sep 17 00:00:00 2001 +From: "Dmitry V. Levin" +Date: Tue, 12 Mar 2019 11:17:20 +0000 +Subject: [PATCH] bpf: add support for btf_* fields in BPF_MAP_CREATE + +* bpf_attr.h (struct BPF_MAP_CREATE_struct): Add btf_fd, +btf_key_type_id, and btf_value_type_id fields. +* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_MAP_CREATE)): Decode btf_fd, +btf_key_type_id, and btf_value_type_id fields introduced by Linux +commits v4.18-rc1~114^2~417^2~1^2~3 and v4.18-rc1~114^2~148^2~7^2~2. +* tests/bpf.c (BPF_MAP_CREATE_checks): Check it. +* tests/bpf-obj_get_info_by_fd.c (print_map_create): Update expected +output. +--- + bpf.c | 10 ++++++++++ + bpf_attr.h | 5 ++++- + tests/bpf-obj_get_info_by_fd.c | 4 ++++ + tests/bpf.c | 20 ++++++++++++++++++++ + 4 files changed, 38 insertions(+), 1 deletion(-) + +Index: strace-4.24/bpf.c +=================================================================== +--- strace-4.24.orig/bpf.c 2020-01-28 00:14:36.905228319 +0100 ++++ strace-4.24/bpf.c 2020-01-28 00:15:26.973756792 +0100 +@@ -212,6 +212,16 @@ + if (len <= offsetof(struct BPF_MAP_CREATE_struct, map_ifindex)) + break; + PRINT_FIELD_IFINDEX(", ", attr, map_ifindex); ++ ++ /* ++ * The following three fields were introduced by Linux commits ++ * v4.18-rc1~114^2~417^2~1^2~3 and v4.18-rc1~114^2~148^2~7^2~2. ++ */ ++ if (len <= offsetof(struct BPF_MAP_CREATE_struct, btf_fd)) ++ break; ++ PRINT_FIELD_FD(", ", attr, btf_fd, tcp); ++ PRINT_FIELD_U(", ", attr, btf_key_type_id); ++ PRINT_FIELD_U(", ", attr, btf_value_type_id); + } + END_BPF_CMD_DECODER(RVAL_DECODED | RVAL_FD) + +Index: strace-4.24/bpf_attr.h +=================================================================== +--- strace-4.24.orig/bpf_attr.h 2020-01-28 00:14:36.905228319 +0100 ++++ strace-4.24/bpf_attr.h 2020-01-28 00:15:26.974756783 +0100 +@@ -45,11 +45,14 @@ + uint32_t numa_node; + char map_name[BPF_OBJ_NAME_LEN]; + uint32_t map_ifindex; ++ uint32_t btf_fd; ++ uint32_t btf_key_type_id; ++ uint32_t btf_value_type_id; + }; + + # define BPF_MAP_CREATE_struct_size \ + sizeof(struct BPF_MAP_CREATE_struct) +-# define expected_BPF_MAP_CREATE_struct_size 48 ++# define expected_BPF_MAP_CREATE_struct_size 60 + + struct BPF_MAP_LOOKUP_ELEM_struct { + uint32_t map_fd; +Index: strace-4.24/tests/bpf-obj_get_info_by_fd.c +=================================================================== +--- strace-4.24.orig/tests/bpf-obj_get_info_by_fd.c 2020-01-28 00:14:36.905228319 +0100 ++++ strace-4.24/tests/bpf-obj_get_info_by_fd.c 2020-01-28 00:15:26.974756783 +0100 +@@ -84,6 +84,10 @@ + printf(", map_name=\"test_map\""); + if (size > offsetof(struct BPF_MAP_CREATE_struct, map_ifindex)) + printf(", map_ifindex=0"); ++ if (size > offsetof(struct BPF_MAP_CREATE_struct, btf_fd)) { ++ printf(", btf_fd=0" ++ ", btf_key_type_id=0, btf_value_type_id=0"); ++ } + printf("}, %zu) = ", size); + if (rc >= 0) + printf("%ld\n", rc); +Index: strace-4.24/tests/bpf.c +=================================================================== +--- strace-4.24.orig/tests/bpf.c 2020-01-28 00:14:36.905228319 +0100 ++++ strace-4.24/tests/bpf.c 2020-01-28 00:15:26.975756773 +0100 +@@ -400,6 +400,26 @@ + ", map_ifindex=" IFINDEX_LO_STR, + .init_fn = init_BPF_MAP_CREATE_attr7, + }, ++ { /* 8 */ ++ .data = { .BPF_MAP_CREATE_data = { ++ .btf_fd = 0xbadc0ded, ++ .btf_key_type_id = 0xfacefeed, ++ .btf_value_type_id = 0xcafef00d ++ } }, ++ .size = offsetofend(struct BPF_MAP_CREATE_struct, ++ btf_value_type_id), ++ .str = "map_type=BPF_MAP_TYPE_UNSPEC" ++ ", key_size=0" ++ ", value_size=0" ++ ", max_entries=0" ++ ", map_flags=0" ++ ", inner_map_fd=0" ++ ", map_name=\"\"" ++ ", map_ifindex=0" ++ ", btf_fd=-1159983635" ++ ", btf_key_type_id=4207869677" ++ ", btf_value_type_id=3405705229" ++ }, + }; + + static const struct bpf_attr_check BPF_MAP_LOOKUP_ELEM_checks[] = { +Index: strace-4.24/tests-m32/bpf-obj_get_info_by_fd.c +=================================================================== +--- strace-4.24.orig/tests-m32/bpf-obj_get_info_by_fd.c 2020-01-28 00:15:16.441855977 +0100 ++++ strace-4.24/tests-m32/bpf-obj_get_info_by_fd.c 2020-01-28 00:15:51.739523557 +0100 +@@ -84,6 +84,10 @@ + printf(", map_name=\"test_map\""); + if (size > offsetof(struct BPF_MAP_CREATE_struct, map_ifindex)) + printf(", map_ifindex=0"); ++ if (size > offsetof(struct BPF_MAP_CREATE_struct, btf_fd)) { ++ printf(", btf_fd=0" ++ ", btf_key_type_id=0, btf_value_type_id=0"); ++ } + printf("}, %zu) = ", size); + if (rc >= 0) + printf("%ld\n", rc); +Index: strace-4.24/tests-m32/bpf.c +=================================================================== +--- strace-4.24.orig/tests-m32/bpf.c 2020-01-28 00:15:08.917926835 +0100 ++++ strace-4.24/tests-m32/bpf.c 2020-01-28 00:15:45.840579111 +0100 +@@ -400,6 +400,26 @@ + ", map_ifindex=" IFINDEX_LO_STR, + .init_fn = init_BPF_MAP_CREATE_attr7, + }, ++ { /* 8 */ ++ .data = { .BPF_MAP_CREATE_data = { ++ .btf_fd = 0xbadc0ded, ++ .btf_key_type_id = 0xfacefeed, ++ .btf_value_type_id = 0xcafef00d ++ } }, ++ .size = offsetofend(struct BPF_MAP_CREATE_struct, ++ btf_value_type_id), ++ .str = "map_type=BPF_MAP_TYPE_UNSPEC" ++ ", key_size=0" ++ ", value_size=0" ++ ", max_entries=0" ++ ", map_flags=0" ++ ", inner_map_fd=0" ++ ", map_name=\"\"" ++ ", map_ifindex=0" ++ ", btf_fd=-1159983635" ++ ", btf_key_type_id=4207869677" ++ ", btf_value_type_id=3405705229" ++ }, + }; + + static const struct bpf_attr_check BPF_MAP_LOOKUP_ELEM_checks[] = { +Index: strace-4.24/tests-mx32/bpf-obj_get_info_by_fd.c +=================================================================== +--- strace-4.24.orig/tests-mx32/bpf-obj_get_info_by_fd.c 2020-01-28 00:15:18.824833536 +0100 ++++ strace-4.24/tests-mx32/bpf-obj_get_info_by_fd.c 2020-01-28 00:15:55.110491811 +0100 +@@ -84,6 +84,10 @@ + printf(", map_name=\"test_map\""); + if (size > offsetof(struct BPF_MAP_CREATE_struct, map_ifindex)) + printf(", map_ifindex=0"); ++ if (size > offsetof(struct BPF_MAP_CREATE_struct, btf_fd)) { ++ printf(", btf_fd=0" ++ ", btf_key_type_id=0, btf_value_type_id=0"); ++ } + printf("}, %zu) = ", size); + if (rc >= 0) + printf("%ld\n", rc); +Index: strace-4.24/tests-mx32/bpf.c +=================================================================== +--- strace-4.24.orig/tests-mx32/bpf.c 2020-01-28 00:15:10.852908612 +0100 ++++ strace-4.24/tests-mx32/bpf.c 2020-01-28 00:15:48.667552488 +0100 +@@ -400,6 +400,26 @@ + ", map_ifindex=" IFINDEX_LO_STR, + .init_fn = init_BPF_MAP_CREATE_attr7, + }, ++ { /* 8 */ ++ .data = { .BPF_MAP_CREATE_data = { ++ .btf_fd = 0xbadc0ded, ++ .btf_key_type_id = 0xfacefeed, ++ .btf_value_type_id = 0xcafef00d ++ } }, ++ .size = offsetofend(struct BPF_MAP_CREATE_struct, ++ btf_value_type_id), ++ .str = "map_type=BPF_MAP_TYPE_UNSPEC" ++ ", key_size=0" ++ ", value_size=0" ++ ", max_entries=0" ++ ", map_flags=0" ++ ", inner_map_fd=0" ++ ", map_name=\"\"" ++ ", map_ifindex=0" ++ ", btf_fd=-1159983635" ++ ", btf_key_type_id=4207869677" ++ ", btf_value_type_id=3405705229" ++ }, + }; + + static const struct bpf_attr_check BPF_MAP_LOOKUP_ELEM_checks[] = { diff --git a/SOURCES/0049-bpf-add-support-for-btf_-fields-in-struct-bpf_map_in.patch b/SOURCES/0049-bpf-add-support-for-btf_-fields-in-struct-bpf_map_in.patch new file mode 100644 index 0000000..f9a4630 --- /dev/null +++ b/SOURCES/0049-bpf-add-support-for-btf_-fields-in-struct-bpf_map_in.patch @@ -0,0 +1,119 @@ +From 27bd13d3664a6047e9431e01bd13fc04cc5e373b Mon Sep 17 00:00:00 2001 +From: "Dmitry V. Levin" +Date: Tue, 12 Mar 2019 11:17:20 +0000 +Subject: [PATCH] bpf: add support for btf_* fields in struct bpf_map_info + +* bpf_attr.h (struct bpf_map_info_struct): Add btf_fd, btf_key_type_id, +and btf_value_type_id fields. +* bpf.c (print_bpf_map_info): Decode btf_fd, btf_key_type_id, +and btf_value_type_id fields introduced by Linux commits +v4.18-rc1~114^2~223^2~21^2~4 and v4.18-rc1~114^2~148^2~7^2~2. +* tests/bpf-obj_get_info_by_fd.c (main): Update expected output. +--- + bpf.c | 10 ++++++++++ + bpf_attr.h | 7 +++++-- + tests/bpf-obj_get_info_by_fd.c | 9 +++++++++ + 3 files changed, 24 insertions(+), 2 deletions(-) + +Index: strace-4.24/bpf.c +=================================================================== +--- strace-4.24.orig/bpf.c 2020-01-28 00:15:26.973756792 +0100 ++++ strace-4.24/bpf.c 2020-01-28 00:15:59.919446522 +0100 +@@ -466,6 +466,16 @@ + PRINT_FIELD_DEV(", ", info, netns_dev); + PRINT_FIELD_U(", ", info, netns_ino); + ++ /* ++ * The next three fields were introduced by Linux commits ++ * v4.18-rc1~114^2~223^2~21^2~4 and v4.18-rc1~114^2~148^2~7^2~2. ++ */ ++ if (len <= offsetof(struct bpf_map_info_struct, btf_id)) ++ goto print_bpf_map_info_end; ++ PRINT_FIELD_U(", ", info, btf_id); ++ PRINT_FIELD_U(", ", info, btf_key_type_id); ++ PRINT_FIELD_U(", ", info, btf_value_type_id); ++ + decode_attr_extra_data(tcp, info_buf, size, bpf_map_info_struct_size); + + print_bpf_map_info_end: +Index: strace-4.24/bpf_attr.h +=================================================================== +--- strace-4.24.orig/bpf_attr.h 2020-01-28 00:15:26.974756783 +0100 ++++ strace-4.24/bpf_attr.h 2020-01-28 00:15:59.919446522 +0100 +@@ -242,11 +242,14 @@ + */ + uint64_t ATTRIBUTE_ALIGNED(8) netns_dev; /* skip check */ + uint64_t ATTRIBUTE_ALIGNED(8) netns_ino; /* skip check */ ++ uint32_t btf_id; ++ uint32_t btf_key_type_id; ++ uint32_t btf_value_type_id; + }; + + # define bpf_map_info_struct_size \ +- sizeof(struct bpf_map_info_struct) +-# define expected_bpf_map_info_struct_size 64 ++ offsetofend(struct bpf_map_info_struct, btf_value_type_id) ++# define expected_bpf_map_info_struct_size 76 + + struct bpf_prog_info_struct { + uint32_t type; +Index: strace-4.24/tests/bpf-obj_get_info_by_fd.c +=================================================================== +--- strace-4.24.orig/tests/bpf-obj_get_info_by_fd.c 2020-01-28 00:15:26.974756783 +0100 ++++ strace-4.24/tests/bpf-obj_get_info_by_fd.c 2020-01-28 00:15:59.920446513 +0100 +@@ -324,6 +324,15 @@ + if (bpf_map_get_info_attr.info_len > + offsetof(struct bpf_map_info_struct, netns_ino)) + printf(", netns_ino=%" PRIu64, map_info->netns_ino); ++ if (bpf_map_get_info_attr.info_len > ++ offsetof(struct bpf_map_info_struct, btf_id)) ++ PRINT_FIELD_U(", ", *map_info, btf_id); ++ if (bpf_map_get_info_attr.info_len > ++ offsetof(struct bpf_map_info_struct, btf_key_type_id)) ++ PRINT_FIELD_U(", ", *map_info, btf_key_type_id); ++ if (bpf_map_get_info_attr.info_len > ++ offsetof(struct bpf_map_info_struct, btf_value_type_id)) ++ PRINT_FIELD_U(", ", *map_info, btf_value_type_id); + printf("}"); + #else /* !VERBOSE */ + printf("%p", map_info); +Index: strace-4.24/tests-m32/bpf-obj_get_info_by_fd.c +=================================================================== +--- strace-4.24.orig/tests-m32/bpf-obj_get_info_by_fd.c 2020-01-28 00:15:51.739523557 +0100 ++++ strace-4.24/tests-m32/bpf-obj_get_info_by_fd.c 2020-01-28 00:16:14.855305862 +0100 +@@ -324,6 +324,15 @@ + if (bpf_map_get_info_attr.info_len > + offsetof(struct bpf_map_info_struct, netns_ino)) + printf(", netns_ino=%" PRIu64, map_info->netns_ino); ++ if (bpf_map_get_info_attr.info_len > ++ offsetof(struct bpf_map_info_struct, btf_id)) ++ PRINT_FIELD_U(", ", *map_info, btf_id); ++ if (bpf_map_get_info_attr.info_len > ++ offsetof(struct bpf_map_info_struct, btf_key_type_id)) ++ PRINT_FIELD_U(", ", *map_info, btf_key_type_id); ++ if (bpf_map_get_info_attr.info_len > ++ offsetof(struct bpf_map_info_struct, btf_value_type_id)) ++ PRINT_FIELD_U(", ", *map_info, btf_value_type_id); + printf("}"); + #else /* !VERBOSE */ + printf("%p", map_info); +Index: strace-4.24/tests-mx32/bpf-obj_get_info_by_fd.c +=================================================================== +--- strace-4.24.orig/tests-mx32/bpf-obj_get_info_by_fd.c 2020-01-28 00:15:55.110491811 +0100 ++++ strace-4.24/tests-mx32/bpf-obj_get_info_by_fd.c 2020-01-28 00:16:23.096228252 +0100 +@@ -324,6 +324,15 @@ + if (bpf_map_get_info_attr.info_len > + offsetof(struct bpf_map_info_struct, netns_ino)) + printf(", netns_ino=%" PRIu64, map_info->netns_ino); ++ if (bpf_map_get_info_attr.info_len > ++ offsetof(struct bpf_map_info_struct, btf_id)) ++ PRINT_FIELD_U(", ", *map_info, btf_id); ++ if (bpf_map_get_info_attr.info_len > ++ offsetof(struct bpf_map_info_struct, btf_key_type_id)) ++ PRINT_FIELD_U(", ", *map_info, btf_key_type_id); ++ if (bpf_map_get_info_attr.info_len > ++ offsetof(struct bpf_map_info_struct, btf_value_type_id)) ++ PRINT_FIELD_U(", ", *map_info, btf_value_type_id); + printf("}"); + #else /* !VERBOSE */ + printf("%p", map_info); diff --git a/SOURCES/0050-bpf-add-support-for-jited_ksyms-and-jited_func_lens-.patch b/SOURCES/0050-bpf-add-support-for-jited_ksyms-and-jited_func_lens-.patch new file mode 100644 index 0000000..723937b --- /dev/null +++ b/SOURCES/0050-bpf-add-support-for-jited_ksyms-and-jited_func_lens-.patch @@ -0,0 +1,220 @@ +From d1f90bcdc7cf95cf442321f18452d0367e80b7d5 Mon Sep 17 00:00:00 2001 +From: "Dmitry V. Levin" +Date: Tue, 12 Mar 2019 11:17:20 +0000 +Subject: [PATCH] bpf: add support for *jited_ksyms and *jited_func_lens fields + in struct bpf_prog_info + +* bpf_attr.h (struct bpf_prog_info_struct): Add nr_jited_ksyms, +nr_jited_func_lens, jited_ksyms, and jited_func_lens fields. +* bpf.c (struct obj_get_info_saved): Likewise. +(print_bpf_prog_info): Decode these fields introduced by Linux commits +v4.18-rc1~114^2~148^2~3^2~6 and v4.18-rc1~114^2~148^2~3^2~2. +* tests/bpf-obj_get_info_by_fd.c (main): Update expected output. +--- + bpf.c | 40 ++++++++++++++++++++++++++++++++++++++++ + bpf_attr.h | 6 +++++- + tests/bpf-obj_get_info_by_fd.c | 21 +++++++++++++++++++++ + 3 files changed, 66 insertions(+), 1 deletion(-) + +Index: strace-4.24/bpf.c +=================================================================== +--- strace-4.24.orig/bpf.c 2020-01-28 00:15:59.919446522 +0100 ++++ strace-4.24/bpf.c 2020-01-28 00:16:27.823183735 +0100 +@@ -427,6 +427,11 @@ + uint32_t jited_prog_len; + uint32_t xlated_prog_len; + uint32_t nr_map_ids; ++ ++ uint32_t nr_jited_ksyms; ++ uint32_t nr_jited_func_lens; ++ uint64_t jited_ksyms; ++ uint64_t jited_func_lens; + }; + + static void +@@ -497,6 +502,10 @@ + saved->jited_prog_len = info.jited_prog_len; + saved->xlated_prog_len = info.xlated_prog_len; + saved->nr_map_ids = info.nr_map_ids; ++ saved->nr_jited_ksyms = info.nr_jited_ksyms; ++ saved->nr_jited_func_lens = info.nr_jited_func_lens; ++ saved->jited_ksyms = info.jited_ksyms; ++ saved->jited_func_lens = info.jited_func_lens; + + return; + } +@@ -559,6 +568,37 @@ + PRINT_FIELD_DEV(", ", info, netns_dev); + PRINT_FIELD_U(", ", info, netns_ino); + ++ /* ++ * The next four fields were introduced by Linux commits ++ * v4.18-rc1~114^2~148^2~3^2~6 and v4.18-rc1~114^2~148^2~3^2~2. ++ */ ++ if (len <= offsetof(struct bpf_prog_info_struct, nr_jited_ksyms)) ++ goto print_bpf_prog_info_end; ++ ++ tprints(", nr_jited_ksyms="); ++ if (saved->nr_jited_ksyms != info.nr_jited_ksyms) ++ tprintf("%" PRIu32 " => ", saved->nr_jited_ksyms); ++ tprintf("%" PRIu32, info.nr_jited_ksyms); ++ ++ tprints(", nr_jited_func_lens="); ++ if (saved->nr_jited_func_lens != info.nr_jited_func_lens) ++ tprintf("%" PRIu32 " => ", saved->nr_jited_func_lens); ++ tprintf("%" PRIu32, info.nr_jited_func_lens); ++ ++ tprints(", jited_ksyms="); ++ if (saved->jited_ksyms != info.jited_ksyms) { ++ printaddr64(saved->jited_ksyms); ++ tprints(" => "); ++ } ++ printaddr64(info.jited_ksyms); ++ ++ tprints(", jited_func_lens="); ++ if (saved->jited_func_lens != info.jited_func_lens) { ++ printaddr64(saved->jited_func_lens); ++ tprints(" => "); ++ } ++ printaddr64(info.jited_func_lens); ++ + decode_attr_extra_data(tcp, info_buf, size, bpf_prog_info_struct_size); + + print_bpf_prog_info_end: +Index: strace-4.24/bpf_attr.h +=================================================================== +--- strace-4.24.orig/bpf_attr.h 2020-01-28 00:15:59.919446522 +0100 ++++ strace-4.24/bpf_attr.h 2020-01-28 00:16:27.823183735 +0100 +@@ -272,10 +272,14 @@ + */ + uint64_t ATTRIBUTE_ALIGNED(8) netns_dev; /* skip check */ + uint64_t ATTRIBUTE_ALIGNED(8) netns_ino; /* skip check */ ++ uint32_t nr_jited_ksyms; ++ uint32_t nr_jited_func_lens; ++ uint64_t ATTRIBUTE_ALIGNED(8) jited_ksyms; ++ uint64_t ATTRIBUTE_ALIGNED(8) jited_func_lens; + }; + + # define bpf_prog_info_struct_size \ + sizeof(struct bpf_prog_info_struct) +-# define expected_bpf_prog_info_struct_size 104 ++# define expected_bpf_prog_info_struct_size 128 + + #endif /* !STRACE_BPF_ATTR_H */ +Index: strace-4.24/tests/bpf-obj_get_info_by_fd.c +=================================================================== +--- strace-4.24.orig/tests/bpf-obj_get_info_by_fd.c 2020-01-28 00:15:59.920446513 +0100 ++++ strace-4.24/tests/bpf-obj_get_info_by_fd.c 2020-01-28 00:16:27.823183735 +0100 +@@ -358,6 +358,8 @@ + memset(prog_info, 0, PROG_INFO_SZ); + for (unsigned int i = 0; i < 4; i++) { + prog_info->jited_prog_len = 0; ++ prog_info->nr_jited_ksyms = 0; ++ prog_info->nr_jited_func_lens = 0; + memset(prog_info + 1, 0, PROG_INFO_SZ - sizeof(*prog_info)); + switch (i) { + case 1: +@@ -485,6 +487,25 @@ + offsetof(struct bpf_prog_info_struct, netns_ino)) + printf(", netns_ino=%" PRIu64, prog_info->netns_ino); + ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, nr_jited_ksyms)) { ++ printf(", nr_jited_ksyms=0"); ++ if (prog_info->nr_jited_ksyms) ++ printf(" => %u", prog_info->nr_jited_ksyms); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, nr_jited_func_lens)) { ++ printf(", nr_jited_func_lens=0"); ++ if (prog_info->nr_jited_func_lens) ++ printf(" => %u", prog_info->nr_jited_func_lens); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, jited_ksyms)) ++ printf(", jited_ksyms=NULL"); ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, jited_func_lens)) ++ printf(", jited_func_lens=NULL"); ++ + printf("}"); + # else /* !VERBOSE */ + printf("%p", prog_info); +Index: strace-4.24/tests-m32/bpf-obj_get_info_by_fd.c +=================================================================== +--- strace-4.24.orig/tests-m32/bpf-obj_get_info_by_fd.c 2020-01-28 00:16:14.855305862 +0100 ++++ strace-4.24/tests-m32/bpf-obj_get_info_by_fd.c 2020-01-28 00:16:37.300094485 +0100 +@@ -358,6 +358,8 @@ + memset(prog_info, 0, PROG_INFO_SZ); + for (unsigned int i = 0; i < 4; i++) { + prog_info->jited_prog_len = 0; ++ prog_info->nr_jited_ksyms = 0; ++ prog_info->nr_jited_func_lens = 0; + memset(prog_info + 1, 0, PROG_INFO_SZ - sizeof(*prog_info)); + switch (i) { + case 1: +@@ -485,6 +487,25 @@ + offsetof(struct bpf_prog_info_struct, netns_ino)) + printf(", netns_ino=%" PRIu64, prog_info->netns_ino); + ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, nr_jited_ksyms)) { ++ printf(", nr_jited_ksyms=0"); ++ if (prog_info->nr_jited_ksyms) ++ printf(" => %u", prog_info->nr_jited_ksyms); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, nr_jited_func_lens)) { ++ printf(", nr_jited_func_lens=0"); ++ if (prog_info->nr_jited_func_lens) ++ printf(" => %u", prog_info->nr_jited_func_lens); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, jited_ksyms)) ++ printf(", jited_ksyms=NULL"); ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, jited_func_lens)) ++ printf(", jited_func_lens=NULL"); ++ + printf("}"); + # else /* !VERBOSE */ + printf("%p", prog_info); +Index: strace-4.24/tests-mx32/bpf-obj_get_info_by_fd.c +=================================================================== +--- strace-4.24.orig/tests-mx32/bpf-obj_get_info_by_fd.c 2020-01-28 00:16:23.096228252 +0100 ++++ strace-4.24/tests-mx32/bpf-obj_get_info_by_fd.c 2020-01-28 00:16:34.082124791 +0100 +@@ -358,6 +358,8 @@ + memset(prog_info, 0, PROG_INFO_SZ); + for (unsigned int i = 0; i < 4; i++) { + prog_info->jited_prog_len = 0; ++ prog_info->nr_jited_ksyms = 0; ++ prog_info->nr_jited_func_lens = 0; + memset(prog_info + 1, 0, PROG_INFO_SZ - sizeof(*prog_info)); + switch (i) { + case 1: +@@ -485,6 +487,25 @@ + offsetof(struct bpf_prog_info_struct, netns_ino)) + printf(", netns_ino=%" PRIu64, prog_info->netns_ino); + ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, nr_jited_ksyms)) { ++ printf(", nr_jited_ksyms=0"); ++ if (prog_info->nr_jited_ksyms) ++ printf(" => %u", prog_info->nr_jited_ksyms); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, nr_jited_func_lens)) { ++ printf(", nr_jited_func_lens=0"); ++ if (prog_info->nr_jited_func_lens) ++ printf(" => %u", prog_info->nr_jited_func_lens); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, jited_ksyms)) ++ printf(", jited_ksyms=NULL"); ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, jited_func_lens)) ++ printf(", jited_func_lens=NULL"); ++ + printf("}"); + # else /* !VERBOSE */ + printf("%p", prog_info); diff --git a/SOURCES/0051-bpf-add-support-for-new-twelve-fields-in-struct-bpf_.patch b/SOURCES/0051-bpf-add-support-for-new-twelve-fields-in-struct-bpf_.patch new file mode 100644 index 0000000..5918265 --- /dev/null +++ b/SOURCES/0051-bpf-add-support-for-new-twelve-fields-in-struct-bpf_.patch @@ -0,0 +1,410 @@ +From 940fe50f5a72d2624b217ccaf720b05f06a4dd90 Mon Sep 17 00:00:00 2001 +From: "Dmitry V. Levin" +Date: Tue, 12 Mar 2019 11:17:20 +0000 +Subject: [PATCH] bpf: add support for new twelve fields in struct + bpf_prog_info + +* bpf_attr.h (struct bpf_prog_info_struct): Add btf_id, +func_info_rec_size, func_info, nr_func_info, nr_line_info, line_info, +jited_line_info, nr_jited_line_info, line_info_rec_size, +jited_line_info_rec_size, nr_prog_tags, and prog_tags fields. +* bpf.c (struct obj_get_info_saved): Add func_info_rec_size, +nr_func_info, nr_line_info, jited_line_info, nr_jited_line_info, +line_info_rec_size, jited_line_info_rec_size, and nr_prog_tags fields. +(print_bpf_prog_info): Decode the twelve fields introduced by Linux +commits v5.0-rc1~129^2~209^2~16^2~8, v5.0-rc1~129^2~114^2~5^2~6, +v5.0-rc1~129^2~114^2^2~2, and v5.0-rc1~129^2~15^2~22. +* NEWS: Mention the latest bpf decoding enhancements. +* tests/bpf-obj_get_info_by_fd.c (main): Update expected output. + +Resolves: https://github.com/strace/strace/issues/94 +--- + NEWS | 1 + + bpf.c | 78 ++++++++++++++++++++++++++++++++++++++++++ + bpf_attr.h | 14 +++++++- + tests/bpf-obj_get_info_by_fd.c | 66 +++++++++++++++++++++++++++++++++++ + 4 files changed, 158 insertions(+), 1 deletion(-) + +Index: strace-4.24/bpf.c +=================================================================== +--- strace-4.24.orig/bpf.c 2020-01-28 00:16:27.823183735 +0100 ++++ strace-4.24/bpf.c 2020-01-28 00:16:43.588035268 +0100 +@@ -432,6 +432,15 @@ + uint32_t nr_jited_func_lens; + uint64_t jited_ksyms; + uint64_t jited_func_lens; ++ ++ uint32_t func_info_rec_size; ++ uint32_t nr_func_info; ++ uint32_t nr_line_info; ++ uint32_t nr_jited_line_info; ++ uint64_t jited_line_info; ++ uint32_t line_info_rec_size; ++ uint32_t jited_line_info_rec_size; ++ uint32_t nr_prog_tags; + }; + + static void +@@ -507,6 +516,15 @@ + saved->jited_ksyms = info.jited_ksyms; + saved->jited_func_lens = info.jited_func_lens; + ++ saved->func_info_rec_size = info.func_info_rec_size; ++ saved->nr_func_info = info.nr_func_info; ++ saved->nr_line_info = info.nr_line_info; ++ saved->nr_jited_line_info = info.nr_jited_line_info; ++ saved->jited_line_info = info.jited_line_info; ++ saved->line_info_rec_size = info.line_info_rec_size; ++ saved->jited_line_info_rec_size = info.jited_line_info_rec_size; ++ saved->nr_prog_tags = info.nr_prog_tags; ++ + return; + } + +@@ -599,6 +617,66 @@ + } + printaddr64(info.jited_func_lens); + ++ /* ++ * The next twelve fields were introduced by Linux commits ++ * v5.0-rc1~129^2~209^2~16^2~8 ++ * v5.0-rc1~129^2~114^2~5^2~6 ++ * v5.0-rc1~129^2~114^2^2~2 ++ * v5.0-rc1~129^2~15^2~22 ++ */ ++ if (len <= offsetof(struct bpf_prog_info_struct, btf_id)) ++ goto print_bpf_prog_info_end; ++ ++ PRINT_FIELD_U(", ", info, btf_id); ++ ++ tprints(", func_info_rec_size="); ++ if (saved->func_info_rec_size != info.func_info_rec_size) ++ tprintf("%" PRIu32 " => ", saved->func_info_rec_size); ++ tprintf("%" PRIu32, info.func_info_rec_size); ++ ++ PRINT_FIELD_ADDR64(", ", info, func_info); ++ ++ tprints(", nr_func_info="); ++ if (saved->nr_func_info != info.nr_func_info) ++ tprintf("%" PRIu32 " => ", saved->nr_func_info); ++ tprintf("%" PRIu32, info.nr_func_info); ++ ++ tprints(", nr_line_info="); ++ if (saved->nr_line_info != info.nr_line_info) ++ tprintf("%" PRIu32 " => ", saved->nr_line_info); ++ tprintf("%" PRIu32, info.nr_line_info); ++ ++ PRINT_FIELD_ADDR64(", ", info, line_info); ++ ++ tprints(", jited_line_info="); ++ if (saved->jited_line_info != info.jited_line_info) { ++ printaddr64(saved->jited_line_info); ++ tprints(" => "); ++ } ++ printaddr64(info.jited_line_info); ++ ++ tprints(", nr_jited_line_info="); ++ if (saved->nr_jited_line_info != info.nr_jited_line_info) ++ tprintf("%" PRIu32 " => ", saved->nr_jited_line_info); ++ tprintf("%" PRIu32, info.nr_jited_line_info); ++ ++ tprints(", line_info_rec_size="); ++ if (saved->line_info_rec_size != info.line_info_rec_size) ++ tprintf("%" PRIu32 " => ", saved->line_info_rec_size); ++ tprintf("%" PRIu32, info.line_info_rec_size); ++ ++ tprints(", jited_line_info_rec_size="); ++ if (saved->jited_line_info_rec_size != info.jited_line_info_rec_size) ++ tprintf("%" PRIu32 " => ", saved->jited_line_info_rec_size); ++ tprintf("%" PRIu32, info.jited_line_info_rec_size); ++ ++ tprints(", nr_prog_tags="); ++ if (saved->nr_prog_tags != info.nr_prog_tags) ++ tprintf("%" PRIu32 " => ", saved->nr_prog_tags); ++ tprintf("%" PRIu32, info.nr_prog_tags); ++ ++ PRINT_FIELD_ADDR64(", ", info, prog_tags); ++ + decode_attr_extra_data(tcp, info_buf, size, bpf_prog_info_struct_size); + + print_bpf_prog_info_end: +Index: strace-4.24/bpf_attr.h +=================================================================== +--- strace-4.24.orig/bpf_attr.h 2020-01-28 00:16:27.823183735 +0100 ++++ strace-4.24/bpf_attr.h 2020-01-28 00:16:43.588035268 +0100 +@@ -276,10 +276,22 @@ + uint32_t nr_jited_func_lens; + uint64_t ATTRIBUTE_ALIGNED(8) jited_ksyms; + uint64_t ATTRIBUTE_ALIGNED(8) jited_func_lens; ++ uint32_t btf_id; ++ uint32_t func_info_rec_size; ++ uint64_t ATTRIBUTE_ALIGNED(8) func_info; ++ uint32_t nr_func_info; ++ uint32_t nr_line_info; ++ uint64_t ATTRIBUTE_ALIGNED(8) line_info; ++ uint64_t ATTRIBUTE_ALIGNED(8) jited_line_info; ++ uint32_t nr_jited_line_info; ++ uint32_t line_info_rec_size; ++ uint32_t jited_line_info_rec_size; ++ uint32_t nr_prog_tags; ++ uint64_t ATTRIBUTE_ALIGNED(8) prog_tags; + }; + + # define bpf_prog_info_struct_size \ + sizeof(struct bpf_prog_info_struct) +-# define expected_bpf_prog_info_struct_size 128 ++# define expected_bpf_prog_info_struct_size 192 + + #endif /* !STRACE_BPF_ATTR_H */ +Index: strace-4.24/tests/bpf-obj_get_info_by_fd.c +=================================================================== +--- strace-4.24.orig/tests/bpf-obj_get_info_by_fd.c 2020-01-28 00:16:27.823183735 +0100 ++++ strace-4.24/tests/bpf-obj_get_info_by_fd.c 2020-01-28 00:16:43.589035258 +0100 +@@ -360,6 +360,14 @@ + prog_info->jited_prog_len = 0; + prog_info->nr_jited_ksyms = 0; + prog_info->nr_jited_func_lens = 0; ++ prog_info->func_info_rec_size = 0; ++ prog_info->nr_func_info = 0; ++ prog_info->nr_line_info = 0; ++ prog_info->nr_jited_line_info = 0; ++ prog_info->jited_line_info = 0; ++ prog_info->line_info_rec_size = 0; ++ prog_info->jited_line_info_rec_size = 0; ++ prog_info->nr_prog_tags = 0; + memset(prog_info + 1, 0, PROG_INFO_SZ - sizeof(*prog_info)); + switch (i) { + case 1: +@@ -506,6 +514,64 @@ + offsetof(struct bpf_prog_info_struct, jited_func_lens)) + printf(", jited_func_lens=NULL"); + ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, btf_id)) ++ PRINT_FIELD_U(", ", *prog_info, btf_id); ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, func_info_rec_size)) { ++ printf(", func_info_rec_size=0"); ++ if (prog_info->func_info_rec_size) ++ printf(" => %u", prog_info->func_info_rec_size); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, func_info)) ++ printf(", func_info=NULL"); ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, nr_func_info)) { ++ printf(", nr_func_info=0"); ++ if (prog_info->nr_func_info) ++ printf(" => %u", prog_info->nr_func_info); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, nr_line_info)) { ++ printf(", nr_line_info=0"); ++ if (prog_info->nr_line_info) ++ printf(" => %u", prog_info->nr_line_info); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, line_info)) ++ printf(", line_info=NULL"); ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, jited_line_info)) ++ printf(", jited_line_info=NULL"); ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, nr_jited_line_info)) { ++ printf(", nr_jited_line_info=0"); ++ if (prog_info->nr_jited_line_info) ++ printf(" => %u", prog_info->nr_jited_line_info); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, line_info_rec_size)) { ++ printf(", line_info_rec_size=0"); ++ if (prog_info->line_info_rec_size) ++ printf(" => %u", prog_info->line_info_rec_size); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, jited_line_info_rec_size)) { ++ printf(", jited_line_info_rec_size=0"); ++ if (prog_info->jited_line_info_rec_size) ++ printf(" => %u", prog_info->jited_line_info_rec_size); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, nr_prog_tags)) { ++ printf(", nr_prog_tags=0"); ++ if (prog_info->nr_prog_tags) ++ printf(" => %u", prog_info->nr_prog_tags); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, prog_tags)) ++ printf(", prog_tags=NULL"); ++ + printf("}"); + # else /* !VERBOSE */ + printf("%p", prog_info); +Index: strace-4.24/tests-m32/bpf-obj_get_info_by_fd.c +=================================================================== +--- strace-4.24.orig/tests-m32/bpf-obj_get_info_by_fd.c 2020-01-28 00:16:37.300094485 +0100 ++++ strace-4.24/tests-m32/bpf-obj_get_info_by_fd.c 2020-01-28 00:16:49.360980900 +0100 +@@ -360,6 +360,14 @@ + prog_info->jited_prog_len = 0; + prog_info->nr_jited_ksyms = 0; + prog_info->nr_jited_func_lens = 0; ++ prog_info->func_info_rec_size = 0; ++ prog_info->nr_func_info = 0; ++ prog_info->nr_line_info = 0; ++ prog_info->nr_jited_line_info = 0; ++ prog_info->jited_line_info = 0; ++ prog_info->line_info_rec_size = 0; ++ prog_info->jited_line_info_rec_size = 0; ++ prog_info->nr_prog_tags = 0; + memset(prog_info + 1, 0, PROG_INFO_SZ - sizeof(*prog_info)); + switch (i) { + case 1: +@@ -506,6 +514,64 @@ + offsetof(struct bpf_prog_info_struct, jited_func_lens)) + printf(", jited_func_lens=NULL"); + ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, btf_id)) ++ PRINT_FIELD_U(", ", *prog_info, btf_id); ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, func_info_rec_size)) { ++ printf(", func_info_rec_size=0"); ++ if (prog_info->func_info_rec_size) ++ printf(" => %u", prog_info->func_info_rec_size); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, func_info)) ++ printf(", func_info=NULL"); ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, nr_func_info)) { ++ printf(", nr_func_info=0"); ++ if (prog_info->nr_func_info) ++ printf(" => %u", prog_info->nr_func_info); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, nr_line_info)) { ++ printf(", nr_line_info=0"); ++ if (prog_info->nr_line_info) ++ printf(" => %u", prog_info->nr_line_info); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, line_info)) ++ printf(", line_info=NULL"); ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, jited_line_info)) ++ printf(", jited_line_info=NULL"); ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, nr_jited_line_info)) { ++ printf(", nr_jited_line_info=0"); ++ if (prog_info->nr_jited_line_info) ++ printf(" => %u", prog_info->nr_jited_line_info); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, line_info_rec_size)) { ++ printf(", line_info_rec_size=0"); ++ if (prog_info->line_info_rec_size) ++ printf(" => %u", prog_info->line_info_rec_size); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, jited_line_info_rec_size)) { ++ printf(", jited_line_info_rec_size=0"); ++ if (prog_info->jited_line_info_rec_size) ++ printf(" => %u", prog_info->jited_line_info_rec_size); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, nr_prog_tags)) { ++ printf(", nr_prog_tags=0"); ++ if (prog_info->nr_prog_tags) ++ printf(" => %u", prog_info->nr_prog_tags); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, prog_tags)) ++ printf(", prog_tags=NULL"); ++ + printf("}"); + # else /* !VERBOSE */ + printf("%p", prog_info); +Index: strace-4.24/tests-mx32/bpf-obj_get_info_by_fd.c +=================================================================== +--- strace-4.24.orig/tests-mx32/bpf-obj_get_info_by_fd.c 2020-01-28 00:16:34.082124791 +0100 ++++ strace-4.24/tests-mx32/bpf-obj_get_info_by_fd.c 2020-01-28 00:16:51.902956961 +0100 +@@ -360,6 +360,14 @@ + prog_info->jited_prog_len = 0; + prog_info->nr_jited_ksyms = 0; + prog_info->nr_jited_func_lens = 0; ++ prog_info->func_info_rec_size = 0; ++ prog_info->nr_func_info = 0; ++ prog_info->nr_line_info = 0; ++ prog_info->nr_jited_line_info = 0; ++ prog_info->jited_line_info = 0; ++ prog_info->line_info_rec_size = 0; ++ prog_info->jited_line_info_rec_size = 0; ++ prog_info->nr_prog_tags = 0; + memset(prog_info + 1, 0, PROG_INFO_SZ - sizeof(*prog_info)); + switch (i) { + case 1: +@@ -506,6 +514,64 @@ + offsetof(struct bpf_prog_info_struct, jited_func_lens)) + printf(", jited_func_lens=NULL"); + ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, btf_id)) ++ PRINT_FIELD_U(", ", *prog_info, btf_id); ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, func_info_rec_size)) { ++ printf(", func_info_rec_size=0"); ++ if (prog_info->func_info_rec_size) ++ printf(" => %u", prog_info->func_info_rec_size); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, func_info)) ++ printf(", func_info=NULL"); ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, nr_func_info)) { ++ printf(", nr_func_info=0"); ++ if (prog_info->nr_func_info) ++ printf(" => %u", prog_info->nr_func_info); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, nr_line_info)) { ++ printf(", nr_line_info=0"); ++ if (prog_info->nr_line_info) ++ printf(" => %u", prog_info->nr_line_info); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, line_info)) ++ printf(", line_info=NULL"); ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, jited_line_info)) ++ printf(", jited_line_info=NULL"); ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, nr_jited_line_info)) { ++ printf(", nr_jited_line_info=0"); ++ if (prog_info->nr_jited_line_info) ++ printf(" => %u", prog_info->nr_jited_line_info); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, line_info_rec_size)) { ++ printf(", line_info_rec_size=0"); ++ if (prog_info->line_info_rec_size) ++ printf(" => %u", prog_info->line_info_rec_size); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, jited_line_info_rec_size)) { ++ printf(", jited_line_info_rec_size=0"); ++ if (prog_info->jited_line_info_rec_size) ++ printf(" => %u", prog_info->jited_line_info_rec_size); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, nr_prog_tags)) { ++ printf(", nr_prog_tags=0"); ++ if (prog_info->nr_prog_tags) ++ printf(" => %u", prog_info->nr_prog_tags); ++ } ++ if (bpf_prog_get_info_attr.info_len > ++ offsetof(struct bpf_prog_info_struct, prog_tags)) ++ printf(", prog_tags=NULL"); ++ + printf("}"); + # else /* !VERBOSE */ + printf("%p", prog_info); diff --git a/SOURCES/0052-tests-robustify-bpf-obj_get_info_by_fd-test-against-.patch b/SOURCES/0052-tests-robustify-bpf-obj_get_info_by_fd-test-against-.patch new file mode 100644 index 0000000..53216c3 --- /dev/null +++ b/SOURCES/0052-tests-robustify-bpf-obj_get_info_by_fd-test-against-.patch @@ -0,0 +1,79 @@ +From c661605b520fa64b6fc042a642027c14ae9a62f9 Mon Sep 17 00:00:00 2001 +From: "Dmitry V. Levin" +Date: Tue, 21 May 2019 23:30:35 +0000 +Subject: [PATCH] tests: robustify bpf-obj_get_info_by_fd test against future + kernels + +* tests/bpf-obj_get_info_by_fd.c (print_prog_load, main): Change +log_level from 42 to 7, to placate Linux kernels containing commit +v5.2-rc1~133^2~193^2~18^2~9. +--- + tests/bpf-obj_get_info_by_fd.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +Index: strace-4.24/tests/bpf-obj_get_info_by_fd.c +=================================================================== +--- strace-4.24.orig/tests/bpf-obj_get_info_by_fd.c 2020-01-28 00:16:43.589035258 +0100 ++++ strace-4.24/tests/bpf-obj_get_info_by_fd.c 2020-01-28 01:49:32.228432719 +0100 +@@ -180,7 +180,7 @@ + if (size > offsetof(struct BPF_PROG_LOAD_struct, license)) + printf(", license=\"BSD\""); + if (size > offsetof(struct BPF_PROG_LOAD_struct, log_buf)) +- printf(", log_level=42, log_size=%zu, log_buf=\"\"", ++ printf(", log_level=7, log_size=%zu, log_buf=\"\"", + sizeof(log_buf)); + if (size > offsetof(struct BPF_PROG_LOAD_struct, kern_version)) + printf(", kern_version=KERNEL_VERSION(57005, 192, 222)"); +@@ -239,7 +239,7 @@ + .insn_cnt = ARRAY_SIZE(socket_prog), + .insns = (uintptr_t) socket_prog, + .license = (uintptr_t) license, +- .log_level = 42, ++ .log_level = 7, + .log_size = sizeof(log_buf), + .log_buf = (uintptr_t) log_buf, + .kern_version = 0xdeadc0de, +Index: strace-4.24/tests-m32/bpf-obj_get_info_by_fd.c +=================================================================== +--- strace-4.24.orig/tests-m32/bpf-obj_get_info_by_fd.c 2020-01-28 00:16:49.360980900 +0100 ++++ strace-4.24/tests-m32/bpf-obj_get_info_by_fd.c 2020-01-28 01:53:08.192398852 +0100 +@@ -180,7 +180,7 @@ + if (size > offsetof(struct BPF_PROG_LOAD_struct, license)) + printf(", license=\"BSD\""); + if (size > offsetof(struct BPF_PROG_LOAD_struct, log_buf)) +- printf(", log_level=42, log_size=%zu, log_buf=\"\"", ++ printf(", log_level=7, log_size=%zu, log_buf=\"\"", + sizeof(log_buf)); + if (size > offsetof(struct BPF_PROG_LOAD_struct, kern_version)) + printf(", kern_version=KERNEL_VERSION(57005, 192, 222)"); +@@ -239,7 +239,7 @@ + .insn_cnt = ARRAY_SIZE(socket_prog), + .insns = (uintptr_t) socket_prog, + .license = (uintptr_t) license, +- .log_level = 42, ++ .log_level = 7, + .log_size = sizeof(log_buf), + .log_buf = (uintptr_t) log_buf, + .kern_version = 0xdeadc0de, +Index: strace-4.24/tests-mx32/bpf-obj_get_info_by_fd.c +=================================================================== +--- strace-4.24.orig/tests-mx32/bpf-obj_get_info_by_fd.c 2020-01-28 00:16:51.902956961 +0100 ++++ strace-4.24/tests-mx32/bpf-obj_get_info_by_fd.c 2020-01-28 01:53:10.772374555 +0100 +@@ -180,7 +180,7 @@ + if (size > offsetof(struct BPF_PROG_LOAD_struct, license)) + printf(", license=\"BSD\""); + if (size > offsetof(struct BPF_PROG_LOAD_struct, log_buf)) +- printf(", log_level=42, log_size=%zu, log_buf=\"\"", ++ printf(", log_level=7, log_size=%zu, log_buf=\"\"", + sizeof(log_buf)); + if (size > offsetof(struct BPF_PROG_LOAD_struct, kern_version)) + printf(", kern_version=KERNEL_VERSION(57005, 192, 222)"); +@@ -239,7 +239,7 @@ + .insn_cnt = ARRAY_SIZE(socket_prog), + .insns = (uintptr_t) socket_prog, + .license = (uintptr_t) license, +- .log_level = 42, ++ .log_level = 7, + .log_size = sizeof(log_buf), + .log_buf = (uintptr_t) log_buf, + .kern_version = 0xdeadc0de, diff --git a/SOURCES/0100-Wire-up-rseq-syscall-on-architectures-that-use-gener.patch b/SOURCES/0100-Wire-up-rseq-syscall-on-architectures-that-use-gener.patch new file mode 100644 index 0000000..d53e2e5 --- /dev/null +++ b/SOURCES/0100-Wire-up-rseq-syscall-on-architectures-that-use-gener.patch @@ -0,0 +1,37 @@ +From 0b051a218d5e7e51677c26c691dcf619a7d894e9 Mon Sep 17 00:00:00 2001 +From: "Dmitry V. Levin" +Date: Mon, 11 Feb 2019 23:35:07 +0000 +Subject: [PATCH] Wire up rseq syscall on architectures that use generic + unistd.h + +* linux/32/syscallent.h [293]: Wire up rseq syscall introduced by linux +commit v4.19-rc1~109^2~47. +* linux/64/syscallent.h [293]: Likewise. +* NEWS: Mention this. +--- + NEWS | 2 ++ + linux/32/syscallent.h | 1 + + linux/64/syscallent.h | 1 + + 3 files changed, 4 insertions(+) + +Index: strace-4.24/linux/32/syscallent.h +=================================================================== +--- strace-4.24.orig/linux/32/syscallent.h 2019-06-13 01:05:32.297055881 +0200 ++++ strace-4.24/linux/32/syscallent.h 2019-06-13 01:05:42.887824722 +0200 +@@ -283,6 +283,7 @@ + [290] = { 1, 0, SEN(pkey_free), "pkey_free" }, + [291] = { 5, TD|TF|TSTA, SEN(statx), "statx" }, + [292] = { 6, 0, SEN(io_pgetevents), "io_pgetevents" }, ++[293] = { 4, 0, SEN(rseq), "rseq" }, + + #undef sys_ARCH_mmap + #undef ARCH_WANT_SYNC_FILE_RANGE2 +Index: strace-4.24/linux/64/syscallent.h +=================================================================== +--- strace-4.24.orig/linux/64/syscallent.h 2019-06-13 01:05:32.297055881 +0200 ++++ strace-4.24/linux/64/syscallent.h 2019-06-13 01:05:42.888824700 +0200 +@@ -276,3 +276,4 @@ + [290] = { 1, 0, SEN(pkey_free), "pkey_free" }, + [291] = { 5, TD|TF|TSTA, SEN(statx), "statx" }, + [292] = { 6, 0, SEN(io_pgetevents), "io_pgetevents" }, ++[293] = { 4, 0, SEN(rseq), "rseq" }, diff --git a/SOURCES/0101-Wire-up-kexec_file_load-syscall-on-architectures-tha.patch b/SOURCES/0101-Wire-up-kexec_file_load-syscall-on-architectures-tha.patch new file mode 100644 index 0000000..3bf9c97 --- /dev/null +++ b/SOURCES/0101-Wire-up-kexec_file_load-syscall-on-architectures-tha.patch @@ -0,0 +1,39 @@ +From 898f0ad0bc498c45734bc95917b74cfdc6466c26 Mon Sep 17 00:00:00 2001 +From: "Dmitry V. Levin" +Date: Mon, 11 Feb 2019 23:35:07 +0000 +Subject: [PATCH] Wire up kexec_file_load syscall on architectures that use + generic unistd.h + +* linux/32/syscallent.h [294]: Wire up kexec_file_load syscall +introduced by linux commit v5.0-rc1~35^2~41^2~15. +* linux/64/syscallent.h [294]: Likewise. +* NEWS: Mention this. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1676045 +--- + NEWS | 2 +- + linux/32/syscallent.h | 1 + + linux/64/syscallent.h | 1 + + 3 files changed, 3 insertions(+), 1 deletion(-) + +Index: strace-4.24/linux/32/syscallent.h +=================================================================== +--- strace-4.24.orig/linux/32/syscallent.h 2019-06-13 01:05:42.887824722 +0200 ++++ strace-4.24/linux/32/syscallent.h 2019-06-13 01:06:00.405442367 +0200 +@@ -284,6 +284,7 @@ + [291] = { 5, TD|TF|TSTA, SEN(statx), "statx" }, + [292] = { 6, 0, SEN(io_pgetevents), "io_pgetevents" }, + [293] = { 4, 0, SEN(rseq), "rseq" }, ++[294] = { 5, TD, SEN(kexec_file_load), "kexec_file_load" }, + + #undef sys_ARCH_mmap + #undef ARCH_WANT_SYNC_FILE_RANGE2 +Index: strace-4.24/linux/64/syscallent.h +=================================================================== +--- strace-4.24.orig/linux/64/syscallent.h 2019-06-13 01:05:42.888824700 +0200 ++++ strace-4.24/linux/64/syscallent.h 2019-06-13 01:06:00.405442367 +0200 +@@ -277,3 +277,4 @@ + [291] = { 5, TD|TF|TSTA, SEN(statx), "statx" }, + [292] = { 6, 0, SEN(io_pgetevents), "io_pgetevents" }, + [293] = { 4, 0, SEN(rseq), "rseq" }, ++[294] = { 5, TD, SEN(kexec_file_load), "kexec_file_load" }, 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..49c2e90 --- /dev/null +++ b/SOURCES/0201-limit-qual_fault-scope-on-aarch64.patch @@ -0,0 +1,42 @@ +Limit the scope of qual_fault.tests on aarch64 as otherwise it takes +unacceptable amount of time on available builders (more than an hour). +Index: strace-4.24/tests/qual_fault.test +=================================================================== +--- strace-4.24.orig/tests/qual_fault.test 2019-06-13 17:37:10.708269613 +0200 ++++ strace-4.24/tests/qual_fault.test 2019-06-13 17:41:29.358829506 +0200 +@@ -75,18 +75,32 @@ + done + } + +-for err in '' ENOSYS 22 einval; do ++ ++case "$STRACE_ARCH" in ++ aarch64) ++ NUMBERS1='2' ++ NUMBERS2='3' ++ ERRS='EnoSys 22' ++ ;; ++ *) ++ ERRS='ENOSYS 22 einval' ++ NUMBERS1='1 2 3 5 7 11' ++ NUMBERS2='1 2 3 5 7 11' ++ ;; ++esac ++ ++for err in '' $(echo $ERRS); do + for fault in writev desc,51; do + check_fault_injection \ + writev $fault "$err" '' '' 1 -efault=chdir + check_fault_injection \ + writev $fault "$err" '' '' 1 -efault=chdir -efault=none +- for F in 1 2 3 5 7 11; do ++ for F in $(echo $NUMBERS1); do + check_fault_injection \ + writev $fault "$err" $F '' 1 + check_fault_injection \ + writev $fault "$err" $F + 1 +- for S in 1 2 3 5 7 11; do ++ for S in $(echo $NUMBERS2); do + check_fault_injection \ + writev $fault "$err" $F $S 1 + check_fault_injection \ diff --git a/SOURCES/0202-disable-ksysent-on-8.2.patch b/SOURCES/0202-disable-ksysent-on-8.2.patch new file mode 100644 index 0000000..102f151 --- /dev/null +++ b/SOURCES/0202-disable-ksysent-on-8.2.patch @@ -0,0 +1,76 @@ +Unfortunately, strace 5.1 rebase didn't make it into RHEL 8.2. +As a result, ksystent tests now fails due to presence of new io_uring* syscalls. +Disable it for 8.2 in anticipation of a rebase in 8.3 timeframe. + +Index: strace-4.24/tests-m32/Makefile.am +=================================================================== +--- strace-4.24.orig/tests-m32/Makefile.am 2019-12-02 18:36:41.156516491 +0100 ++++ strace-4.24/tests-m32/Makefile.am 2019-12-02 20:32:00.744610221 +0100 +@@ -323,7 +323,6 @@ + get_regs.test \ + inject-nf.test \ + interactive_block.test \ +- ksysent.test \ + localtime.test \ + opipe.test \ + options-syntax.test \ +Index: strace-4.24/tests-m32/Makefile.in +=================================================================== +--- strace-4.24.orig/tests-m32/Makefile.in 2019-12-02 18:36:41.079516234 +0100 ++++ strace-4.24/tests-m32/Makefile.in 2019-12-02 20:32:07.676582952 +0100 +@@ -4246,7 +4246,6 @@ + inject-nf.test \ + interactive_block.test \ + kill_child.test \ +- ksysent.test \ + localtime.test \ + looping_threads.test \ + opipe.test \ +Index: strace-4.24/tests-mx32/Makefile.am +=================================================================== +--- strace-4.24.orig/tests-mx32/Makefile.am 2019-12-02 18:36:41.156516491 +0100 ++++ strace-4.24/tests-mx32/Makefile.am 2019-12-02 20:32:33.983479462 +0100 +@@ -323,7 +323,6 @@ + get_regs.test \ + inject-nf.test \ + interactive_block.test \ +- ksysent.test \ + localtime.test \ + opipe.test \ + options-syntax.test \ +Index: strace-4.24/tests-mx32/Makefile.in +=================================================================== +--- strace-4.24.orig/tests-mx32/Makefile.in 2019-12-02 18:36:41.080516237 +0100 ++++ strace-4.24/tests-mx32/Makefile.in 2019-12-02 20:32:29.375497590 +0100 +@@ -4246,7 +4246,6 @@ + inject-nf.test \ + interactive_block.test \ + kill_child.test \ +- ksysent.test \ + localtime.test \ + looping_threads.test \ + opipe.test \ +Index: strace-4.24/tests/Makefile.am +=================================================================== +--- strace-4.24.orig/tests/Makefile.am 2019-12-02 18:36:41.156516491 +0100 ++++ strace-4.24/tests/Makefile.am 2019-12-02 20:31:29.951731358 +0100 +@@ -308,7 +308,6 @@ + inject-nf.test \ + interactive_block.test \ + kill_child.test \ +- ksysent.test \ + localtime.test \ + looping_threads.test \ + opipe.test \ +Index: strace-4.24/tests/Makefile.in +=================================================================== +--- strace-4.24.orig/tests/Makefile.in 2019-12-02 18:36:41.160516504 +0100 ++++ strace-4.24/tests/Makefile.in 2019-12-02 20:31:49.786653329 +0100 +@@ -4259,7 +4259,6 @@ + inject-nf.test \ + interactive_block.test \ + kill_child.test \ +- ksysent.test \ + localtime.test \ + looping_threads.test \ + opipe.test \ diff --git a/SOURCES/strace-b89a69dec27cf638df0e17db80ed937c3e1abf77.patch b/SOURCES/strace-b89a69dec27cf638df0e17db80ed937c3e1abf77.patch deleted file mode 100644 index 34e3ad0..0000000 --- a/SOURCES/strace-b89a69dec27cf638df0e17db80ed937c3e1abf77.patch +++ /dev/null @@ -1,71 +0,0 @@ -diff -Naurp a/xlat/v4l2_control_id_bases.h b/xlat/v4l2_control_id_bases.h ---- a/xlat/v4l2_control_id_bases.h 2018-08-14 00:44:25.000000000 +0000 -+++ b/xlat/v4l2_control_id_bases.h 2019-05-23 12:21:15.396137688 +0000 -@@ -31,12 +31,16 @@ DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE - #else - # define V4L2_CID_USER_TI_VPE_BASE (V4L2_CID_BASE + 0x1050) - #endif -+#ifndef STRACE_WORKAROUND_FOR_V4L2_CID_USER_IMX_BASE -+# define STRACE_WORKAROUND_FOR_V4L2_CID_USER_IMX_BASE -+# undef V4L2_CID_USER_IMX_BASE -+#endif - #if defined(V4L2_CID_USER_IMX_BASE) || (defined(HAVE_DECL_V4L2_CID_USER_IMX_BASE) && HAVE_DECL_V4L2_CID_USER_IMX_BASE) - DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE --static_assert((V4L2_CID_USER_IMX_BASE) == ((V4L2_CID_BASE + 0x1090)), "V4L2_CID_USER_IMX_BASE != (V4L2_CID_BASE + 0x1090)"); -+static_assert((V4L2_CID_USER_IMX_BASE) == ((V4L2_CID_BASE + 0x10b0)), "V4L2_CID_USER_IMX_BASE != (V4L2_CID_BASE + 0x10b0)"); - DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE - #else --# define V4L2_CID_USER_IMX_BASE (V4L2_CID_BASE + 0x1090) -+# define V4L2_CID_USER_IMX_BASE (V4L2_CID_BASE + 0x10b0) - #endif - #if defined(V4L2_CID_MPEG_BASE) || (defined(HAVE_DECL_V4L2_CID_MPEG_BASE) && HAVE_DECL_V4L2_CID_MPEG_BASE) - DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE -@@ -146,6 +150,21 @@ const struct xlat v4l2_control_id_bases[ - XLAT(V4L2_CID_USER_MEYE_BASE), - XLAT(V4L2_CID_USER_BTTV_BASE), - XLAT(V4L2_CID_USER_TI_VPE_BASE), -+#ifndef STRACE_WORKAROUND_FOR_V4L2_CID_USER_IMX_BASE -+# define STRACE_WORKAROUND_FOR_V4L2_CID_USER_IMX_BASE -+/* -+* Linux kernel commit v4.18-rc2-106-g421860b9d47053badce4b247576fa48df9ab4c48 -+* has changed the value of V4L2_CID_USER_IMX_BASE constant introduced -+* by commit v4.13-rc1~141^2~121 because the old value was already used -+* by V4L2_CID_USER_MAX217X_BASE. -+* This is of course an ABI breakage that affects Linux kernels starting -+* with 4.13 and up to 4.18, as well as their LTS derivatives. -+* Since the imx driver didn't provide any public control ID definitions, -+* it looks like the best way to handle this situation is to pretend that -+* the old value of V4L2_CID_USER_IMX_BASE didn't exist. -+*/ -+# undef V4L2_CID_USER_IMX_BASE -+#endif - XLAT(V4L2_CID_USER_IMX_BASE), - XLAT(V4L2_CID_MPEG_BASE), - XLAT(V4L2_CID_MPEG_CX2341X_BASE), -diff -Naurp a/xlat/v4l2_control_id_bases.in b/xlat/v4l2_control_id_bases.in ---- a/xlat/v4l2_control_id_bases.in 2018-05-06 15:34:41.000000000 +0000 -+++ b/xlat/v4l2_control_id_bases.in 2019-05-23 12:21:01.146061843 +0000 -@@ -2,7 +2,22 @@ V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | - V4L2_CID_USER_MEYE_BASE (V4L2_CID_BASE + 0x1000) - V4L2_CID_USER_BTTV_BASE (V4L2_CID_BASE + 0x1010) - V4L2_CID_USER_TI_VPE_BASE (V4L2_CID_BASE + 0x1050) --V4L2_CID_USER_IMX_BASE (V4L2_CID_BASE + 0x1090) -+#ifndef STRACE_WORKAROUND_FOR_V4L2_CID_USER_IMX_BASE -+# define STRACE_WORKAROUND_FOR_V4L2_CID_USER_IMX_BASE -+/* -+ * Linux kernel commit v4.18-rc2-106-g421860b9d47053badce4b247576fa48df9ab4c48 -+ * has changed the value of V4L2_CID_USER_IMX_BASE constant introduced -+ * by commit v4.13-rc1~141^2~121 because the old value was already used -+ * by V4L2_CID_USER_MAX217X_BASE. -+ * This is of course an ABI breakage that affects Linux kernels starting -+ * with 4.13 and up to 4.18, as well as their LTS derivatives. -+ * Since the imx driver didn't provide any public control ID definitions, -+ * it looks like the best way to handle this situation is to pretend that -+ * the old value of V4L2_CID_USER_IMX_BASE didn't exist. -+ */ -+# undef V4L2_CID_USER_IMX_BASE -+#endif -+V4L2_CID_USER_IMX_BASE (V4L2_CID_BASE + 0x10b0) - V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) - V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) - V4L2_CID_MPEG_MFC51_BASE (V4L2_CTRL_CLASS_MPEG | 0x1100) diff --git a/SPECS/strace.spec b/SPECS/strace.spec index 4687012..a518681 100644 --- a/SPECS/strace.spec +++ b/SPECS/strace.spec @@ -1,81 +1,192 @@ Summary: Tracks and displays system calls associated with a running process Name: strace Version: 4.24 -Release: 5%{?dist} +Release: 9%{?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 +URL: https://strace.io/ +Source: https://strace.io/files/%{version}/%{name}-%{version}.tar.xz + BuildRequires: libacl-devel time gcc gzip BuildRequires: pkgconfig(bluez) BuildRequires: elfutils-devel binutils-devel -# General bug fixes +## General bug fixes +# v4.25~91 "evdev: fix decoding of bit sets" Patch1: 0001-evdev-fix-decoding-of-bit-sets.patch +# v4.25~90 "evdev: fix decoding of EVIOCGBIT(0, ...)" Patch2: 0002-evdev-fix-decoding-of-EVIOCGBIT-0.patch +# v4.25~83 "xlat: fix typo in smc_protocols.in" Patch3: 0003-xlat-fix-typo-in-smc_protocols.in.patch -# Pre-requisite for the queueing patch +## Pre-requisite for the queueing patch +# v4.25~82 "strace.c: introduce struct tcb_wait_data" Patch4: 0004-strace.c-introduce-struct-tcb_wait_data.patch -# Documentation +## Documentation +# v4.26~83 "Document -X option in strace -h output" Patch5: 0005-Document-X-option-in-strace-h-output.patch -# Addresses https://bugzilla.redhat.com/1660759 ("strace prints "xlat_idx: -# Unexpected xlat value 0 at index 4" messages") +## Addresses https://bugzilla.redhat.com/1660759 ("strace prints "xlat_idx: +## Unexpected xlat value 0 at index 4" messages") +# v4.26~36 "evdev: fix off-by-one error in decode_bitset" Patch6: 0006-evdev-fix-off-by-one-error-in-decode_bitset.patch +# v4.26~35 "nlattr: fix off-by-one error in indexed xlat lookup" Patch7: 0007-nlattr-fix-off-by-one-error-in-indexed-xlat-lookup.patch +# v4.26~34 "aio: fix off-by-one error in indexed xlat lookup" Patch8: 0008-aio-fix-off-by-one-error-in-indexed-xlat-lookup.patch +# v4.26~31 "rtnl_link: fix off-by-one errors in indexed and sorted xlat lookups" Patch9: 0009-rtnl_link-fix-off-by-one-errors-in-indexed-and-sorte.patch +# v4.26~30 "rtnl_link: fix off-by-one errors in indexed and sorted xlat lookups" Patch10: 0010-xlat_idx-do-not-issue-warnings-for-holes-in-indices.patch -# man page updates +## man page updates +# v4.26~27 "strace.1.in: print names of entities in bold, provide man page sections" Patch11: 0011-strace.1.in-print-names-of-entities-in-bold-provide-.patch +# v4.26~26 "strace.1.in: consistently use CTRL-combinations" Patch12: 0012-strace.1.in-consistently-use-CTRL-combinations.patch -# License change +## License change +# v4.26~53 "tests: change the license to GPL-2.0-or-later" Patch13: 0013-tests-change-the-license-to-GPL-2.0-or-later.patch +# v4.26~52 "Change the license of strace to LGPL-2.1-or-later" Patch14: 0014-Change-the-license-of-strace-to-LGPL-2.1-or-later.patch -# Tests fixes +## Tests fixes, can be hit on newer kernels +# v5.0~95 "tests: use tail_alloc instead of calloc in bpf-obj_get_info_by_fd-prog*" Patch15: 0015-tests-use-tail_alloc-instead-of-calloc-in-bpf-obj_ge.patch +# v5.0~94 "tests: fix prog_info initialization in bpf-obj_get_info_by_fd-prog*" Patch16: 0016-tests-fix-prog_info-initialization-in-bpf-obj_get_in.patch -# General bug fixes +## General bug fixes +# v5.0~71 "Merge "<... resumed>" printing" Patch17: 0017-Merge-.-resumed-printing.patch +# v5.0~69 "Use accessors for tcp->s_ent, return a stub struct if it is NULL" Patch18: 0018-Use-accessors-for-tcp-s_ent-return-a-stub-struct-if-.patch +# v5.0~66 "syscall.c: set MEMORY_MAPPING_CHANGE in stub sysent" Patch19: 0019-syscall.c-set-MEMORY_MAPPING_CHANGE-in-stub-sysent.patch -# Addresses https://bugzilla.redhat.com/1662936 ("strace reports -# 'ptrace(SYSCALL): No such process' on multi-threaded testcase on RHEL-8") +## Addresses https://bugzilla.redhat.com/1662936 ("strace reports +## 'ptrace(SYSCALL): No such process' on multi-threaded testcase on RHEL-8") +# v5.0~67 "Make inline message on failed restart attempt more verbose" Patch20: 0020-Make-inline-message-on-failed-restart-attempt-more-v.patch +# v5.0~64 "ptrace_restart: do not print diagnostics when ptrace returns ESRCH" Patch21: 0021-ptrace_restart-do-not-print-diagnostics-when-ptrace-.patch -# Pre-requisites for the queueing patch +## Pre-requisites for the queueing patch +# v5.0~60 "tests: add kill_child test" Patch22: 0022-tests-add-kill_child-test.patch +# v5.0~30 "tests: move PTRACE_SEIZE check to a separate file" Patch23: 0023-tests-move-PTRACE_SEIZE-check-to-a-separate-file.patch +# v5.0~29 "tests: check tracing of orphaned process group" Patch24: 0024-tests-check-tracing-of-orphaned-process-group.patch +# v5.0~27 "tests: check tracing of looping threads" Patch25: 0025-tests-check-tracing-of-looping-threads.patch -# Implementation of tcp queueing -# Addresses https://bugzilla.redhat.com/1609318 ("Some threads are not created -# when strace with -f option is executed") and all previous its incarnations -# (478419, 526740, 851457, 1610774). +## Implementation of tcp queueing +## Addresses https://bugzilla.redhat.com/1609318 ("Some threads are not created +## when strace with -f option is executed") and all previous its incarnations +## (478419, 526740, 851457, 1610774). +# v5.0~26 "Add a generic list implementation" Patch26: 0026-Add-a-generic-list-implementation.patch +# v5.0~25 "Implement queueing of threads before dispatching them" Patch27: 0027-Implement-queueing-of-threads-before-dispatching-the.patch -# Wire up rseq and kexec_file_load in order to avoid kexec_file_load -# test failure on aarch64. Addresses https://bugzilla.redhat.com/1676045 -# ("strace: FTBFS in Fedora rawhide/f30"). -Patch28: 0028-Wire-up-rseq-syscall-on-architectures-that-use-gener.patch -Patch29: 0029-Wire-up-kexec_file_load-syscall-on-architectures-tha.patch - -# Limit scope of qual_fault.test in order to avoid test timeout on aarch64 -Patch30: 0030-limit-qual_fault-test-on-aarch64.patch - -Patch31: 0031-avoid-zero-length-VLA-in-evdev_c.patch - -Patch9999: strace-b89a69dec27cf638df0e17db80ed937c3e1abf77.patch +## Pre-requisites for "evdev: fix array size calculation in decode_bitset_" +# v4.25~30 "macros: add ROUNDUP macro" +Patch28: 0028-macros-add-ROUNDUP-macro.patch +# v5.0~45 "util: update dumpstr" (only macros.h change) +Patch29: 0029-util-update-dumpstr.patch + +## 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 + +## Pre-requisite for "tests: test evdev bitset decoding more thoroughly" +# v4.25~89 "tests: check decoding of successful evdev ioctl" +Patch32: 0032-tests-check-decoding-of-successful-evdev-ioctl.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 + +## https://bugzilla.redhat.com/1747475 https://bugzilla.redhat.com/1747514 +# v4.26~65 "s390x: beautify sthyi data tail prints" +Patch34: 0034-s390x-beautify-sthyi-data-tail-prints.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 + +## Update bpf decoder, as bpf-obj_get_info_by_fd-prog-v.gen.test has started +## to fail after BPF rebase in RHEL 8.2 kernel. +# v5.0~98 "Fix preprocessor indentation", only the bpf_attr.h chunks +Patch45: 0045-Fix-preprocessor-indentation.patch +# v5.0~24 "bpf: exclude bit fields from the check" +Patch46: 0046-bpf-exclude-bit-fields-from-the-check.patch +# v5.0~23 "bpf: print struct bpf_prog_info.gpl_compatible" +Patch47: 0047-bpf-print-struct-bpf_prog_info.gpl_compatible.patch +# v5.0~22 "bpf: add support for btf_* fields in BPF_MAP_CREATE" +Patch48: 0048-bpf-add-support-for-btf_-fields-in-BPF_MAP_CREATE.patch +# v5.0~21 "bpf: add support for btf_* fields in struct bpf_map_info" +Patch49: 0049-bpf-add-support-for-btf_-fields-in-struct-bpf_map_in.patch +# v5.0~20 "bpf: add support for *jited_ksyms and *jited_func_lens fields in struct bpf_prog_info" +Patch50: 0050-bpf-add-support-for-jited_ksyms-and-jited_func_lens-.patch +# v5.0~19 "bpf: add support for new twelve fields in struct bpf_prog_info" +Patch51: 0051-bpf-add-support-for-new-twelve-fields-in-struct-bpf_.patch +# v5.1~6 "tests: robustify bpf-obj_get_info_by_fd test against future kernels" +Patch52: 0052-tests-robustify-bpf-obj_get_info_by_fd-test-against-.patch + +## Wire up rseq and kexec_file_load in order to avoid kexec_file_load +## test failure on aarch64. Addresses https://bugzilla.redhat.com/1676045 +## ("strace: FTBFS in Fedora rawhide/f30"). +# v5.0~62 "Wire up rseq syscall on architectures that use generic unistd.h" +Patch100: 0100-Wire-up-rseq-syscall-on-architectures-that-use-gener.patch +# v5.0~61 "Wire up kexec_file_load syscall on architectures that use generic unistd.h" +Patch101: 0101-Wire-up-kexec_file_load-syscall-on-architectures-tha.patch + +### 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 +## RHEL8.2-only: disable ksysent test due to missing rebase +Patch202: 0202-disable-ksysent-on-8.2.patch # We no longer need to build a separate strace32 binary, but we don't want # to break existing strace32 users' workflows. @@ -132,16 +243,39 @@ received by a process. %patch29 -p1 %patch30 -p1 %patch31 -p1 - -%ifarch %{arm} -%patch9999 -p1 -%endif - -chmod a+x tests/*.test +%patch32 -p1 +%patch33 -p1 +%patch34 -p1 +%patch35 -p1 +%patch36 -p1 +%patch37 -p1 +%patch38 -p1 +%patch39 -p1 +#%patch40 -p1 +%patch41 -p1 +%patch42 -p1 +%patch43 -p1 +%patch44 -p1 +%patch45 -p1 +%patch46 -p1 +%patch47 -p1 +%patch48 -p1 +%patch49 -p1 +%patch50 -p1 +%patch51 -p1 +%patch52 -p1 + +%patch100 -p1 +%patch101 -p1 + +#%patch200 -p1 +%patch201 -p1 +%patch202 -p1 echo -n %version-%release > .tarball-version echo -n 2019 > .year -echo -n 2019-06-12 > .strace.1.in.date +echo -n 2019-12-02 > .strace.1.in.date + %build echo 'BEGIN OF BUILD ENVIRONMENT INFORMATION' @@ -155,6 +289,16 @@ kver="$(printf '%%s\n%%s\n' '#include ' 'LINUX_VERSION_CODE' | printf 'kernel-headers %%s.%%s.%%s\n' $(($kver/65536)) $(($kver/256%%256)) $(($kver%%256)) echo 'END OF BUILD ENVIRONMENT INFORMATION' +CFLAGS=" $RPM_OPT_FLAGS $LDFLAGS " +# Removing explicit -m64 as it breaks mpers +[ "x${CFLAGS#* -m64 }" = "x${CFLAGS}" ] || CFLAGS=$(echo "$CFLAGS" | sed 's/ -m64 / /g') +export CFLAGS + +CPPFLAGS=" -I%{_includedir} %{optflags} " +# Removing explicit -m64 as it breaks mpers +[ "x${CPPFLAGS#* -m64 }" = "x${CPPFLAGS}" ] || CPPFLAGS=$(echo "$CPPFLAGS" | sed 's/ -m64 / /g') +export CPPFLAGS + CFLAGS_FOR_BUILD="$RPM_OPT_FLAGS"; export CFLAGS_FOR_BUILD # Commit v4.26-50-gb1a2db9 is needed for enforcing libiberty usage with # --with-libiberty @@ -174,7 +318,7 @@ rm -f %{buildroot}%{_bindir}/strace-graph # some say uncompressed changelog files are too big for f in ChangeLog ChangeLog-CVS; do - gzip -9n < "$f" > "$f".gz & + gzip -9n < "$f" > "$f".gz & done wait @@ -182,21 +326,21 @@ wait # This is needed since patch does not set x bit to the newly created files # (0022-tests-add-kill_child-test.patch, # 0024-tests-check-tracing-of-orphaned-process-group.patch, -# 0025-tests-check-tracing-of-looping-threads.patch) +# 0025-tests-check-tracing-of-looping-threads.patch, +# 0032-tests-check-decoding-of-successful-evdev-ioctl.patch) chmod u+x tests/*.test tests-m32/*.test tests-mx32/*.test %{buildroot}%{_bindir}/strace -V # 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. -%ifnarch %{arm} 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 +tail -n 99999 -- tests*/test-suite.log +tail -n 99999 -- tests*/ksysent.log ||: find tests* -type f -name '*.log' -print0 | xargs -r0 grep -H '^KERNEL BUG:' -- ||: echo 'END OF TEST SUITE INFORMATION' -%endif %files %defattr(-,root,root) @@ -209,6 +353,45 @@ echo 'END OF TEST SUITE INFORMATION' %{_mandir}/man1/* %changelog +* Thu Jan 30 2020 Eugene Syromiatnikov - 4.24-9 +- Fix the "extra tokens at end of #ifdef directive" warning: + 579f2702 "bpf: exclude bit fields from the check". + +* Mon Jan 27 2020 Eugene Syromiatnikov - 4.24-8 +- Fix expected alignment for IPC tests (#1795251): + 4377e3a1 "tests: fix expected output for some ipc tests", and + a75c7c4b "tests: fix -a argument in ipc_msgbuf-Xraw test". +- Update tests-m32/looping_threads.test and tests-mx32/looping_threads.test + in 0025-tests-check-tracing-of-looping-threads.patch. +- Update the bpf syscall decoder: + d6c71dd0 "Fix preprocessor indentation", + cabd6955 "bpf: print struct bpf_prog_info.gpl_compatible", + 14a9b6ca "bpf: add support for btf_* fields in BPF_MAP_CREATE", + 27bd13d3 "bpf: add support for btf_* fields in struct bpf_map_info", + d1f90bcd "bpf: add support for *jited_ksyms and *jited_func_lens fields + in struct bpf_prog_info", and + 940fe50f "bpf: add support for new twelve fields in struct bpf_prog_info". + c661605b "tests: robustify bpf-obj_get_info_by_fd test against future kernels" + +* Thu Jan 23 2020 Eugene Syromiatnikov - 4.24-7 +- Fix printing stack traces for early syscalls on process attach (#1790053): + 69b2c33a "unwind-libdw: fix initialization of libdwfl cache" and + 8e515c74 "tests: add strace-k-p test". +- Properly decode struct sockaddr_hci without hci_channel field. +- Update tests-m32/ioctl_evdev.c and tests-mx32/ioctl_evdev.c + in 0002-evdev-fix-decoding-of-EVIOCGBIT-0.patch. +- Update tests-m32/Makefile.in and tests-mx32/Makefile.in + in 0032-tests-check-decoding-of-successful-evdev-ioctl.patch. + +* Mon Dec 02 2019 Eugene Syromiatnikov - 4.24-6 +- Pull upstream fix for ioctl evdev bitset decoding, fix the tests (#1747214). +- Include commit v4.26~65 "s390x: beautify sthyi data tail prints" (#1747514). +- Include upstream patches that fix issues reported by covscan (#1747526): + 91281fec "v4l2: avoid shifting left a signed number by 31 bit", + 522ad3a0 "syscall.c: avoid infinite loop in subcalls parsing", + 9446038e "kvm: avoid bogus vcpu_info assignment in vcpu_register", and + 2b64854e "xlat: use unsgined type for mount_flags fallback values". + * Fri Jun 14 2019 Eugene Syromiatnikov - 4.24-5 - Use SPDX abbreviations for licenses.