From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Newsgroups: gmane.lisp.guile.bugs Subject: bug#73167: [PATCH] Fix setjmp/longjmp-related crashes on Windows Date: Sun, 20 Oct 2024 13:05:14 +0200 Message-ID: <87ed4bm3v9.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29193"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 73167-done@debbugs.gnu.org To: Michael =?UTF-8?Q?K=C3=A4ppler?= Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Sun Oct 20 13:08:05 2024 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t2Tn2-0007UW-OV for guile-bugs@m.gmane-mx.org; Sun, 20 Oct 2024 13:08:04 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t2Tmc-0006Mf-Sa; Sun, 20 Oct 2024 07:07:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t2Tmb-0006MJ-T8 for bug-guile@gnu.org; Sun, 20 Oct 2024 07:07:37 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t2Tmb-0007rQ-K5 for bug-guile@gnu.org; Sun, 20 Oct 2024 07:07:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=8autpRsQqmCx57tSSee55GpmJ8KP+Pffl7e4gQM3P8A=; b=pvf6IKi/7JKWKoxvuRzmPvzntexDHf+n+uoD1IpomyQTvcVF5eYAfoV1br34y2lSfha4qsT6Y85UEKoNoehXVqnLrZLiTFwf5sjwoM7c8enxyZPb6jPwEVL7QtVLVkEoEECCAfMiL9XlT3IOYTj6xHspAa9F7awE9qna4sA2riGftuhUUZqy5UeR1aJbImO5Ixbu/lrX7ihaX9NZP49re1BVDMCpnHSMzLDP9oQl617XqnuWvdWeP9Q46sF4RF4fC7Yc++xsyfyLUkwrM2KyvFtT9u90zuxQyemAjYqDTH6dvNvOwHu41zcRm9HZmEBX5fTrcmCS1srQphGA+FBNgQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t2Tn0-00015a-IR for bug-guile@gnu.org; Sun, 20 Oct 2024 07:08:02 -0400 Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-To: bug-guile@gnu.org Resent-Date: Sun, 20 Oct 2024 11:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 73167 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch Mail-Followup-To: 73167@debbugs.gnu.org, ludo@gnu.org, xmichael-k@web.de Original-Received: via spool by 73167-done@debbugs.gnu.org id=D73167.17294224794172 (code D ref 73167); Sun, 20 Oct 2024 11:08:02 +0000 Original-Received: (at 73167-done) by debbugs.gnu.org; 20 Oct 2024 11:07:59 +0000 Original-Received: from localhost ([127.0.0.1]:46007 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2Tmw-00015E-P3 for submit@debbugs.gnu.org; Sun, 20 Oct 2024 07:07:59 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53496) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2Tmv-00014x-50 for 73167-done@debbugs.gnu.org; Sun, 20 Oct 2024 07:07:57 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t2TkL-0007gp-3Y; Sun, 20 Oct 2024 07:05:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=8autpRsQqmCx57tSSee55GpmJ8KP+Pffl7e4gQM3P8A=; b=hnqP3XTK+cjT+eaNoOi+ +t56BvKG0ZqJHKwBRlBGoYaQHYua3qcKVzw8APoon82fzF36709EFBiW/CfUD32FPuUHXqDPmXRKr wI7cPafArU2gy2a7QcuaQZdaBRiNi0q/6WXa78AupFpXJ0EULnZ4zYCR0ZeQgvWqZeQ1sWVp79LzY 2qOWXVAumLaKb5ustbhylXIwY/whIpvOD5ahMpnQv088DikDmH2KX+RFn36RgH0lIZV3vWnHAmLrW OFskiuOFXDuTtDoZLI4EvcrRWMg+4uMmja4o70iQa+hlylnoVhy7reZeyE4yq6KEj45xviQ5xKMq8 P+axbOatvlwlKA==; In-Reply-To: ("Michael =?UTF-8?Q?K=C3=A4ppler?="'s message of "Tue, 10 Sep 2024 14:45:40 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.bugs:11043 Archived-At: Hi Michael, Michael K=C3=A4ppler skribis: > From f9222ec96209c59c9a9a409c019ff59c0c20917c Mon Sep 17 00:00:00 2001 > From: =3D?UTF-8?q?Michael=3D20K=3DC3=3DA4ppler?=3D > Date: Sat, 7 Sep 2024 22:52:22 +0200 > Subject: [PATCH] Fix setjmp/longjmp-related crashes on Windows > > * libguile/Makefile.am: add new header file setjump-win.h > * libguile/continuations.h, libguile/dynstack.c, libguile/dynstack.h, > libguile/intrinsics.h, libguile/vm.h: > supply custom `setjmp` macro on Windows > > Mingw implements `setjmp (env)` as a macro that expands to > > _setjmp (env, faddr) > > where `faddr` is set to the current frame address. > > This address is then stored as first element in the jump buffer `env`. > When `longjmp` is called, it tries to unwind the stack up > to the saved address by calling `RtlUnwindEx` from MSVCRT, > which will fail, if the stack frames are interwoven with > JIT-generated code, that violate the Windows x64 calling conventions. > > Thus implement the macro ourselves as > > _setjmp (env, NULL) > > which will toggle a code path in `longjmp` that does no unwinding. Applied, thanks! Ludo=E2=80=99.