# Re: \[PATCH v4 1/7\] kcsan: Add atomic builtin stubs for 32-bit systems

- From: Max Filippov \<jcmvbkbc@gmail.com\>
- Date: 2023-02-08 04:24:56 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2023/02/9529978
- Thread: https://ratatoskr.run/linuxppc-dev/2023/02/9529969/t.md

```text
On Tue, Feb 7, 2023 at 7:22 PM Rohan McLure [ref] wrote:
>
> KCSAN instruments calls to atomic builtins, and will in turn call these
> builtins itself. As such, architectures supporting KCSAN must have
> compiler support for these atomic primitives.
>
> Since 32-bit systems are unlikely to have 64-bit compiler builtins,
> provide a stub for each missing builtin, and use BUG() to assert
> unreachability.
>
> In commit 725aea873261 ("xtensa: enable KCSAN"), xtensa implements these
> locally, but does not advertise the fact with preprocessor macros. To
> avoid production of duplicate symbols, do not build the stubs on xtensa.
> A future patch will remove the xtensa implementation of these stubs.
>
> Signed-off-by: Rohan McLure <redacted>
> ---
> v4: New patch
> ---
>  kernel/kcsan/Makefile |  3 ++
>  kernel/kcsan/stubs.c  | 78 +++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 81 insertions(+)
>  create mode 100644 kernel/kcsan/stubs.c

Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>

-- 
Thanks.
-- Max
```
