[PATCH v6 03/18] khwasan: add CONFIG_KASAN_GENERIC and CONFIG_KASAN_HW
From: Andrey Konovalov <hidden>
Date: 2018-09-17 18:42:41
Also in:
linux-doc, linux-kbuild, linux-mm, lkml
On Wed, Sep 12, 2018 at 4:47 PM, Dmitry Vyukov [off-list ref] wrote:
On Wed, Aug 29, 2018 at 1:35 PM, Andrey Konovalov [off-list ref] wrote:
quoted
#define __no_sanitize_address __attribute__((no_sanitize("address"))) +#define __no_sanitize_hwaddress __attribute__((no_sanitize("hwaddress")))It seems that it would be better to have just 1 attribute for both types. Currently __no_sanitize_address is used just in a single place. But if it ever used more, people will need to always spell both which looks unnecessary, or, worse will only fix asan but forget about khwasan. If we do just: #define __no_sanitize_address __attribute__((no_sanitize("address", "hwaddress"))) Then we don't need any changes in compiler-gcc.h nor in compiler.h, and no chance or forgetting one of them.
Will do in v7.
quoted
config KASAN - bool "KASan: runtime memory debugger" + bool "KASAN: runtime memory debugger" + help + Enables KASAN (KernelAddressSANitizer) - runtime memory debugger, + designed to find out-of-bounds accesses and use-after-free bugs.Perhaps also give link to Documentation/dev-tools/kasan.rst while we are here.
Will do in v7.
quoted
+ +choice + prompt "KASAN mode" + depends on KASAN + default KASAN_GENERIC + help + KASAN has two modes: KASAN (a classic version, similar to userspaceIn these few sentences we call the old mode with 3 different terms: "generic", "classic" and "KASAN" :) This is somewhat confusing. Let's call it "generic" throughout (here and in the docs patch). "Generic" as in "supported on multiple arch and not-dependent on hardware features". "Classic" makes sense for people who knew KASAN before, but for future readers in won't make sense.
Will use "generic" in v7.
quoted
+if HAVE_ARCH_KASAN_HWThis choice looks somewhat weird on non-arm64. It's kinda a choice menu, but one can't really choose anything. Should we put the whole choice under HAVE_ARCH_KASAN_HW, and just select KASAN_GENERIC otherwise? I don't know what't the practice here. Andrey R?
I think having one option that is auto selected is fine.
quoted
+config KASAN_HW + bool "KHWASAN: the hardware assisted mode"
Do we need a hyphen here? hardware-assisted? Yes, will fix in v7.