NetBSD Problem Report #56830

From www@netbsd.org  Fri May 13 17:35:44 2022
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 7B8511A9239
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 13 May 2022 17:35:44 +0000 (UTC)
Message-Id: <20220513173542.D53101A923C@mollari.NetBSD.org>
Date: Fri, 13 May 2022 17:35:42 +0000 (UTC)
From: tgl@sss.pgh.pa.us
Reply-To: tgl@sss.pgh.pa.us
To: gnats-bugs@NetBSD.org
Subject: RAS support is slightly incorrect on hppa
X-Send-Pr-Version: www-1.0

>Number:         56830
>Category:       port-hppa
>Synopsis:       RAS support is slightly incorrect on hppa
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-hppa-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 13 17:40:00 +0000 2022
>Closed-Date:    Sun May 15 06:10:56 +0000 2022
>Last-Modified:  Sun May 15 06:10:56 +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:/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;

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: skrll@NetBSD.org
State-Changed-When: Fri, 13 May 2022 18:40:14 +0000
State-Changed-Why:
Applied. Thanks for the analysis and fix!


From: Tom Lane <tgl@sss.pgh.pa.us>
To: skrll@NetBSD.org
Cc: gnats-bugs@netbsd.org
Subject: Re: port-hppa/56830 (RAS support is slightly incorrect on hppa)
Date: Fri, 13 May 2022 15:21:02 -0400

 skrll@NetBSD.org writes:
 > Applied. Thanks for the analysis and fix!

 Thanks!  Will this be pulled up into NetBSD 9?

 			regards, tom lane

State-Changed-From-To: closed->pending-pullups
State-Changed-By: skrll@NetBSD.org
State-Changed-When: Fri, 13 May 2022 21:17:08 +0000
State-Changed-Why:
pullup requested... waiting for ticket number.


From: Nick Hudson <nick.hudson@gmx.co.uk>
To: gnats-bugs@netbsd.org, port-hppa-maintainer@netbsd.org,
 gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, tgl@sss.pgh.pa.us
Cc: 
Subject: Re: port-hppa/56830 (RAS support is slightly incorrect on hppa)
Date: Fri, 13 May 2022 22:17:48 +0100

 On 13/05/2022 20:25, Tom Lane wrote:
 > The following reply was made to PR port-hppa/56830; it has been noted by=
  GNATS.
 >
 > From: Tom Lane <tgl@sss.pgh.pa.us>
 > To: skrll@NetBSD.org
 > Cc: gnats-bugs@netbsd.org
 > Subject: Re: port-hppa/56830 (RAS support is slightly incorrect on hppa)
 > Date: Fri, 13 May 2022 15:21:02 -0400
 >
 >   skrll@NetBSD.org writes:
 >   > Applied. Thanks for the analysis and fix!
 >
 >   Thanks!  Will this be pulled up into NetBSD 9?

 Good point! Request email sent.

 Thanks,
 Nick

From: Nick Hudson <nick.hudson@gmx.co.uk>
To: gnats-bugs@netbsd.org, port-hppa-maintainer@netbsd.org,
 gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, tgl@sss.pgh.pa.us
Cc: 
Subject: Re: port-hppa/56830 (RAS support is slightly incorrect on hppa)
Date: Fri, 13 May 2022 22:19:25 +0100

 [pullup-9 #1446] port-hppa/56830: RAS support is slightly incorrect on hppa

State-Changed-From-To: pending-pullups->closed
State-Changed-By: skrll@NetBSD.org
State-Changed-When: Sun, 15 May 2022 06:10:56 +0000
State-Changed-Why:
pullup done.
Thanks for the PR.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.