Skip to content

Commit b68a68d

Browse files
committed
signal: Move addr_lsb into the _sigfault union for clarity
The addr_lsb fields is only valid and available when the signal is SIGBUS and the si_code is BUS_MCEERR_AR or BUS_MCEERR_AO. Document this with a comment and place the field in the _sigfault union to make this clear. All of the fields stay in the same physical location so both the old and new definitions of struct siginfo will continue to work. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
1 parent b713da6 commit b68a68d

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

include/linux/compat.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,23 @@ typedef struct compat_siginfo {
221221
#ifdef __ARCH_SI_TRAPNO
222222
int _trapno; /* TRAP # which caused the signal */
223223
#endif
224-
short int _addr_lsb; /* Valid LSB of the reported address. */
225224
union {
225+
/*
226+
* used when si_code=BUS_MCEERR_AR or
227+
* used when si_code=BUS_MCEERR_AO
228+
*/
229+
short int _addr_lsb; /* Valid LSB of the reported address. */
226230
/* used when si_code=SEGV_BNDERR */
227231
struct {
232+
short _dummy_bnd;
228233
compat_uptr_t _lower;
229234
compat_uptr_t _upper;
230235
} _addr_bnd;
231236
/* used when si_code=SEGV_PKUERR */
232-
u32 _pkey;
237+
struct {
238+
short _dummy_pkey;
239+
u32 _pkey;
240+
} _addr_pkey;
233241
};
234242
} _sigfault;
235243

include/uapi/asm-generic/siginfo.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,23 @@ typedef struct siginfo {
9494
unsigned int _flags; /* see ia64 si_flags */
9595
unsigned long _isr; /* isr */
9696
#endif
97-
short _addr_lsb; /* LSB of the reported address */
9897
union {
98+
/*
99+
* used when si_code=BUS_MCEERR_AR or
100+
* used when si_code=BUS_MCEERR_AO
101+
*/
102+
short _addr_lsb; /* LSB of the reported address */
99103
/* used when si_code=SEGV_BNDERR */
100104
struct {
105+
short _dummy_bnd;
101106
void __user *_lower;
102107
void __user *_upper;
103108
} _addr_bnd;
104109
/* used when si_code=SEGV_PKUERR */
105-
__u32 _pkey;
110+
struct {
111+
short _dummy_pkey;
112+
__u32 _pkey;
113+
} _addr_pkey;
106114
};
107115
} _sigfault;
108116

@@ -142,7 +150,7 @@ typedef struct siginfo {
142150
#define si_addr_lsb _sifields._sigfault._addr_lsb
143151
#define si_lower _sifields._sigfault._addr_bnd._lower
144152
#define si_upper _sifields._sigfault._addr_bnd._upper
145-
#define si_pkey _sifields._sigfault._pkey
153+
#define si_pkey _sifields._sigfault._addr_pkey._pkey
146154
#define si_band _sifields._sigpoll._band
147155
#define si_fd _sifields._sigpoll._fd
148156
#define si_call_addr _sifields._sigsys._call_addr

0 commit comments

Comments
 (0)