All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: lkp@lists.01.org
Subject: Re: kthread_stop insanity (Re: [[DEBUG] force] 2642458962: BUG: unable to handle kernel paging request at ffffc90000997f18)
Date: Tue, 28 Jun 2016 20:58:54 +0200	[thread overview]
Message-ID: <20160628185853.GA3998@redhat.com> (raw)
In-Reply-To: <20160627170010.GA21628@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 772 bytes --]

On 06/27, Oleg Nesterov wrote:
>
> On 06/27, Andy Lutomirski wrote:
> >
> > Want to send a patch?  I could do it, but you understand this code
> > much better than I do.
>
> Well, I'll try to do this tomorrow unless you do it.

I have cloned luto/linux.git to see if kthread_stop() can pin ->stack
somehow, but it seems this is not possible, finish_task_switch() does
free_thread_stack() unconditionally.

Then how (say) proc_pid_stack() can work? If it hits the task which is
alreay dead we are (probably) fine, valid_stack_ptr() should fail iiuc.

But what if we race with the last schedule() ? "addr = *stack" can read
the already vfree'ed memory, no?

Looks like print_context_stack/etc need probe_kernel_address or I missed
something.

Oleg.


WARNING: multiple messages have this Message-ID (diff)
From: Oleg Nesterov <oleg@redhat.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Lutomirski <luto@kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>, Tejun Heo <tj@kernel.org>,
	LKP <lkp@01.org>, LKML <linux-kernel@vger.kernel.org>,
	kernel test robot <xiaolong.ye@intel.com>
Subject: Re: kthread_stop insanity (Re: [[DEBUG] force] 2642458962: BUG: unable to handle kernel paging request at ffffc90000997f18)
Date: Tue, 28 Jun 2016 20:58:54 +0200	[thread overview]
Message-ID: <20160628185853.GA3998@redhat.com> (raw)
In-Reply-To: <20160627170010.GA21628@redhat.com>

On 06/27, Oleg Nesterov wrote:
>
> On 06/27, Andy Lutomirski wrote:
> >
> > Want to send a patch?  I could do it, but you understand this code
> > much better than I do.
>
> Well, I'll try to do this tomorrow unless you do it.

I have cloned luto/linux.git to see if kthread_stop() can pin ->stack
somehow, but it seems this is not possible, finish_task_switch() does
free_thread_stack() unconditionally.

Then how (say) proc_pid_stack() can work? If it hits the task which is
alreay dead we are (probably) fine, valid_stack_ptr() should fail iiuc.

But what if we race with the last schedule() ? "addr = *stack" can read
the already vfree'ed memory, no?

Looks like print_context_stack/etc need probe_kernel_address or I missed
something.

Oleg.

  reply	other threads:[~2016-06-28 18:58 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-27  5:22 kthread_stop insanity (Re: [[DEBUG] force] 2642458962: BUG: unable to handle kernel paging request at ffffc90000997f18) Andy Lutomirski
2016-06-27  5:22 ` Andy Lutomirski
2016-06-27  8:28 ` Peter Zijlstra
2016-06-27  8:28   ` Peter Zijlstra
2016-06-27 14:54 ` Oleg Nesterov
2016-06-27 14:54   ` Oleg Nesterov
2016-06-27 15:44   ` Andy Lutomirski
2016-06-27 15:44     ` Andy Lutomirski
2016-06-27 17:00     ` Oleg Nesterov
2016-06-27 17:00       ` Oleg Nesterov
2016-06-28 18:58       ` Oleg Nesterov [this message]
2016-06-28 18:58         ` Oleg Nesterov
2016-06-28 19:12         ` Andy Lutomirski
2016-06-28 19:12           ` Andy Lutomirski
2016-06-28 20:12           ` Oleg Nesterov
2016-06-28 20:12             ` Oleg Nesterov
2016-06-28 20:54             ` Andy Lutomirski
2016-06-28 20:54               ` Andy Lutomirski
2016-06-28 21:14               ` Linus Torvalds
2016-06-28 21:14                 ` Linus Torvalds
2016-06-28 21:18                 ` Linus Torvalds
2016-06-28 21:18                   ` Linus Torvalds
2016-06-28 21:21                 ` Andy Lutomirski
2016-06-28 21:21                   ` Andy Lutomirski
2016-06-28 21:35                   ` Linus Torvalds
2016-06-28 21:35                     ` Linus Torvalds
2016-06-28 21:40                     ` Linus Torvalds
2016-06-28 21:40                       ` Linus Torvalds
2016-06-28 22:47                       ` Oleg Nesterov
2016-06-28 22:47                         ` Oleg Nesterov
2016-06-28 22:59               ` Oleg Nesterov
2016-06-28 22:59                 ` Oleg Nesterov
2016-06-29 15:34                 ` Andy Lutomirski
2016-06-29 15:34                   ` Andy Lutomirski
2016-06-29 18:03                   ` [PATCH] kthread: to_live_kthread() needs try_get_task_stack() Oleg Nesterov
2016-06-29 18:03                     ` Oleg Nesterov
2016-06-29 18:28                     ` kbuild test robot
2016-06-29 18:28                       ` kbuild test robot
2016-06-29 18:44                       ` Oleg Nesterov
2016-06-29 18:44                         ` Oleg Nesterov
2016-06-29 18:51                     ` kbuild test robot
2016-06-29 18:51                       ` kbuild test robot
2016-06-29 23:01                     ` Andy Lutomirski
2016-06-29 23:01                       ` Andy Lutomirski
2016-06-29 23:33         ` kthread_stop insanity (Re: [[DEBUG] force] 2642458962: BUG: unable to handle kernel paging request at ffffc90000997f18) Andy Lutomirski
2016-06-29 23:33           ` Andy Lutomirski
2016-06-27 17:16 ` Linus Torvalds
2016-06-27 17:16   ` Linus Torvalds

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=20160628185853.GA3998@redhat.com \
    --to=oleg@redhat.com \
    --cc=lkp@lists.01.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 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.