Re: [PATCH 1/9] mm: kmemleak: properly disable task stack scanning

From: Catalin Marinas
Date: Wed Jan 25 2023 - 09:47:32 EST


On Mon, Jan 23, 2023 at 11:04:11AM -0600, George Prekas wrote:
> @@ -1586,23 +1608,6 @@ static void kmemleak_scan(void)
> }
> put_online_mems();
>
> - /*
> - * Scanning the task stacks (may introduce false negatives).
> - */
> - if (kmemleak_stack_scan) {
> - struct task_struct *p, *g;
> -
> - rcu_read_lock();
> - for_each_process_thread(g, p) {
> - void *stack = try_get_task_stack(p);
> - if (stack) {
> - scan_block(stack, stack + THREAD_SIZE, NULL);
> - put_task_stack(p);
> - }
> - }
> - rcu_read_unlock();
> - }

On architectures without VMAP_STACK, we still need the above otherwise
it could lead to some false positives.

--
Catalin