Merge "Fix shadowstack init crash on 16K page system" into main am: 52e3190b9b am: faf3237564 am: faddc7102f
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2651111
Change-Id: I3068b014b96b845db163a0bef3511a06b0403646
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/libc/private/bionic_constants.h b/libc/private/bionic_constants.h
index d7f4474..05914f4 100644
--- a/libc/private/bionic_constants.h
+++ b/libc/private/bionic_constants.h
@@ -21,7 +21,9 @@
// Size of the shadow call stack. This can be small because these stacks only
// contain return addresses. This must be a power of 2 so the mask trick works.
// See the SCS commentary in pthread_internal.h for more detail.
-#define SCS_SIZE (8 * 1024)
+// SCS_SIZE must be a multiple of page size.
+// We used 8KiB until V but switched to 16KiB in V to experiment with 16KiB pages.
+#define SCS_SIZE (16 * 1024)
#define SCS_MASK (SCS_SIZE - 1)
// The shadow call stack is allocated at an aligned address within a guard region of this size. The