public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "ulrich.weigand at de dot ibm.com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug tdep/28623] Missing catching return of execve syscall of PowerPC
Date: Fri, 17 Nov 2023 14:32:16 +0000	[thread overview]
Message-ID: <bug-28623-4717-piQ1AqEL7T@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-28623-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=28623

--- Comment #7 from ulrich.weigand at de dot ibm.com ---
This is certainly better, but still somewhat fragile in that it still requires
the platform back-end to reliably detect that it cannot detect the system call
number.  On some targets (e.g. s390x) that read the system call number from
memory as immediate operand of the syscall instruction, you may encounter the
even worse scenario that after an execve you *do* detect a syscall but it is
wrong (because at that same location in memory the new executable also contains
a syscall instruction, but a different one) ...

I still think ideally we should be able to make use of the PTRACE_EVENT_EXEC
reported by the kernel.  If I'm reading kernel code correctly, we should be
getting the following sequence of ptrace events:
 - syscall SIGTRAP - before execve
 - PTRACE_EVENT_EXEC
 - syscall SIGTRAP - after execve

So maybe processing of PTRACE_EVENT_EXEC should set a flag that if syscall
traps are active, the immediate next such event in the current process should
not even attempt to call gdbarch_get_syscall_number, but simply assume that it
is a return of the immediately preceding execve syscall.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2023-11-17 14:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24 19:27 [Bug gdb/28623] New: " simark at simark dot ca
2023-11-16 10:30 ` [Bug gdb/28623] " vries at gcc dot gnu.org
2023-11-16 10:42 ` vries at gcc dot gnu.org
2023-11-16 11:48 ` vries at gcc dot gnu.org
2023-11-16 11:50 ` [Bug tdep/28623] " vries at gcc dot gnu.org
2023-11-16 11:51 ` vries at gcc dot gnu.org
2023-11-16 17:00 ` ulrich.weigand at de dot ibm.com
2023-11-17 12:37 ` vries at gcc dot gnu.org
2023-11-17 14:32 ` ulrich.weigand at de dot ibm.com [this message]
2023-11-17 20:57 ` simon.marchi at polymtl dot ca
2023-11-20 15:44 ` vries at gcc dot gnu.org
2023-11-20 15:49 ` vries at gcc dot gnu.org
2023-11-21 12:42 ` vries at gcc dot gnu.org
2023-11-23 14:53 ` sam at gentoo dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-28623-4717-piQ1AqEL7T@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).