Skip to content

Commit

Permalink
asm-generic: Allow overriding clock_t and add attributes to siginfo_t
Browse files Browse the repository at this point in the history
For the particular issue of x32, which shares code with i386 in the
handling of compat_siginfo_t, the use of a 64-bit clock_t bumps the
sigchld structure out of alignment, which triggers a messy cascade of
padding.

This was already handled on the kernel compat side, but it needs
handling on the user space side, which uses the generic header.  To
make that possible:

1. Allow __kernel_clock_t to be overridden in struct siginfo;
2. Allow there to be attributes added to struct siginfo.

Reported-by: H.J. Lu <[email protected]>
Cc: Bruce J. Beare <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Link: http://lkml.kernel.org/r/CAMe9rOqF6Kh6-NK7oP0Fpzkd4SBAWU%[email protected]
Signed-off-by: H. Peter Anvin <[email protected]>
  • Loading branch information
H. Peter Anvin committed Apr 23, 2012
1 parent 98e5272 commit d643bdc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions include/asm-generic/siginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ typedef union sigval {
#define __ARCH_SI_BAND_T long
#endif

#ifndef __ARCH_SI_CLOCK_T
#define __ARCH_SI_CLOCK_T __kernel_clock_t
#endif

#ifndef __ARCH_SI_ATTRIBUTES
#define __ARCH_SI_ATTRIBUTES
#endif

#ifndef HAVE_ARCH_SIGINFO_T

typedef struct siginfo {
Expand Down Expand Up @@ -72,8 +80,8 @@ typedef struct siginfo {
__kernel_pid_t _pid; /* which child */
__ARCH_SI_UID_T _uid; /* sender's uid */
int _status; /* exit code */
__kernel_clock_t _utime;
__kernel_clock_t _stime;
__ARCH_SI_CLOCK_T _utime;
__ARCH_SI_CLOCK_T _stime;
} _sigchld;

/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
Expand All @@ -91,7 +99,7 @@ typedef struct siginfo {
int _fd;
} _sigpoll;
} _sifields;
} siginfo_t;
} __ARCH_SI_ATTRIBUTES siginfo_t;

#endif

Expand Down

0 comments on commit d643bdc

Please sign in to comment.