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:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 17 05:30:00 +0000 2025
>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.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.