NetBSD Problem Report #59341

From www@netbsd.org  Tue Apr 22 12:42: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 D8DC31A9239
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 22 Apr 2025 12:42:44 +0000 (UTC)
Message-Id: <20250422124243.B6E3D1A923E@mollari.NetBSD.org>
Date: Tue, 22 Apr 2025 12:42:43 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: _longjmp(..., 0) makes _setjmp return zero
X-Send-Pr-Version: www-1.0

>Number:         59341
>Category:       lib
>Synopsis:       _longjmp(..., 0) makes _setjmp return zero
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 22 12:45:00 +0000 2025
>Closed-Date:    Tue Apr 22 13:10:56 +0000 2025
>Last-Modified:  Tue Apr 22 13:10:56 +0000 2025
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
The _LongBSD Foundazero
>Environment:
>Description:
On mips, _longjmp doesn't force the argument to be nonzero, so tests/lib/libc/setjmp/t_setjmp:_longjmp_zero fails.

The same problem has plagued kernel setjmp/longjmp and I filed too many MD PRs for that, so let's just keep one PR here and a checklist for a systematic audit of longjmp, _longjmp, and siglongjmp:

[x] aarch64
[x] alpha
[x] arm
[x] hppa
[x] i386
[x] ia64
[x] m68k
[ ] mips
[x] or1k
[x] powerpc
[x] powerpc64
[x] riscv
[x] sh3
[x] sparc
[x] sparc64
[x] vax
[x] x86_64
>How-To-Repeat:
cd /usr/tests/lib/libc/setjmp
atf-run t_setjmp | atf-report
>Fix:
Yes, please!

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Tue, 22 Apr 2025 13:10:56 +0000
State-Changed-Why:
I reviewed all the longjmps and compat longjmps in libc, and it turns
out mips is the only one missing the return value fixup, and so this
is just a duplicate of the issue I already filed last week and forgot
about:

port-mips/59285: _longjmp(..., 0) makes setjmp return 0, not 1


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