mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: syzbot <syzbot+3485e3773f7da290eecc@syzkaller.appspotmail.com>,
	axboe@kernel.dk, christian@brauner.io,
	linux-kernel@vger.kernel.org, liuzhiqiang26@huawei.com,
	syzkaller-bugs@googlegroups.com, Tejun Heo <tj@kernel.org>
Subject: Re: WARNING in get_signal
Date: Mon, 5 Oct 2020 15:49:24 +0200	[thread overview]
Message-ID: <20201005134923.GA9995@redhat.com> (raw)
In-Reply-To: <87zh54bp0n.fsf@x220.int.ebiederm.org>

On 10/02, Eric W. Biederman wrote:
>
> syzbot <syzbot+3485e3773f7da290eecc@syzkaller.appspotmail.com> writes:
>
> > Hello,
> >
> > syzbot found the following issue on:
>
> So this is:
>
> static void do_jobctl_trap(void)
> {
> 	struct signal_struct *signal = current->signal;
> 	int signr = current->jobctl & JOBCTL_STOP_SIGMASK;
>
> 	if (current->ptrace & PT_SEIZED) {
> 		if (!signal->group_stop_count &&
> 		    !(signal->flags & SIGNAL_STOP_STOPPED))
> 			signr = SIGTRAP;
> 		WARN_ON_ONCE(!signr);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 		ptrace_do_notify(signr, signr | (PTRACE_EVENT_STOP << 8),
> 				 CLD_STOPPED);
> 	} else {
> 		WARN_ON_ONCE(!signr);
> 		ptrace_stop(signr, CLD_STOPPED, 0, NULL);
> 		current->exit_code = 0;
> 	}
> }
>
> I have the state of this paged out of my head at the moment.
>
> Oleg or Tejun do you remember what is supposed to keep signr from being
> NULL?

This nearly killed me, but I seem to understand whats going on.
ptrace_init_task() does task_set_jobctl_pending(JOBCTL_TRAP_STOP) while
SIGNAL_STOP_STOPPED, child->jobctl & JOBCTL_STOP_SIGMASK == 0.

> It looks like this code was introduced in commit 73ddff2bee15 ("job
> control: introduce JOBCTL_TRAP_STOP and use it for group stop trap").

Yes, but I bet this was broken later, _may be_ by 924de3b8c9410c4.

I need to take a rest and read this code again. I too forgot how this
all supposed to work.

Oleg.


  reply	other threads:[~2020-10-05 13:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-02 15:48 syzbot
2020-10-02 15:56 ` Eric W. Biederman
2020-10-05 13:49   ` Oleg Nesterov [this message]
2020-10-05 16:30     ` Oleg Nesterov
2020-10-06 17:05       ` Oleg Nesterov
2020-10-15 12:49         ` Oleg Nesterov
2020-10-19 13:42 ` [PATCH] ptrace: fix task_join_group_stop() for the case when current is traced 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=20201005134923.GA9995@redhat.com \
    --to=oleg@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=christian@brauner.io \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuzhiqiang26@huawei.com \
    --cc=syzbot+3485e3773f7da290eecc@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=tj@kernel.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

Powered by JetHome