signal: Correct the offset of si_pkey in struct siginfo
authorEric W. Biederman <ebiederm@xmission.com>
Tue, 6 Mar 2018 06:20:25 +0000 (00:20 -0600)
committerEric W. Biederman <ebiederm@xmission.com>
Tue, 6 Mar 2018 06:22:36 +0000 (00:22 -0600)
The change moving addr_lsb into the _sigfault union failed to take
into account that _sigfault._addr_bnd._lower being a pointer forced
the entire union to have pointer alignment.  In practice this only
mattered for the offset of si_pkey which is why this has taken so long
to discover.

To correct this change _dummy_pkey and _dummy_bnd to have pointer type.

Reported-by: kernel test robot <shun.hao@intel.com>
Fixes: b68a68d3dcc1 ("signal: Move addr_lsb into the _sigfault union for clarity")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
include/linux/compat.h
include/uapi/asm-generic/siginfo.h

index 8a9643857c4a13be60726a18bfe51ccfb1557c46..e16d07eb08cfa8c3bbc2b9c0089058891a92a951 100644 (file)
@@ -229,13 +229,13 @@ typedef struct compat_siginfo {
                                short int _addr_lsb;    /* Valid LSB of the reported address. */
                                /* used when si_code=SEGV_BNDERR */
                                struct {
-                                       short _dummy_bnd;
+                                       compat_uptr_t _dummy_bnd;
                                        compat_uptr_t _lower;
                                        compat_uptr_t _upper;
                                } _addr_bnd;
                                /* used when si_code=SEGV_PKUERR */
                                struct {
-                                       short _dummy_pkey;
+                                       compat_uptr_t _dummy_pkey;
                                        u32 _pkey;
                                } _addr_pkey;
                        };
index 85dc965afd892ccd34a4d9f41673c60412fd97c0..99c902e460c2534609c6c385543e527adc36fa57 100644 (file)
@@ -102,13 +102,13 @@ typedef struct siginfo {
                                short _addr_lsb; /* LSB of the reported address */
                                /* used when si_code=SEGV_BNDERR */
                                struct {
-                                       short _dummy_bnd;
+                                       void *_dummy_bnd;
                                        void __user *_lower;
                                        void __user *_upper;
                                } _addr_bnd;
                                /* used when si_code=SEGV_PKUERR */
                                struct {
-                                       short _dummy_pkey;
+                                       void *_dummy_pkey;
                                        __u32 _pkey;
                                } _addr_pkey;
                        };