Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755241AbcJTKCk (ORCPT ); Thu, 20 Oct 2016 06:02:40 -0400 Received: from foss.arm.com ([217.140.101.70]:42910 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750920AbcJTKCj (ORCPT ); Thu, 20 Oct 2016 06:02:39 -0400 Date: Thu, 20 Oct 2016 11:02:34 +0100 From: Catalin Marinas To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andy Lutomirski , CAI Qian Subject: Re: [PATCH] mm: kmemleak: Ensure that the task stack is not freed during scanning Message-ID: <20161020100234.GD23600@e104818-lin.cambridge.arm.com> References: <1476266223-14325-1-git-send-email-catalin.marinas@arm.com> <20161019113327.3e796893d89333f6ebe65d79@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161019113327.3e796893d89333f6ebe65d79@linux-foundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1152 Lines: 28 Hi Andrew, On Wed, Oct 19, 2016 at 11:33:27AM -0700, Andrew Morton wrote: > On Wed, 12 Oct 2016 10:57:03 +0100 Catalin Marinas wrote: > > 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 > > Cc: Andy Lutomirski > > Cc: CAI Qian > > Reported-by: CAI Qian > > Signed-off-by: Catalin Marinas > > I'll add > > Cc: [4.8.x] This should be 4.9.x. The commit that introduces try_get_task_stack() was merged in 4.9-rc1: c6c314a613cd ("sched/core: Add try_get_task_stack() and put_task_stack()"). -- Catalin