mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aleksei Besogonov <alex.besogonov@gmail.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: David Rientjes <rientjes@google.com>, linux-kernel@vger.kernel.org
Subject: Re: Soft lockups during reading /proc/PID/smaps
Date: Sun, 3 Aug 2014 05:03:45 -0700	[thread overview]
Message-ID: <264016DC-6B8B-4732-8977-44AA2CF47E1A@gmail.com> (raw)
In-Reply-To: <20140802181958.GA28283@redhat.com>

On 02 Aug 2014, at 11:19, Oleg Nesterov <oleg@redhat.com> wrote:
> On 07/31, Aleksei Besogonov wrote:
>> 
>> On 31 Jul 2014, at 00:43, David Rientjes <rientjes@google.com> wrote:
>> 
>>> The while_each_thread() in vm_is_stack() looks suspicious since the task
>>> isn't current and rcu won't protect the iteration, and we also don't hold
>>> sighand lock or a readlock on tasklist_lock.
>>> I think Oleg will know how to proceed, cc'd.
>> I’m attaching a minimal test case that can reproduce the issue. Works in 100% cases on any system I’ve tried.
> Thanks. I think David is right and we need the simple patch below.
> This reminds me I should kill while_each_thread :/
> Any chance you can test it? If not, I will do this later and send
> the patch if it helps.
Thanks, it works on the rc7 kernel.

I can make a backported version for earlier kernels if nobody else is interested.

> 
> Oleg.
> 
> --- x/mm/util.c
> +++ x/mm/util.c
> @@ -277,17 +277,14 @@ pid_t vm_is_stack(struct task_struct *ta
> 
> 	if (in_group) {
> 		struct task_struct *t;
> -		rcu_read_lock();
> -		if (!pid_alive(task))
> -			goto done;
> 
> -		t = task;
> -		do {
> +		rcu_read_lock();
> +		for_each_thread(task, t) {
> 			if (vm_is_stack_for_task(t, vma)) {
> 				ret = t->pid;
> 				goto done;
> 			}
> -		} while_each_thread(task, t);
> +		}
> done:
> 		rcu_read_unlock();
> 	}
> 


  reply	other threads:[~2014-08-03 12:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-31  7:22 Aleksei Besogonov
2014-07-31  7:43 ` David Rientjes
2014-07-31 11:13   ` Aleksei Besogonov
2014-08-02 18:19     ` Oleg Nesterov
2014-08-03 12:03       ` Aleksei Besogonov [this message]
2014-08-04 19:26         ` 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=264016DC-6B8B-4732-8977-44AA2CF47E1A@gmail.com \
    --to=alex.besogonov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=rientjes@google.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

all inboxes | Powered by JetHome®