Merge "vmbase: Fix undetected EH stack overflows" into main am: 767881f6a4
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/3383330
Change-Id: I7493dd41a28a88a842f3ee0672c5b33adb67c16c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/libs/libvmbase/sections.ld b/libs/libvmbase/sections.ld
index 5ca5ff4..61af60f 100644
--- a/libs/libvmbase/sections.ld
+++ b/libs/libvmbase/sections.ld
@@ -56,17 +56,6 @@
} >image
rodata_end = .;
- .eh_stack (NOLOAD) : ALIGN(4096) {
- /*
- * Get stack overflow guard from the previous page being from
- * .rodata and mapped read-only or left unmapped.
- */
- eh_stack_limit = .;
- . += 4096;
- . = ALIGN(4096);
- init_eh_stack_pointer = .;
- } >writable_data
-
/*
* Collect together the read-write data including .bss at the end which
* will be zero'd by the entry code. This is page aligned so it can be
@@ -96,6 +85,18 @@
bss_end = .;
} >writable_data
+ /* Left unmapped, to catch overflows of the exception handler stack. */
+ .eh_stack_guard_page (NOLOAD) : ALIGN(4096) {
+ . += 4096;
+ } >writable_data
+
+ /* Exception handler stack, mapped read-write. */
+ .eh_stack (NOLOAD) : ALIGN(4096) {
+ eh_stack_limit = .;
+ . += 4096;
+ init_eh_stack_pointer = .;
+ } >writable_data
+
/* Left unmapped, to catch overflows of the stack. */
.stack_guard_page (NOLOAD) : ALIGN(4096) {
. += 4096;