From 51593dd0c6cf1f69b813ba9c507f74f3641bdc68 Mon Sep 17 00:00:00 2001 From: Harshit Sharma Date: Sat, 8 Aug 2020 17:51:59 -0700 Subject: arch/x86: Add support for ASan to memory functions Compiler's instrumentation cannot insert asan memory checks in case of memory functions like memset, memcpy and memmove as they are written in assembly. So, we need to manually check the memory state before performing each of these operations to ensure that ASan is triggered in case of bad access. Change-Id: I2030437636c77aea7cccda8efe050df4b77c15c7 Signed-off-by: Harshit Sharma Reviewed-on: https://review.coreboot.org/c/coreboot/+/44307 Tested-by: build bot (Jenkins) Reviewed-by: Werner Zeh --- src/include/asan.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/include') diff --git a/src/include/asan.h b/src/include/asan.h index 8816eafbf4..1fe798d97f 100644 --- a/src/include/asan.h +++ b/src/include/asan.h @@ -57,6 +57,8 @@ void asan_unpoison_shadow(const void *address, size_t size); void asan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip); void asan_init(void); +void check_memory_region(unsigned long addr, size_t size, bool write, + unsigned long ret_ip); uintptr_t __asan_shadow_offset(uintptr_t addr); void __asan_register_globals(struct asan_global *globals, size_t size); -- cgit v1.2.3