From: Roland McGrath <roland@redhat.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: linux-kernel@vger.kernel.org,
Jan Kratochvil <jan.kratochvil@redhat.com>,
Denys Vlasenko <dvlasenk@redhat.com>
Subject: Re: Q: ptrace_signal() && PTRACE_SETSIGINFO (Was: SIGSTOP && ptrace)
Date: Thu, 23 Apr 2009 23:31:59 -0700 (PDT) [thread overview]
Message-ID: <20090424063159.BCEDAFC3C7@magilla.sf.frob.com> (raw)
In-Reply-To: Oleg Nesterov's message of Thursday, 23 April 2009 17:16:33 +0200 <20090423151633.GA3120@redhat.com>
> Yes. PTRACE_SETSIGINFO can change *info if debugger wants something
> special. But then we do:
>
> if (signr != info->si_signo) {
> info->si_signo = signr;
[...]
> Why? If the tracer changes ->exit_code it should know what it does.
If it uses PTRACE_SETSIGINFO it should know what it does, and update
the siginfo_t to match the signal it passes to PTRACE_CONT et al.
> Why do we reset *info?
PTRACE_SETSIGINFO did not always exist, and even now might not be used by a
simple-minded application. If the user is sophisticated, it calls
PTRACE_SETSIGINFO and then passes the signal number to match. If not, it
never calls PTRACE_SETSIGINFO at all, but expects the signal number it
chose to pass in PTRACE_CONT to behave "normally" in the tracee.
We reset the siginfo_t the tracee will see to match what a kill() from the
debugger would have looked like. Otherwise the tracee could be confused by
the siginfo_t values that don't make sense for the signal number delivered.
(The simple-minded debugger's ptrace code could even predate SA_SIGINFO
handlers and tracees that could see the siginfo_t.)
> But the real question, how can PTRACE_SETSIGINFO change ->si_signo
> (for example, for do_signal_stop(si_signo)) if this in fact is not
> allowed?
It's allowed. You just have to pass the same value you set in si_signo as
the argument to PTRACE_CONT after you do PTRACE_SETSIGINFO.
Thanks,
Roland
next prev parent reply other threads:[~2009-04-24 6:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-23 12:15 ptrace(PTRACE_SYSCALL/CONT/DETACH, ..., SIGSTOP) does not work Denys Vlasenko
2009-04-23 14:26 ` SIGSTOP && ptrace (Was: ptrace(PTRACE_SYSCALL/CONT/DETACH, ..., SIGSTOP) does not work) Oleg Nesterov
2009-04-23 15:16 ` Q: ptrace_signal() && PTRACE_SETSIGINFO (Was: SIGSTOP && ptrace) Oleg Nesterov
2009-04-24 6:31 ` Roland McGrath [this message]
2009-04-24 17:41 ` Oleg Nesterov
2009-04-24 6:23 ` SIGSTOP && ptrace (Was: ptrace(PTRACE_SYSCALL/CONT/DETACH, ..., SIGSTOP) does not work) Roland McGrath
2009-04-24 21:15 ` Denys Vlasenko
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=20090424063159.BCEDAFC3C7@magilla.sf.frob.com \
--to=roland@redhat.com \
--cc=dvlasenk@redhat.com \
--cc=jan.kratochvil@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
/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
Powered by JetHome