From patchwork Tue Jan 29 14:42:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 156997 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4743640jaa; Tue, 29 Jan 2019 06:42:36 -0800 (PST) X-Google-Smtp-Source: ALg8bN4FepVe417i9W4HM2mPo6uTeLE5+hcJTqoUDeXePjEtPj56PY0t5/IVUVug6lNPigjdQotT X-Received: by 2002:a63:4384:: with SMTP id q126mr23713311pga.160.1548772956677; Tue, 29 Jan 2019 06:42:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548772956; cv=none; d=google.com; s=arc-20160816; b=kUDej0YoMil+5G5SQFSmetSNjA1nV3Jx4gfDeCW2vfL4UV2jnL/Sj54KSeKuedolO1 dApurJN0OrPt+lUvWNGjqmjJdCAn7ZKILOgiAi4iI/NAKO/mJcv6qXa1FxTia7mrB4Qk lZgciSYAhmwW9Oa/tWM/sEkYULXpz0ULeBdlq/LH40qRoCGSnAQ7wNFPOdaSfk8kGn3P FqGRm+3EeeRlImGPowH515r/FdNnyKffEnhdYPNIU4zNwgKBPgc/ELawlyG02fzTCO+6 g6E9Ulhlip0FbE5r9OWBbIORJrsH9TvWfUtomgxSDM5RAYglEYdpqKSz6QapazsueB0D ZJxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=yLl6ztnthwC64WTFW/m3+s88WreuRI/Bh7V1X91JEBE=; b=hUXxG/cs8isQpnTIeenB2W9o1g/YHkJ9weKfkVCC1fIJTM9BUYAhtJ22SX4l4XrBpi tGZhWtqWLXzrpwCv13yTRD1fA8SVnCpdA0EuetUp0FQgZd3Wd8/+EsOWDFKhiC5tZrwa LxFfEi6+rOVePgXL+VwtWMZEBbIUqJ+3kknSSaRuPUmjl8crgs1JOUwM63joJmu9Wgrh OMAzmOOxnZKRcoXCP+dbEx7MrQQfAZ5FDzZksOEkZEm/OX4vc1KMppW5vlf5KdAELovQ +oJrT5K0yU3AjH+EHqVfl5mmclxmRX8YZbVwtunU52hC6DlNr6A3F3mMh5RvSnANtrpJ Zn2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AK8ZZ9f1; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z8si4837541pgf.577.2019.01.29.06.42.36; Tue, 29 Jan 2019 06:42:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AK8ZZ9f1; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726417AbfA2Omg (ORCPT + 3 others); Tue, 29 Jan 2019 09:42:36 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:36273 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725811AbfA2Omg (ORCPT ); Tue, 29 Jan 2019 09:42:36 -0500 Received: by mail-wm1-f65.google.com with SMTP id p6so18036162wmc.1 for ; Tue, 29 Jan 2019 06:42:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yLl6ztnthwC64WTFW/m3+s88WreuRI/Bh7V1X91JEBE=; b=AK8ZZ9f1p1q/8wQi7u6wvG0q5FxYtdcnQY2gn+WsDpfMAm9a1ibAQRZfeMs/72xEKG hhQDEISOyXViR5smppVUYUuCUNn8m4ivi4rEDvjj1W2t4SYECF9OR68rdmBx0lX+zH54 knV5OvO/exvDIK2EacHfj9wbnb9HsBkYspXjA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yLl6ztnthwC64WTFW/m3+s88WreuRI/Bh7V1X91JEBE=; b=oHAMFn6UIr91FjU2ajetHWWK2pUWhKI9Darc0yA4kIFNh4nMHZwZA/k8Q6yZihMDOv RPKBwezWZ2l60cvZZ703DzYs96M07eD3D9e1NupUDS/tMZFZF4naNDNYb1ugbo9Hyj2N 3frL9uJXbG9+M7g/qZYezgqAm0aHDbL80xiMkoCPqami1THrsAZ86Z0fFNvkEwdG/HZU cL5uSPoJOlD/J8cBIAdr8rCUtm7Woz2PvCGlmcluECwDX4omHw1+ylbp0Gv6rKqQyIS8 oj6q1rJc7hrzpQccimp7loaw8E4O9XZ+fip0OA46P6Zfb1wZnDzXvv/u6luEZswyz252 ANXg== X-Gm-Message-State: AJcUukeeOEyYV6zUQFPLa4YOS4p0OsdyNnyDnJ42hz3kIq4iLyO72MbN uQIFSWbfQg9VsvARg2p+cPmLyc1qWjA= X-Received: by 2002:a1c:e913:: with SMTP id q19mr21921728wmc.55.1548772954138; Tue, 29 Jan 2019 06:42:34 -0800 (PST) Received: from localhost.localdomain (laubervilliers-657-1-83-120.w92-154.abo.wanadoo.fr. [92.154.90.120]) by smtp.gmail.com with ESMTPSA id b13sm106056720wrn.28.2019.01.29.06.42.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jan 2019 06:42:32 -0800 (PST) From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: Qian Cai , stable@vger.kernel.org, Ingo Molnar , Linus Torvalds , Ard Biesheuvel Subject: [PATCH] efi: let kmemleak ignore false positives Date: Tue, 29 Jan 2019 15:42:18 +0100 Message-Id: <20190129144218.15888-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org From: Qian Cai No matching commit upstream, but the issue being addressed no longer exists after commit 80424b02d42b ("efi: Reduce the amount of memblock reservations for persistent allocations") was merged for the 5.0 cycle. 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); Fixes: a23d3bb05ccb ("efi: add API to reserve memory persistently across ...") Cc: # v4.20 Cc: Ingo Molnar Cc: Linus Torvalds Signed-off-by: Qian Cai Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/efi.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.20.1 diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index 415849bab233..7fcfe8a7ae98 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -31,6 +31,7 @@ #include #include #include +#include #include @@ -1000,6 +1001,8 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size) if (!rsv) return -ENOMEM; + kmemleak_ignore(rsv); + rsv->base = addr; rsv->size = size;