diff options
| author | Eric W. Biederman <ebiederm@xmission.com> | 2017-06-26 17:36:57 -0400 |
|---|---|---|
| committer | Eric W. Biederman <ebiederm@xmission.com> | 2017-07-19 20:13:15 -0400 |
| commit | d12fe87e62d773e81e0cb3a123c5a480a10d7d91 (patch) | |
| tree | 1db041a3f0967cfa27958043ad82bed800c29dba /tools/testing | |
| parent | ea1b75cf9138003eee6389b70e654f5865728525 (diff) | |
signal/testing: Don't look for __SI_FAULT in userspace
Fix the debug print statements in these tests where they reference
si_codes and in particular __SI_FAULT. __SI_FAULT is a kernel
internal value and should never be seen by userspace.
While I am in there also fix si_code_str. si_codes are an enumeration
there are not a bitmap so == and not & is the apropriate operation to
test for an si_code.
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Fixes: 5f23f6d082a9 ("x86/pkeys: Add self-tests")
Fixes: e754aedc26ef ("x86/mpx, selftests: Add MPX self test")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'tools/testing')
| -rw-r--r-- | tools/testing/selftests/x86/mpx-mini-test.c | 3 | ||||
| -rw-r--r-- | tools/testing/selftests/x86/protection_keys.c | 13 |
2 files changed, 7 insertions, 9 deletions
diff --git a/tools/testing/selftests/x86/mpx-mini-test.c b/tools/testing/selftests/x86/mpx-mini-test.c index a8df159a8924..ec0f6b45ce8b 100644 --- a/tools/testing/selftests/x86/mpx-mini-test.c +++ b/tools/testing/selftests/x86/mpx-mini-test.c | |||
| @@ -391,8 +391,7 @@ void handler(int signum, siginfo_t *si, void *vucontext) | |||
| 391 | br_count++; | 391 | br_count++; |
| 392 | dprintf1("#BR 0x%jx (total seen: %d)\n", status, br_count); | 392 | dprintf1("#BR 0x%jx (total seen: %d)\n", status, br_count); |
| 393 | 393 | ||
| 394 | #define __SI_FAULT (3 << 16) | 394 | #define SEGV_BNDERR 3 /* failed address bound checks */ |
| 395 | #define SEGV_BNDERR (__SI_FAULT|3) /* failed address bound checks */ | ||
| 396 | 395 | ||
| 397 | dprintf2("Saw a #BR! status 0x%jx at %016lx br_reason: %jx\n", | 396 | dprintf2("Saw a #BR! status 0x%jx at %016lx br_reason: %jx\n", |
| 398 | status, ip, br_reason); | 397 | status, ip, br_reason); |
diff --git a/tools/testing/selftests/x86/protection_keys.c b/tools/testing/selftests/x86/protection_keys.c index 3237bc010e1c..23927845518d 100644 --- a/tools/testing/selftests/x86/protection_keys.c +++ b/tools/testing/selftests/x86/protection_keys.c | |||
| @@ -212,19 +212,18 @@ void dump_mem(void *dumpme, int len_bytes) | |||
| 212 | } | 212 | } |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | #define __SI_FAULT (3 << 16) | 215 | #define SEGV_BNDERR 3 /* failed address bound checks */ |
| 216 | #define SEGV_BNDERR (__SI_FAULT|3) /* failed address bound checks */ | 216 | #define SEGV_PKUERR 4 |
| 217 | #define SEGV_PKUERR (__SI_FAULT|4) | ||
| 218 | 217 | ||
| 219 | static char *si_code_str(int si_code) | 218 | static char *si_code_str(int si_code) |
| 220 | { | 219 | { |
| 221 | if (si_code & SEGV_MAPERR) | 220 | if (si_code == SEGV_MAPERR) |
| 222 | return "SEGV_MAPERR"; | 221 | return "SEGV_MAPERR"; |
| 223 | if (si_code & SEGV_ACCERR) | 222 | if (si_code == SEGV_ACCERR) |
| 224 | return "SEGV_ACCERR"; | 223 | return "SEGV_ACCERR"; |
| 225 | if (si_code & SEGV_BNDERR) | 224 | if (si_code == SEGV_BNDERR) |
| 226 | return "SEGV_BNDERR"; | 225 | return "SEGV_BNDERR"; |
| 227 | if (si_code & SEGV_PKUERR) | 226 | if (si_code == SEGV_PKUERR) |
| 228 | return "SEGV_PKUERR"; | 227 | return "SEGV_PKUERR"; |
| 229 | return "UNKNOWN"; | 228 | return "UNKNOWN"; |
| 230 | } | 229 | } |
