History

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.

Eric W. Biederman committed 9 years ago

Commit b68a68d1 parent b713da62 files · +21 −5Browse files

Unified · Split

2 files
  1. include/linux/compat.h +10 −2
  2. include/uapi/asm-generic/siginfo.h +11 −3
include/linux/compat.h+10−2
@@ -221,15 +221,23 @@ typedef struct compat_siginfo { · 220 unmodified lines
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+11−3
@@ -94,15 +94,23 @@ typedef struct siginfo { · 93 unmodified lines
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 { · 33 unmodified lines
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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t