All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joey Gouly <joey.gouly@arm.com>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Marco Elver <elver@google.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, mark.rutland@arm.com, nd@arm.com
Subject: Re: [PATCH v3] arm64: Enable KCSAN
Date: Thu, 2 Dec 2021 16:13:10 +0000	[thread overview]
Message-ID: <20211202161310.GA27207@e124191.cambridge.arm.com> (raw)
In-Reply-To: <20211202143331.15259-1-wangkefeng.wang@huawei.com>

Hi all,

On Thu, Dec 02, 2021 at 10:33:31PM +0800, Kefeng Wang wrote:
> This patch enables KCSAN for arm64, with updates to build rules
> to not use KCSAN for several incompatible compilation units.
> 
> Resent GCC version(at least GCC10) made outline-atomics as the
> default option(unlike Clang), which will cause linker errors
> for kernel/kcsan/core.o. Disables the out-of-line atomics by
> no-outline-atomics to fix the linker errors.
> 
> Meanwhile, as Mark said[1], there is a specific issue on arm64
> about ARM64_BTI with Clang 11 if KCSAN enabled, which is fixed
> by Clang 12, add CLANG_VERSION check. And also some latent issues
> are need to be fixed which isn't just a KCSAN problem, we make
> the KCSAN depends on EXPERT for now.
> 
> Tested selftest and kcsan_test(built with GCC11 and Clang 13),
> and all passed.
> 
> [1] https://lkml.org/lkml/2021/12/1/354
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>

Confirming that I get KCSAN errors such as:

[  285.188576] ==================================================================
[  285.189514] BUG: KCSAN: data-race in el0_svc_common.constprop.0+0x84/0x14c
[  285.190599]
[  285.191092] race at unknown origin, with read to 0xffff0000e3ce3700 of 8 bytes by task 19946 on cpu 5:
[  285.192576]  el0_svc_common.constprop.0+0x84/0x14c
[  285.193601]  do_el0_svc+0x30/0x40
[  285.194457]  el0_svc+0x3c/0x70
[  285.194954]  el0t_64_sync_handler+0x9c/0x120
[  285.195618]  el0t_64_sync+0x18c/0x190
[  285.196371]
[  285.196823] value changed: 0x0000000000000008 -> 0x000000000000000a
[  285.197674]
[  285.198172] Reported by Kernel Concurrency Sanitizer on:
[  285.198941] CPU: 5 PID: 19946 Comm: stress-ng Not tainted 5.16.0-rc3+ #842 95517f70e70f029451088b9dec0b9074aa29ae52
[  285.201191] ==================================================================

This particular case is fixed by Mark's thread flag series [1], which is in linux-next now.

Tested with gcc 11 and clang 14.0 (built from git) on qemu and FVP.

Tested-by: Joey Gouly <joey.gouly@arm.com>

Thanks,
Joey

[1] https://lore.kernel.org/lkml/20211129130653.2037928-1-mark.rutland@arm.com/

WARNING: multiple messages have this Message-ID (diff)
From: Joey Gouly <joey.gouly@arm.com>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Marco Elver <elver@google.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, mark.rutland@arm.com, nd@arm.com
Subject: Re: [PATCH v3] arm64: Enable KCSAN
Date: Thu, 2 Dec 2021 16:13:10 +0000	[thread overview]
Message-ID: <20211202161310.GA27207@e124191.cambridge.arm.com> (raw)
In-Reply-To: <20211202143331.15259-1-wangkefeng.wang@huawei.com>

Hi all,

On Thu, Dec 02, 2021 at 10:33:31PM +0800, Kefeng Wang wrote:
> This patch enables KCSAN for arm64, with updates to build rules
> to not use KCSAN for several incompatible compilation units.
> 
> Resent GCC version(at least GCC10) made outline-atomics as the
> default option(unlike Clang), which will cause linker errors
> for kernel/kcsan/core.o. Disables the out-of-line atomics by
> no-outline-atomics to fix the linker errors.
> 
> Meanwhile, as Mark said[1], there is a specific issue on arm64
> about ARM64_BTI with Clang 11 if KCSAN enabled, which is fixed
> by Clang 12, add CLANG_VERSION check. And also some latent issues
> are need to be fixed which isn't just a KCSAN problem, we make
> the KCSAN depends on EXPERT for now.
> 
> Tested selftest and kcsan_test(built with GCC11 and Clang 13),
> and all passed.
> 
> [1] https://lkml.org/lkml/2021/12/1/354
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>

Confirming that I get KCSAN errors such as:

[  285.188576] ==================================================================
[  285.189514] BUG: KCSAN: data-race in el0_svc_common.constprop.0+0x84/0x14c
[  285.190599]
[  285.191092] race at unknown origin, with read to 0xffff0000e3ce3700 of 8 bytes by task 19946 on cpu 5:
[  285.192576]  el0_svc_common.constprop.0+0x84/0x14c
[  285.193601]  do_el0_svc+0x30/0x40
[  285.194457]  el0_svc+0x3c/0x70
[  285.194954]  el0t_64_sync_handler+0x9c/0x120
[  285.195618]  el0t_64_sync+0x18c/0x190
[  285.196371]
[  285.196823] value changed: 0x0000000000000008 -> 0x000000000000000a
[  285.197674]
[  285.198172] Reported by Kernel Concurrency Sanitizer on:
[  285.198941] CPU: 5 PID: 19946 Comm: stress-ng Not tainted 5.16.0-rc3+ #842 95517f70e70f029451088b9dec0b9074aa29ae52
[  285.201191] ==================================================================

This particular case is fixed by Mark's thread flag series [1], which is in linux-next now.

Tested with gcc 11 and clang 14.0 (built from git) on qemu and FVP.

Tested-by: Joey Gouly <joey.gouly@arm.com>

Thanks,
Joey

[1] https://lore.kernel.org/lkml/20211129130653.2037928-1-mark.rutland@arm.com/

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-12-02 16:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-02 14:33 [PATCH v3] arm64: Enable KCSAN Kefeng Wang
2021-12-02 14:33 ` Kefeng Wang
2021-12-02 14:36 ` Marco Elver
2021-12-02 14:36   ` Marco Elver
2021-12-02 14:44   ` Mark Rutland
2021-12-02 14:44     ` Mark Rutland
2021-12-03  2:29     ` Kefeng Wang
2021-12-03  2:29       ` Kefeng Wang
2021-12-03 10:41       ` Mark Rutland
2021-12-03 10:41         ` Mark Rutland
2021-12-10  6:58         ` Kefeng Wang
2021-12-10  6:58           ` Kefeng Wang
2021-12-02 16:13 ` Joey Gouly [this message]
2021-12-02 16:13   ` Joey Gouly
2021-12-02 16:56 ` Nathan Chancellor
2021-12-02 16:56   ` Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211202161310.GA27207@e124191.cambridge.arm.com \
    --to=joey.gouly@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=elver@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=nd@arm.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.