[Bug 268521] [PATCH] arm64 libc: fix longjmp with 0 value
Date: Thu, 22 Dec 2022 23:36:00 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268521
Bug ID: 268521
Summary: [PATCH] arm64 libc: fix longjmp with 0 value
Product: Base System
Version: Unspecified
Hardware: arm64
OS: Any
Status: New
Severity: Affects Many People
Priority: ---
Component: arm
Assignee: freebsd-arm@FreeBSD.org
Reporter: alois+freebsd@aloisklink.com
Created attachment 238981
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=238981&action=edit
`git format-patch` patch file
On arm64/aarch64, calling `longjmp(x, 0);` makes `setjmp(x)` return 0,
which normally causes an infinite loop, and is against the ISO C
standard for setjmp/longjmp. Instead, using a value of 0 should
make `setjmp` return 1:
> The `longjmp` function cannot cause the `setjmp` macro to return the
> value 0; if `val` is 0, the `setjmp` macro returns the value 1.
>
> _Taken from ยง7.13.2.1.4 of the C99 spec_
This has already been reported in
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255320, but the contributing
docs weren't clear on what to do if I had a patch for an already existing
problem report, so I thought I'd make another problem report so it has
`[PATCH]` in the name.
My commit is also available on GitHub
https://github.com/aloisklink/freebsd-src/tree/fix-longjmp-with-0-val
I also have a patch that adds tests for `longjmp(x, 0)` at
https://github.com/aloisklink/freebsd-src/commit/007af6a46677b143f9544fd30e30a1b9f1048ae6
However, since there might be a few architectures that suffer from this bug,
I'm not 100% sure if this okay to merge. I'll make a new PR for it.
--
You are receiving this mail because:
You are the assignee for the bug.