NetBSD Problem Report #59306
From www@netbsd.org Thu Apr 17 05:12:45 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 686E61A9239
for <gnats-bugs@gnats.NetBSD.org>; Thu, 17 Apr 2025 05:12:45 +0000 (UTC)
Message-Id: <20250417051244.2D4FB1A923D@mollari.NetBSD.org>
Date: Thu, 17 Apr 2025 05:12:44 +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: 59306
>Category: port-powerpc
>Synopsis: kernel longjmp(9) fails to make setjmp(9) return 1
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: port-powerpc-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Apr 17 05:15:00 +0000 2025
>Last-Modified: Tue Apr 29 11:00:03 +0000 2025
>Originator: Taylor R Campbell
>Release: current
>Organization:
i'm out of clever names tonight foundation
>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 powerpc code does this:
103 mr %r3, %r4
104 blr
https://nxr.netbsd.org/xref/src/sys/arch/powerpc/powerpc/setjmp.S?r=1.4
powerpc ABI puts arguments in %r3, %r4, ..., and return value in %r3, so this returns whatever garbage is in the register for the second argument -- garbage because kernel longjmp doesn't take a second argument.
>How-To-Repeat:
code inspection
mess with ddb, probably
>Fix:
Change
mr %r3, %r4
to
li %r3, 1
>Audit-Trail:
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/59306 CVS commit: src/sys/arch/powerpc/powerpc
Date: Tue, 29 Apr 2025 10:56:38 +0000
Module Name: src
Committed By: martin
Date: Tue Apr 29 10:56:38 UTC 2025
Modified Files:
src/sys/arch/powerpc/powerpc: setjmp.S
Log Message:
PR port-powerpc/59306: kernel longjmp(9) only takes one argument,
always make setjmp(9) return 1.
Change as suggested by Taylor.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/powerpc/powerpc/setjmp.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/59306 CVS commit: src/tests/kernel
Date: Tue, 29 Apr 2025 10:57:18 +0000
Module Name: src
Committed By: martin
Date: Tue Apr 29 10:57:17 UTC 2025
Modified Files:
src/tests/kernel: t_setjmp.sh
Log Message:
PR port-powerpc/59306 has been fixed, remove expected failure.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/kernel/t_setjmp.sh
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
(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.