Merge "<sys/user.h>: factor PAGE_SIZE out into <bits/page_size.h>." into main
diff --git a/libc/bionic/pthread_internal.h b/libc/bionic/pthread_internal.h
index 7efbf6d..3b9e6a4 100644
--- a/libc/bionic/pthread_internal.h
+++ b/libc/bionic/pthread_internal.h
@@ -38,6 +38,8 @@
 #define __hwasan_thread_exit()
 #endif
 
+#include "platform/bionic/page.h"
+
 #include "private/bionic_elf_tls.h"
 #include "private/bionic_lock.h"
 #include "private/bionic_tls.h"
@@ -236,7 +238,7 @@
 // On LP64, we could use more but there's no obvious advantage to doing
 // so, and the various media processes use RLIMIT_AS as a way to limit
 // the amount of allocation they'll do.
-#define PTHREAD_GUARD_SIZE PAGE_SIZE
+#define PTHREAD_GUARD_SIZE max_page_size()
 
 // SIGSTKSZ (8KiB) is not big enough.
 // An snprintf to a stack buffer of size PATH_MAX consumes ~7KiB of stack.
diff --git a/libc/include/setjmp.h b/libc/include/setjmp.h
index 6d047ae..0aaaac5 100644
--- a/libc/include/setjmp.h
+++ b/libc/include/setjmp.h
@@ -66,12 +66,14 @@
 /**
  * The size in words of a riscv64 jmp_buf. Room for callee-saved registers,
  * including floating point, stack pointer and program counter, various
- * internal implementation details, and leaving some free space.
+ * internal implementation details, and leaving lots of free space.
  *
- * Coincidentally matches OpenBSD, though they also save/restore the
- * floating point status register too.
+ * Deliberately very large given the uncertainty around the final form of
+ * hardware shadow stack, and the fact that x86-64 glibc needed to steal
+ * space from their enormous sigset_t (which we don't have) to be able to
+ * implement the CET shadow stack.
  */
-#define _JBLEN 32
+#define _JBLEN 64
 #elif defined(__x86_64__)
 /** The size in words of an x86-64 jmp_buf. Inherited from OpenBSD. */
 #define _JBLEN 11