Subject: bug#76327: 29.4; random segfaults after switch to tree-sitter

From: Pip Cet <[email-masked]>
Date: Thu, 20 Feb 2025 16:38:15 +0000

"Evgeniy Dushistov via \"Bug reports for GNU Emacs, the Swiss army knife of text editors\"" <[email-masked]> writes:

> On Thu, Feb 20, 2025 at 08:12:20AM +0200, Eli Zaretskii wrote:
>> > Try disassembling mark_threads, though I expect that to be okay now, to
>> > be honest.  Something else must be the problem.
>>
>> Based on previous similar problems, removing the -D_FORTIFY_SOURCE=3
>> flag from the build will avoid the crashes with high probability.  I
>> think it is worth our while to see if that's the case with this
>> problem, even if eventually the root cause will be found elsewhere,
>> and _FORTIFY_SOURCE just triggers it somehow.
>
> I removed mention of _FORTIFY_SOURCE:
>
> CFLAGS="-march=nehalem -mtune=znver1 -O2 -pipe -fno-plt -fexceptions \
>         -Wformat -Werror=format-security \
>         -fstack-clash-protection -fcf-protection \
>         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fno-optimize-sibling-calls"

Can you try setting the CFLAGS to plain "-O2", or even "-O0 -g3 -ggdb",
to see whether you get crashes then, too?  I don't know how GCC handles
-fstack-clash-protection, for example, and "-fno-plt" isn't necessarily
harmless either.

(All of your crashes seem to happen right after a longjmp, so looking at
glibc versions might also be worth it.  Maybe it doesn't like being
called except through the PLT?)

Pip