feat: L0~L1 支持Lms

1.【需求描述】:
   支持内核态和用户态堆内存非法访问检测,包括:越界访问、double free、释放后使用;支持libc常用高频函数内存检测;支持安全函数内存检测;读写检测可配可裁剪。
2.【方案描述】:
   L0 ~ L1:
   (1).影子内存映射与标记
   (2).编译器使能-fsanitize=kernel-address 自动插桩检测点
   (3).实时校验影子内存的合法性;
   (4).错误访问打印回溯栈

BREAKING CHANGE: 新增支持API:

LOS_LmsCheckPoolAdd使能检测指定内存池
LOS_LmsCheckPoolDel不检测指定内存池
LOS_LmsAddrProtect为指定内存段上锁,不允许访问
LOS_LmsAddrDisableProtect去能指定内存段的访问保护

Close #I4HYAV

Signed-off-by: LiteOS2021 <dinglu@huawei.com>
Change-Id: Id8e5c890656da9edc4a22227e6a3c32205c024ce
This commit is contained in:
LiteOS2021
2021-11-27 09:56:51 +08:00
parent 48f645db84
commit e748fdbe57
26 changed files with 2695 additions and 21 deletions
+41
View File
@@ -0,0 +1,41 @@
config KERNEL_LMS
bool "Enable Lite Memory Sanitizer"
default n
depends on KERNEL_EXTKERNEL && DEBUG_VERSION && LIB_LIBC
help
Select y to build LiteOS with memory sanitizer.
config LMS_MAX_RECORD_POOL_NUM
int "Lms check pool max num"
default 50
depends on KERNEL_LMS
help
The Max num of lms check pool
config LMS_LOAD_CHECK
bool "Enable lms read check"
default y
depends on KERNEL_LMS
help
Select y to enable read check.
config LMS_STORE_CHECK
bool "Enable lms write check"
default y
depends on KERNEL_LMS
help
Select y to enable write check.
config LMS_CHECK_STRICT
bool "Enable lms strict check, byte-by-byte"
default n
depends on KERNEL_LMS
help
Select y to enable byte-by-byte check in lms
config LMS_LIBC_FULL_CHECK
bool "Enable libc all function do lms check"
default n
depends on KERNEL_LMS
help
Select y to enable libc full check