Subject: [Bug 204479] KASAN hit at modprobe zram

From: [email-masked]
Date: Fri, 09 Aug 2019 14:08:01 +0000

https://bugzilla.kernel.org/show_bug.cgi?id=204479

--- Comment #11 from Christophe Leroy ([email-masked]) ---
Thanks. Then it is not about SMP allthough there's anyway a theoritical problem
with SMP that's I'll address in another patch.

I think I finally spotted the issue. Let's take the first occurence of the
first log:

Aug 08 23:39:58 T600 kernel: ###### module_alloc(4718) = f1065000
[fe20ca00-fe20d2e3]
[...]
Aug 08 23:39:59 T600 kernel: BUG: Unable to handle kernel data access at
0xfe20d040

In kasan_init_region(), the loop starts with k_cur = 0xfe20ca00 to set the pte
for the first shadow page at 0xfe20c000. Then k_cur is increased by PAGE_SIZE
so now k_cur = 0xfe20da00.

As this is over 0xfe20d2e3, it doesn't set the pte for the second page at
0xfe20d000.

It should be fixed by changing the init value of k_cur in the for() loop of
kasan_init_region() by:

for (k_cur = k_start & PAGE_MASK; ....)

Can you test it ?

-- 
You are receiving this mail because:
You are on the CC list for the bug.