public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Roland McGrath <roland@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: Fri, 24 Apr 2009 19:41:40 +0200	[thread overview]
Message-ID: <20090424174140.GA15020@redhat.com> (raw)
In-Reply-To: <20090424063159.BCEDAFC3C7@magilla.sf.frob.com>

On 04/23, Roland McGrath wrote:
>
> > 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.

OK, understand.

> > 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.

Yes, yes, I see. I meant "the tracer can not use signr != ->si_signo",
but now I don't see the reason it should.

Oleg.


  reply	other threads:[~2009-04-24 17:45 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
2009-04-24 17:41       ` Oleg Nesterov [this message]
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=20090424174140.GA15020@redhat.com \
    --to=oleg@redhat.com \
    --cc=dvlasenk@redhat.com \
    --cc=jan.kratochvil@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@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