Re: [RFC PATCH 2/2] KUnit: KASAN Integration

From: Dmitry Vyukov
Date: Thu Feb 27 2020 - 09:45:27 EST


On Thu, Feb 27, 2020 at 3:44 AM 'Patricia Alfonso' via kasan-dev
<kasan-dev@xxxxxxxxxxxxxxxx> wrote:
>
> Integrate KASAN into KUnit testing framework.
> - Fail tests when KASAN reports an error that is not expected
> - Use KUNIT_EXPECT_KASAN_FAIL to expect a KASAN error in KASAN tests
> - KUnit struct added to current task to keep track of the current test
> from KASAN code
> - Booleans representing if a KASAN report is expected and if a KASAN
> report is found added to kunit struct
> - This prints "line# has passed" or "line# has failed"
>
> Signed-off-by: Patricia Alfonso <trishalfonso@xxxxxxxxxx>

This does not build for me:

$ make
scripts/kconfig/conf --syncconfig Kconfig
CC arch/x86/kernel/asm-offsets.s
UPD include/generated/asm-offsets.h
CALL scripts/checksyscalls.sh
CALL scripts/atomic/check-atomics.sh
DESCEND objtool
CC init/main.o
In file included from ./include/linux/uaccess.h:11,
from ./arch/x86/include/asm/fpu/xstate.h:5,
from ./arch/x86/include/asm/pgtable.h:26,
from ./include/linux/kasan.h:15,
from ./include/linux/slab.h:136,
from ./include/kunit/test.h:16,
from ./include/linux/sched.h:35,
from ./include/linux/ioprio.h:5,
from ./include/linux/fs.h:39,
from ./include/linux/proc_fs.h:9,
from init/main.c:18:
./arch/x86/include/asm/uaccess.h: In function âset_fsâ:
./arch/x86/include/asm/uaccess.h:31:9: error: dereferencing pointer to
incomplete type âstruct task_structâ
31 | current->thread.addr_limit = fs;
| ^~
make[1]: *** [scripts/Makefile.build:268: init/main.o] Error 1
make: *** [Makefile:1681: init] Error 2


On bfdc6d91a25f4545bcd1b12e3219af4838142ef1 config:
https://pastebin.com/raw/nwnL2N9w