signal: Add TRAP_UNK si_code for undiagnosted trap exceptions
authorEric W. Biederman <ebiederm@xmission.com>
Tue, 17 Apr 2018 21:18:25 +0000 (16:18 -0500)
committerEric W. Biederman <ebiederm@xmission.com>
Wed, 25 Apr 2018 15:40:56 +0000 (10:40 -0500)
Both powerpc and alpha have cases where they wronly set si_code to 0
in combination with SIGTRAP and don't mean SI_USER.

About half the time this is because the architecture can not report
accurately what kind of trap exception triggered the trap exception.
The other half the time it looks like no one has bothered to
figure out an appropriate si_code.

For the cases where the architecture does not have enough information
or is too lazy to figure out exactly what kind of trap exception
it is define TRAP_UNK.

Cc: linux-api@vger.kernel.org
Cc: linux-arch@vger.kernel.org
Cc: linux-alpha@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
arch/x86/kernel/signal_compat.c
include/uapi/asm-generic/siginfo.h

index 14c057f2997969023f3ebeecb36669beaf9c8a47..9ccbf0576cd0ebe6b3cbb30d7f141fac1681ad13 100644 (file)
@@ -29,7 +29,7 @@ static inline void signal_compat_build_tests(void)
        BUILD_BUG_ON(NSIGFPE  != 15);
        BUILD_BUG_ON(NSIGSEGV != 7);
        BUILD_BUG_ON(NSIGBUS  != 5);
-       BUILD_BUG_ON(NSIGTRAP != 4);
+       BUILD_BUG_ON(NSIGTRAP != 5);
        BUILD_BUG_ON(NSIGCHLD != 6);
        BUILD_BUG_ON(NSIGSYS  != 1);
 
index 558b902f18d4129261dfe2de451dba23dba98dff..80e2a722720537e357479905122295cd1720c2f8 100644 (file)
@@ -249,7 +249,8 @@ typedef struct siginfo {
 #define TRAP_TRACE     2       /* process trace trap */
 #define TRAP_BRANCH     3      /* process taken branch trap */
 #define TRAP_HWBKPT     4      /* hardware breakpoint/watchpoint */
-#define NSIGTRAP       4
+#define TRAP_UNK       5       /* undiagnosed trap */
+#define NSIGTRAP       5
 
 /*
  * There is an additional set of SIGTRAP si_codes used by ptrace