All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Denys Vlasenko <vda.linux@googlemail.com>
Cc: Tejun Heo <tj@kernel.org>,
	jan.kratochvil@redhat.com, linux-kernel@vger.kernel.org,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	indan@nul.nu
Subject: Re: Ptrace documentation, draft #1
Date: Mon, 23 May 2011 14:10:11 +0200	[thread overview]
Message-ID: <20110523121011.GA5799@redhat.com> (raw)
In-Reply-To: <BANLkTi=bRb+NCqqS9+ptzxHVOjKKXhZgsg@mail.gmail.com>

On 05/20, Denys Vlasenko wrote:
>
> On Thu, May 19, 2011 at 9:49 PM, Oleg Nesterov <oleg@redhat.com> wrote:
> > Once again, PTRACE_KILL == ptrace(PTRACE_CONT, SIGKILL), except it
> > doesn't return the error if the tracee is not stopped.
>
> Oleg, this doesn't explain the resulting behavior in terms understandable
> to mere mortals. *What will happen* when user does ptrace(PTRACE_KILL)?
>
> Yes, it's obvious that the tracee gets SIGKILLed,

No, it is not necessarily killed. Once again, it is equivalent to PTRACE_CONT
except it returns 0 (but does nothing) if the tracee is not stopped.

"does nothing" is not 100% true, it does wake_up_process() but this shouldn't
be documented, this should be fixed.

> >> >> ??? can this SIGTRAP be distinguished from "real" user-generated SIGTRAP
> >> >>     by looking at its siginfo?
> >> >
> >> > Afaics no. Well, except .si_pid shows that the signal was sent by the
> >> > tracing process to itself.
> >>
> >> What about si_code? Is it set to SI_KERNEL for this signal?
> >
> > No, SI_USER.
>
> This is stupid. This signal is sent by kernel. Why is it flagged as "from user"?
> Maybe we should change it?

Well, may be... I dunno actually. Hmm. On a second thought you are probably
right. ptrace_report_syscall() does send_sig() too, but it sets SI_KERNEL.
I am starting to think, at least they should use the same si_code.

> (BTW, where is it generated in the kernel source? I found
> PTRACE_EVENT_EXEC generation, but failed to find
> "old-school SIGTRAP" generation code...)

tracehook_report_exec()->send_sig(SIGTRAP).

Oleg.


  reply	other threads:[~2011-05-23 12:11 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-15 20:35 Ptrace documentation, draft #1 Denys Vlasenko
2011-05-16  9:15 ` Tejun Heo
2011-05-16 15:31 ` Oleg Nesterov
2011-05-16 15:52   ` Tejun Heo
2011-05-16 16:53     ` Oleg Nesterov
2011-05-16 17:20       ` Tejun Heo
2011-05-16 17:48         ` Oleg Nesterov
2011-05-18 15:02       ` Denys Vlasenko
2011-05-18 15:02   ` Denys Vlasenko
2011-05-19 19:49     ` Oleg Nesterov
2011-05-20 18:02       ` Denys Vlasenko
2011-05-23 12:10         ` Oleg Nesterov [this message]
2011-05-23 14:10           ` ptrace_resume->wake_up_process (Was: Ptrace documentation, draft #1) Oleg Nesterov
2011-05-23 16:17             ` Linus Torvalds
2011-05-23 17:23               ` Oleg Nesterov
2011-05-25 20:08                 ` [GIT PULL] PTRACE_KILL/wakeup fix for v2.6.40 Oleg Nesterov
2011-05-23 17:05             ` [PATCH 0/2] Was: ptrace_resume->wake_up_process Oleg Nesterov
2011-05-23 17:05               ` [PATCH 1/2] ptrace: ptrace_resume() shouldn't wake up !TASK_TRACED thread Oleg Nesterov
2011-05-23 17:05               ` [PATCH 2/2] signal: sys_pause() should check signal_pending() Oleg Nesterov

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=20110523121011.GA5799@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=indan@nul.nu \
    --cc=jan.kratochvil@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=vda.linux@googlemail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.