This is a simple known-how for how to enable KASAN on L4.14.98 with i.MX8/8X and also a collection of related patches for fixing issues reported by KASAN.
Enable KASAN:
It's very simple, just enable "CONFIG_KASAN" in kernel configuration.
Besides this, adjusting the kernel's loading address is also required, due to KASAN (which will alloc more memory as a "tracker" for each allocation). For e.g., on imx8qxp MEK, we need to change the kernel loadaddr in uboot:
0x80280000 --> 0xE0280000
through uboot env:
setenv loadaddr 0xE0280000
After this, it supposed to be working.
KASAN related patches on L4.14.98:
KASAN will do detection/sanitizing for any memory allocation/access. In case of L4.14.98 on i.MX8/8X, there're several "BUG" reported by KASAN in default BSP.
The attached patches are a collection for these issues.
Note: not all "BUG" reported by KASAN are really bug. Most of them are just some programming rule related problems and may not really cause memory access violation.