Date: Thu, 22 Dec 2022 23:36:00 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-arm@FreeBSD.org Subject: [Bug 268521] [PATCH] arm64 libc: fix longjmp with 0 value Message-ID: <bug-268521-7@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D268521 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=3D238981&action= =3Dedit `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 =C2=A77.13.2.1.4 of the C99 spec_ This has already been reported in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D255320, but the contrib= uting 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/007af6a46677b143f9544fd30e= 30a1b9f1048ae6 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. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-268521-7>