linux/Documentation/dev-tools
Qing Zhang 5aa4ac64e6 LoongArch: Add KASAN (Kernel Address Sanitizer) support
1/8 of kernel addresses reserved for shadow memory. But for LoongArch,
There are a lot of holes between different segments and valid address
space (256T available) is insufficient to map all these segments to kasan
shadow memory with the common formula provided by kasan core, saying
(addr >> KASAN_SHADOW_SCALE_SHIFT) + KASAN_SHADOW_OFFSET

So LoongArch has a arch-specific mapping formula, different segments are
mapped individually, and only limited space lengths of these specific
segments are mapped to shadow.

At early boot stage the whole shadow region populated with just one
physical page (kasan_early_shadow_page). Later, this page is reused as
readonly zero shadow for some memory that kasan currently don't track.
After mapping the physical memory, pages for shadow memory are allocated
and mapped.

Functions like memset()/memcpy()/memmove() do a lot of memory accesses.
If bad pointer passed to one of these function it is important to be
caught. Compiler's instrumentation cannot do this since these functions
are written in assembly.

KASan replaces memory functions with manually instrumented variants.
Original functions declared as weak symbols so strong definitions in
mm/kasan/kasan.c could replace them. Original functions have aliases
with '__' prefix in names, so we could call non-instrumented variant
if needed.

Signed-off-by: Qing Zhang <zhangqing@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2023-09-06 22:54:16 +08:00
..
kunit Documentation: kunit: Rename references to kunit_abort() 2023-06-06 08:57:37 -06:00
checkpatch.rst checkpatch: warn for non-standard fixes tag style 2022-10-03 14:21:44 -07:00
coccinelle.rst Documentation: coccinelle: Escape --options to fix Sphinx output 2023-01-31 13:55:44 -07:00
gcov.rst docs/gcov: Convert two tags to ref in dev-tools/gov.rst 2021-04-08 11:19:43 -06:00
gdb-kernel-debugging.rst docs/scripts/gdb: add necessary make scripts_gdb step 2023-01-26 11:21:05 -07:00
index.rst kmsan: add ReST documentation 2022-10-03 14:03:18 -07:00
kasan.rst LoongArch: Add KASAN (Kernel Address Sanitizer) support 2023-09-06 22:54:16 +08:00
kcov.rst kcov: improve documentation 2023-04-08 13:45:36 -07:00
kcsan.rst kcsan: Document modeling of weak memory 2021-12-09 16:42:27 -08:00
kfence.rst kfence: allow use of a deferrable timer 2022-03-22 15:57:11 -07:00
kgdb.rst Documentation: kgdb: Replace deprecated remotebaud 2022-01-07 09:33:13 -07:00
kmemleak.rst docs: kmemleak: adjust to config renaming 2023-04-20 17:53:38 -06:00
kmsan.rst docs: kmsan: fix formatting of "Example report" 2022-11-08 15:57:25 -08:00
kselftest.rst - Yosry Ahmed brought back some cgroup v1 stats in OOM logs. 2023-06-28 10:28:11 -07:00
ktap.rst Documentation: dev-tools: Clarify requirements for result description 2022-12-12 14:13:48 -07:00
sparse.rst Documentation/sparse: add hints about __CHECKER__ 2022-03-23 19:00:33 -07:00
testing-overview.rst Documentation: dev-tools: Enhance static analysis section with discussion 2022-04-05 09:48:25 -06:00
ubsan.rst ubsan: remove UBSAN_MISC in favor of individual options 2020-12-15 22:46:19 -08:00