linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] efi: let kmemleak ignore false positives
@ 2018-11-29 18:45 Qian Cai
  2018-12-06 16:16 ` [RESEND PATCH] " Qian Cai
  0 siblings, 1 reply; 8+ messages in thread
From: Qian Cai @ 2018-11-29 18:45 UTC (permalink / raw)
  To: ard.biesheuvel; +Cc: marc.zyngier, linux-efi, linux-kernel, Qian Cai

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 <cai@gmx.us>
---
 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 <linux/acpi.h>
 #include <linux/ucs2_string.h>
 #include <linux/memblock.h>
+#include <linux/kmemleak.h>
 
 #include <asm/early_ioremap.h>
 
@@ -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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [RESEND PATCH] efi: let kmemleak ignore false positives
  2018-11-29 18:45 [PATCH] efi: let kmemleak ignore false positives Qian Cai
@ 2018-12-06 16:16 ` Qian Cai
  2018-12-06 17:59   ` Catalin Marinas
  0 siblings, 1 reply; 8+ messages in thread
From: Qian Cai @ 2018-12-06 16:16 UTC (permalink / raw)
  To: akpm
  Cc: ard.biesheuvel, catalin.marinas, marc.zyngier, linux-efi,
	linux-kernel, Qian Cai

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 <cai@gmx.us>
---
 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;
 
-- 
2.17.2 (Apple Git-113)


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [RESEND PATCH] efi: let kmemleak ignore false positives
  2018-12-06 16:16 ` [RESEND PATCH] " Qian Cai
@ 2018-12-06 17:59   ` Catalin Marinas
  2018-12-06 18:01     ` Ard Biesheuvel
  0 siblings, 1 reply; 8+ messages in thread
From: Catalin Marinas @ 2018-12-06 17:59 UTC (permalink / raw)
  To: Qian Cai; +Cc: akpm, ard.biesheuvel, marc.zyngier, linux-efi, linux-kernel

On Thu, Dec 06, 2018 at 11:16:33AM -0500, Qian Cai wrote:
> 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 <cai@gmx.us>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RESEND PATCH] efi: let kmemleak ignore false positives
  2018-12-06 17:59   ` Catalin Marinas
@ 2018-12-06 18:01     ` Ard Biesheuvel
  2018-12-06 18:04       ` Qian Cai
  0 siblings, 1 reply; 8+ messages in thread
From: Ard Biesheuvel @ 2018-12-06 18:01 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Qian Cai, Andrew Morton, Marc Zyngier, linux-efi,
	Linux Kernel Mailing List

On Thu, 6 Dec 2018 at 19:00, Catalin Marinas <catalin.marinas@arm.com> wrote:
>
> On Thu, Dec 06, 2018 at 11:16:33AM -0500, Qian Cai wrote:
> > 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 <cai@gmx.us>
>
> Acked-by: Catalin Marinas <catalin.marinas@arm.com>\

I don't see the patch and I wasn't cc'ed

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RESEND PATCH] efi: let kmemleak ignore false positives
  2018-12-06 18:01     ` Ard Biesheuvel
@ 2018-12-06 18:04       ` Qian Cai
  2018-12-07 11:28         ` Ard Biesheuvel
  0 siblings, 1 reply; 8+ messages in thread
From: Qian Cai @ 2018-12-06 18:04 UTC (permalink / raw)
  To: Ard Biesheuvel, Catalin Marinas
  Cc: Andrew Morton, Marc Zyngier, linux-efi, Linux Kernel Mailing List

On Thu, 2018-12-06 at 19:01 +0100, Ard Biesheuvel wrote:
> On Thu, 6 Dec 2018 at 19:00, Catalin Marinas <catalin.marinas@arm.com> wrote:
> > 
> > On Thu, Dec 06, 2018 at 11:16:33AM -0500, Qian Cai wrote:
> > > 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 <cai@gmx.us>
> > 
> > Acked-by: Catalin Marinas <catalin.marinas@arm.com>\
> 
> I don't see the patch and I wasn't cc'ed

That is strange. Please see,

https://lore.kernel.org/lkml/1543517152-23969-1-git-send-email-cai@gmx.us/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RESEND PATCH] efi: let kmemleak ignore false positives
  2018-12-06 18:04       ` Qian Cai
@ 2018-12-07 11:28         ` Ard Biesheuvel
  2018-12-07 12:32           ` Qian Cai
  0 siblings, 1 reply; 8+ messages in thread
From: Ard Biesheuvel @ 2018-12-07 11:28 UTC (permalink / raw)
  To: Qian Cai
  Cc: Catalin Marinas, Andrew Morton, Marc Zyngier, linux-efi,
	Linux Kernel Mailing List

On Thu, 6 Dec 2018 at 19:05, Qian Cai <cai@gmx.us> wrote:
>
> On Thu, 2018-12-06 at 19:01 +0100, Ard Biesheuvel wrote:
> > On Thu, 6 Dec 2018 at 19:00, Catalin Marinas <catalin.marinas@arm.com> wrote:
> > >
> > > On Thu, Dec 06, 2018 at 11:16:33AM -0500, Qian Cai wrote:
> > > > 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 <cai@gmx.us>
> > >
> > > Acked-by: Catalin Marinas <catalin.marinas@arm.com>\
> >
> > I don't see the patch and I wasn't cc'ed
>
> That is strange. Please see,
>
> https://lore.kernel.org/lkml/1543517152-23969-1-git-send-email-cai@gmx.us/

OK, I found it in my spam folder, apologies for that.

This kmalloc() will be replaced in the next merge window by a call to
__get_free_page(). Does kmemleak still require the kmemleak_ignore()
for that case? Or is it only for kmalloc()?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RESEND PATCH] efi: let kmemleak ignore false positives
  2018-12-07 11:28         ` Ard Biesheuvel
@ 2018-12-07 12:32           ` Qian Cai
  2018-12-07 12:45             ` Ard Biesheuvel
  0 siblings, 1 reply; 8+ messages in thread
From: Qian Cai @ 2018-12-07 12:32 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Andrew Morton, Marc Zyngier, Linux Kernel Mailing List,
	linux-efi, Catalin Marinas


On 12/7/18 at 6:28 AM, Ard Biesheuvel wrote:

> On Thu, 6 Dec 2018 at 19:05, Qian Cai <cai@gmx.us> wrote:
> >
> > On Thu, 2018-12-06 at 19:01 +0100, Ard Biesheuvel wrote:
> > > On Thu, 6 Dec 2018 at 19:00, Catalin Marinas <catalin.marinas@arm.com> wrote:
> > > >
> > > > On Thu, Dec 06, 2018 at 11:16:33AM -0500, Qian Cai wrote:
> > > > > 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 <cai@gmx.us>
> > > >
> > > > Acked-by: Catalin Marinas <catalin.marinas@arm.com>\
> > >
> > > I don't see the patch and I wasn't cc'ed
> >
> > That is strange. Please see,
> >
> > https://lore.kernel.org/lkml/1543517152-23969-1-git-send-email-cai@gmx.us/
> 
> OK, I found it in my spam folder, apologies for that.
> 
> This kmalloc() will be replaced in the next merge window by a call to
> __get_free_page(). Does kmemleak still require the kmemleak_ignore()
> for that case? Or is it only for kmalloc()?

Looks like kmemleak won’t be able to track page
allocation, so it should be fine then without 
kmemleak_ignore().

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RESEND PATCH] efi: let kmemleak ignore false positives
  2018-12-07 12:32           ` Qian Cai
@ 2018-12-07 12:45             ` Ard Biesheuvel
  0 siblings, 0 replies; 8+ messages in thread
From: Ard Biesheuvel @ 2018-12-07 12:45 UTC (permalink / raw)
  To: Qian Cai
  Cc: Andrew Morton, Marc Zyngier, Linux Kernel Mailing List,
	linux-efi, Catalin Marinas

On Fri, 7 Dec 2018 at 13:32, Qian Cai <cai@gmx.us> wrote:
>
>
> On 12/7/18 at 6:28 AM, Ard Biesheuvel wrote:
>
> > On Thu, 6 Dec 2018 at 19:05, Qian Cai <cai@gmx.us> wrote:
> > >
> > > On Thu, 2018-12-06 at 19:01 +0100, Ard Biesheuvel wrote:
> > > > On Thu, 6 Dec 2018 at 19:00, Catalin Marinas <catalin.marinas@arm.com> wrote:
> > > > >
> > > > > On Thu, Dec 06, 2018 at 11:16:33AM -0500, Qian Cai wrote:
> > > > > > 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 <cai@gmx.us>
> > > > >
> > > > > Acked-by: Catalin Marinas <catalin.marinas@arm.com>\
> > > >
> > > > I don't see the patch and I wasn't cc'ed
> > >
> > > That is strange. Please see,
> > >
> > > https://lore.kernel.org/lkml/1543517152-23969-1-git-send-email-cai@gmx.us/
> >
> > OK, I found it in my spam folder, apologies for that.
> >
> > This kmalloc() will be replaced in the next merge window by a call to
> > __get_free_page(). Does kmemleak still require the kmemleak_ignore()
> > for that case? Or is it only for kmalloc()?
>
> Looks like kmemleak won’t be able to track page
> allocation, so it should be fine then without
> kmemleak_ignore().

OK, thanks Qian

I will take the patch for v4.20 and remove the kmemleak_ignore() again for v4.21

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-12-07 12:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29 18:45 [PATCH] efi: let kmemleak ignore false positives Qian Cai
2018-12-06 16:16 ` [RESEND PATCH] " Qian Cai
2018-12-06 17:59   ` Catalin Marinas
2018-12-06 18:01     ` Ard Biesheuvel
2018-12-06 18:04       ` Qian Cai
2018-12-07 11:28         ` Ard Biesheuvel
2018-12-07 12:32           ` Qian Cai
2018-12-07 12:45             ` Ard Biesheuvel

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).