diff --git a/arch/sandbox/os/Makefile b/arch/sandbox/os/Makefile index df6d597..28ecc09 100644 --- a/arch/sandbox/os/Makefile +++ b/arch/sandbox/os/Makefile @@ -6,6 +6,10 @@ KBUILD_CPPFLAGS += -DCONFIG_MALLOC_SIZE=$(CONFIG_MALLOC_SIZE) +ifeq ($(CONFIG_KASAN),y) +KBUILD_CPPFLAGS += -DCONFIG_KASAN=1 +endif + KBUILD_CFLAGS += -Wall NOSTDINC_FLAGS := diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c index 534571c..69fadb3 100644 --- a/arch/sandbox/os/common.c +++ b/arch/sandbox/os/common.c @@ -44,6 +44,8 @@ #include #include +void __sanitizer_set_death_callback(void (*callback)(void)); + int sdl_xres; int sdl_yres; @@ -345,6 +347,10 @@ int fdno = 0, envno = 0, option_index = 0; char *aux; +#ifdef CONFIG_KASAN + __sanitizer_set_death_callback(cookmode); +#endif + while (1) { option_index = 0; opt = getopt_long(argc, argv, optstring,