linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"Amanieu d'Antras" <amanieu@gmail.com>,
	Richard Weinberger <richard@nod.at>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Vladimir Davydov <vdavydov@parallels.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Andy Lutomirski <luto@amacapital.net>,
	LKML <linux-kernel@vger.kernel.org>,
	syzkaller <syzkaller@googlegroups.com>,
	Kostya Serebryany <kcc@google.com>,
	Alexander Potapenko <glider@google.com>,
	Sasha Levin <sasha.levin@oracle.com>,
	Eric Dumazet <edumazet@google.com>
Subject: Re: WARNING in do_jobctl_trap
Date: Wed, 27 Jan 2016 17:04:57 +0100	[thread overview]
Message-ID: <20160127160457.GA14320@redhat.com> (raw)
In-Reply-To: <20160126205244.GA4649@redhat.com>

On 01/26, Oleg Nesterov wrote:
>
> On 01/26, Dmitry Vyukov wrote:
> >
> > Hello,
> >
> > The following program triggers WARN_ON_ONCE(!signr) in do_jobctl_trap:
>
> Can't reproduce, but most probably I understand the problem... I'll try to
> make the simplified test-case tomorrow, it should work if I am right.

This triggers the same problem immediately:


	#include <unistd.h>
	#include <sys/ptrace.h>
	#include <sys/wait.h>

	void test(void)
	{
		for (;;) {
			if (fork()) {
				wait(NULL);
				continue;
			}

			ptrace(PTRACE_SEIZE, getppid(), 0, 0);
			ptrace(PTRACE_INTERRUPT, getppid(), 0, 0);
			_exit(0);
		}
	}

	int main(void)
	{
		int np;

		for (np = 0; np < 8; ++np)
			if (!fork())
				test();

		while (wait(NULL) > 0)
			;
		return 0;
	}

and just in case, your test-case works too if I run

	perl -e 'fork; fork; fork; 1 while 1' &

in the background, it has too many delays to work on the idle system.

> Does it work for you reliably?  If yes, any chance you can try the patch
> below?
>
> Oleg.
>
> --- x/kernel/ptrace.c
> +++ x/kernel/ptrace.c
> @@ -73,11 +73,11 @@ void __ptrace_unlink(struct task_struct *child)
>  {
>  	BUG_ON(!child->ptrace);
>
> -	child->ptrace = 0;
>  	child->parent = child->real_parent;
>  	list_del_init(&child->ptrace_entry);
>
>  	spin_lock(&child->sighand->siglock);
> +	child->ptrace = 0;
>
>  	/*
>  	 * Clear all pending traps and TRAPPING.  TRAPPING should be

The change above helps, but I need to think more...

Oleg.

  reply	other threads:[~2016-01-27 16:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-26 15:12 WARNING in do_jobctl_trap Dmitry Vyukov
2016-01-26 20:52 ` Oleg Nesterov
2016-01-27 16:04   ` Oleg Nesterov [this message]
2016-03-10 18:33     ` Dmitry Vyukov
2016-03-14 19:45       ` 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=20160127160457.GA14320@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=amanieu@gmail.com \
    --cc=dave@stgolabs.net \
    --cc=dvyukov@google.com \
    --cc=edumazet@google.com \
    --cc=glider@google.com \
    --cc=kcc@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=palmer@dabbelt.com \
    --cc=richard@nod.at \
    --cc=sasha.levin@oracle.com \
    --cc=syzkaller@googlegroups.com \
    --cc=vdavydov@parallels.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;
as well as URLs for NNTP newsgroup(s).