summaryrefslogtreecommitdiffstats
path: root/src/lib/program.ld
diff options
context:
space:
mode:
authorHarshit Sharma <harshitsharmajs@gmail.com>2020-06-17 20:19:00 -0700
committerPatrick Georgi <pgeorgi@google.com>2020-08-21 07:37:52 +0000
commit9c88fb8df0005dc60e6c62778b4f16313cb3308e (patch)
tree8f29d4bf1f6ab90a3241e91fff2d8fe62bf49ea8 /src/lib/program.ld
parent3b9cc859ff64a55cb6fbd247b1c2680d13716d91 (diff)
downloadcoreboot-9c88fb8df0005dc60e6c62778b4f16313cb3308e.tar.gz
coreboot-9c88fb8df0005dc60e6c62778b4f16313cb3308e.tar.bz2
coreboot-9c88fb8df0005dc60e6c62778b4f16313cb3308e.zip
lib: Add ASan support to ramstage on x86 arch
This patch adds address sanitizer module to the library and reserves a linker section representing the shadow region for ramstage. Also, it adds an instruction to initialize shadow region on x86 architecture when ramstage is loaded. Change-Id: Ica06bd2be78fcfc79fa888721ed920d4e8248f3b Signed-off-by: Harshit Sharma <harshitsharmajs@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/42496 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Diffstat (limited to 'src/lib/program.ld')
-rw-r--r--src/lib/program.ld7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/program.ld b/src/lib/program.ld
index 88a312603898..3b6aa2ecba04 100644
--- a/src/lib/program.ld
+++ b/src/lib/program.ld
@@ -51,7 +51,7 @@
_etext = .;
} : to_load
-#if ENV_RAMSTAGE && CONFIG(COVERAGE)
+#if ENV_RAMSTAGE && (CONFIG(COVERAGE) || CONFIG(ASAN_IN_RAMSTAGE))
.ctors . : {
. = ALIGN(0x100);
__CTOR_LIST__ = .;
@@ -126,6 +126,11 @@
}
#endif
+#if ENV_RAMSTAGE && CONFIG(ASAN_IN_RAMSTAGE)
+ _shadow_size = (_eheap - _data) >> 3;
+ REGION(asan_shadow, ., _shadow_size, ARCH_POINTER_ALIGN_SIZE)
+#endif
+
_eprogram = .;
/* Discard the sections we don't need/want */