From patchwork Thu Jun 13 16:20:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Waiman Long X-Patchwork-Id: 13697123 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 31C21C27C4F for ; Thu, 13 Jun 2024 16:21:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=C6E639UIwAtkQNEr9kBB2jPUHGaI+pSB3aws83mC+K4=; b=laGv6m4RzIxb4mSp/m/ME2FNc/ gAEiOjQpmIaQ8X0Ln09/sEYrwSdfAwE0atVwoiC2KbIPiveySAYQQmO5zUBRsLwOXXxKBx5W+qcGa qfjsWO+HgMNbmS8paP1t5cd82OkyViNsmzZKCaeZ8DkMjiAHQT5LCq4O49do+VQs4Pvvg0e++r/SK 1MpQuxXr5Zx9kw9QnLNalzhq1gHfFRFkh2SCBvAoTVRXBekbozAhGsBP8h95rnr3vq2FWez2QNZ2b bpYufDfXo3EM8uLn/QM3ir86BA2LtJCO/g1Qkn4lXG/ISDuDLaqznPizQOj5nm4Jwi3NIBMTIWrjH gexzR5CQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHnCJ-0000000HKb0-0ouv; Thu, 13 Jun 2024 16:21:11 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHnCG-0000000HKZW-1S5y for linux-arm-kernel@lists.infradead.org; Thu, 13 Jun 2024 16:21:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718295666; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=C6E639UIwAtkQNEr9kBB2jPUHGaI+pSB3aws83mC+K4=; b=BkMdIEBu3fX9+E7PS03PIfMWLKJRkWb0vRm33DwNujLC83Kj2xsJsaEp9+rixF0v09tQZ0 TlkfbPX5ZSu9zVwSR/zHB1jIQx3gXrTjY13/ueS/zNuuyjGGRVMof2Kb67F1iPMDf1P3Km nFyJq+6b3E21S3/G4D6HGvLxUklep3c= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-491-LJN3tRSLPLa-rlbG8gSRcg-1; Thu, 13 Jun 2024 12:21:02 -0400 X-MC-Unique: LJN3tRSLPLa-rlbG8gSRcg-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B924F1955F2C; Thu, 13 Jun 2024 16:21:00 +0000 (UTC) Received: from llong.com (unknown [10.22.16.195]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C3FF419560AD; Thu, 13 Jun 2024 16:20:58 +0000 (UTC) From: Waiman Long To: Ard Biesheuvel , Catalin Marinas , Will Deacon Cc: linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Waiman Long Subject: [PATCH] arm64/efi: Fix kmemleak false positive in arm64_efi_rt_init() Date: Thu, 13 Jun 2024 12:20:31 -0400 Message-Id: <20240613162031.142224-1-longman@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240613_092108_492275_1A60F350 X-CRM114-Status: GOOD ( 10.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The kmemleak code sometimes complains about the following leak: unreferenced object 0xffff8000102e0000 (size 32768):   comm "swapper/0", pid 1, jiffies 4294937323 (age 71.240s)   hex dump (first 32 bytes):     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................   backtrace:     [<00000000db9a88a3>] __vmalloc_node_range+0x324/0x450     [<00000000ff8903a4>] __vmalloc_node+0x90/0xd0     [<000000001a06634f>] arm64_efi_rt_init+0x64/0xdc     [<0000000007826a8d>] do_one_initcall+0x178/0xac0     [<0000000054a87017>] do_initcalls+0x190/0x1d0     [<00000000308092d0>] kernel_init_freeable+0x2c0/0x2f0     [<000000003e7b99e0>] kernel_init+0x28/0x14c     [<000000002246af5b>] ret_from_fork+0x10/0x20 The memory object in this case is for efi_rt_stack_top and is allocated in an initcall. So this is certainly a false positive. Mark the object as not a leak to quash it. Signed-off-by: Waiman Long Acked-by: Ard Biesheuvel --- arch/arm64/kernel/efi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index 4a92096db34e..712718aed5dd 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -213,6 +214,7 @@ l: if (!p) { return -ENOMEM; } + kmemleak_not_leak(p); efi_rt_stack_top = p + THREAD_SIZE; return 0; }