summaryrefslogtreecommitdiff
path: root/src/lib/asan.c
diff options
context:
space:
mode:
authorHarshit Sharma <harshitsharmajs@gmail.com>2020-06-09 20:25:16 -0700
committerPatrick Georgi <pgeorgi@google.com>2020-08-21 07:35:07 +0000
commit2bcaba0fd4f61493a02f11ad01d0677164e2e86e (patch)
tree8e9a40326efc6917611e99e79874fd536060d54a /src/lib/asan.c
parent693f4a417984849cdb68d176ca162f477275ac3f (diff)
lib: Add ASan stub
Add a Kconfig option to enable address sanitizer on x86 architecture. Create ASan dummy functions. And add relevant gcc flags to compile ramstage with ASan. Change-Id: I6d87e48b6786f02dd46ea74e702f294082fd8891 Signed-off-by: Harshit Sharma <harshitsharmajs@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/42271 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Diffstat (limited to 'src/lib/asan.c')
-rw-r--r--src/lib/asan.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/lib/asan.c b/src/lib/asan.c
new file mode 100644
index 0000000000..e4a1012e13
--- /dev/null
+++ b/src/lib/asan.c
@@ -0,0 +1,34 @@
+#include <stddef.h>
+
+#pragma GCC diagnostic ignored "-Wmissing-prototypes"
+
+#define DEFINE_ASAN_LOAD_STORE(size) \
+ void __asan_load##size(unsigned long addr) \
+ {} \
+ void __asan_load##size##_noabort(unsigned long addr) \
+ {} \
+ void __asan_store##size(unsigned long addr) \
+ {} \
+ void __asan_store##size##_noabort(unsigned long addr) \
+ {}
+
+DEFINE_ASAN_LOAD_STORE(1);
+DEFINE_ASAN_LOAD_STORE(2);
+DEFINE_ASAN_LOAD_STORE(4);
+DEFINE_ASAN_LOAD_STORE(8);
+DEFINE_ASAN_LOAD_STORE(16);
+
+void __asan_loadN(unsigned long addr, size_t size)
+{}
+
+void __asan_loadN_noabort(unsigned long addr, size_t size)
+{}
+
+void __asan_storeN(unsigned long addr, size_t size)
+{}
+
+void __asan_storeN_noabort(unsigned long addr, size_t size)
+{}
+
+void __asan_handle_no_return(void)
+{}