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 <harshitsharmajs@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/44307
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
This commit is contained in:
Harshit Sharma
2020-08-08 17:51:59 -07:00
committed by Patrick Georgi
parent c29c12376f
commit 51593dd0c6
5 changed files with 26 additions and 1 deletions

View File

@@ -260,7 +260,7 @@ static __always_inline void check_memory_region_inline(unsigned long addr,
asan_report(addr, size, write, ret_ip);
}
static void check_memory_region(unsigned long addr, size_t size, bool write,
void check_memory_region(unsigned long addr, size_t size, bool write,
unsigned long ret_ip)
{
check_memory_region_inline(addr, size, write, ret_ip);