From 31e18b07b9f98cacc0ab5c092b28d4552a954be5 Mon Sep 17 00:00:00 2001 From: kettenis Date: Tue, 28 Sep 2021 08:56:15 +0000 Subject: [PATCH] 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@ --- regress/sys/kern/signal/siginfo-fault/siginfo-fault.c | 6 +++--- 1 file 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 /* - * 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; -- 2.20.1