diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2021-09-28 08:56:16 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2021-09-28 08:56:16 +0000 |
commit | 159b482be31212eded149199fd09659e4c8ba3e6 (patch) | |
tree | c5933f96bb6dfc72cb1636b912240190719c49df | |
parent | 731ad4ba1854025bb7f9b0aaf5772564141378cd (diff) |
Turns out that older SPARC CPUs (like the UltraSPARC II) do report an exact
fault address, while others (like the UltraSPARC T2) report an inexact
address. Deal with this by using the EXPADDR_MASK on both the expected and
the reported fault address.
ok bluhm@
-rw-r--r-- | regress/sys/kern/signal/siginfo-fault/siginfo-fault.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/regress/sys/kern/signal/siginfo-fault/siginfo-fault.c b/regress/sys/kern/signal/siginfo-fault/siginfo-fault.c index 9fa1a8dea0c..bacc277323b 100644 --- a/regress/sys/kern/signal/siginfo-fault/siginfo-fault.c +++ b/regress/sys/kern/signal/siginfo-fault/siginfo-fault.c @@ -1,4 +1,4 @@ -/* $OpenBSD: siginfo-fault.c,v 1.1 2020/09/16 14:02:23 mpi Exp $ */ +/* $OpenBSD: siginfo-fault.c,v 1.2 2021/09/28 08:56:15 kettenis Exp $ */ /* * Copyright (c) 2014 Google Inc. * @@ -30,7 +30,7 @@ #include <unistd.h> /* - * Some architectures deliver an imprecise fault address. + * Some architectures may deliver an imprecise fault address. */ #ifdef __sparc64__ #define EXPADDR_MASK ~(3UL) @@ -109,7 +109,7 @@ checksig(const char *name, int expsigno, int expcode, volatile char *expaddr) gotsi.si_code, strsigcode(gotsigno, gotsi.si_code)); ++fail; } - if (expaddr != gotsi.si_addr) { + if (expaddr != (char *)((uintptr_t)gotsi.si_addr & EXPADDR_MASK)) { fprintf(stderr, "%s si_addr: expect %p, actual %p\n", name, expaddr, gotsi.si_addr); ++fail; |