Skip to content

Commit

Permalink
s390/compat: correct ucontext layout for high gprs
Browse files Browse the repository at this point in the history
The uc_sigmask definition in the kernel differs from the one in the
glibc, the kernel uc_sigmask has 64 bits while the glibc verison
is 1024 bits. The extension of the ucontext structure for 64-bit
register support for 31-bit compat processes added a new field
uc_gprs_high which starts 8 bytes after the uc_sigmask field.
As the glibc view of the ucontext assumes a size of 128 bytes for
uc_sigmask add a 120 byte padding to the kernel structure
ucontext_extended after the 8 byte uc_sigmask.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Martin Schwidefsky committed Jun 16, 2014
1 parent 2c3e7e1 commit b9c9a33
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions arch/s390/include/uapi/asm/ucontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ struct ucontext_extended {
struct ucontext *uc_link;
stack_t uc_stack;
_sigregs uc_mcontext;
unsigned long uc_sigmask[2];
sigset_t uc_sigmask;
/* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */
unsigned char __unused[128 - sizeof(sigset_t)];
unsigned long uc_gprs_high[16];
};

Expand All @@ -27,7 +29,9 @@ struct ucontext {
struct ucontext *uc_link;
stack_t uc_stack;
_sigregs uc_mcontext;
sigset_t uc_sigmask; /* mask last for extensibility */
sigset_t uc_sigmask;
/* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */
unsigned char __unused[128 - sizeof(sigset_t)];
};

#endif /* !_ASM_S390_UCONTEXT_H */
4 changes: 3 additions & 1 deletion arch/s390/kernel/compat_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ struct ucontext32 {
__u32 uc_link; /* pointer */
compat_stack_t uc_stack;
_sigregs32 uc_mcontext;
compat_sigset_t uc_sigmask; /* mask last for extensibility */
compat_sigset_t uc_sigmask;
/* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */
unsigned char __unused[128 - sizeof(compat_sigset_t)];
};

struct stat64_emu31;
Expand Down

0 comments on commit b9c9a33

Please sign in to comment.