mbox series

[RFC,0/7] powerpc: KASAN for 64-bit 3s radix

Message ID 20190523052120.18459-1-dja@axtens.net (mailing list archive)
Headers show
Series powerpc: KASAN for 64-bit 3s radix | expand

Message

Daniel Axtens May 23, 2019, 5:21 a.m. UTC
Building on the work of Christophe, Aneesh and Balbir, I've ported
KASAN to Book3S radix.

It builds on top Christophe's work on 32bit, and includes my work for
64-bit Book3E (3S doesn't really depend on 3E, but it was handy to
have around when developing and debugging).

This provides full inline instrumentation on radix, but does require
that you be able to specify the amount of memory on the system at
compile time. More details in patch 7.

Regards,
Daniel

Daniel Axtens (7):
  kasan: do not open-code addr_has_shadow
  kasan: allow architectures to manage the memory-to-shadow mapping
  kasan: allow architectures to provide an outline readiness check
  powerpc: KASAN for 64bit Book3E
  kasan: allow arches to provide their own early shadow setup
  kasan: allow arches to hook into global registration
  powerpc: Book3S 64-bit "heavyweight" KASAN support

 arch/powerpc/Kconfig                         |   2 +
 arch/powerpc/Kconfig.debug                   |  17 ++-
 arch/powerpc/Makefile                        |   7 ++
 arch/powerpc/include/asm/kasan.h             | 116 +++++++++++++++++++
 arch/powerpc/kernel/prom.c                   |  40 +++++++
 arch/powerpc/mm/kasan/Makefile               |   2 +
 arch/powerpc/mm/kasan/kasan_init_book3e_64.c |  50 ++++++++
 arch/powerpc/mm/kasan/kasan_init_book3s_64.c |  67 +++++++++++
 arch/powerpc/mm/nohash/Makefile              |   5 +
 include/linux/kasan.h                        |  13 +++
 mm/kasan/generic.c                           |   9 +-
 mm/kasan/generic_report.c                    |   2 +-
 mm/kasan/init.c                              |  10 ++
 mm/kasan/kasan.h                             |   6 +-
 mm/kasan/report.c                            |   6 +-
 mm/kasan/tags.c                              |   3 +-
 16 files changed, 345 insertions(+), 10 deletions(-)
 create mode 100644 arch/powerpc/mm/kasan/kasan_init_book3e_64.c
 create mode 100644 arch/powerpc/mm/kasan/kasan_init_book3s_64.c

Comments

Christophe Leroy May 23, 2019, 6:10 a.m. UTC | #1
Hi Daniel,

Le 23/05/2019 à 07:21, Daniel Axtens a écrit :
> Building on the work of Christophe, Aneesh and Balbir, I've ported
> KASAN to Book3S radix.
> 
> It builds on top Christophe's work on 32bit, and includes my work for
> 64-bit Book3E (3S doesn't really depend on 3E, but it was handy to
> have around when developing and debugging).
> 
> This provides full inline instrumentation on radix, but does require
> that you be able to specify the amount of memory on the system at
> compile time. More details in patch 7.
> 
> Regards,
> Daniel
> 
> Daniel Axtens (7):
>    kasan: do not open-code addr_has_shadow
>    kasan: allow architectures to manage the memory-to-shadow mapping
>    kasan: allow architectures to provide an outline readiness check
>    powerpc: KASAN for 64bit Book3E

I see you are still hacking the core part of KASAN.

Did you have a look at my RFC patch 
(https://patchwork.ozlabs.org/patch/1068260/) which demonstrate that 
full KASAN can be implemented on book3E/64 without those hacks ?

Christophe

>    kasan: allow arches to provide their own early shadow setup
>    kasan: allow arches to hook into global registration
>    powerpc: Book3S 64-bit "heavyweight" KASAN support
> 
>   arch/powerpc/Kconfig                         |   2 +
>   arch/powerpc/Kconfig.debug                   |  17 ++-
>   arch/powerpc/Makefile                        |   7 ++
>   arch/powerpc/include/asm/kasan.h             | 116 +++++++++++++++++++
>   arch/powerpc/kernel/prom.c                   |  40 +++++++
>   arch/powerpc/mm/kasan/Makefile               |   2 +
>   arch/powerpc/mm/kasan/kasan_init_book3e_64.c |  50 ++++++++
>   arch/powerpc/mm/kasan/kasan_init_book3s_64.c |  67 +++++++++++
>   arch/powerpc/mm/nohash/Makefile              |   5 +
>   include/linux/kasan.h                        |  13 +++
>   mm/kasan/generic.c                           |   9 +-
>   mm/kasan/generic_report.c                    |   2 +-
>   mm/kasan/init.c                              |  10 ++
>   mm/kasan/kasan.h                             |   6 +-
>   mm/kasan/report.c                            |   6 +-
>   mm/kasan/tags.c                              |   3 +-
>   16 files changed, 345 insertions(+), 10 deletions(-)
>   create mode 100644 arch/powerpc/mm/kasan/kasan_init_book3e_64.c
>   create mode 100644 arch/powerpc/mm/kasan/kasan_init_book3s_64.c
>
Daniel Axtens May 23, 2019, 6:18 a.m. UTC | #2
Christophe Leroy <christophe.leroy@c-s.fr> writes:

> Hi Daniel,
>
> Le 23/05/2019 à 07:21, Daniel Axtens a écrit :
>> Building on the work of Christophe, Aneesh and Balbir, I've ported
>> KASAN to Book3S radix.
>> 
>> It builds on top Christophe's work on 32bit, and includes my work for
>> 64-bit Book3E (3S doesn't really depend on 3E, but it was handy to
>> have around when developing and debugging).
>> 
>> This provides full inline instrumentation on radix, but does require
>> that you be able to specify the amount of memory on the system at
>> compile time. More details in patch 7.
>> 
>> Regards,
>> Daniel
>> 
>> Daniel Axtens (7):
>>    kasan: do not open-code addr_has_shadow
>>    kasan: allow architectures to manage the memory-to-shadow mapping
>>    kasan: allow architectures to provide an outline readiness check
>>    powerpc: KASAN for 64bit Book3E
>
> I see you are still hacking the core part of KASAN.
>
> Did you have a look at my RFC patch 
> (https://patchwork.ozlabs.org/patch/1068260/) which demonstrate that 
> full KASAN can be implemented on book3E/64 without those hacks ?

I haven't gone back and looked at the book3e patches as I've just been
working on the 3s stuff. I will have a look at that for the next version
for sure. I just wanted to get the 3s stuff out into the world sooner
rather than later! I don't think 3s uses those hacks so we can probably
drop them entirely.

Regards,
Daniel

>
> Christophe
>
>>    kasan: allow arches to provide their own early shadow setup
>>    kasan: allow arches to hook into global registration
>>    powerpc: Book3S 64-bit "heavyweight" KASAN support
>> 
>>   arch/powerpc/Kconfig                         |   2 +
>>   arch/powerpc/Kconfig.debug                   |  17 ++-
>>   arch/powerpc/Makefile                        |   7 ++
>>   arch/powerpc/include/asm/kasan.h             | 116 +++++++++++++++++++
>>   arch/powerpc/kernel/prom.c                   |  40 +++++++
>>   arch/powerpc/mm/kasan/Makefile               |   2 +
>>   arch/powerpc/mm/kasan/kasan_init_book3e_64.c |  50 ++++++++
>>   arch/powerpc/mm/kasan/kasan_init_book3s_64.c |  67 +++++++++++
>>   arch/powerpc/mm/nohash/Makefile              |   5 +
>>   include/linux/kasan.h                        |  13 +++
>>   mm/kasan/generic.c                           |   9 +-
>>   mm/kasan/generic_report.c                    |   2 +-
>>   mm/kasan/init.c                              |  10 ++
>>   mm/kasan/kasan.h                             |   6 +-
>>   mm/kasan/report.c                            |   6 +-
>>   mm/kasan/tags.c                              |   3 +-
>>   16 files changed, 345 insertions(+), 10 deletions(-)
>>   create mode 100644 arch/powerpc/mm/kasan/kasan_init_book3e_64.c
>>   create mode 100644 arch/powerpc/mm/kasan/kasan_init_book3s_64.c
>>