Re: KCSAN Support on ARM64 Kernel

From: Mark Rutland
Date: Thu Dec 12 2019 - 12:27:12 EST


Hi Mukesh,

In future *please* reply in plaintext rather than HTML.

On Thu, Dec 12, 2019 at 04:22:30PM +0000, Mukesh Ojha wrote:
> On 10/14/2019 3:49 PM, Mark Rutland wrote:
> > Once the core kcsan bits are ready, I'll rebase the arm64 patch atop.
> > I'm expecting some things to change as part of review, so it'd be great
> > to see that posted ASAP.
> >
> > For arm64 I'm not expecting major changes (other than those necessary to
> > handle the arm64 atomic rework that went in to v5.4-rc1)
>
> Hi Mark,
>
> Are the below patches enough for kcsan to be working on arm64 ?

That depends on what branch you're using as a base. My arm64/kcsan
branch worked for me as-is, but as I mentioned that was /very/ noisy.
Both the kcsan code and the arm64 code have moved on since then, and I
have no idea how well that would backport.

I had a quick go at porting my arm64 patch atop the kcsan branch in
Paul's tree, and that doesn't get as far as producing earlycon output,
so more work will be necessary to investigate and debug that.

I hope to look at that, but I don't think I'll have the chance to do so
before the end of next week.

> I am not sure about the one you are mentioning about "atomic rework patches
> which went in 5.4 rc1" .

There were a number of patches from Andrew Murray reworking the arm64
atomic implementation. See:

$ git log v5.3..v5.4-rc1 --author='Andrew Murray' -- arch/arm64

With those patches applied, my change to arch/arm64/lib/Makefile is
unnecessary and can be dropped.

Thanks,
Mark.

> 2019-10-03 arm64, kcsan: enable KCSAN for arm64 <https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/commit/?h=arm64/kcsan&id=ae1d089527027ce710e464105a73eb0db27d7875>arm64/kcsan <https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/log/?h=arm64/kcsan>
> Mark Rutland 5 -1/+5
>
>
>
>
>
> 2019-09-24 locking/atomics, kcsan: Add KCSAN instrumentation <https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/commit/?h=arm64/kcsan&id=8b3b76ec443b9af7e55994a163bb6f4aee016f09>
> Marco Elver 2 -2/+199
> 2019-09-24 asm-generic, kcsan: Add KCSAN instrumentation for bitops <https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/commit/?h=arm64/kcsan&id=50c23ad00c040927e71c8943d4eb7d52e9f77762>
> Marco Elver 1 -0/+18
> 2019-09-24 seqlock, kcsan: Add annotations for KCSAN <https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/commit/?h=arm64/kcsan&id=e2b32e1a3b397bffcb6afbe86f6fe55e2040a34a>
> Marco Elver 1 -5/+42
> 2019-09-24 build, kcsan: Add KCSAN build exceptions <https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/commit/?h=arm64/kcsan&id=35a907033244099a71f17d28e9ffaca92f714463>
> Marco Elver 3 -0/+17
> 2019-09-24 objtool, kcsan: Add KCSAN runtime functions to whitelist <https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/commit/?h=arm64/kcsan&id=3afc592ca7ebd9c13c939c98b995763345e85e08>
> Marco Elver 1 -0/+17
> 2019-09-24 kcsan: Add Kernel Concurrency Sanitizer infrastructure <https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/commit/?h=arm64/kcsan&id=73d893b441dc3e5c1645884a19b46a1bfd4fd692>
> Marco Elver
>