From nobody Tue Jan 31 01:47:13 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4P5SbP5nZ5z3c3CK; Tue, 31 Jan 2023 01:47:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P5SbP4c5Qz4krm; Tue, 31 Jan 2023 01:47:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675129633; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UGoWElrKQlErHsmoDUNLrM1Pdhuux+Jl5myt1KiHhDM=; b=fpLXFigozIwiUNvOa5/cuH/45Ns1y7BTj1q9WFzUKld316ru5KwgDZxmpuClVIkT1kHM6t pPRu386tn6RzE9D7NuJ4zrlrvM96SbyJ7pqBn8XbjwiqyrQb2NLv17HqtlT1ph0ntlKnG2 Z6SUBHLN9Wgzb/MdnzgdsVCRXjAtuuG4n/EmG1CHG/uLydqRBRty7ZRsPSx6dt88RfS6pk gLnju6oOwiPDMKj4RJFbfGFRaz1e0lX9C7u/Lt8TFhg7J97nbmEd9+M1R63tKkVA8jPrZe rwUPuqyEfp89HlsvwSyj4HsaM6HjU0Om2D6MA6R3DvaTbAZf5LJGc0QTYh/uGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675129633; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UGoWElrKQlErHsmoDUNLrM1Pdhuux+Jl5myt1KiHhDM=; b=CwbyKYBlXHFtaVGPHSU9eF/DJo+KedKHYk7jNCU1gWXmSFYNi/sQaZqlF42ABNeJ+dQh72 CvgmiyjWp8B6GzVjLBkd0Gg1ecDioRXfun6vz9i5vzdqnk2ziOqPMoQPWfJ995PsNnzm2t XyT6jLZgrJoQ64TWgzMTttPPQedriL9Y1oglrrOpTJxwK9w2urgH/jHwJ0cd0we4497rFC xZY2mgoUJ0R7vjdtrwbz/PCprKSjBwqQetCerGBwtSih2eeqRxcirkrQwVxy/pE1UycjDm ZT1AMEBIxH4hN+Ge+S+JW3QTLROaUhF3PxrJb6ozuu05EnsEsK4ipRmGO+YKlA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675129633; a=rsa-sha256; cv=none; b=XU5ZC9FkUiXhRPQ4XsuN6sBKvBiSZP+iWCHV7Y5dOuQ1X1HTYfql4ITNz9PcbIrUmd9Yje v9CX1muVih7NJ3YcSk0u/6jpdBTA3LFw8MmqFn2pmS6LkyiHntnCHHcndt0n1sPNIQ86Cd sNsNDt6If+Fxy//9oIQU0ThaECsQ/ePcJp/GIn4hgQYkIdlcEXBuFsk6MD6DpDJc0GeL+8 8kMUsf+4HLzB4O+BEOtZudeCnjZ7zSpTHKHpRoiuxs53SB6bBjtpo8IVJ3eRTClH4vmlno fgVp/uyNJK6PYnc7EjS5ubPzVDMEa/CNyfhTkwpm8XFoO+Kgi9R9lrMTclrSBw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4P5SbP3k9zzWhh; Tue, 31 Jan 2023 01:47:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30V1lDqv058689; Tue, 31 Jan 2023 01:47:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30V1lDEX058688; Tue, 31 Jan 2023 01:47:13 GMT (envelope-from git) Date: Tue, 31 Jan 2023 01:47:13 GMT Message-Id: <202301310147.30V1lDEX058688@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: a82b1ca60381 - stable/13 - libc: Fix longjmp/_longjmp(buf, 0) for MIPS List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a82b1ca6038152eb5740552507534842acebede2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=a82b1ca6038152eb5740552507534842acebede2 commit a82b1ca6038152eb5740552507534842acebede2 Author: Jessica Clarke AuthorDate: 2023-01-30 23:55:03 +0000 Commit: Jessica Clarke CommitDate: 2023-01-31 01:46:18 +0000 libc: Fix longjmp/_longjmp(buf, 0) for MIPS Like AArch64 and RISC-V in the past, MIPS fails to handle this special case, and will cause the corresponding setjmp/_setjmp to return 0 rather than 1. Fix this so the newly-added regression tests pass. This is a direct commit to stable/13 as mips no longer exists in main. Reviewed by: arichardson, jhb Differential Revision: https://reviews.freebsd.org/D29363 --- lib/libc/mips/gen/_setjmp.S | 3 +++ lib/libc/mips/gen/setjmp.S | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/libc/mips/gen/_setjmp.S b/lib/libc/mips/gen/_setjmp.S index 10c4cda5e0c1..ba9b89f208c4 100644 --- a/lib/libc/mips/gen/_setjmp.S +++ b/lib/libc/mips/gen/_setjmp.S @@ -183,7 +183,10 @@ LEAF(_longjmp) #endif /* ! __mips_soft_float */ REG_EPILOGUE + bne a1, zero, 1f move v0, a1 # get return value in 1st arg + REG_LI v0, 1 # return 1 if arg is 0 +1: j ra nop diff --git a/lib/libc/mips/gen/setjmp.S b/lib/libc/mips/gen/setjmp.S index 3ef6878bb608..6b8f196735c4 100644 --- a/lib/libc/mips/gen/setjmp.S +++ b/lib/libc/mips/gen/setjmp.S @@ -220,7 +220,10 @@ NESTED(longjmp, LONGJMP_FRAME_SIZE, ra) #endif #endif /* ! __mips_soft_float */ - move v0, a1 + move v0, a1 # get return value in 1st arg + bne a1, zero, 1f # NB: no .set noreorder + REG_LI v0, 1 # return 1 if arg is 0 +1: j ra nop