diff options
author | Calin Juravle <calin@google.com> | 2014-05-28 15:56:46 +0100 |
---|---|---|
committer | Calin Juravle <calin@google.com> | 2014-05-28 17:24:28 +0100 |
commit | bdca3802c9c9d033fbc553ed24b92ac78859a463 (patch) | |
tree | bc098b21a164cd3a719e01d0803b06b996fb62cc /libc | |
parent | 7fdde4a58b304a7c4f87987f3fde16bdded63a76 (diff) | |
download | android_bionic-bdca3802c9c9d033fbc553ed24b92ac78859a463.tar.gz android_bionic-bdca3802c9c9d033fbc553ed24b92ac78859a463.tar.bz2 android_bionic-bdca3802c9c9d033fbc553ed24b92ac78859a463.zip |
Remove unnecessary padding in ucontext_t
- removed extra padding from ucontex_t on x86, x86_64 and mips
- force ucontext_t struct to use 64 bits for the sigmask on all arches
(previsouly wrong since sigset_t on arm and x86 is only 32 bits)
- arm and arm64 continue to use padding to match glibc sigset_t
This brings Bionic on par with the kernel w.r.t ucontext padding.
Bug: 12828904
Change-Id: Ia8915ace694ecb4695603a334e697985f4c3e7aa
Diffstat (limited to 'libc')
-rw-r--r-- | libc/include/sys/ucontext.h | 19 |
1 files changed, 13 insertions, 6 deletions
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; |