[PATCH v7 6/7] ARM: Initialize the mapping of KASan shadow memory

2020-01-17 Thread Florian Fainelli
From: Andrey Ryabinin This patch initializes KASan shadow region's page table and memory. There are two stage for KASan initializing: 1. At early boot stage the whole shadow region is mapped to just one physical page (kasan_zero_page). It is finished by the function kasan_early_init which

[PATCH v7 7/7] ARM: Enable KASan for ARM

2020-01-17 Thread Florian Fainelli
From: Andrey Ryabinin This patch enables the kernel address sanitizer for ARM. XIP_KERNEL has not been tested and is therefore not allowed. Acked-by: Dmitry Vyukov Tested-by: Linus Walleij Signed-off-by: Abbott Liu Signed-off-by: Florian Fainelli --- Documentation/dev-tools/kasan.rst |

[PATCH v7 2/7] ARM: Add TTBR operator for kasan_init

2020-01-17 Thread Florian Fainelli
From: Abbott Liu The purpose of this patch is to provide set_ttbr0/get_ttbr0 to kasan_init function. This makes use of the CP15 definitions added in the previous patch. Cc: Andrey Ryabinin Reported-by: Marc Zyngier Tested-by: Linus Walleij Signed-off-by: Abbott Liu Signed-off-by: Florian

[PATCH v7 5/7] ARM: Define the virtual space of KASan's shadow region

2020-01-17 Thread Florian Fainelli
From: Abbott Liu Define KASAN_SHADOW_OFFSET,KASAN_SHADOW_START and KASAN_SHADOW_END for arm kernel address sanitizer. ++ 0x || || || ++ CONFIG_PAGE_OFFSET || || |-> module virtual address space area. ||/ ++

[PATCH v7 4/7] ARM: Replace memory function for kasan

2020-01-17 Thread Florian Fainelli
From: Andrey Ryabinin Functions like memset/memmove/memcpy do a lot of memory accesses. If a bad pointer pis assed to one of these function it is important to catch this. Compiler instrumentation cannot do this since these functions are written in assembly. KASan replaces memory functions with

[PATCH v7 3/7] ARM: Disable instrumentation for some code

2020-01-17 Thread Florian Fainelli
From: Andrey Ryabinin Disable instrumentation for arch/arm/boot/compressed/* and arch/arm/vdso/* because that code would not linkd with kernel image. Disable instrumentation for arch/arm/kvm/hyp/*. See commit a6cdf1c08cbf ("kvm: arm64: Disable compiler instrumentation for hypervisor code") for

[PATCH v7 1/7] ARM: Moved CP15 definitions from kvm_hyp.h to cp15.h

2020-01-17 Thread Florian Fainelli
We are going to add specific accessor functions for TTBR which are 32-bit/64-bit appropriate, move all CP15 register definitions into cp15.h where they belong. Suggested-by: Linus Walleij Tested-by: Linus Walleij Signed-off-by: Florian Fainelli --- arch/arm/include/asm/cp15.h| 57

[PATCH v7 0/7] KASan for arm

2020-01-17 Thread Florian Fainelli
Hi all, Abbott submitted a v5 about a year ago here: and the series was not picked up since then, so I rebased it against v5.2-rc4 and re-tested it on a Brahma-B53 (ARMv8 running AArch32 mode) and Brahma-B15, both LPAE and test-kasan is consistent with the ARM64 counter part. We were in a

Re: [PATCH v6 0/6] KASan for arm

2020-01-17 Thread Linus Walleij
On Fri, Jan 17, 2020 at 8:55 PM Florian Fainelli wrote: > [Me] > > Can we start to submit these patches to Russell's patch tracker? > > Any more testing I should be doing? > > Let me submit and rebase v7 get the auto builders some days to see if it > exposes a new build issue and then we toss it

Re: [PATCH v6 0/6] KASan for arm

2020-01-17 Thread Florian Fainelli
On 1/17/20 2:13 AM, Linus Walleij wrote: > On Tue, Nov 19, 2019 at 1:14 AM Florian Fainelli wrote: >> On 11/15/19 3:44 AM, Marco Felsch wrote: >>> >>> With your v7 it is working on my imx6 but unfortunately I can't run my >>> gstreamer testcase. My CPU load goes to 100% after starting gstreamer

Re: [PATCH v6 0/6] KASan for arm

2020-01-17 Thread Linus Walleij
On Tue, Nov 19, 2019 at 1:14 AM Florian Fainelli wrote: > On 11/15/19 3:44 AM, Marco Felsch wrote: > > > > With your v7 it is working on my imx6 but unfortunately I can't run my > > gstreamer testcase. My CPU load goes to 100% after starting gstreamer > > and nothing happens.. But the test_kasan