lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 12 Oct 2016 17:14:41 +0100
From:   Catalin Marinas <catalin.marinas@....com>
To:     CAI Qian <caiqian@...hat.com>
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        Andrew Morton <akpm@...ux-foundation.org>,
        Andy Lutomirski <luto@...nel.org>
Subject: Re: [PATCH] mm: kmemleak: Ensure that the task stack is not freed
 during scanning

On Wed, Oct 12, 2016 at 11:54:17AM -0400, CAI Qian wrote:
> ----- Original Message -----
> > From: "Catalin Marinas" <catalin.marinas@....com>
> > To: linux-mm@...ck.org
> > Cc: linux-kernel@...r.kernel.org, "Andrew Morton" <akpm@...ux-foundation.org>, "Andy Lutomirski" <luto@...nel.org>,
> > "CAI Qian" <caiqian@...hat.com>
> > Sent: Wednesday, October 12, 2016 5:57:03 AM
> > Subject: [PATCH] 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.
> > 
> > Fixes: 68f24b08ee89 ("sched/core: Free the stack early if
> > CONFIG_THREAD_INFO_IN_TASK")
> > Cc: Andrew Morton <akpm@...ux-foundation.org>
> > Cc: Andy Lutomirski <luto@...nel.org>
> > Cc: CAI Qian <caiqian@...hat.com>
> > Reported-by: CAI Qian <caiqian@...hat.com>
> > Signed-off-by: Catalin Marinas <catalin.marinas@....com>
> 
> Tested-by: CAI Qian <caiqian@...hat.com>

Thanks.

BTW, I noticed a few false positives reported by kmemleak with the
CONFIG_VMAP_STACK enabled caused by the fact that kmemleak requires two
references (instead of one) to a vmalloc'ed object because of the
vm_struct already containing the address. The cached_stack[] array only
stores the vm_struct rather than the stack address, hence the kmemleak
report. I'll work on a fix/annotation.

-- 
Catalin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ