mbox series

[GIT,PULL] KASan for Arm, v12

Message ID CACRpkdYbbtJFcAugz6rBMHNihz3pnY9O4mVzwLsFY_CjBb9K=A@mail.gmail.com
State New
Headers show
Series [GIT,PULL] KASan for Arm, v12 | expand

Pull-request

git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-integrator.git tags/kasan-for-rmk

Message

Linus Walleij July 20, 2020, 9:40 a.m. UTC
Hi Russell,

please consider pulling in these changes to bring KASan
support to Arm.

Certainly there will be bugs like with all new code, but I
think we are in such good shape that in-tree development
is the best way to go from now so that interested people
can test this out.

I have tested it extensively on classic MMUs from ARMv4
to ARMv7 and also on LPAE. But now I need the help of
linux-next and the broader community to iron out any
remaining corner cases.

I will of course respect a "no" but then some direction would
be sweet. I could for example ask linux-next to include
this branch separately from v5.9-rc1 or so to get some
coverage.

Thanks!
Linus Walleij

The following changes since commit b3a9e3b9622ae10064826dccb4f7a52bd88c7407:

  Linux 5.8-rc1 (2020-06-14 12:45:04 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-integrator.git
tags/kasan-for-rmk

for you to fetch changes up to 5ebcc6d74e3b7791e3b1c3411a62d216fc5c5230:

  ARM: Enable KASan for ARM (2020-07-20 11:29:31 +0200)

----------------------------------------------------------------
KASan support for ARM, the v12 patch series.

----------------------------------------------------------------
Abbott Liu (1):
      ARM: Define the virtual space of KASan's shadow region

Andrey Ryabinin (3):
      ARM: Disable KASan instrumentation for some code
      ARM: Replace string mem* functions for KASan
      ARM: Enable KASan for ARM

Linus Walleij (1):
      ARM: Initialize the mapping of KASan shadow memory

 Documentation/arm/memory.rst                       |   5 +
 Documentation/dev-tools/kasan.rst                  |   4 +-
 .../features/debug/KASAN/arch-support.txt          |   2 +-
 arch/arm/Kconfig                                   |  10 +
 arch/arm/boot/compressed/Makefile                  |   1 +
 arch/arm/boot/compressed/string.c                  |  19 ++
 arch/arm/include/asm/kasan.h                       |  32 +++
 arch/arm/include/asm/kasan_def.h                   |  81 +++++++
 arch/arm/include/asm/memory.h                      |   5 +
 arch/arm/include/asm/pgalloc.h                     |   8 +-
 arch/arm/include/asm/string.h                      |  21 ++
 arch/arm/include/asm/thread_info.h                 |   8 +
 arch/arm/include/asm/uaccess-asm.h                 |   2 +-
 arch/arm/kernel/entry-armv.S                       |   3 +-
 arch/arm/kernel/entry-common.S                     |   9 +-
 arch/arm/kernel/head-common.S                      |   7 +-
 arch/arm/kernel/setup.c                            |   2 +
 arch/arm/kernel/unwind.c                           |   6 +-
 arch/arm/lib/memcpy.S                              |   3 +
 arch/arm/lib/memmove.S                             |   5 +-
 arch/arm/lib/memset.S                              |   3 +
 arch/arm/mm/Makefile                               |   5 +
 arch/arm/mm/kasan_init.c                           | 264 +++++++++++++++++++++
 arch/arm/mm/mmu.c                                  |  18 ++
 arch/arm/mm/pgd.c                                  |  16 +-
 arch/arm/vdso/Makefile                             |   2 +
 26 files changed, 527 insertions(+), 14 deletions(-)
 create mode 100644 arch/arm/include/asm/kasan.h
 create mode 100644 arch/arm/include/asm/kasan_def.h
 create mode 100644 arch/arm/mm/kasan_init.c

Comments

Florian Fainelli July 20, 2020, 6:01 p.m. UTC | #1
Hi Linus,

On 7/20/20 2:40 AM, Linus Walleij wrote:
> Hi Russell,
> 
> please consider pulling in these changes to bring KASan
> support to Arm.
> 
> Certainly there will be bugs like with all new code, but I
> think we are in such good shape that in-tree development
> is the best way to go from now so that interested people
> can test this out.
> 
> I have tested it extensively on classic MMUs from ARMv4
> to ARMv7 and also on LPAE. But now I need the help of
> linux-next and the broader community to iron out any
> remaining corner cases.
> 
> I will of course respect a "no" but then some direction would
> be sweet. I could for example ask linux-next to include
> this branch separately from v5.9-rc1 or so to get some
> coverage.

I am still seeing crashes similar to the ones reported before with this
pull request, but maybe we can get it merged and address it later on
since this has been waiting forever to be merged.
Linus Walleij July 21, 2020, 7:36 a.m. UTC | #2
On Mon, Jul 20, 2020 at 8:01 PM Florian Fainelli <f.fainelli@gmail.com> wrote:

> I am still seeing crashes similar to the ones reported before with this
> pull request, but maybe we can get it merged and address it later on
> since this has been waiting forever to be merged.

We definitely need it fixed, my current working assumption is that at
least some of it is a result of the kernel growing big as a result of
enabling KASan.

Can you try to inspect the early memblock.memory.regions[0]
mapping debug prints as I pointed out here:
https://lore.kernel.org/linux-arm-kernel/CACRpkdYoMiVtnQEUiXy3Ezf3Z0dEQSVyA-9emDeewRKwonoUHQ@mail.gmail.com/#t

On the APQ8060 it seems the first memblock does not fit the
kernel+attached devicetree and the devicetree ends up in the
unmapped memory that is cleared by prepare_page_table()
but the Broadcom problem may be another one altogether.

Yours,
Linus Walleij