linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: CAI Qian <caiqian@redhat.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Andy Lutomirski <luto@kernel.org>
Subject: Re: [PATCH] mm: kmemleak: Ensure that the task stack is not freed during scanning
Date: Wed, 12 Oct 2016 17:14:41 +0100	[thread overview]
Message-ID: <20161012161441.GC21592@e104818-lin.cambridge.arm.com> (raw)
In-Reply-To: <2086376822.528054.1476287657078.JavaMail.zimbra@redhat.com>

On Wed, Oct 12, 2016 at 11:54:17AM -0400, CAI Qian wrote:
> ----- Original Message -----
> > From: "Catalin Marinas" <catalin.marinas@arm.com>
> > To: linux-mm@kvack.org
> > Cc: linux-kernel@vger.kernel.org, "Andrew Morton" <akpm@linux-foundation.org>, "Andy Lutomirski" <luto@kernel.org>,
> > "CAI Qian" <caiqian@redhat.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@linux-foundation.org>
> > Cc: Andy Lutomirski <luto@kernel.org>
> > Cc: CAI Qian <caiqian@redhat.com>
> > Reported-by: CAI Qian <caiqian@redhat.com>
> > Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> 
> Tested-by: CAI Qian <caiqian@redhat.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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2016-10-12 16:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-12  9:57 Catalin Marinas
2016-10-12 10:16 ` Hillf Danton
2016-10-12 10:47   ` Catalin Marinas
2016-10-12 10:41 ` Michal Hocko
2016-10-12 15:54 ` CAI Qian
2016-10-12 16:14   ` Catalin Marinas [this message]
2016-10-19 18:33 ` Andrew Morton
2016-10-20 10:02   ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161012161441.GC21592@e104818-lin.cambridge.arm.com \
    --to=catalin.marinas@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=caiqian@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox