Skip to content

powerpc: KASAN for 64-bit Book3S on Radix

Daniel Axtens linuxppc-dev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 12 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4kasan: allow arches to provide their own early shadow setupinclude/linux/kasan.h lib/Kconfig.kasan mm/kasan/init.c+15 -03 replies
2/4kasan: support instrumented bitops with generic non-atomic bitopsinclude/asm-generic/bitops-instrumented.h+76 -681 reply
3/4powerpc: support KASAN instrumentation of bitopsarch/powerpc/include/asm/bitops.h+14 -111 reply
4/4powerpc: Book3S 64-bit "heavyweight" KASAN supportDocumentation/dev-tools/kasan.rst Documentation/powerpc/kasan.txt arch/powerpc/Kconfig +8 more+326 -65 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] powerpc: KASAN for 64-bit Book3S on Radix

Building on the work of Christophe, Aneesh and Balbir, I've ported KASAN to 64-bit Book3S kernels running on the Radix MMU.

It builds on top Christophe's work on 32bit. It also builds on my generic KASAN_VMALLOC series, available at:
https://patchwork.kernel.org/project/linux-mm/list/?series=153209

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 4.

Notable changes from the RFC:

- I've dropped Book3E 64-bit for now.

- Now instead of hacking into the KASAN core to disable module allocations, we use KASAN_VMALLOC.

- More testing, including on real hardware. This revealed that discontiguous memory is a bit of a headache, at the moment we must disable memory not contiguous from 0.

- Update to deal with kasan bitops instrumentation that landed between RFC and now.

- Documentation!

- Various cleanups and tweaks.

I am getting occasional problems on boot of real hardware where it seems vmalloc space mappings don't get installed in time. (We get a BUG that memory is not accessible, but by the time we hit xmon the memory then is accessible!) It happens once every few boots. I haven't yet been able to figure out what is happening and why. I'm going to look in to it, but I think the patches are in good enough shape to review while I work on it.

Regards,
Daniel

Daniel Axtens (4):
kasan: allow arches to provide their own early shadow setup
kasan: support instrumented bitops with generic non-atomic bitops
powerpc: support KASAN instrumentation of bitops
powerpc: Book3S 64-bit "heavyweight" KASAN support

 Documentation/dev-tools/kasan.rst            |   7 +-
 Documentation/powerpc/kasan.txt              | 111 ++++++++++++++
 arch/powerpc/Kconfig                         |   4 +
 arch/powerpc/Kconfig.debug                   |  21 +++
 arch/powerpc/Makefile                        |   7 +
 arch/powerpc/include/asm/bitops.h            |  25 ++--
 arch/powerpc/include/asm/book3s/64/radix.h   |   5 +
 arch/powerpc/include/asm/kasan.h             |  35 ++++-
 arch/powerpc/kernel/process.c                |   8 ++
 arch/powerpc/kernel/prom.c                   |  57 +++++++-
 arch/powerpc/mm/kasan/Makefile               |   1 +
 arch/powerpc/mm/kasan/kasan_init_book3s_64.c |  76 ++++++++++
 include/asm-generic/bitops-instrumented.h    | 144 ++++++++++---------
 include/linux/kasan.h                        |   2 +
 lib/Kconfig.kasan                            |   3 +
 mm/kasan/init.c                              |  10 ++
 16 files changed, 431 insertions(+), 85 deletions(-)
 create mode 100644 Documentation/powerpc/kasan.txt
 create mode 100644 arch/powerpc/mm/kasan/kasan_init_book3s_64.c
Signature · 1 line
2.20.1