Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1319105

Re: WARNING in do_jobctl_trap

From Oleg Nesterov <oleg@redhat.com>
Newsgroups linux.kernel
Subject Re: WARNING in do_jobctl_trap
Date 2016-01-27 17:10 +0100
Message-ID <qVAPn-65V-3@gated-at.bofh.it> (permalink)
References <qVdzs-5Vw-3@gated-at.bofh.it> <qViSv-1iC-45@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

WARNING in do_jobctl_trap Dmitry Vyukov <dvyukov@google.com> - 2016-01-26 16:20 +0100
  Re: WARNING in do_jobctl_trap Oleg Nesterov <oleg@redhat.com> - 2016-01-26 22:00 +0100
    Re: WARNING in do_jobctl_trap Oleg Nesterov <oleg@redhat.com> - 2016-01-27 17:10 +0100

csiph-web