Re: [PATCH v2 8/8] x86, kcsan: Enable KCSAN for x86

From: Mark Rutland
Date: Tue Oct 22 2019 - 08:59:52 EST


On Thu, Oct 17, 2019 at 04:13:05PM +0200, Marco Elver wrote:
> This patch enables KCSAN for x86, with updates to build rules to not use
> KCSAN for several incompatible compilation units.
>
> Signed-off-by: Marco Elver <elver@xxxxxxxxxx>
> ---
> v2:
> * Document build exceptions where no previous above comment explained
> why we cannot instrument.
> ---
> arch/x86/Kconfig | 1 +
> arch/x86/boot/Makefile | 2 ++
> arch/x86/boot/compressed/Makefile | 2 ++
> arch/x86/entry/vdso/Makefile | 3 +++
> arch/x86/include/asm/bitops.h | 6 +++++-
> arch/x86/kernel/Makefile | 7 +++++++
> arch/x86/kernel/cpu/Makefile | 3 +++
> arch/x86/lib/Makefile | 4 ++++
> arch/x86/mm/Makefile | 3 +++
> arch/x86/purgatory/Makefile | 2 ++
> arch/x86/realmode/Makefile | 3 +++
> arch/x86/realmode/rm/Makefile | 3 +++
> drivers/firmware/efi/libstub/Makefile | 2 ++
> 13 files changed, 40 insertions(+), 1 deletion(-)

> diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
> index 0460c7581220..693d0a94b118 100644
> --- a/drivers/firmware/efi/libstub/Makefile
> +++ b/drivers/firmware/efi/libstub/Makefile
> @@ -31,7 +31,9 @@ KBUILD_CFLAGS := $(cflags-y) -DDISABLE_BRANCH_PROFILING \
> -D__DISABLE_EXPORTS
>
> GCOV_PROFILE := n
> +# Sanitizer runtimes are unavailable and cannot be linked here.
> KASAN_SANITIZE := n
> +KCSAN_SANITIZE := n
> UBSAN_SANITIZE := n
> OBJECT_FILES_NON_STANDARD := y

Not a big deal, but it might make sense to move the EFI stub exception
to patch 3 since it isn't x86 specific (and will also apply for arm64).

Otherwise this looks good to me.

Thanks,
Mark.