NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-hppa/56830: RAS support is slightly incorrect on hppa



>Number:         56830
>Category:       port-hppa
>Synopsis:       RAS support is slightly incorrect on hppa
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-hppa-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 13 17:40:00 +0000 2022
>Originator:     Tom Lane
>Release:        HEAD/202205021430Z, but it's a very old bug
>Organization:
PostgreSQL Global Development Group
>Environment:
NetBSD sss2.sss.pgh.pa.us 9.99.96 NetBSD 9.99.96 (GENERIC) #0: Wed May 11 15:39:57 EDT 2022  tgl%nuc1.sss.pgh.pa.us@localhost:/home/tgl/netbsd-H-202205021430Z/obj.hppa/sys/arch/hppa/compile/GENERIC hppa

>Description:
Running NetBSD HEAD on an HP9000/C360, I observe many programs intermittently failing with SIGSEGV at a specific spot in libpthread.  I traced this to an oversight in the kernel's support for "RAS" instruction sequences.  More details appear in my reports to port-hppa:

https://mail-index.netbsd.org/port-hppa/2022/05/10/msg000065.html
https://mail-index.netbsd.org/port-hppa/2022/05/11/msg000066.html

>How-To-Repeat:
Doing just about anything on a C360 will fail every so often, since the problem affects many libc functions.  "tar" seems notably prone to it.
>Fix:
hppa_ras() needs to mask off privilege-level bits in the PC value, as cpu_getmcontext() has always done:

Index: sys/arch/hppa/hppa/hppa_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/hppa/hppa/hppa_machdep.c,v
retrieving revision 1.32
diff -u -r1.32 hppa_machdep.c
--- sys/arch/hppa/hppa/hppa_machdep.c   22 Aug 2021 20:18:39 -0000      1.32
+++ sys/arch/hppa/hppa/hppa_machdep.c   11 May 2022 18:35:56 -0000
@@ -279,7 +279,8 @@
 
        p = l->l_proc;
        tf = l->l_md.md_regs;
-       rasaddr = (intptr_t)ras_lookup(p, (void *)tf->tf_iioq_head);
+       rasaddr = (intptr_t)ras_lookup(p,
+           (void *)(tf->tf_iioq_head & ~HPPA_PC_PRIV_MASK));
        if (rasaddr != -1) {
                rasaddr |= HPPA_PC_PRIV_USER;
                tf->tf_iioq_head = rasaddr;



Home | Main Index | Thread Index | Old Index