diff options
| author | Konstantin Khlebnikov <khlebnikov@yandex-team.ru> | 2017-10-13 18:58:22 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-10-13 19:18:33 -0400 |
| commit | ca182551857cc2c1e6a2b7f1e72090a137a15008 (patch) | |
| tree | 2811f50f3d352d6f82f453e05a76489637b2d1b0 /kernel | |
| parent | 7e86600606cef21beec725039d70377fb364f881 (diff) | |
kmemleak: clear stale pointers from task stacks
Kmemleak considers any pointers on task stacks as references. This
patch clears newly allocated and reused vmap stacks.
Link: http://lkml.kernel.org/r/150728990124.744199.8403409836394318684.stgit@buzz
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/fork.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index e702cb9ffbd8..07cc743698d3 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
| @@ -215,6 +215,10 @@ static unsigned long *alloc_thread_stack_node(struct task_struct *tsk, int node) | |||
| 215 | if (!s) | 215 | if (!s) |
| 216 | continue; | 216 | continue; |
| 217 | 217 | ||
| 218 | #ifdef CONFIG_DEBUG_KMEMLEAK | ||
| 219 | /* Clear stale pointers from reused stack. */ | ||
| 220 | memset(s->addr, 0, THREAD_SIZE); | ||
| 221 | #endif | ||
| 218 | tsk->stack_vm_area = s; | 222 | tsk->stack_vm_area = s; |
| 219 | return s->addr; | 223 | return s->addr; |
| 220 | } | 224 | } |
