GNU bug report logs - #70342
29.3.50; treesitter and RTLD_GLOBAL

Previous Next

Package: emacs;

Reported by: Michael Lausch <mick.lausch <at> gmail.com>

Date: Thu, 11 Apr 2024 18:01:03 UTC

Severity: normal

Tags: moreinfo, notabug

Found in version 29.3.50

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#70342: closed (29.3.50; treesitter and RTLD_GLOBAL)
Date: Sat, 01 Mar 2025 23:52:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sat, 1 Mar 2025 15:51:17 -0800
with message-id <CADwFkmnrv0RO0OX8uZCufkbOtW6pYoDoBA5+5BBtuZCfS6C=ug <at> mail.gmail.com>
and subject line Re: bug#70342: 29.3.50; treesitter and RTLD_GLOBAL
has caused the debbugs.gnu.org bug report #70342,
regarding 29.3.50; treesitter and RTLD_GLOBAL
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
70342: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=70342
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Michael Lausch <mick.lausch <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.3.50; treesitter and RTLD_GLOBAL
Date: Thu, 11 Apr 2024 19:38:52 +0200
[Message part 3 (text/plain, inline)]
When loading a treesitter grammar in GNU/Linux, the dlopen() call is used
with the RTLD_GLOBAL flag set. If you load more than one
treesitter grammer, and both grammars define the same functions, most
probably in the scanner.c file, symbol resolution may use the wrong symbol.
For example the org and the yaml grammar both define a deserialize()
function in their scanner.c file. This may result a call from the org
grammar to the yaml defined deserialize() function. This fails, because the
yaml function does different things than the org grammer expects (it's a
free of a dangling pointer and therefore emacs crashes).

A solution can be:
1) use a special call to dlopen without the RTLD_OPEN flag, sim,ilar to
what the eln loader does.
2) fix all the grammars and make all functions 'static' so that the
functions are not visible outside the compilation unit.
3) something i didn't think about
[Message part 4 (text/html, inline)]
[Message part 5 (message/rfc822, inline)]
From: Stefan Kangas <stefankangas <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: casouri <at> gmail.com, mick.lausch <at> gmail.com, 70342-done <at> debbugs.gnu.org
Subject: Re: bug#70342: 29.3.50; treesitter and RTLD_GLOBAL
Date: Sat, 1 Mar 2025 15:51:17 -0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Stefan Kangas <stefankangas <at> gmail.com>
>> Date: Fri, 28 Feb 2025 18:49:50 -0800
>> Cc: Michael Lausch <mick.lausch <at> gmail.com>, 70342 <at> debbugs.gnu.org,
>> 	Yuan Fu <casouri <at> gmail.com>
>>
>> I'd tend to agree.  Should this therefore be closed?
>
> I think so, yes.

Thanks, done.  Please reopen if that's wrong for some reason.


This bug report was last modified 83 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.