All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vm_is_stack: use for_each_thread() rather then buggy while_each_thread()
@ 2014-08-07 19:47 Oleg Nesterov
  2014-08-09  8:59 ` David Rientjes
  0 siblings, 1 reply; 2+ messages in thread
From: Oleg Nesterov @ 2014-08-07 19:47 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Aleksei Besogonov, David Rientjes, linux-kernel

Aleksei hit the soft lockup during reading /proc/PID/smaps.
David investigated the problem and suggested the right fix.

while_each_thread() is racy and should die, this patch updates
vm_is_stack().

Reported-and-tested-by: Aleksei Besogonov <alex.besogonov@gmail.com>
Suggested-by: David Rientjes <rientjes@google.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: stable@vger.kernel.org
---
 mm/util.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/mm/util.c b/mm/util.c
index d5ea733..33e9f44 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -277,17 +277,14 @@ pid_t vm_is_stack(struct task_struct *task,
 
 	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();
 	}
-- 
1.5.5.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] vm_is_stack: use for_each_thread() rather then buggy while_each_thread()
  2014-08-07 19:47 [PATCH] vm_is_stack: use for_each_thread() rather then buggy while_each_thread() Oleg Nesterov
@ 2014-08-09  8:59 ` David Rientjes
  0 siblings, 0 replies; 2+ messages in thread
From: David Rientjes @ 2014-08-09  8:59 UTC (permalink / raw)
  To: Oleg Nesterov; +Cc: Andrew Morton, Aleksei Besogonov, linux-kernel

On Thu, 7 Aug 2014, Oleg Nesterov wrote:

> Aleksei hit the soft lockup during reading /proc/PID/smaps.
> David investigated the problem and suggested the right fix.
> 
> while_each_thread() is racy and should die, this patch updates
> vm_is_stack().
> 
> Reported-and-tested-by: Aleksei Besogonov <alex.besogonov@gmail.com>
> Suggested-by: David Rientjes <rientjes@google.com>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>

Acked-by: David Rientjes <rientjes@google.com>

> Cc: stable@vger.kernel.org

3.4+

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-09  8:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-07 19:47 [PATCH] vm_is_stack: use for_each_thread() rather then buggy while_each_thread() Oleg Nesterov
2014-08-09  8:59 ` David Rientjes

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.