bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#73167: [PATCH] Fix setjmp/longjmp-related crashes on Windows


From: Ludovic Courtès
Subject: bug#73167: [PATCH] Fix setjmp/longjmp-related crashes on Windows
Date: Sun, 20 Oct 2024 13:05:14 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Hi Michael,

Michael Käppler <xmichael-k@web.de> skribis:

> From f9222ec96209c59c9a9a409c019ff59c0c20917c Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Michael=20K=C3=A4ppler?= <xmichael-k@web.de>
> 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’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]