Hi Daniel,
Le 07/08/2019 à 18:34, Christophe Leroy a écrit :
Le 07/08/2019 à 01:38, Daniel Axtens a écrit :
KASAN support on powerpc64 is interesting:
- We want to be able to support inline instrumentation so as to be
able to catch global and stack issues.
- We run a lot of code at boot in real mode. This includes stuff like
printk(), so it's not feasible to just disable instrumentation
around it.
Have you definitely given up the idea of doing a standard implementation
of KASAN like other 64 bits arches have done ?
Isn't it possible to setup an early 1:1 mapping and go in virtual mode
earlier ? What is so different between book3s64 and book3e64 ?
On book3e64, we've been able to setup KASAN before printing anything
(except when using EARLY_DEBUG). Isn't it feasible on book3s64 too ?
I looked at it once more, and cannot find that "We run a lot of code at
boot in real mode. This includes stuff like printk()".
Can you provide exemples ?
AFAICS, there are two things which are run in real mode at boot:
1/ prom_init() in kernel/prom_init.c
2/ early_setup() in kernel/setup_64.c
1/ KASAN is already inhibited for prom_init(), and prom_init() only uses
prom_printf() to display stuff.
2/ early_setup() only call a subset of simple functions. By regrouping
things in a new file called early_64.c as done for PPC32 with
early_32.c, we can easily inhibit kasan for those few stuff. printk() is
not used there either, there is even a comment at the startup of
early_setup() telling /* -------- printk is _NOT_ safe to use here !
------- */. The only things that perform display is the function
udbg_printf(), which is called only when DEBUG is set and which is
linked to CONFIG_PPC_EARLY_DEBUG. We already discussed that and agreed
that CONFIG_PPC_EARLY_DEBUG could be made exclusive of CONFIG_KASAN.
Once early_setup() has run, BOOK3S64 goes in virtual mode, just like
BOOK3E does.
What am I missing ?
Thanks
Christophe