* [merged] mm-kmemleak-ensure-that-the-task-stack-is-not-freed-during-scanning.patch removed from -mm tree
@ 2016-10-28 18:30 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2016-10-28 18:30 UTC (permalink / raw)
To: catalin.marinas, caiqian, hillf.zj, luto, mhocko, oleg, mm-commits
The patch titled
Subject: mm: kmemleak: ensure that the task stack is not freed during scanning
has been removed from the -mm tree. Its filename was
mm-kmemleak-ensure-that-the-task-stack-is-not-freed-during-scanning.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Catalin Marinas <catalin.marinas@arm.com>
Subject: mm: kmemleak: ensure that the task stack is not freed during scanning
Commit 68f24b08ee89 ("sched/core: Free the stack early if
CONFIG_THREAD_INFO_IN_TASK") may cause the task->stack to be freed
during kmemleak_scan() execution, leading to either a NULL pointer
fault (if task->stack is NULL) or kmemleak accessing already freed
memory. This patch uses the new try_get_task_stack() API to ensure that
the task stack is not freed during kmemleak stack scanning.
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=173901.
Fixes: 68f24b08ee89 ("sched/core: Free the stack early if CONFIG_THREAD_INFO_IN_TASK")
Link: http://lkml.kernel.org/r/1476266223-14325-1-git-send-email-catalin.marinas@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Reported-by: CAI Qian <caiqian@redhat.com>
Tested-by: CAI Qian <caiqian@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: CAI Qian <caiqian@redhat.com>
Cc: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/kmemleak.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff -puN mm/kmemleak.c~mm-kmemleak-ensure-that-the-task-stack-is-not-freed-during-scanning mm/kmemleak.c
--- a/mm/kmemleak.c~mm-kmemleak-ensure-that-the-task-stack-is-not-freed-during-scanning
+++ a/mm/kmemleak.c
@@ -1453,8 +1453,11 @@ static void kmemleak_scan(void)
read_lock(&tasklist_lock);
do_each_thread(g, p) {
- scan_block(task_stack_page(p), task_stack_page(p) +
- THREAD_SIZE, NULL);
+ void *stack = try_get_task_stack(p);
+ if (stack) {
+ scan_block(stack, stack + THREAD_SIZE, NULL);
+ put_task_stack(p);
+ }
} while_each_thread(g, p);
read_unlock(&tasklist_lock);
}
_
Patches currently in -mm which might be from catalin.marinas@arm.com are
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-10-28 18:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-28 18:30 [merged] mm-kmemleak-ensure-that-the-task-stack-is-not-freed-during-scanning.patch removed from -mm tree akpm
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.