all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#70342: 29.3.50; treesitter and RTLD_GLOBAL
@ 2024-04-11 17:38 Michael Lausch
  2024-04-11 18:39 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Lausch @ 2024-04-11 17:38 UTC (permalink / raw)
  To: 70342

[-- Attachment #1: Type: text/plain, Size: 898 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1212 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-11 19:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-11 17:38 bug#70342: 29.3.50; treesitter and RTLD_GLOBAL Michael Lausch
2024-04-11 18:39 ` Eli Zaretskii
2024-04-11 18:47   ` Michael Lausch
2024-04-11 18:54     ` Eli Zaretskii
2024-04-11 19:04       ` Michael Lausch

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.