Re: edac KASAN warning in experimental arm64 allmodconfig boot

From: James Morse
Date: Mon Oct 14 2019 - 12:15:12 EST


Hi John,

On 14/10/2019 16:18, John Garry wrote:
> I'm experimenting by trying to boot an allmodconfig arm64 kernel, as mentioned here:

Crumbs!


> One thing that I noticed - it's hard to miss actually - is the amount of complaining from
> KASAN about the EDAC/ghes code. Maybe this is something I should not care about/red
> herring, or maybe something genuine. Let me know what you think.

Hmmm, I thought I tested this recently...

> Log snippet (I cut off after the first KASAN warning):
>
> [ÂÂ 70.471011][ÂÂÂ T1] random: get_random_u32 called from new_slab+0x360/0x698 with
> crng_init=0

> [ÂÂ 70.478671][ÂÂÂ T1] [Firmware Bug]: APEI: Invalid bit width + offset in GAR
> [0x94110034/64/0/3/0]

(this one's for you right?)

> [ÂÂ 70.700412][ÂÂÂ T1] ------------[ cut here ]------------

> [ÂÂ 70.802080][ÂÂÂ T1] Call trace:
> [ÂÂ 70.802093][ÂÂÂ T1]Â debug_print_object+0xec/0x130
> [ÂÂ 70.802106][ÂÂÂ T1]Â __debug_check_no_obj_freed+0x114/0x290
> [ÂÂ 70.802119][ÂÂÂ T1]Â debug_check_no_obj_freed+0x18/0x28
> [ÂÂ 70.802130][ÂÂÂ T1]Â slab_free_freelist_hook+0x18c/0x228
> [ÂÂ 70.802140][ÂÂÂ T1]Â kfree+0x264/0x420
> [ÂÂ 70.802157][ÂÂÂ T1]Â _edac_mc_free+0x6c/0x210
> [ÂÂ 70.814163][ÂÂÂ T1]Â edac_mc_free+0x68/0x88
> [ÂÂ 70.814177][ÂÂÂ T1]Â ghes_edac_unregister+0x44/0x70
> [ÂÂ 70.814193][ÂÂÂ T1]Â ghes_remove+0x274/0x2a0

Ugh. This must be the test driver remove thing.

I've reproduced this, but had to remove the parent GHES twice. It looks like it tries to
use the first ghes_edac global variables when freeing the second. ghes_init prevents it
from re-allocating over the top.

The below diff fixes it for me. (I'll post it as a proper patch once I've done the
archaeology)

-----------%<-----------
diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c
index d413a0bdc9ad..955b59b6aade 100644
--- a/drivers/edac/ghes_edac.c
+++ b/drivers/edac/ghes_edac.c
@@ -554,6 +554,7 @@ void ghes_edac_unregister(struct ghes *ghes)
return;

mci = ghes_pvt->mci;
+ ghes_pvt = NULL;
edac_mc_del_mc(mci->pdev);
edac_mc_free(mci);
}

-----------%<-----------


Thanks!

James