diff --git a/libc/include/sys/ucontext.h b/libc/include/sys/ucontext.h index d6c6b4317..f62380d8a 100644 --- a/libc/include/sys/ucontext.h +++ b/libc/include/sys/ucontext.h @@ -68,8 +68,13 @@ typedef struct ucontext { struct ucontext* uc_link; stack_t uc_stack; mcontext_t uc_mcontext; - sigset_t uc_sigmask; - char __padding[128 - sizeof(sigset_t)]; + // Android has a wrong (smaller) sigset_t on ARM. + union { + sigset_t bionic; + uint32_t kernel[2]; + } uc_sigmask; + // The kernel adds extra padding after uc_sigmask to match glibc sigset_t on ARM. + char __padding[120]; unsigned long uc_regspace[128] __attribute__((__aligned__(8))); } ucontext_t; @@ -83,6 +88,7 @@ typedef struct ucontext { struct ucontext *uc_link; stack_t uc_stack; sigset_t uc_sigmask; + // The kernel adds extra padding after uc_sigmask to match glibc sigset_t on ARM64. char __padding[128 - sizeof(sigset_t)]; mcontext_t uc_mcontext; } ucontext_t; @@ -146,8 +152,11 @@ typedef struct ucontext { struct ucontext* uc_link; stack_t uc_stack; mcontext_t uc_mcontext; - sigset_t uc_sigmask; - char __padding[128 - sizeof(sigset_t)]; + // Android has a wrong (smaller) sigset_t on x86. + union { + sigset_t bionic; + uint32_t kernel[2]; + } uc_sigmask; struct _libc_fpstate __fpregs_mem; } ucontext_t; @@ -198,7 +207,6 @@ typedef struct ucontext { stack_t uc_stack; mcontext_t uc_mcontext; sigset_t uc_sigmask; - char __padding[128 - sizeof(sigset_t)]; } ucontext_t; #elif defined(__mips64__) @@ -275,7 +283,6 @@ typedef struct ucontext { stack_t uc_stack; mcontext_t uc_mcontext; sigset_t uc_sigmask; - char __padding[128 - sizeof(sigset_t)]; struct _libc_fpstate __fpregs_mem; } ucontext_t;