diff --git a/SOURCES/strace-rh1466535.patch b/SOURCES/strace-rh1466535.patch new file mode 100644 index 0000000..b3964cd --- /dev/null +++ b/SOURCES/strace-rh1466535.patch @@ -0,0 +1,63 @@ +commit 1b93f4032a246e0aa43c2f424921e0aace57b994 +Author: Eugene Syromyatnikov +Date: Fri Aug 4 11:33:04 2017 +0200 + + Improve handling of unexpected tracees + + When receiving a ptrace stop of an unexpected child, handle it + in the most transparent way possible: + - detach it instead of PTRACE_CONT'ing; + - send it the signal with which it has been stopped. + This should hopefully help to deal with processes that have been created + with misused CLONE_PTRACE flag set. + + * strace.c (maybe_allocate_tcb) : + Calculate the signal similarly to the way next_event does, + forward it to the unexpected tracee, and detach the tracee. + +commit 7a35b711df127664e7430b2644ae92c75f3d5f67 +Author: Dmitry V. Levin +Date: Sun Aug 6 13:27:07 2017 +0000 + + Fix handling of unexpected tracees when PTRACE_SEIZE is not in use + + * strace.c (maybe_allocate_tcb) : + The expected ptrace stop signal in case of !use seize is not + syscall_trap_sig but SIGSTOP. An idea of using PTRACE_GETSIGINFO to + distinguish signal stops that should be re-injected from other kinds + of stops didn't work out due to kernel implementation peculiarities + of initial ptrace-stop. + +commit 330f4633d5103938982602b6f21f761570e3482c +Author: Dmitry V. Levin +Date: Sun Aug 6 15:10:56 2017 +0000 + + Simplify handling of unexpected tracees + + * strace.c (maybe_allocate_tcb) : + Remove the dance around possible re-injection of WSTOPSIG(status) + as the only observable stop here is the initial ptrace-stop. + +diff -rup a/strace.c b/strace.c +--- a/strace.c 2017-08-31 14:04:21.000000000 -0400 ++++ b/strace.c 2017-08-31 14:51:32.523134570 -0400 +@@ -1958,11 +1958,15 @@ maybe_allocate_tcb(const int pid, int st + error_msg("Process %d attached", pid); + return tcp; + } else { +- /* This can happen if a clone call used +- * CLONE_PTRACE itself. ++ /* ++ * This can happen if a clone call misused CLONE_PTRACE itself. ++ * ++ * There used to be a dance around possible re-injection of ++ * WSTOPSIG(status), but it was later removed as the only ++ * observable stop here is the initial ptrace-stop. + */ +- ptrace(PTRACE_CONT, pid, (char *) 0, 0); +- error_msg("Stop of unknown pid %u seen, PTRACE_CONTed it", pid); ++ ptrace(PTRACE_DETACH, pid, NULL, 0L); ++ error_msg("Detached unknown pid %d", pid); + return NULL; + } + } diff --git a/SOURCES/strace-rh1540954-1.patch b/SOURCES/strace-rh1540954-1.patch new file mode 100644 index 0000000..c90b29b --- /dev/null +++ b/SOURCES/strace-rh1540954-1.patch @@ -0,0 +1,51 @@ +commit 52231be034160c786735c6ae2f51ac7723c2e1fd +Author: Dmitry V. Levin +Date: Fri Sep 15 16:06:14 2017 +0000 + + Update MEMBARRIER_CMD_* constants + + * xlat/membarrier_cmds.in: Add MEMBARRIER_CMD_PRIVATE_EXPEDITED + introduced by kernel commit v4.14-rc1~174^2^2^4. + * NEWS: Mention this. + * tests/membarrier.c (main): Update expected output. + +diff -rup a/tests/membarrier.c b/tests/membarrier.c +--- a/tests/membarrier.c 2016-04-21 14:16:50.000000000 -0400 ++++ b/tests/membarrier.c 2018-02-05 19:24:07.016341127 -0500 +@@ -42,10 +42,23 @@ main(void) + printf("membarrier(0x3 /* MEMBARRIER_CMD_??? */, 255) = -1 %s (%m)\n", + errno2name()); + if (errno != ENOSYS) { +- /* the test needs to be updated? */ +- assert(syscall(__NR_membarrier, 0, 0) == 1); +- puts("membarrier(MEMBARRIER_CMD_QUERY, 0)" +- " = 0x1 (MEMBARRIER_CMD_SHARED)"); ++ const char *text; ++ int rc = syscall(__NR_membarrier, 0, 0); ++ ++ switch (rc) { ++ case 1: ++ text = "MEMBARRIER_CMD_SHARED"; ++ break; ++ case 1|8: ++ text = "MEMBARRIER_CMD_SHARED|" ++ "MEMBARRIER_CMD_PRIVATE_EXPEDITED"; ++ break; ++ default: ++ error_msg_and_fail("membarrier returned %#x, does" ++ " the test have to be updated?", rc); ++ } ++ printf("membarrier(MEMBARRIER_CMD_QUERY, 0) = %#x (%s)\n", ++ rc, text); + } + puts("+++ exited with 0 +++"); + return 0; +diff -rup a/xlat/membarrier_cmds.in b/xlat/membarrier_cmds.in +--- a/xlat/membarrier_cmds.in 2015-11-16 19:40:22.000000000 -0500 ++++ b/xlat/membarrier_cmds.in 2018-02-05 19:23:39.097820501 -0500 +@@ -1,2 +1,3 @@ +-MEMBARRIER_CMD_QUERY 0 +-MEMBARRIER_CMD_SHARED 1 ++MEMBARRIER_CMD_QUERY 0 ++MEMBARRIER_CMD_SHARED 1 ++MEMBARRIER_CMD_PRIVATE_EXPEDITED 8 diff --git a/SOURCES/strace-rh1540954-2.patch b/SOURCES/strace-rh1540954-2.patch new file mode 100644 index 0000000..d4ff3e2 --- /dev/null +++ b/SOURCES/strace-rh1540954-2.patch @@ -0,0 +1,60 @@ +commit 73354cff1aae409d6ef7d8a539a2a0a09c2480f9 +Author: Dmitry V. Levin +Date: Wed Nov 1 00:20:44 2017 +0000 + + Update MEMBARRIER_CMD_* constants + + * xlat/membarrier_cmds.in: Add MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED + introduced by kernel commit v4.14-rc6~26. + * tests/membarrier.c (main): Update expected output. + +diff --git a/tests/membarrier.c b/tests/membarrier.c +index 7d79724..75a8469 100644 +--- a/tests/membarrier.c ++++ b/tests/membarrier.c +@@ -55,6 +55,11 @@ main(void) + text = "MEMBARRIER_CMD_SHARED|" + "MEMBARRIER_CMD_PRIVATE_EXPEDITED"; + break; ++ case 1|8|16: ++ text = "MEMBARRIER_CMD_SHARED|" ++ "MEMBARRIER_CMD_PRIVATE_EXPEDITED|" ++ "MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED"; ++ break; + default: + error_msg_and_fail("membarrier returned %#x, does" + " the test have to be updated?", rc); +diff --git a/xlat/membarrier_cmds.in b/xlat/membarrier_cmds.in +index 3baef17..e4fe06a 100644 +--- a/xlat/membarrier_cmds.in ++++ b/xlat/membarrier_cmds.in +@@ -1,3 +1,4 @@ + MEMBARRIER_CMD_QUERY 0 + MEMBARRIER_CMD_SHARED 1 + MEMBARRIER_CMD_PRIVATE_EXPEDITED 8 ++MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED 16 +diff -rup a/xlat/membarrier_cmds.h b/xlat/membarrier_cmds.h +--- a/xlat/membarrier_cmds.h 2016-05-31 07:35:42.000000000 -0400 ++++ b/xlat/membarrier_cmds.h 2018-02-05 19:44:34.045234830 -0500 +@@ -5,6 +5,12 @@ + #if !(defined(MEMBARRIER_CMD_SHARED) || (defined(HAVE_DECL_MEMBARRIER_CMD_SHARED) && HAVE_DECL_MEMBARRIER_CMD_SHARED)) + # define MEMBARRIER_CMD_SHARED 1 + #endif ++#if !(defined(MEMBARRIER_CMD_PRIVATE_EXPEDITED) || (defined(HAVE_DECL_MEMBARRIER_CMD_PRIVATE_EXPEDITED) && HAVE_DECL_MEMBARRIER_CMD_PRIVATE_EXPEDITED)) ++# define MEMBARRIER_CMD_PRIVATE_EXPEDITED 8 ++#endif ++#if !(defined(MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED) || (defined(HAVE_DECL_MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED) && HAVE_DECL_MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED)) ++# define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED 16 ++#endif + + #ifdef IN_MPERS + +@@ -16,6 +22,8 @@ static + const struct xlat membarrier_cmds[] = { + XLAT(MEMBARRIER_CMD_QUERY), + XLAT(MEMBARRIER_CMD_SHARED), ++ XLAT(MEMBARRIER_CMD_PRIVATE_EXPEDITED), ++ XLAT(MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED), + XLAT_END + }; + diff --git a/SPECS/strace.spec b/SPECS/strace.spec index 3329cc8..2c700c3 100644 --- a/SPECS/strace.spec +++ b/SPECS/strace.spec @@ -1,7 +1,7 @@ Summary: Tracks and displays system calls associated with a running process Name: strace Version: 4.12 -Release: 4%{?dist} +Release: 6%{?dist} License: BSD Group: Development/Debuggers URL: http://sourceforge.net/projects/strace/ @@ -23,6 +23,9 @@ Patch2003: strace-rh1377847.patch Patch3001: strace-rpmbuild-m64.patch Patch3002: strace-no-setgid-rhel6.patch Patch3003: strace-rh1449935.patch +Patch3004: strace-rh1466535.patch +Patch3005: strace-rh1540954-1.patch +Patch3006: strace-rh1540954-2.patch # In the past we had a separate strace64 package, these days the # stndard 64 bit build provides that functionality. For tracing @@ -75,6 +78,9 @@ This package provides the `strace32' program to trace 32-bit processes on %patch3001 -p1 %patch3002 -p1 %patch3003 -p1 +%patch3004 -p1 +%patch3005 -p1 +%patch3006 -p1 %build %configure @@ -100,7 +106,7 @@ rm -f %{buildroot}%{_bindir}/strace-graph %check # Temporary until we dig deeper into the failures -%ifnarch s390x ppc64 +%ifnarch s390 s390x ppc64 ppc64le make -k check %endif @@ -121,6 +127,13 @@ rm -rf %{buildroot} %endif %changelog +* Wed Feb 7 2018 DJ Delorie - 4.12-6 +- Update membarrier constants. (#1540954) + +* Thu Sep 14 2017 DJ Delorie - 4.12-5 +- Handle unexpected CLONE_PTRACE events. (#1466535) +- Skip tests for s390/ppc64le as well as s390x/ppc64. + * Fri May 12 2017 DJ Delorie - 4.12-4 - Fix typo in btrfs detection logic. (#1449935)