linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Qian Cai <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: ard.biesheuvel@linaro.org, luto@kernel.org, cai@gmx.us,
	riel@surriel.com, dave.hansen@linux.intel.com,
	torvalds@linux-foundation.org, mingo@kernel.org, hpa@zytor.com,
	peterz@infradead.org, linux-kernel@vger.kernel.org, bp@alien8.de,
	tglx@linutronix.de, xypron.glpk@gmx.de
Subject: [tip:efi/urgent] efi: Let kmemleak ignore false positives
Date: Mon, 17 Dec 2018 10:15:53 -0800	[thread overview]
Message-ID: <tip-a0fc5578f1d63ba6e80d9509991b4c14f6eaf488@git.kernel.org> (raw)
In-Reply-To: <20181217180214.9436-2-ard.biesheuvel@linaro.org>

Commit-ID:  a0fc5578f1d63ba6e80d9509991b4c14f6eaf488
Gitweb:     https://git.kernel.org/tip/a0fc5578f1d63ba6e80d9509991b4c14f6eaf488
Author:     Qian Cai <cai@gmx.us>
AuthorDate: Mon, 17 Dec 2018 19:02:13 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 17 Dec 2018 19:12:47 +0100

efi: Let kmemleak ignore false positives

Address this kmemleak false positive :

  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

It's allocated by 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);

So tell kmemleak to ignore the 'rsv' object.

 [ mingo: Improved the changelog. ]

Signed-off-by: Qian Cai <cai@gmx.us>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/20181217180214.9436-2-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 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 415849bab233..7fcfe8a7ae98 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -31,6 +31,7 @@
 #include <linux/acpi.h>
 #include <linux/ucs2_string.h>
 #include <linux/memblock.h>
+#include <linux/kmemleak.h>
 
 #include <asm/early_ioremap.h>
 
@@ -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;
 

  reply	other threads:[~2018-12-17 18:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-17 18:02 [GIT PULL 0/2] Final EFI fixes for v4.20 Ard Biesheuvel
2018-12-17 18:02 ` [PATCH 1/2] efi: let kmemleak ignore false positives Ard Biesheuvel
2018-12-17 18:15   ` tip-bot for Qian Cai [this message]
2018-12-17 18:02 ` [PATCH 2/2] efi: efi_guid_t must be 64-bit aligned Ard Biesheuvel
2018-12-17 18:16   ` [tip:efi/urgent] efi: Align 'efi_guid_t' to 64 bits tip-bot for Heinrich Schuchardt
2018-12-17 22:33     ` Heinrich Schuchardt
2018-12-17 22:42       ` Ard Biesheuvel
2018-12-17 23:20         ` Heinrich Schuchardt
2018-12-19 22:50           ` Ard Biesheuvel
2018-12-21  0:08             ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-a0fc5578f1d63ba6e80d9509991b4c14f6eaf488@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=bp@alien8.de \
    --cc=cai@gmx.us \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=riel@surriel.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).