mbox series

[0/3] KASAN support for 64-bit Book 3S powerpc

Message ID Yntk7oERGce44+Sd@cleo (mailing list archive)
Headers show
Series KASAN support for 64-bit Book 3S powerpc | expand

Message

Paul Mackerras May 11, 2022, 7:25 a.m. UTC
This patch series implements KASAN on 64-bit POWER with radix MMU,
such as POWER9 or POWER10.  Daniel Axtens posted previous versions of
these patches, but is no longer working on KASAN, and I have been
asked to get them ready for inclusion.

Because of various technical difficulties, mostly around the need to
allow for code that runs in real mode, we only support "outline" mode
(as opposed to "inline" mode), where the compiler adds a call to
a checking procedure before every store to memory.

The main patch is still marked [RFC] because of known deficiencies,
specifically that the kernel will crash on boot on a HPT system, and
that out-of-bounds accesses to module global data are not caught
(which leads to one of the KASAN tests failing).

Comments welcome.  I may not have addressed all the comments about
previous versions of these patches; if so, then please just repeat
your comments.

Paul.

 Documentation/dev-tools/kasan.rst                  |   7 +-
 Documentation/powerpc/kasan.txt                    |  58 ++++++++++++
 arch/powerpc/Kconfig                               |   5 +-
 arch/powerpc/Kconfig.debug                         |   3 +-
 arch/powerpc/include/asm/book3s/64/hash.h          |   4 +
 arch/powerpc/include/asm/book3s/64/pgtable.h       |   3 +
 arch/powerpc/include/asm/book3s/64/radix.h         |  13 ++-
 arch/powerpc/include/asm/interrupt.h               |  52 ++++++++---
 arch/powerpc/include/asm/kasan.h                   |  22 +++++
 arch/powerpc/include/asm/ptrace.h                  |   6 --
 arch/powerpc/kernel/Makefile                       |  11 +++
 arch/powerpc/kernel/process.c                      |  16 ++--
 arch/powerpc/kernel/smp.c                          |  22 ++---
 arch/powerpc/kernel/traps.c                        |   6 +-
 arch/powerpc/kexec/Makefile                        |   2 +
 arch/powerpc/kvm/Makefile                          |   5 +
 arch/powerpc/lib/Makefile                          |   3 +
 arch/powerpc/mm/book3s64/Makefile                  |   9 ++
 arch/powerpc/mm/kasan/Makefile                     |   3 +-
 .../mm/kasan/{kasan_init_32.c => init_32.c}        |   0
 arch/powerpc/mm/kasan/init_book3s_64.c             | 103 +++++++++++++++++++++
 arch/powerpc/mm/ptdump/ptdump.c                    |   3 +-
 arch/powerpc/platforms/Kconfig.cputype             |   1 +
 arch/powerpc/platforms/powernv/Makefile            |   8 ++
 arch/powerpc/platforms/powernv/smp.c               |   2 +-
 arch/powerpc/platforms/pseries/Makefile            |   6 ++
 arch/powerpc/sysdev/xics/xics-common.c             |   4 +-
 arch/powerpc/sysdev/xive/common.c                  |   4 +-
 28 files changed, 330 insertions(+), 51 deletions(-)

Comments

Christophe Leroy May 15, 2022, 7:59 a.m. UTC | #1
Le 11/05/2022 à 09:25, Paul Mackerras a écrit :
> [Vous ne recevez pas souvent de courriers de la part de paulus@ozlabs.org. D?couvrez pourquoi cela peut ?tre important ? l'adresse https://aka.ms/LearnAboutSenderIdentification.]
> 
> This patch series implements KASAN on 64-bit POWER with radix MMU,
> such as POWER9 or POWER10.  Daniel Axtens posted previous versions of
> these patches, but is no longer working on KASAN, and I have been
> asked to get them ready for inclusion.
> 
> Because of various technical difficulties, mostly around the need to
> allow for code that runs in real mode, we only support "outline" mode
> (as opposed to "inline" mode), where the compiler adds a call to
> a checking procedure before every store to memory.
> 
> The main patch is still marked [RFC] because of known deficiencies,
> specifically that the kernel will crash on boot on a HPT system, and
> that out-of-bounds accesses to module global data are not caught
> (which leads to one of the KASAN tests failing).
> 
> Comments welcome.  I may not have addressed all the comments about
> previous versions of these patches; if so, then please just repeat
> your comments.

Last patch is quite big. I think it would be worth splitting in several 
patches. A made a few suggestions while reviewing it. I think it could 
also be worth putting all the adding of no_instr and KASAN_SANITIZE := n 
in a preparatory patch.

Also, your last patch includes v1 of "powerpc: make stack walking 
KASAN-safe" 
(https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20210528074806.1311297-1-dja@axtens.net/) 
while v2 was merged 
(https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20210614120907.1952321-1-dja@axtens.net/)

Christophe