diff options
Diffstat (limited to 'regress/sys')
-rw-r--r-- | regress/sys/kern/siginfo-fault/siginfo-fault.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/regress/sys/kern/siginfo-fault/siginfo-fault.c b/regress/sys/kern/siginfo-fault/siginfo-fault.c index b5b7c4ce98b..e56d3155e0e 100644 --- a/regress/sys/kern/siginfo-fault/siginfo-fault.c +++ b/regress/sys/kern/siginfo-fault/siginfo-fault.c @@ -1,4 +1,4 @@ -/* $OpenBSD: siginfo-fault.c,v 1.5 2017/07/20 18:22:25 bluhm Exp $ */ +/* $OpenBSD: siginfo-fault.c,v 1.6 2017/07/22 16:12:27 kettenis Exp $ */ /* * Copyright (c) 2014 Google Inc. * @@ -24,10 +24,20 @@ #include <setjmp.h> #include <signal.h> #include <stdio.h> +#include <stdint.h> #include <stdlib.h> #include <string.h> #include <unistd.h> +/* + * Some architectures deliver an imprecise fault address. + */ +#ifdef __sparc64__ +#define EXPADDR_MASK ~(3UL) +#else +#define EXPADDR_MASK ~(0UL) +#endif + #define CHECK_EQ(a, b) assert((a) == (b)) #define CHECK_NE(a, b) assert((a) != (b)) #define CHECK_LE(a, b) assert((a) <= (b)) @@ -76,6 +86,9 @@ checksig(const char *name, int expsigno, int expcode, volatile char *expaddr) { int fail = 0; char str1[NL_TEXTMAX], str2[NL_TEXTMAX]; + + expaddr = (char *)((uintptr_t)expaddr & EXPADDR_MASK); + if (expsigno != gotsigno) { strlcpy(str1, strsignal(expsigno), sizeof(str1)); strlcpy(str2, strsignal(gotsigno), sizeof(str2)); |