Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2825074imu; Thu, 29 Nov 2018 10:49:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/Vblv73b/WAXX+H/Y+uHrqrF9/s6pjTNIQ00bH1iwwzDBs0nI+2zGDwDS39wXASZjaPQe0Y X-Received: by 2002:a17:902:4025:: with SMTP id b34mr2603012pld.181.1543517378862; Thu, 29 Nov 2018 10:49:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543517378; cv=none; d=google.com; s=arc-20160816; b=FMZx4brVq7xSM2BRW4RNJ2FZAc1kurYHP3j6esNGxJtZukzEXSF88WkgevPk45k61H r31zsYRqmuYKTIYRSfINlTs/cmlZ8gFD2DZFjRzPPgxOI4r/iMXSm98uClIeJykhp65J HcPr/Lokg41XHSbE7rSL8jFLhI8WWBZOUiPzHjyeOvhCzzQJ7hVovlBcSGvQOVp3BJNO QcnS1dT2jtPo0jh8P8wHn6Nv9A2CAM4CemPzaS5/iojuWyqYCViOb91dcUnW1HX7jRSv V/wyhH06HGvTu4H5TCAvZSmGsDD4CrHNXgMgt3Wb81Um8RCfWSsLOUib7V2zDnsliqAY TVDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=xS5q6m4Nh5rmh+mS8VOUeBD0coV3qNDl5x055cpnf0k=; b=qfospM1SMD1EH2fHHc03tIgeTPUc8TJWtPEISz/U3tXWV1I/RUY7MPbQ3gmpoeyXud iOC2yPSdRANXM2eQHwDbemxDtTtJWoQY63ImWyEhU7T5qF/Ip8szR0a67hVgQysNRksS j2q4UhLaAuR3DQ9jp4zDkT5fUEEIVOe1dq5gMUXd10VnvFaHbIrTQIEHNxyhDNs+wjm3 XjKkFVpkgW3X/v6rf9O/ewcX/KMrzxB5OhF4YX5NO+QVosjMk2HXAmsz0jzGLoKoZJun vfE3JLucALtJtlMAr2C3uhsJftuDOQbL/wGTY7NqHhTlz+60BaY61gFgC16RjuoSKCAN 9M5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g23si2628954pgb.229.2018.11.29.10.49.24; Thu, 29 Nov 2018 10:49:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726554AbeK3Fwz (ORCPT + 99 others); Fri, 30 Nov 2018 00:52:55 -0500 Received: from mout.gmx.net ([212.227.17.20]:43543 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726393AbeK3Fwz (ORCPT ); Fri, 30 Nov 2018 00:52:55 -0500 Received: from qcai.nay.com ([66.187.233.206]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MgXCF-1gqPjc1UON-00NzGi; Thu, 29 Nov 2018 19:46:31 +0100 From: Qian Cai To: ard.biesheuvel@linaro.org Cc: marc.zyngier@arm.com, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Qian Cai Subject: [PATCH] efi: let kmemleak ignore false positives Date: Thu, 29 Nov 2018 13:45:52 -0500 Message-Id: <1543517152-23969-1-git-send-email-cai@gmx.us> X-Mailer: git-send-email 1.8.3.1 X-Provags-ID: V03:K1:y2qigTIqku976iZS0VF0KI20pkKTInCT7ylRvB+fIvHbp0rpkH2 38Y3lIqLr76FsIo6AULbeAc84fqIeT3ExVVgNKbQawKuUCDkBZjf+A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VjvoO4iFMrA8lbuhaFD9GV8= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org unreferenced object 0xffff8096c1acf580 (size 128): comm "swapper/63", pid 0, jiffies 4294937418 (age 1201.230s) hex dump (first 32 bytes): 80 87 b5 c1 96 00 00 00 00 00 cc c2 16 00 00 00 ................ 00 00 01 00 00 00 00 00 6b 6b 6b 6b 6b 6b 6b 6b ........kkkkkkkk backtrace: [<000000001d2549ba>] kmem_cache_alloc_trace+0x430/0x500 [<0000000093a6dfab>] efi_mem_reserve_persistent+0x50/0xf8 [<000000000a730828>] its_cpu_init_lpis+0x394/0x4b8 [<00000000edf04e07>] its_cpu_init+0x104/0x150 [<000000004d0342c5>] gic_starting_cpu+0x34/0x40 [<000000005d9da772>] cpuhp_invoke_callback+0x228/0x1d68 [<0000000061eace9b>] notify_cpu_starting+0xc0/0x118 [<0000000048bc2dc5>] secondary_start_kernel+0x23c/0x3b0 [<0000000015137d6a>] 0xffffffffffffffff efi_mem_reserve_persistent+0x50/0xf8: kmalloc at include/linux/slab.h:546 (inlined by) efi_mem_reserve_persistent at drivers/firmware/efi/efi.c:979 This line, rsv = kmalloc(sizeof(*rsv), GFP_ATOMIC); Kmemleak has a known limitation that can only track pointers in the kernel virtual space. Hence, it will report false positives due to "rsv" will only reference to other physical addresses, rsv->next = efi_memreserve_root->next; efi_memreserve_root->next = __pa(rsv); Signed-off-by: Qian Cai --- drivers/firmware/efi/efi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index fad7c62..0b69bb6 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -31,6 +31,7 @@ #include #include #include +#include #include @@ -980,6 +981,8 @@ int efi_mem_reserve_persistent(phys_addr_t addr, u64 size) if (!rsv) return -ENOMEM; + kmemleak_ignore(rsv); + rsv->base = addr; rsv->size = size; -- 1.8.3.1