All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Tycho Andersen <tycho@tycho.ws>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Kees Cook <keescook@chromium.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Linux List Kernel Mailing <linux-kernel@vger.kernel.org>
Subject: Re: siginfo pid not populated from ptrace?
Date: Mon, 10 Dec 2018 15:57:16 +0100	[thread overview]
Message-ID: <20181210145716.GC4177@redhat.com> (raw)
In-Reply-To: <20181206192059.GD10086@cisco>

On 12/06, Tycho Andersen wrote:
>
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -1056,11 +1056,14 @@ static int __send_signal(int sig, struct kernel_siginfo *info, struct task_struc
>  		goto ret;
>  
>  	result = TRACE_SIGNAL_DELIVERED;
> +
>  	/*
> -	 * Skip useless siginfo allocation for SIGKILL SIGSTOP,
> -	 * and kernel threads.
> +	 * Skip useless siginfo allocation for SIGKILL and kernel threads.
> +	 * SIGSTOP is visible to tracers, so only skip allocation when the task
> +	 * is not traced.
>  	 */
> -	if (sig_kernel_only(sig) || (t->flags & PF_KTHREAD))
> +	if ((sig == SIGKILL) || (!task_is_traced(t) && sig == SIGSTOP) ||
			          ^^^^^^^^^^^^^^

task_is_traced() checks task->state, probably you meant t->ptrace != 0.

However, in multithreaded case t->ptrace won't help too, unless the signal
is private you do not know which thread will actually dequeue this signal
and possibly report to debugger.

Oleg.


      parent reply	other threads:[~2018-12-10 14:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-12 17:11 siginfo pid not populated from ptrace? Tycho Andersen
2018-11-12 18:30 ` Eric W. Biederman
2018-11-12 18:55   ` Tycho Andersen
2018-11-12 19:22     ` Eric W. Biederman
2018-11-12 19:24     ` Tycho Andersen
2018-11-27 23:21       ` Tycho Andersen
2018-11-28  0:38         ` Kees Cook
2018-11-28  1:17           ` Kees Cook
2018-11-28  4:44             ` Eric W. Biederman
2018-11-29 21:17               ` Kees Cook
2018-11-29 23:22                 ` Tycho Andersen
2018-12-01 15:04                 ` Eric W. Biederman
2018-12-06  1:00                   ` Kees Cook
2018-12-06 14:40                     ` Eric W. Biederman
2018-12-06 18:48                       ` Linus Torvalds
2018-12-06 19:20                         ` Tycho Andersen
2018-12-06 21:11                           ` Eric W. Biederman
2018-12-06 21:34                             ` Kees Cook
2018-12-06 22:43                               ` Eric W. Biederman
2018-12-06 22:55                                 ` Kees Cook
2018-12-10 15:37                             ` Oleg Nesterov
2018-12-10 15:44                               ` Tycho Andersen
2018-12-10 17:36                               ` Eric W. Biederman
2018-12-10 14:57                           ` Oleg Nesterov [this message]

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=20181210145716.GC4177@redhat.com \
    --to=oleg@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=tycho@tycho.ws \
    /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.