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

From: Eli Zaretskii <[email-masked]>
Date: Thu, 20 Feb 2025 08:12:20 +0200

> Date: Wed, 19 Feb 2025 20:14:53 +0000
> From: Pip Cet <[email-masked]>
> 
> > It is completely gone after inlining:
> > (gdb) disassemble flush_stack_call_func
> > No symbol "flush_stack_call_func" in current context.
> > (gdb) disassemble flush_stack_call_func1
> > Dump of assembler code for function flush_stack_call_func1:
> >    0x000000000021d870 <+0>:	endbr64
> >    0x000000000021d874 <+4>:	mov    0x5d2955(%rip),%rdx        # 0x7f01d0 <current_thread>
> >    0x000000000021d87b <+11>:	push   %rbp
> >    0x000000000021d87c <+12>:	mov    %rdi,%rax
> >    0x000000000021d87f <+15>:	mov    %rsi,%rdi
> >    0x000000000021d882 <+18>:	mov    %rsp,%rbp
> >    0x000000000021d885 <+21>:	mov    %rbp,0x50(%rdx)
> >    0x000000000021d889 <+25>:	call   *%rax
> >    0x000000000021d88b <+27>:	pop    %rbp
> >    0x000000000021d88c <+28>:	ret
> > End of assembler dump.
> 
> 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.