From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBE76C433F5 for ; Mon, 13 Sep 2021 22:35:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B618E61269 for ; Mon, 13 Sep 2021 22:35:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348566AbhIMWgT (ORCPT ); Mon, 13 Sep 2021 18:36:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:51156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348581AbhIMWfk (ORCPT ); Mon, 13 Sep 2021 18:35:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4420461222; Mon, 13 Sep 2021 22:34:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631572464; bh=MXf4S0vzKac0hK17tnN+6U9uXKb+YFLSpgKQKzDLYDM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lxkv1dOfp9hKtzNS9AoYKjFxGECxdeqoDYlH8ha/ATFBkS+qaj7+AYD679/rzMFFj FpXkvvqJU4neYfxPkCm8FPPKyfoUnnQB6tZoHTFHthhpcXW+FKOOVQn70B3e9qew9J 9g4wbL8p1+nYaya5v0wgpDgzBsyUjI6wVx7tD8cdqmwKik/Up9fXQCRgZ1/2smihNL A8yy8zQWdHDUh/Hzck3KqkL+93UumyKw0zPwFYYs1INncgELqX+ElyQvaIYLikqI2V WTALzSKQyjp786cywTA7arwd7OYuMRGKyC2O6xOj1o2f4sp7tnGRXhEOXg4rcNHwXW 95CWfmJnlzRaA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sven Schnelle , Marc Hartmayer , Heiko Carstens , Sasha Levin , linux-s390@vger.kernel.org Subject: [PATCH AUTOSEL 5.13 06/19] s390: add kmemleak annotation in stack_alloc() Date: Mon, 13 Sep 2021 18:34:02 -0400 Message-Id: <20210913223415.435654-6-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210913223415.435654-1-sashal@kernel.org> References: <20210913223415.435654-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Sven Schnelle [ Upstream commit 436fc4feeabbf103d78d50a8e091b3aac28cc37f ] kmemleak with enabled auto scanning reports that our stack allocation is lost. This is because we're saving the pointer + STACK_INIT_OFFSET to lowcore. When kmemleak now scans the objects, it thinks that this one is lost because it can't find a corresponding pointer. Reported-by: Marc Hartmayer Signed-off-by: Sven Schnelle Tested-by: Marc Hartmayer Signed-off-by: Heiko Carstens Signed-off-by: Sasha Levin --- arch/s390/kernel/setup.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 93538e63fa03..442150c88278 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -310,9 +311,12 @@ void *restart_stack; unsigned long stack_alloc(void) { #ifdef CONFIG_VMAP_STACK - return (unsigned long)__vmalloc_node(THREAD_SIZE, THREAD_SIZE, - THREADINFO_GFP, NUMA_NO_NODE, - __builtin_return_address(0)); + void *ret; + + ret = __vmalloc_node(THREAD_SIZE, THREAD_SIZE, THREADINFO_GFP, + NUMA_NO_NODE, __builtin_return_address(0)); + kmemleak_not_leak(ret); + return (unsigned long)ret; #else return __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER); #endif -- 2.30.2