strace/0184-startup_tcb-add-a-comment.patch
Eugene Syromiatnikov bf36fdf2da Fix incorrect syscall name reporting in restart_syscall() on attach
* 0183-syscall-do-not-use-uninitialized-parts-of-struct-ptr.patch: New
file.
* 0184-startup_tcb-add-a-comment.patch: Likewise.
* 0185-tests-add-another-test-of-restart_syscall-decoding.patch:
Likewise.
* 0186-tests-workaround-net-yy-inet-for-new-kernels.patch: Rename
from 0001-tests-workaround-net-yy-inet-for-new-kernels.patch
to be in sync with RHEL 9, add tests-m32 and tests-mx32 hunks.
* 0187-tests-avoid-linkat-secontext_mismatch-failures-on-se.patch: New
file.
* 0188-linux-s390-get_scno.c-use-NT_S390_SYSTEM_CALL-if-gpr.patch:
Likewise.
* 0189-tests-move-k_setsockopt-definition-into-a-separate-f.patch:
Likewise.
* 0190-tests-sockopt-timestamp.c-use-k_getsockopt-and-k_set.patch:
Likewise.
* strace.spec (Patch183, Patch184, Patch185, Patch186, Patch187,
Patch188, Patch189, Patch190): New patches.
(Patch0001): Remove.
(%prep): Apply them.
(%changelog): Add a record.

Resolves: RHEL-65108
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2024-11-01 13:50:48 +01:00

38 lines
1.0 KiB
Diff

From 2048c136ba6edc4282dbc976c499e038d5b60c03 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@strace.io>
Date: Mon, 28 Oct 2024 08:00:00 +0000
Subject: [PATCH 184/185] startup_tcb: add a comment
* src/strace.c (startup_tcb): Add a comment explaining why it is safe
to call get_scno().
---
src/strace.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/strace.c b/src/strace.c
index 45ab48c43..1a9d53bc8 100644
--- a/src/strace.c
+++ b/src/strace.c
@@ -3549,8 +3549,16 @@ startup_tcb(struct tcb *tcp)
}
}
- if ((tcp->flags & TCB_GRABBED) && (get_scno(tcp) == 1))
- tcp->s_prev_ent = tcp->s_ent;
+ if (tcp->flags & TCB_GRABBED) {
+ /*
+ * There is no guarantee the state of the tracee is such that
+ * would allow get_scno() to obtain meaningful information.
+ * However, if the tracee is not in a syscall, then the garbage
+ * obtained by get_scno() is not going to be used.
+ */
+ if (get_scno(tcp) == 1)
+ tcp->s_prev_ent = tcp->s_ent;
+ }
if (cflag) {
tcp->atime = tcp->stime;
--
2.13.6