kasan: Extract kasan's kconfig separately
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
This commit is contained in:
parent
299136bdc7
commit
9b4cd4e0a4
2 changed files with 124 additions and 118 deletions
119
mm/Kconfig
119
mm/Kconfig
|
|
@ -318,124 +318,7 @@ config FS_PROCFS_EXCLUDE_MEMPOOL
|
|||
default DEFAULT_SMALL
|
||||
depends on FS_PROCFS && MM_HEAP_MEMPOOL_THRESHOLD > 0
|
||||
|
||||
config MM_KASAN
|
||||
bool "Kernel Address Sanitizer"
|
||||
default n
|
||||
---help---
|
||||
KASan is a fast compiler-based tool for detecting memory
|
||||
bugs in native code. After turn on this option, Please
|
||||
add -fsanitize=kernel-address to CFLAGS/CXXFLAGS too.
|
||||
|
||||
if MM_KASAN
|
||||
|
||||
choice
|
||||
prompt "KAsan Mode"
|
||||
default MM_KASAN_GENERIC
|
||||
|
||||
config MM_KASAN_NONE
|
||||
bool "KAsan disable"
|
||||
---help---
|
||||
Disable KASan check
|
||||
|
||||
config MM_KASAN_GENERIC
|
||||
bool "KAsan generic mode"
|
||||
---help---
|
||||
KASan generic mode that does not require hardware support at all
|
||||
|
||||
config MM_KASAN_SW_TAGS
|
||||
bool "KAsan SW tags"
|
||||
select ARM64_TBI
|
||||
depends on ARCH_ARM64
|
||||
---help---
|
||||
KAsan based on software tags
|
||||
|
||||
endchoice
|
||||
|
||||
config MM_KASAN_ALL
|
||||
bool "Enable KASan for the entire image"
|
||||
default y
|
||||
---help---
|
||||
This option activates address sanitizer for the entire image.
|
||||
If you don't enable this option, you have to explicitly specify
|
||||
"-fsanitize=kernel-address" for the files/directories you want
|
||||
to check. Enabling this option will get image size increased
|
||||
and performance decreased significantly.
|
||||
|
||||
config MM_KASAN_REGIONS
|
||||
int "Kasan region count"
|
||||
default 8
|
||||
|
||||
config MM_KASAN_WATCHPOINT
|
||||
int "Kasan watchpoint maximum number"
|
||||
default 0
|
||||
---help---
|
||||
The maximum number of watchpoints that can be set by KASan.
|
||||
|
||||
config MM_KASAN_DISABLE_NULL_POINTER_CHECK
|
||||
bool "Disable null pointer access check"
|
||||
default n
|
||||
---help---
|
||||
This option enables KASan check null pointer access.
|
||||
|
||||
config MM_KASAN_DISABLE_READS_CHECK
|
||||
bool "Disable reads check"
|
||||
default n
|
||||
---help---
|
||||
This option disables kasan reads check. It speeds up performance
|
||||
compared with default read/write check. Only disable it when you are
|
||||
sure there's no need to do so. Or performance is too bad and only focus
|
||||
on writes check.
|
||||
|
||||
config MM_KASAN_DISABLE_WRITES_CHECK
|
||||
bool "Disable writes check"
|
||||
default n
|
||||
---help---
|
||||
This option disables kasan writes check.
|
||||
|
||||
config MM_KASAN_DISABLE_READ_PANIC
|
||||
bool "Disable panic on kasan read error"
|
||||
default n
|
||||
---help---
|
||||
This option disables panic on kasan read error. It will print error info
|
||||
and continue to run.
|
||||
|
||||
config MM_KASAN_DISABLE_WRITE_PANIC
|
||||
bool "Disable panic on kasan write error"
|
||||
default n
|
||||
---help---
|
||||
This option disables panic on kasan write error. It will print error info
|
||||
and continue to run.
|
||||
|
||||
config MM_KASAN_SKIP_ZERO_TAGS
|
||||
bool "Enable skip check zero tags"
|
||||
default LIBC_MODLIB
|
||||
---help---
|
||||
This option disables checking for zero tags.
|
||||
|
||||
config MM_KASAN_GLOBAL
|
||||
bool "Enable global data check"
|
||||
depends on MM_KASAN_ALL
|
||||
default n
|
||||
---help---
|
||||
This option enables KASan global data check.
|
||||
It's used to extract segments in the linker script.
|
||||
Two new segments need to be created, one being
|
||||
".kasan.unused: { *(.data..LASANLOC*) }",
|
||||
used to eliminate excess data generated.
|
||||
One is ".kasan.global:{
|
||||
KEEP ( *(. data.. LASAN0))
|
||||
KEEP ( *(. data. rel. local.. LASAN0))
|
||||
}", used to extract data generated by the compiler
|
||||
|
||||
config MM_KASAN_GLOBAL_ALIGN
|
||||
int "KASan global alignment"
|
||||
default 1
|
||||
depends on MM_KASAN_GLOBAL
|
||||
---help---
|
||||
It is recommended to use 1, 2, 4, 8, 16, 32.
|
||||
The maximum value is 32.
|
||||
|
||||
endif # MM_KASAN
|
||||
source "mm/kasan/Kconfig"
|
||||
|
||||
config MM_UBSAN
|
||||
bool "Undefined Behavior Sanitizer"
|
||||
|
|
|
|||
123
mm/kasan/Kconfig
Normal file
123
mm/kasan/Kconfig
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
config MM_KASAN
|
||||
bool "Kernel Address Sanitizer"
|
||||
default n
|
||||
---help---
|
||||
KASan is a fast compiler-based tool for detecting memory
|
||||
bugs in native code. After turn on this option, Please
|
||||
add -fsanitize=kernel-address to CFLAGS/CXXFLAGS too.
|
||||
|
||||
if MM_KASAN
|
||||
|
||||
choice
|
||||
prompt "KAsan Mode"
|
||||
default MM_KASAN_GENERIC
|
||||
|
||||
config MM_KASAN_NONE
|
||||
bool "KAsan disable"
|
||||
---help---
|
||||
Disable KASan check
|
||||
|
||||
config MM_KASAN_GENERIC
|
||||
bool "KAsan generic mode"
|
||||
---help---
|
||||
KASan generic mode that does not require hardware support at all
|
||||
|
||||
config MM_KASAN_SW_TAGS
|
||||
bool "KAsan SW tags"
|
||||
select ARM64_TBI
|
||||
depends on ARCH_ARM64
|
||||
---help---
|
||||
KAsan based on software tags
|
||||
|
||||
endchoice
|
||||
|
||||
config MM_KASAN_ALL
|
||||
bool "Enable KASan for the entire image"
|
||||
default y
|
||||
---help---
|
||||
This option activates address sanitizer for the entire image.
|
||||
If you don't enable this option, you have to explicitly specify
|
||||
"-fsanitize=kernel-address" for the files/directories you want
|
||||
to check. Enabling this option will get image size increased
|
||||
and performance decreased significantly.
|
||||
|
||||
config MM_KASAN_REGIONS
|
||||
int "Kasan region count"
|
||||
default 8
|
||||
|
||||
config MM_KASAN_WATCHPOINT
|
||||
int "Kasan watchpoint maximum number"
|
||||
default 0
|
||||
---help---
|
||||
The maximum number of watchpoints that can be set by KASan.
|
||||
|
||||
config MM_KASAN_DISABLE_NULL_POINTER_CHECK
|
||||
bool "Disable null pointer access check"
|
||||
default n
|
||||
---help---
|
||||
This option enables KASan check null pointer access.
|
||||
|
||||
config MM_KASAN_DISABLE_READS_CHECK
|
||||
bool "Disable reads check"
|
||||
default n
|
||||
---help---
|
||||
This option disables kasan reads check. It speeds up performance
|
||||
compared with default read/write check. Only disable it when you are
|
||||
sure there's no need to do so. Or performance is too bad and only focus
|
||||
on writes check.
|
||||
|
||||
config MM_KASAN_DISABLE_WRITES_CHECK
|
||||
bool "Disable writes check"
|
||||
default n
|
||||
---help---
|
||||
This option disables kasan writes check.
|
||||
|
||||
config MM_KASAN_DISABLE_READ_PANIC
|
||||
bool "Disable panic on kasan read error"
|
||||
default n
|
||||
---help---
|
||||
This option disables panic on kasan read error. It will print error info
|
||||
and continue to run.
|
||||
|
||||
config MM_KASAN_DISABLE_WRITE_PANIC
|
||||
bool "Disable panic on kasan write error"
|
||||
default n
|
||||
---help---
|
||||
This option disables panic on kasan write error. It will print error info
|
||||
and continue to run.
|
||||
|
||||
config MM_KASAN_SKIP_ZERO_TAGS
|
||||
bool "Enable skip check zero tags"
|
||||
default LIBC_MODLIB
|
||||
---help---
|
||||
This option disables checking for zero tags.
|
||||
|
||||
config MM_KASAN_GLOBAL
|
||||
bool "Enable global data check"
|
||||
depends on MM_KASAN_ALL
|
||||
default n
|
||||
---help---
|
||||
This option enables KASan global data check.
|
||||
It's used to extract segments in the linker script.
|
||||
Two new segments need to be created, one being
|
||||
".kasan.unused: { *(.data..LASANLOC*) }",
|
||||
used to eliminate excess data generated.
|
||||
One is ".kasan.global:{
|
||||
KEEP ( *(. data.. LASAN0))
|
||||
KEEP ( *(. data. rel. local.. LASAN0))
|
||||
}", used to extract data generated by the compiler
|
||||
|
||||
config MM_KASAN_GLOBAL_ALIGN
|
||||
int "KASan global alignment"
|
||||
default 1
|
||||
depends on MM_KASAN_GLOBAL
|
||||
---help---
|
||||
It is recommended to use 1, 2, 4, 8, 16, 32.
|
||||
The maximum value is 32.
|
||||
|
||||
endif # MM_KASAN
|
||||
Loading…
Add table
Reference in a new issue