NetBSD Problem Report #60102
From www@netbsd.org Thu Mar 19 04:09:25 2026
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)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.netbsd.org", Issuer "R12" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 078F91A9239
for <gnats-bugs@gnats.NetBSD.org>; Thu, 19 Mar 2026 04:09:25 +0000 (UTC)
Message-Id: <20260319040923.EB7591A923A@mollari.NetBSD.org>
Date: Thu, 19 Mar 2026 04:09:23 +0000 (UTC)
From: pyhirricturtle@gmail.com
Reply-To: pyhirricturtle@gmail.com
To: gnats-bugs@NetBSD.org
Subject: kernel longjmp(9) on vax reads stack garbage instead of returning 1 (patch)
X-Send-Pr-Version: www-1.0
X-From4GNATS: "pyhirricturtle@gmail.com via gnats" <gnats-admin@NetBSD.org>
>Number: 60102
>Category: port-vax
>Synopsis: kernel longjmp(9) on vax reads stack garbage instead of returning 1 (patch)
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: port-vax-maintainer
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Mar 19 04:10:00 +0000 2026
>Closed-Date: Thu Mar 19 04:34:34 +0000 2026
>Last-Modified: Tue Jun 30 09:45:09 +0000 2026
>Originator: FireTurtle
>Release: 10.1_STABLE
>Organization:
>Environment:
NetBSD 10.1_STABLE (GENERIC) vax on SIMH MicroVAX 3900
>Description:
Patch for PR port-vax/59308.
As noted in 59308, kernel longjmp(9) takes only one argument (the
jmp_buf) but the VAX implementation at sys/arch/vax/vax/subr.S line 278
reads 8(%ap) as the return value. Since there is no second argument,
this returns whatever stack garbage happens to be there -- which might
be zero, causing the setjmp(9) caller to take the wrong branch.
longjmp(9) is used by DDB for fault recovery, so this bug could
cause unpredictable debugger behavior.
--- a/sys/arch/vax/vax/subr.S
+++ b/sys/arch/vax/vax/subr.S
@@ -275,7 +275,7 @@
_C_LABEL(longjmp):.word0
movl4(%ap), %r1
-movl8(%ap), %r0
+movl$1, %r0
movl(%r1), %ap
movl4(%r1), %fp
movl12(%r1), %sp
Built and boot-tested on SIMH MicroVAX 3900, NetBSD 10.1_STABLE.
>How-To-Repeat:
Code inspection of sys/arch/vax/vax/subr.S line 278. See also PR port-vax/59308.
>Fix:
Change movl 8(%ap), %r0 to movl $1, %r0 in longjmp at sys/arch/vax/vax/subr.S. Patch included in description.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Thu, 19 Mar 2026 04:34:34 +0000
State-Changed-Why:
dup of https://gnats.netbsd.org/59308
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60102 CVS commit: src/sys/arch/vax/vax
Date: Thu, 19 Mar 2026 04:34:03 +0000
Module Name: src
Committed By: riastradh
Date: Thu Mar 19 04:34:03 UTC 2026
Modified Files:
src/sys/arch/vax/vax: subr.S
Log Message:
vax longjmp(9): Fix return value.
PR port-vax/59308: kernel longjmp(9) fails to make setjmp(9) return 1
PR port-vax/60102: kernel longjmp(9) on vax reads stack garbage instead
of returning 1 (patch)
To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/vax/vax/subr.S
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60102 CVS commit: [netbsd-11] src/sys/arch/vax/vax
Date: Tue, 30 Jun 2026 09:41:28 +0000
Module Name: src
Committed By: martin
Date: Tue Jun 30 09:41:27 UTC 2026
Modified Files:
src/sys/arch/vax/vax [netbsd-11]: subr.S
Log Message:
Pull up following revision(s) (requested by riastradh in ticket #354):
sys/arch/vax/vax/subr.S: revision 1.44
vax longjmp(9): Fix return value.
PR port-vax/59308: kernel longjmp(9) fails to make setjmp(9) return 1
PR port-vax/60102: kernel longjmp(9) on vax reads stack garbage instead
of returning 1 (patch)
To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.43.4.1 src/sys/arch/vax/vax/subr.S
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60102 CVS commit: [netbsd-10] src/sys/arch/vax/vax
Date: Tue, 30 Jun 2026 09:42:40 +0000
Module Name: src
Committed By: martin
Date: Tue Jun 30 09:42:40 UTC 2026
Modified Files:
src/sys/arch/vax/vax [netbsd-10]: subr.S
Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1298):
sys/arch/vax/vax/subr.S: revision 1.44
vax longjmp(9): Fix return value.
PR port-vax/59308: kernel longjmp(9) fails to make setjmp(9) return 1
PR port-vax/60102: kernel longjmp(9) on vax reads stack garbage instead
of returning 1 (patch)
To generate a diff of this commit:
cvs rdiff -u -r1.41.2.2 -r1.41.2.3 src/sys/arch/vax/vax/subr.S
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60102 CVS commit: [netbsd-9] src/sys/arch/vax/vax
Date: Tue, 30 Jun 2026 09:43:52 +0000
Module Name: src
Committed By: martin
Date: Tue Jun 30 09:43:52 UTC 2026
Modified Files:
src/sys/arch/vax/vax [netbsd-9]: subr.S
Log Message:
Pull up following revision(s) (requested by riastradh in ticket #2028):
sys/arch/vax/vax/subr.S: revision 1.44
vax longjmp(9): Fix return value.
PR port-vax/59308: kernel longjmp(9) fails to make setjmp(9) return 1
PR port-vax/60102: kernel longjmp(9) on vax reads stack garbage instead
of returning 1 (patch)
To generate a diff of this commit:
cvs rdiff -u -r1.36.4.1 -r1.36.4.2 src/sys/arch/vax/vax/subr.S
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.