L1 tables are allocated with __get_dma_pages, and therefore already
ignored by kmemleak.
Without this, the kernel would print this error message on boot,
when the first L1 table is allocated:
[ 2.810533] kmemleak: Trying to color unknown object at 0xffffffd652388000 as Black
[ 2.818190] CPU: 5 PID: 39 Comm: kworker/5:0 Tainted: G S 4.19.16 #8
[ 2.831227] Workqueue: events deferred_probe_work_func
[ 2.836353] Call trace:
...
[ 2.852532] paint_ptr+0xa0/0xa8
[ 2.855750] kmemleak_ignore+0x38/0x6c
[ 2.859490] __arm_v7s_alloc_table+0x168/0x1f4
[ 2.863922] arm_v7s_alloc_pgtable+0x114/0x17c
[ 2.868354] alloc_io_pgtable_ops+0x3c/0x78
...
Fixes: e5fc9753b1a8314 ("iommu/io-pgtable: Add ARMv7 short descriptor support")
Signed-off-by: Nicolas Boichat <[email protected]>
---
I only tested this on top of my other series
(https://patchwork.kernel.org/patch/10720495/), but I think the same fix
applies. I'm still a bit confused as to why this only shows up now, as IIUC,
the kmemleak_ignore call was always wrong with L1 tables.
drivers/iommu/io-pgtable-arm-v7s.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c
index cec29bf45c9bd7..98a4a4a0dfb0c1 100644
--- a/drivers/iommu/io-pgtable-arm-v7s.c
+++ b/drivers/iommu/io-pgtable-arm-v7s.c
@@ -217,7 +217,8 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp,
if (dma != phys)
goto out_unmap;
}
- kmemleak_ignore(table);
+ if (lvl == 2)
+ kmemleak_ignore(table);
return table;
out_unmap:
--
2.20.1.495.gaa96b0ce6b-goog
On Mon, Jan 28, 2019 at 05:43:01PM +0800, Nicolas Boichat wrote:
> L1 tables are allocated with __get_dma_pages, and therefore already
> ignored by kmemleak.
>
> Without this, the kernel would print this error message on boot,
> when the first L1 table is allocated:
>
> [ 2.810533] kmemleak: Trying to color unknown object at 0xffffffd652388000 as Black
> [ 2.818190] CPU: 5 PID: 39 Comm: kworker/5:0 Tainted: G S 4.19.16 #8
> [ 2.831227] Workqueue: events deferred_probe_work_func
> [ 2.836353] Call trace:
> ...
> [ 2.852532] paint_ptr+0xa0/0xa8
> [ 2.855750] kmemleak_ignore+0x38/0x6c
> [ 2.859490] __arm_v7s_alloc_table+0x168/0x1f4
> [ 2.863922] arm_v7s_alloc_pgtable+0x114/0x17c
> [ 2.868354] alloc_io_pgtable_ops+0x3c/0x78
> ...
>
> Fixes: e5fc9753b1a8314 ("iommu/io-pgtable: Add ARMv7 short descriptor support")
> Signed-off-by: Nicolas Boichat <[email protected]>
> ---
>
> I only tested this on top of my other series
> (https://patchwork.kernel.org/patch/10720495/), but I think the same fix
> applies. I'm still a bit confused as to why this only shows up now, as IIUC,
> the kmemleak_ignore call was always wrong with L1 tables.
>
> drivers/iommu/io-pgtable-arm-v7s.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
<formletter>
This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.
</formletter>
On Mon, Jan 28, 2019 at 05:43:01PM +0800, Nicolas Boichat wrote:
> L1 tables are allocated with __get_dma_pages, and therefore already
> ignored by kmemleak.
>
> Without this, the kernel would print this error message on boot,
> when the first L1 table is allocated:
>
> [ 2.810533] kmemleak: Trying to color unknown object at 0xffffffd652388000 as Black
> [ 2.818190] CPU: 5 PID: 39 Comm: kworker/5:0 Tainted: G S 4.19.16 #8
> [ 2.831227] Workqueue: events deferred_probe_work_func
> [ 2.836353] Call trace:
> ...
> [ 2.852532] paint_ptr+0xa0/0xa8
> [ 2.855750] kmemleak_ignore+0x38/0x6c
> [ 2.859490] __arm_v7s_alloc_table+0x168/0x1f4
> [ 2.863922] arm_v7s_alloc_pgtable+0x114/0x17c
> [ 2.868354] alloc_io_pgtable_ops+0x3c/0x78
> ...
>
> Fixes: e5fc9753b1a8314 ("iommu/io-pgtable: Add ARMv7 short descriptor support")
> Signed-off-by: Nicolas Boichat <[email protected]>
> ---
>
> I only tested this on top of my other series
> (https://patchwork.kernel.org/patch/10720495/), but I think the same fix
> applies. I'm still a bit confused as to why this only shows up now, as IIUC,
> the kmemleak_ignore call was always wrong with L1 tables.
Yes, I managed to reproduce this on top of -rc4 (see below). I suspect you
/are/ the intersection of people using v7s w/ kmemleak, so this has just
lingered and never been hit until now.
For the patch (assuming this is going via Joerg):
Acked-by: Will Deacon <[email protected]>
Will
--->8
[ 0.124473] kmemleak: Trying to color unknown object at 0xffff8000042d8000 as Black
[ 0.125312] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.0.0-rc4-00012-g40b114779944 #1
[ 0.126181] Hardware name: linux,dummy-virt (DT)
[ 0.126680] Call trace:
[ 0.126950] dump_backtrace+0x0/0x140
[ 0.127346] show_stack+0x14/0x20
[ 0.127706] dump_stack+0x90/0xb4
[ 0.128066] paint_ptr+0x94/0xa8
[ 0.128417] kmemleak_ignore+0x54/0x60
[ 0.128991] __arm_v7s_alloc_table+0x6c/0x240
[ 0.129661] arm_v7s_alloc_pgtable+0x10c/0x188
[ 0.130359] alloc_io_pgtable_ops+0x44/0xb0
[ 0.131006] arm_v7s_do_selftests+0x84/0x4bc
[ 0.131663] do_one_initcall+0x74/0x178
[ 0.132253] kernel_init_freeable+0x188/0x220
[ 0.132923] kernel_init+0x10/0x100
[ 0.133460] ret_from_fork+0x10/0x18
[ 0.142102] arm-v7s io-pgtable: self test ok
Joerg: Just to make sure, is this patch in your queue? Thanks.
On Thu, Jan 31, 2019 at 2:21 AM Will Deacon <[email protected]> wrote:
>
> On Mon, Jan 28, 2019 at 05:43:01PM +0800, Nicolas Boichat wrote:
> > L1 tables are allocated with __get_dma_pages, and therefore already
> > ignored by kmemleak.
> >
> > Without this, the kernel would print this error message on boot,
> > when the first L1 table is allocated:
> >
> > [ 2.810533] kmemleak: Trying to color unknown object at 0xffffffd652388000 as Black
> > [ 2.818190] CPU: 5 PID: 39 Comm: kworker/5:0 Tainted: G S 4.19.16 #8
> > [ 2.831227] Workqueue: events deferred_probe_work_func
> > [ 2.836353] Call trace:
> > ...
> > [ 2.852532] paint_ptr+0xa0/0xa8
> > [ 2.855750] kmemleak_ignore+0x38/0x6c
> > [ 2.859490] __arm_v7s_alloc_table+0x168/0x1f4
> > [ 2.863922] arm_v7s_alloc_pgtable+0x114/0x17c
> > [ 2.868354] alloc_io_pgtable_ops+0x3c/0x78
> > ...
> >
> > Fixes: e5fc9753b1a8314 ("iommu/io-pgtable: Add ARMv7 short descriptor support")
> > Signed-off-by: Nicolas Boichat <[email protected]>
> > ---
> >
> > I only tested this on top of my other series
> > (https://patchwork.kernel.org/patch/10720495/), but I think the same fix
> > applies. I'm still a bit confused as to why this only shows up now, as IIUC,
> > the kmemleak_ignore call was always wrong with L1 tables.
>
> Yes, I managed to reproduce this on top of -rc4 (see below). I suspect you
> /are/ the intersection of people using v7s w/ kmemleak, so this has just
> lingered and never been hit until now.
>
> For the patch (assuming this is going via Joerg):
>
> Acked-by: Will Deacon <[email protected]>
>
> Will
>
> --->8
>
> [ 0.124473] kmemleak: Trying to color unknown object at 0xffff8000042d8000 as Black
> [ 0.125312] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.0.0-rc4-00012-g40b114779944 #1
> [ 0.126181] Hardware name: linux,dummy-virt (DT)
> [ 0.126680] Call trace:
> [ 0.126950] dump_backtrace+0x0/0x140
> [ 0.127346] show_stack+0x14/0x20
> [ 0.127706] dump_stack+0x90/0xb4
> [ 0.128066] paint_ptr+0x94/0xa8
> [ 0.128417] kmemleak_ignore+0x54/0x60
> [ 0.128991] __arm_v7s_alloc_table+0x6c/0x240
> [ 0.129661] arm_v7s_alloc_pgtable+0x10c/0x188
> [ 0.130359] alloc_io_pgtable_ops+0x44/0xb0
> [ 0.131006] arm_v7s_do_selftests+0x84/0x4bc
> [ 0.131663] do_one_initcall+0x74/0x178
> [ 0.132253] kernel_init_freeable+0x188/0x220
> [ 0.132923] kernel_init+0x10/0x100
> [ 0.133460] ret_from_fork+0x10/0x18
> [ 0.142102] arm-v7s io-pgtable: self test ok
On Mon, Feb 25, 2019 at 08:21:46AM +0800, Nicolas Boichat wrote:
> Joerg: Just to make sure, is this patch in your queue? Thanks.
It is now, thanks.