strace/0184-startup_tcb-add-a-comment.patch
Eugene Syromiatnikov fc35c71aea 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: Likewise.
* 0187-tests-avoid-linkat-secontext_mismatch-failures-on-se.patch:
Likewise.
* 0188-linux-s390-get_scno.c-use-NT_S390_SYSTEM_CALL-if-gpr.patch:
Likewise.
* 0191-prctl-improve-PR_SVE_-SG-ET_VL-decoding.patch: Likewise.
* 0192-tests-prctl-sve-fix-prctl-PR_SVE_GET_VL-return-expec.patch:
Likewise.
* strace.spec (Patch183, Patch184, Patch185, Patch186, Patch187,
Patch188, Patch191, Patch192): New patches.
(%prep): Apply them.
(%changelog): Add a record.

Resolves: RHEL-8570
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2024-11-01 21:58:46 +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