NetBSD Problem Report #59308

From www@netbsd.org  Thu Apr 17 05:25:43 2025
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)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 510011A9239
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 17 Apr 2025 05:25:43 +0000 (UTC)
Message-Id: <20250417052542.287481A923D@mollari.NetBSD.org>
Date: Thu, 17 Apr 2025 05:25:42 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: kernel longjmp(9) fails to make setjmp(9) return 1
X-Send-Pr-Version: www-1.0

>Number:         59308
>Category:       port-vax
>Synopsis:       kernel longjmp(9) fails to make setjmp(9) return 1
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-vax-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 17 05:30:00 +0000 2025
>Closed-Date:    Tue Jun 30 13:39:04 +0000 2026
>Last-Modified:  Tue Jun 30 13:39:04 +0000 2026
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
set vax jump, jump vax jump
>Environment:
>Description:
Kernel longjmp(9) is supposed to make setjmp(9) return 1 -- it doesn't take a second argument for the return value.  But the vax code does this:

    276 _C_LABEL(longjmp):.word	0
    277 	movl	4(%ap), %r1
    278 	movl	8(%ap), %r0
    279 	movl	(%r1), %ap
    280 	movl	4(%r1), %fp
    281 	movl	12(%r1), %sp
    282 	jmp	*8(%r1)

https://nxr.netbsd.org/xref/src/sys/arch/vax/vax/subr.S?r=1.43#276

That is, it takes 8(%ap), which would hold the second argument if there were two arguments, and returns it.  Since there are not two arguments, it just returns stack garbage -- which might be zero.
>How-To-Repeat:
code inspection
mess with ddb, probably
>Fix:
Change

movl  8(%ap), %r0

to however you spell `load immediate 1 into %r0' in vaxlish.

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Thu, 19 Mar 2026 04:34:51 +0000
State-Changed-Why:
fixed in HEAD, needs pullup-11, pullup-10, pullup-9


From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/59308 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.

State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Mon, 29 Jun 2026 20:04:32 +0000
State-Changed-Why:
fixed in HEAD
pullup-11 #354 https://releng.netbsd.org/cgi-bin/req-11.cgi?show=354
pullup-10 #1298 https://releng.netbsd.org/cgi-bin/req-10.cgi?show=1298
pullpu-9 #2028 https://releng.netbsd.org/cgi-bin/req-9.cgi?show=2028


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/59308 CVS commit: [netbsd-11] src/sys/arch/vax/vax
Date: Tue, 30 Jun 2026 09:41:27 +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/59308 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/59308 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.

State-Changed-From-To: pending-pullups->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Tue, 30 Jun 2026 13:39:04 +0000
State-Changed-Why:
fixed in HEAD, pulled up to 11, 10, and 9


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(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.