From unknown Sat Jun 21 10:40:20 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#70342 <70342@debbugs.gnu.org> To: bug#70342 <70342@debbugs.gnu.org> Subject: Status: 29.3.50; treesitter and RTLD_GLOBAL Reply-To: bug#70342 <70342@debbugs.gnu.org> Date: Sat, 21 Jun 2025 17:40:20 +0000 retitle 70342 29.3.50; treesitter and RTLD_GLOBAL reassign 70342 emacs submitter 70342 Michael Lausch severity 70342 normal tag 70342 notabug moreinfo thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 11 14:00:49 2024 Received: (at submit) by debbugs.gnu.org; 11 Apr 2024 18:00:49 +0000 Received: from localhost ([127.0.0.1]:57266 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruyj7-0007VJ-Qt for submit@debbugs.gnu.org; Thu, 11 Apr 2024 14:00:49 -0400 Received: from lists.gnu.org ([2001:470:142::17]:46592) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruyOR-0004fq-Oi for submit@debbugs.gnu.org; Thu, 11 Apr 2024 13:39:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ruyOA-000492-IR for bug-gnu-emacs@gnu.org; Thu, 11 Apr 2024 13:39:06 -0400 Received: from mail-yw1-x112f.google.com ([2607:f8b0:4864:20::112f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ruyO8-0000FC-W2 for bug-gnu-emacs@gnu.org; Thu, 11 Apr 2024 13:39:06 -0400 Received: by mail-yw1-x112f.google.com with SMTP id 00721157ae682-617e42a3f94so62026737b3.2 for ; Thu, 11 Apr 2024 10:39:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712857143; x=1713461943; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=IBFArqmHMGkXvXVhGK8TswbLH9bFO1Ys+DfP9YZpj9g=; b=gpMsGg6N+TwVGawwBkLppp1w6hD7Cl5ot0Xz13YM4HE8B5AYn+eFdUsWdipimoaXR6 UKZbF9qdU3zwN3UAaIyTEK2ULVZZ0xk3GB87k/WXiGU5xAdXGihPiCzNf4vU3kU6CWc8 PRrpayvQYYV1xI01ruWm5+gZggqBeqWIlUTUJDu0S4+cfpmLAcGVyJsp1Ds2bStkdW7m VYmj+KrhWpXzSFD6qEWTr48KR6bfpR2H92RXXmpjEamhPEBfyxCoZcZQBVSnIPQV1y2k A+3gkzYQJIcc0WbRyKGnm8ApdthBiOfEiFlQIYcFL5OT42ToVwT6biqA4++kEKM4aoDT whaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712857143; x=1713461943; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=IBFArqmHMGkXvXVhGK8TswbLH9bFO1Ys+DfP9YZpj9g=; b=vDX4EWmvwr3ZkJIJ2pWRLlpO8lsshHbfOEr7WvVFLTYdS3Wp6zNJL4TrKHyuzq6bqy PGIV0vkSBzH1UQBc/sIuVGCOv9AnFPopO93IHPkbuoTPNUwnzl81Zegdjsrzt575jJLI GawsWLwXfYBoylCr/U7oB40UnSIY/cNIUDyFxFr807cBZ2z6lnA3PS3OEVejVWDy8WQa 99QX653aE/uYE/KNDORwIz1oN7hjdSfLxBK13RRmqqHPZ4hatnTVMWT7ge8OdwjZkOsX RQxiseXX1Vq4YF1QM6/xeDjUnQExyc4roVJ+pwJpIJbvrpGjPuH2AIB9x8r95AY985UR UbfA== X-Gm-Message-State: AOJu0Yx0WhEx4nq2cFrJmXo0HrLL5lXHZ6/wOObPYi71Ff5MVvIzzHzb ISdyju+6sPUoF+9wsFhmMo4XIgZn4hi+LFt+HQeFxwh7gyrjPaNsiPwobZ3TCAJ07ds02fl8aYA lY62i2Zd/k715xYlnW2TfdoK3SJd2Et9QUos= X-Google-Smtp-Source: AGHT+IE2JuSUvrwFCcekLwDX3vUYTN+Of82iegj4kNY32bV1PuEhLAozdCfXFjveixkuIt/T7U7HVFViLQFmAr8ejb8= X-Received: by 2002:a05:690c:f11:b0:615:4b83:bafe with SMTP id dc17-20020a05690c0f1100b006154b83bafemr133955ywb.38.1712857143059; Thu, 11 Apr 2024 10:39:03 -0700 (PDT) MIME-Version: 1.0 From: Michael Lausch Date: Thu, 11 Apr 2024 19:38:52 +0200 Message-ID: Subject: 29.3.50; treesitter and RTLD_GLOBAL To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary="000000000000902c780615d5a161" Received-SPF: pass client-ip=2607:f8b0:4864:20::112f; envelope-from=mick.lausch@gmail.com; helo=mail-yw1-x112f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 11 Apr 2024 14:00:40 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --000000000000902c780615d5a161 Content-Type: text/plain; charset="UTF-8" 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 --000000000000902c780615d5a161 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
When load= ing a treesitter=C2=A0grammar in GNU/Linux, the dlopen() call is used with = the RTLD_GLOBAL flag set. If you load more than one treesitter=C2=A0grammer= , and both grammars define the same functions, most probably=C2=A0in the sc= anner.c file, symbol resolution may use the wrong symbol.
For exa= mple the org and=C2=A0the yaml grammar both define a deserialize() function= in their scanner.c file. This may result a call from the org grammar to th= e yaml defined deserialize() function. This fails, because the yaml functio= n does different things than the org grammer expects (it's a free of a = dangling pointer and therefore emacs crashes).=C2=A0

A solution can be:
1) use a special call to dlopen without the= RTLD_OPEN flag, sim,ilar to what the eln loader does.=C2=A0
2) f= ix all the grammars and make all functions 'static' so that the fun= ctions are not visible=C2=A0outside the compilation unit.=C2=A0
3= ) something i didn't think about


=C2=A0
--000000000000902c780615d5a161-- From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 11 14:39:37 2024 Received: (at 70342) by debbugs.gnu.org; 11 Apr 2024 18:39:38 +0000 Received: from localhost ([127.0.0.1]:57287 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruzKj-0003uf-Jx for submit@debbugs.gnu.org; Thu, 11 Apr 2024 14:39:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40866) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruzKg-0003tf-Ni for 70342@debbugs.gnu.org; Thu, 11 Apr 2024 14:39:36 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ruzKR-0001GN-TS; Thu, 11 Apr 2024 14:39:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=OVqXZ6YtKjfF4uw6KRnImKBkO5uQ1+h6AKBO92qIguc=; b=Y0jAoigRVQ7Q E5qQ1d+PbS7e/eAhCO3JuIE/SpEjbUSmqK0qmY30FnW3lHr94L3Hz81eL5qRuJJ5cCiWf5IsGaRxB z16UzsijYcMe/7borWZgjoym0WtA3TVioJyAs69NbTt3/U+9Uao/HV4tK4DCd7LTDIkJxcyAkvNYJ nVEUR31/kgBFlRPjbixNx00hootMnSS3xT7G59O/QPzmNrF7MRHdu/FJ0om15IvjG3imWDEVuRkfd mztU7n23lIehLjJH2JVaEvCF6S8Z/txRnTCf5wwkZoQYU6rjZg1LukWwWI4m7/9FNEp86GkBzJJB6 5fvDCHocU+M1t8G0EQX86A==; Date: Thu, 11 Apr 2024 21:39:16 +0300 Message-Id: <86jzl3u4kr.fsf@gnu.org> From: Eli Zaretskii To: Michael Lausch In-Reply-To: (message from Michael Lausch on Thu, 11 Apr 2024 19:38:52 +0200) Subject: Re: bug#70342: 29.3.50; treesitter and RTLD_GLOBAL References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 70342 Cc: 70342@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Michael Lausch > Date: Thu, 11 Apr 2024 19:38:52 +0200 > > 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 If those 'serialize' functions are not needed to be called from outside of the shared library, the usual way is not to export them, i.e. to give all symbols except the few that need to be exported the so-called "hidden visibility". From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 11 14:55:01 2024 Received: (at 70342) by debbugs.gnu.org; 11 Apr 2024 18:55:01 +0000 Received: from localhost ([127.0.0.1]:57305 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruzZd-0005xQ-4u for submit@debbugs.gnu.org; Thu, 11 Apr 2024 14:55:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49058) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruzZZ-0005wH-Pr for 70342@debbugs.gnu.org; Thu, 11 Apr 2024 14:54:58 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ruzZK-0003Qe-Ua; Thu, 11 Apr 2024 14:54:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=nH4ggaIfCbqkfXfSyMrELyai2c0reiMNVU8YToaVVjA=; b=Ev2VKf3rNwYH cfABGhEE10hQmzo6RXRXy27aqq7Ilv5629Pvzba+PUR9HQyGUUpkE/GM7sWH9/w8nckiw+XwcZMfQ 4gX7t64+lTcEGmLtDrKoN/FUbj3b4BFRnxSSddUNL5c1bzYMJypVHugSAdexZdXzyU6lFfH2C5GpQ 7o86bnBZt4s6WIJ/mleSZPGa9BQkRncLt/3GPE1mRpl6xoKEzEsOO5qh5tfHZToYhu3KPlgOJbtTv qj2xzhaZGp/LDL/w/A0BUwhmuZVl7Kd7VQKbmUFspTtQe6sN+9RBQek92eg4etrULprs4xsojgfUA Y8zBWHNgBAIdY9j3QzE6dA==; Date: Thu, 11 Apr 2024 21:54:39 +0300 Message-Id: <86il0nu3v4.fsf@gnu.org> From: Eli Zaretskii To: Michael Lausch In-Reply-To: (message from Michael Lausch on Thu, 11 Apr 2024 20:47:50 +0200) Subject: Re: bug#70342: 29.3.50; treesitter and RTLD_GLOBAL References: <86jzl3u4kr.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 70342 Cc: 70342@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Michael Lausch > Date: Thu, 11 Apr 2024 20:47:50 +0200 > Cc: 70342@debbugs.gnu.org > > > 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 > > If those 'serialize' functions are not needed to be called from > outside of the shared library, the usual way is not to export them, > i.e. to give all symbols except the few that need to be exported the > so-called "hidden visibility". > > I agree that this would be the cleanest way to solve the problem, but that would mean to patch all the existing > grammars and maybe all the future grammars and push the changes to their maintainers. > > I started to prep patches for the yaml and org grammar (those were the ones which triggered the bug for me) > and i'm going to have them merged upstream. I understand, but why is this an Emacs problem? We use RTLD_GLOBAL for a reason, and the problem of not exposing unnecessary symbols should be solved by the respective libraries and those who build them. From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 12 00:10:03 2024 Received: (at 70342) by debbugs.gnu.org; 12 Apr 2024 04:10:03 +0000 Received: from localhost ([127.0.0.1]:57557 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rv8Ej-0005tU-HX for submit@debbugs.gnu.org; Fri, 12 Apr 2024 00:10:03 -0400 Received: from mail-yb1-xb2e.google.com ([2607:f8b0:4864:20::b2e]:50413) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruzT6-00051k-Uc for 70342@debbugs.gnu.org; Thu, 11 Apr 2024 14:48:17 -0400 Received: by mail-yb1-xb2e.google.com with SMTP id 3f1490d57ef6-dcc80d6006aso127243276.0 for <70342@debbugs.gnu.org>; Thu, 11 Apr 2024 11:48:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712861282; x=1713466082; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ZiXJhQeX4IrTGrvf8HFkiCkckUPyjs+4/EhdDyl0+bg=; b=HRSuBdDc+tY6xbhFtLj7m5N91ER31W/87cOJp/hi4YYD5TGY8B/fxGfwyxRqdyDPyw zDdCxtZBl78ffzgrp8DbJMZ7affitIYAgsRmCbnsyCXVM9c3TFP4ZVIVGELDFUNZP1Ww XtOLPvsj7NMqNNeYMJBhSnIMdO1ZGy1HaaO4JCWCy7+HlQ4bbrJYEXNwwqs0VjQzUdA7 FXAGEFR4IolfE0pS+NhMZOb31IYh2ipGD1rUnr1KVO+Ki6SQ8ndeFsAMbdxJylH04mwh 0yPFZyqc0pK5QN2bzB9SmKZml3ZdMjJaY3QqiRoYpBZdhQqoHAQLSyvBraEWm9Ej8kyN mKfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712861282; x=1713466082; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ZiXJhQeX4IrTGrvf8HFkiCkckUPyjs+4/EhdDyl0+bg=; b=pWZiGd5exUnelQe0EJcWNEjmeD93oOlFsOIjKlBGIh69C88gtkycMbYhDLCPQmWBqM VXNYKY3RqRYNovCMMCwNINm8uzGIculboMfYDTg0AFBd5IJtdPWtEdG9lIMD44LdqNUD fT0teHBsACHtFzUj+seww6UzxZISmecg1pwjkiK7fRMIgKgo9+FJG0to4qCygUd5+pFM Ff446ki0QsdvuwSVYgVplAAaIb+t6Fg5Rodisc6UsoE74xZyfu50Nx9jhFqS5XfHOXX3 pfVNUwIBuaKdtDdTX1yla+AEgcMyuCzKLbOt6WhMKI/OZ9wITXFf42glJijf60zbx155 MwRQ== X-Gm-Message-State: AOJu0YzKhfsPGw+FZwfj8wZm3UkfYbqNJCoqVgBcVpb4hAf3c6BdMHOW QnA3YheogvoFyQAIpslhMPqgJYjb7d29S0PGv/54LrBEWXpIA0vIcPyomkFMkqOIcYfS7AFr4Mh owwLdAAJmN11HH4dfsS0XaonX9bk= X-Google-Smtp-Source: AGHT+IG6jzMsVszTexRexNBXLwApXPNYr072W/k/SlmfdyQtqSwPC9YX3k6H6xT1FVjZTz6+zCz76jSbnx4FELHFiWo= X-Received: by 2002:a05:6902:528:b0:dc6:deca:468f with SMTP id y8-20020a056902052800b00dc6deca468fmr423658ybs.29.1712861281765; Thu, 11 Apr 2024 11:48:01 -0700 (PDT) MIME-Version: 1.0 References: <86jzl3u4kr.fsf@gnu.org> In-Reply-To: <86jzl3u4kr.fsf@gnu.org> From: Michael Lausch Date: Thu, 11 Apr 2024 20:47:50 +0200 Message-ID: Subject: Re: bug#70342: 29.3.50; treesitter and RTLD_GLOBAL To: Eli Zaretskii Content-Type: multipart/alternative; boundary="0000000000003fe3360615d69858" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 70342 X-Mailman-Approved-At: Fri, 12 Apr 2024 00:10:00 -0400 Cc: 70342@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000003fe3360615d69858 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Apr 11, 2024 at 8:39=E2=80=AFPM Eli Zaretskii wrote: > > From: Michael Lausch > > Date: Thu, 11 Apr 2024 19:38:52 +0200 > > > > 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 fre= e > 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 > > If those 'serialize' functions are not needed to be called from > outside of the shared library, the usual way is not to export them, > i.e. to give all symbols except the few that need to be exported the > so-called "hidden visibility". > I agree that this would be the cleanest way to solve the problem, but that would mean to patch all the existing grammars and maybe all the future grammars and push the changes to their maintainers. I started to prep patches for the yaml and org grammar (those were the ones which triggered the bug for me) and i'm going to have them merged upstream. --0000000000003fe3360615d69858 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Thu, Apr 11, 2024 at 8:39=E2=80=AF= PM Eli Zaretskii <eliz@gnu.org> w= rote:
> From:= Michael Lausch <mick.lausch@gmail.com>
> Date: Thu, 11 Apr 2024 19:38:52 +0200
>
> When loading a treesitter grammar in GNU/Linux, the dlopen() call is u= sed with the RTLD_GLOBAL flag set. If
> you load more than one treesitter grammer, and both grammars define th= e 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() f= unction 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 t= o what the eln loader does.
> 2) fix all the grammars and make all functions 'static' so tha= t the functions are not visible outside the
> compilation unit.
> 3) something i didn't think about

If those 'serialize' functions are not needed to be called from
outside of the shared library, the usual way is not to export them,
i.e. to give all symbols except the few that need to be exported the
so-called "hidden visibility".

I agree that this would be the cleanest way to solve the problem, but tha= t would mean to patch all the existing grammars and maybe all the future gr= ammars and push the changes to their maintainers.

= I started to prep patches for the yaml and org grammar (those were the ones= which triggered the bug=C2=A0for me) and i'm going to have them merged= upstream.=C2=A0
=C2=A0
--0000000000003fe3360615d69858-- From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 12 00:10:08 2024 Received: (at 70342) by debbugs.gnu.org; 12 Apr 2024 04:10:08 +0000 Received: from localhost ([127.0.0.1]:57559 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rv8El-0005tn-M5 for submit@debbugs.gnu.org; Fri, 12 Apr 2024 00:10:07 -0400 Received: from mail-yb1-xb2c.google.com ([2607:f8b0:4864:20::b2c]:52530) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruzjc-0007Gs-Sn for 70342@debbugs.gnu.org; Thu, 11 Apr 2024 15:05:25 -0400 Received: by mail-yb1-xb2c.google.com with SMTP id 3f1490d57ef6-dc6dcd9124bso150868276.1 for <70342@debbugs.gnu.org>; Thu, 11 Apr 2024 12:05:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712862306; x=1713467106; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=vHNDECy5GTpgeeXVS4hfKJcFFdjUBWWJkuY2lSDoWWg=; b=mNotD2gnwGvBV0XH3Wyzpt37Olwk/6A1mFl2qBLBcYqeS4bGj9/2chXNeoVgzPEdIn k0EuXPOe4X+5m6UaqnONZ0eU4tDhm9YV9W2I/kHYJ9NKA0RRK3qwruKQM7mJFVXhEdvW IHiM6l+daQ+irXjrgrqX08+IwNLYIwD6UAbwmYeQHGd0ZzS2med1I6ndileuhjdfc3QC /WyNwDayge/5eX82+5xG29sr4pcAsrnzy3gG1GUYna7jyKpOM/vi0EHKMn3tzCcHQe2u 1gmtmOIbknQSmBEsggDASfVPgCLfkn1dJ17KafI/YYjZymm72AC3XethrjcYlDV197/j yKSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712862306; x=1713467106; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vHNDECy5GTpgeeXVS4hfKJcFFdjUBWWJkuY2lSDoWWg=; b=NAvtXxpc6QkVcY1UbM+jZVqEHjkYc5LpB3BBowK6jLkntJt3OogCtbvFZ50UQDnf/x 11cqnMlQfHKrPejStbV5zgpOTeR8/hb5MDa7ntInibxm1RWGiJ50VGY0unMGO2APJVsO OhRx4u5W2MGt3hOX1ByZE6Jxobu+eRszpkhvLfra2sYq5hOvQ+K3RbKAT+TVSRd3EWGb zoGiAwGVmYtl3f3g4fKslHj3izW7he/qgvXKqsYKo0eAB/uowoOjlFueTJ20aegAfIdO 1ygQ/YAed862D2CWVPEjcOe34eYB7a17EwtE4r8zJX1ZNNKF5NFsPYotucs/IRa4UzX/ zkzA== X-Gm-Message-State: AOJu0YxOo8ZTamHgdYvLDsIv5Lo0e1MPLwTz/yX4qvtkqaPULnMr6B6R 9NbQ5AtB6dSLU067yh5uJ3Rwqcu3fmEMGBBNEDNp77N+/9PcA28/7M+IphM28KK77hzzdvNTKUm Ml77ryQBtrDDCpl6ZIF8E/drs3j0= X-Google-Smtp-Source: AGHT+IF8yfnDo6/g4GPLlroGN/OO6inYKbmTWsDjqHi0gjN/7+5yTlA8XAF9aECP8K2jJqzqIBXQ3pSVmsoQk8M2FgI= X-Received: by 2002:a25:d6c4:0:b0:dc2:3f75:1f79 with SMTP id n187-20020a25d6c4000000b00dc23f751f79mr445135ybg.23.1712862305679; Thu, 11 Apr 2024 12:05:05 -0700 (PDT) MIME-Version: 1.0 References: <86jzl3u4kr.fsf@gnu.org> <86il0nu3v4.fsf@gnu.org> In-Reply-To: <86il0nu3v4.fsf@gnu.org> From: Michael Lausch Date: Thu, 11 Apr 2024 21:04:55 +0200 Message-ID: Subject: Re: bug#70342: 29.3.50; treesitter and RTLD_GLOBAL To: Eli Zaretskii Content-Type: multipart/alternative; boundary="0000000000004782c70615d6d5b7" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 70342 X-Mailman-Approved-At: Fri, 12 Apr 2024 00:10:00 -0400 Cc: 70342@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000004782c70615d6d5b7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Apr 11, 2024 at 8:54=E2=80=AFPM Eli Zaretskii wrote: > > From: Michael Lausch > > Date: Thu, 11 Apr 2024 20:47:50 +0200 > > Cc: 70342@debbugs.gnu.org > > > > > 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 > > > > If those 'serialize' functions are not needed to be called from > > outside of the shared library, the usual way is not to export them, > > i.e. to give all symbols except the few that need to be exported the > > so-called "hidden visibility". > > > > I agree that this would be the cleanest way to solve the problem, but > that would mean to patch all the existing > > grammars and maybe all the future grammars and push the changes to thei= r > maintainers. > > > > I started to prep patches for the yaml and org grammar (those were the > ones which triggered the bug for me) > > and i'm going to have them merged upstream. > > I understand, but why is this an Emacs problem? We use RTLD_GLOBAL > for a reason, and the problem of not exposing unnecessary symbols > should be solved by the respective libraries and those who build them. > You are completely right, the thing is that it may take a long time to fix all the grammars and in the meantime, whenever someone loads two buggy grammars in the same emacs process, it will crash emacs. And that causes more bug reports against emacs, even if it isn't an emacs problem. The addition of yet another dlopen() function may mitigate this, but i think that would lead to not fixing the grammars, because it then works. Therefore i created a bug, instead submitting a patch. --0000000000004782c70615d6d5b7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Thu, Apr 11, 2024 at 8:54=E2=80=AF= PM Eli Zaretskii <eliz@gnu.org> w= rote:
> From:= Michael Lausch <mick.lausch@gmail.com>
> Date: Thu, 11 Apr 2024 20:47:50 +0200
> Cc: 70342@d= ebbugs.gnu.org
>
>=C2=A0 > A solution can be:
>=C2=A0 > 1) use a special call to dlopen without the RTLD_OPEN flag,= sim,ilar to what the eln loader does.
>=C2=A0 > 2) fix all the grammars and make all functions 'static&= #39; so that the functions are not visible outside the
>=C2=A0 > compilation unit.
>=C2=A0 > 3) something i didn't think about
>
>=C2=A0 If those 'serialize' functions are not needed to be call= ed from
>=C2=A0 outside of the shared library, the usual way is not to export th= em,
>=C2=A0 i.e. to give all symbols except the few that need to be exported= the
>=C2=A0 so-called "hidden visibility".
>
> I agree that this would be the cleanest way to solve the problem, but = that would mean to patch all the existing
> grammars and maybe all the future grammars and push the changes to the= ir maintainers.
>
> I started to prep patches for the yaml and org grammar (those were the= ones which triggered the bug for me)
> and i'm going to have them merged upstream.

I understand, but why is this an Emacs problem?=C2=A0 We use RTLD_GLOBAL for a reason, and the problem of not exposing unnecessary symbols
should be solved by the respective libraries and those who build them.
<= /blockquote>

You are completely=C2=A0right, the thing is= that it may take a long time to fix all the grammars=C2=A0and in the meant= ime,=C2=A0
whenever someone loads two buggy grammars in the same = emacs process, it will crash emacs. And that=C2=A0
causes more bu= g reports against emacs, even if it isn't an emacs problem.
<= br>
The addition of yet another dlopen() function may mitigate th= is, but i think that would lead to not fixing=C2=A0
the grammars,= because it then works.=C2=A0

Therefore i created= =C2=A0a bug, instead submitting a patch.
--0000000000004782c70615d6d5b7-- From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 28 21:50:00 2025 Received: (at 70342) by debbugs.gnu.org; 1 Mar 2025 02:50:00 +0000 Received: from localhost ([127.0.0.1]:56584 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1toCvP-00074f-UI for submit@debbugs.gnu.org; Fri, 28 Feb 2025 21:50:00 -0500 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]:60782) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1toCvN-00073r-DL for 70342@debbugs.gnu.org; Fri, 28 Feb 2025 21:49:57 -0500 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-5e4d3f92250so3048045a12.1 for <70342@debbugs.gnu.org>; Fri, 28 Feb 2025 18:49:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740797391; x=1741402191; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=OiqJjtJIOxj1C9YJkm7+DyJIq5olTbEEFsImTXk6qp0=; b=T2SaAJcyKGDpd4u8/SNG4Pn7CH3g9Y4RDq8jlmMaXoP8EJjVHlDZVLnf9qfL6zDrGR p/UYYmzasSRcOptjtz5reMgdrmdkTIWJdZDRv+8wJYuHp6WjvacOhhD3u9exTAcwgAX1 mNF766mOMZ6Rkj9H0NE5VN5gs27hImFoJUDqAhTtZbCiV5PL2lG66gvmFWNGaYRFAmi5 wqt2+iqAtya8sZkLu5b12AkPb9YQUU+vcetvyegFYunggkbhm0K1VK8e31L2WPrc0vkZ TTBtcXpdslFKAPRljyegA1LavYBUVS0xkMbBWDGM/TzBQDrA+bPN0iQi5py/r04AG94P n5XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740797391; x=1741402191; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OiqJjtJIOxj1C9YJkm7+DyJIq5olTbEEFsImTXk6qp0=; b=dZGai5F+Wj2sDdZFqMbVMB9Inywc5Ik55wHxCDHkP7o9JmE5MtTcdEoMmF0MYvEpTG s3sdJl8Fn52HrlCMs6UCG9Kby80vEJnLmG4AP5rVIXV7merMBiWHA6BNnEYIz6UnJWJd oD7x9V22Qo2igJpIYRvd5CU42avy8/Gn+gCQBn7xjskyXniHZ4IKd/jlhKZQE8tTJONX wtrNE4kOaOAgkfQj8dLM5JLYtWM+mavEiqfO6rMo25B3uq4pNX1hK5NZnf538+Ru59V9 8JaS2ijtq9mSMGabHWjouTDH0sfYELz9+QVhjxQ0QU2M82AjDj1SqVb+3GkC4o50fFxr CVng== X-Forwarded-Encrypted: i=1; AJvYcCWZU6FTkY9PF/tub3IXEsTGDECiBEEDDZ3e/DaJKD4UKLg8h1jsTl09X48M/PFfqO+PVo4dRw==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzFAe5Km48qQjA0Bh9SntbzwrsgW5EH8E99dEuoYW0IjO6+G2eS c8WE/aNkSeMTEGKQwQZhGNm0Fx2Ptrnz6Wn/yIgOj6HgCv2W5vLuMqv1JKbxh9RguI1VPc5uTbc +NggBFjeb0kHKfHsdiZeDJQvzEWCITJ7uASI= X-Gm-Gg: ASbGncspax/bNzqPBJIK+RpBhP0NLe0WeDYzMjDt9spiSyHt2rDRR7cXE5/CraSLM/+ SUHk3Cz56w8b3clZlJFfTWaK1ZghHKmR0CXl0ZiQSoYIExpjWEWecdb6X6vHAGOjpHlIjcqJxb5 o+FcnfXpXr+ayUp3N1juGdRp8vGQc= X-Google-Smtp-Source: AGHT+IG8R/ZIQFgZBF2uk/OYVYQgQRE9DqHd8k0Mk8FVt9+YE+/Mvl1wYsfVJqc9wJUyQxV1fNA/yiCRx9u4+hUh/WI= X-Received: by 2002:a05:6402:234e:b0:5de:dc08:9cc5 with SMTP id 4fb4d7f45d1cf-5e4d6ad44famr5573913a12.7.1740797391246; Fri, 28 Feb 2025 18:49:51 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Fri, 28 Feb 2025 18:49:50 -0800 From: Stefan Kangas In-Reply-To: <86il0nu3v4.fsf@gnu.org> References: <86jzl3u4kr.fsf@gnu.org> <86il0nu3v4.fsf@gnu.org> MIME-Version: 1.0 Date: Fri, 28 Feb 2025 18:49:50 -0800 X-Gm-Features: AQ5f1JpqQluhWjv2k-sAP4_14rAsFVdmd3AUoN-0OlWen0iU0wJt1SKAgHNHqcw Message-ID: Subject: Re: bug#70342: 29.3.50; treesitter and RTLD_GLOBAL To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 70342 Cc: Yuan Fu , Michael Lausch , 70342@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Michael Lausch >> Date: Thu, 11 Apr 2024 20:47:50 +0200 >> Cc: 70342@debbugs.gnu.org >> >> > 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 >> >> If those 'serialize' functions are not needed to be called from >> outside of the shared library, the usual way is not to export them, >> i.e. to give all symbols except the few that need to be exported the >> so-called "hidden visibility". >> >> I agree that this would be the cleanest way to solve the problem, but that would mean to patch all the existing >> grammars and maybe all the future grammars and push the changes to their maintainers. >> >> I started to prep patches for the yaml and org grammar (those were the ones which triggered the bug for me) >> and i'm going to have them merged upstream. > > I understand, but why is this an Emacs problem? We use RTLD_GLOBAL > for a reason, and the problem of not exposing unnecessary symbols > should be solved by the respective libraries and those who build them. I'd tend to agree. Should this therefore be closed? I'm copying in Yuan also. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 28 21:50:15 2025 Received: (at control) by debbugs.gnu.org; 1 Mar 2025 02:50:15 +0000 Received: from localhost ([127.0.0.1]:56595 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1toCvf-0007C3-Eb for submit@debbugs.gnu.org; Fri, 28 Feb 2025 21:50:15 -0500 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]:52709) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1toCva-00075o-0D for control@debbugs.gnu.org; Fri, 28 Feb 2025 21:50:10 -0500 Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-aaedd529ba1so288435166b.1 for ; Fri, 28 Feb 2025 18:50:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740797404; x=1741402204; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=1AXzf/poWPGoHwFQsn2A1VnjlAa5/5QYvTeiivg2Qys=; b=Bwy9f4xg6ji6dHUGI6+YDI5ifAsnXF9d7sB1wSaXknoe7SDH5KHxBinVrSzfhNJjBV +L/95UObijfojJ2gGACwsdeoP4PhmvymVnztc4EuwONs9w11llxXfjulKwR12IfC1WKs HEpCIrA1lZ1OpxsTcWYy4LYR9L6pYPo3LwvwqEJ+0z9zFsQtPjRIWMXffmSJzvDW2ujX wpvrJ1UnUfbsg+6uioA5RaG0IF0pIGjjcO7RZZZybEVH2+uiapxAvysqIrVpNd8OddsI DfLzWv8LxjPfZTrvNQecfrmD6m+4r5gXknnx0JNQfQw97xpyZ2lxud50+uOcqJCPTj6a qi8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740797404; x=1741402204; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=1AXzf/poWPGoHwFQsn2A1VnjlAa5/5QYvTeiivg2Qys=; b=blwtEVleZw782S1UIeSE21ZrOS2aIaK2k3h9tl1C0aGxcNceRXu2fPOabTHI5hLW8J nKSPRuI1FbkLHI1o7CCLVOOJU6VeDTTodJqwLa6PGFdfIT+rS/Uq5+5dlTmnCgdeXWDw GfqQEHMuKI/V/ZwKttUxpTVVXB5Bnv3XnSr6rvfWyMzpHhTq565106792al3481Yu/qr wxeHP/kBtYEoihczN0noNos8FZ/jnCPySV9w1m6sXuP79lyoGjFYWqz+RTplcbhR0S7Y U6WPc1cioRd1s4yZrD2zO5j0V3PgxklJrTK4Q3f/wEMq+weT60ej5FxRzkWHgzpFYkzP DUQg== X-Gm-Message-State: AOJu0Ywg5nCLzKXVDPoeb1IazVN1Nbk/JLMIsYqyH7KNmZFr+lP65Y6F 3FFx0851SMmcnm6Gt9339CsuRpL2oDWTvRXWlkbRwHtPzP/saT7Prx/Y5Gp7gZbiS71M9KeRDMB zX9tcVkvzRglwWwn207A0b9Cbswv6OTYk2wo= X-Gm-Gg: ASbGncu1JZHBu2TxGIGENBGwzvzI07Yk7eeFYmLdF6nYr1fb+VQCHmJIrVEC4Ynjd+y kk6t4IirouiNto8n/vGuOPywbnMZXKPrxymgOGBH0WkaAkkOuPP2XojXtmfvH4p4xPezm4TVioO gDyjF5xcqtMh8jLczH5qZR5keErdg= X-Google-Smtp-Source: AGHT+IH8U1KsK7VXhTrMw+kjwvPvDZ6fUyuq1UGcEbgJ0pAx2NNXDVEFw8LULolsENaDVptmGIgbwBAiahYhUAI8vuM= X-Received: by 2002:a05:6402:1ecf:b0:5e4:ce6e:388b with SMTP id 4fb4d7f45d1cf-5e4d6ac54a7mr12631265a12.6.1740797403009; Fri, 28 Feb 2025 18:50:03 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Fri, 28 Feb 2025 18:50:02 -0800 From: Stefan Kangas MIME-Version: 1.0 Date: Fri, 28 Feb 2025 18:50:02 -0800 X-Gm-Features: AQ5f1Jrnhl9As-pSlUwx1U0Z9o8FqSEWiLAcwmWC0YZI43wkyErulbZfXmKe6fQ Message-ID: Subject: control message for bug #70342 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 70342 + moreinfo notabug quit From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 01 04:24:57 2025 Received: (at 70342) by debbugs.gnu.org; 1 Mar 2025 09:24:57 +0000 Received: from localhost ([127.0.0.1]:32818 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1toJ5c-0001Pb-Nz for submit@debbugs.gnu.org; Sat, 01 Mar 2025 04:24:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51740) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1toJ5a-0001Op-GW for 70342@debbugs.gnu.org; Sat, 01 Mar 2025 04:24:55 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1toJ5V-0001sQ-7I; Sat, 01 Mar 2025 04:24:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=37BRxP7kG6KSoeBo+VaRpflpjVOFHHK/b6DPF6vLkZU=; b=HVG1yICimffJ hWM2CZDC7A0VK2iYHpYVTH48JKvH4Kd9gjJ/vrU0u+jWRkzOWmIp2usMnsNvkYXE6eFlSzyJS0l8G ckpqs54rF2KW+uBSK0SV3C7Z5Q5g3+EGpzlX/C723AMzJxNoaH24R/Pzn+YWcZL3h46Ci4BUtQx9m 4sF0yzMxgHIC2eTK4R1fA+GbppdlYFZBOE0POqZUmEOUuvI+bPdUsUSZVKAHYBAlVRJ5JKff00QZm CJwpKg4TVVw5xhdRFf/Lf9VRw/xbT3iHa9eXLwWPIvAuqnjNJ0YzlUtab/AsL4oLh33xWXNBKlC8I arZMeDYu8iwc0YJb7RZM1g==; Date: Sat, 01 Mar 2025 11:24:45 +0200 Message-Id: <86frjxqf1e.fsf@gnu.org> From: Eli Zaretskii To: Stefan Kangas In-Reply-To: (message from Stefan Kangas on Fri, 28 Feb 2025 18:49:50 -0800) Subject: Re: bug#70342: 29.3.50; treesitter and RTLD_GLOBAL References: <86jzl3u4kr.fsf@gnu.org> <86il0nu3v4.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 70342 Cc: casouri@gmail.com, mick.lausch@gmail.com, 70342@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Kangas > Date: Fri, 28 Feb 2025 18:49:50 -0800 > Cc: Michael Lausch , 70342@debbugs.gnu.org, > Yuan Fu > > Eli Zaretskii writes: > > >> From: Michael Lausch > >> Date: Thu, 11 Apr 2024 20:47:50 +0200 > >> Cc: 70342@debbugs.gnu.org > >> > >> > 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 > >> > >> If those 'serialize' functions are not needed to be called from > >> outside of the shared library, the usual way is not to export them, > >> i.e. to give all symbols except the few that need to be exported the > >> so-called "hidden visibility". > >> > >> I agree that this would be the cleanest way to solve the problem, but that would mean to patch all the existing > >> grammars and maybe all the future grammars and push the changes to their maintainers. > >> > >> I started to prep patches for the yaml and org grammar (those were the ones which triggered the bug for me) > >> and i'm going to have them merged upstream. > > > > I understand, but why is this an Emacs problem? We use RTLD_GLOBAL > > for a reason, and the problem of not exposing unnecessary symbols > > should be solved by the respective libraries and those who build them. > > I'd tend to agree. Should this therefore be closed? I think so, yes. > I'm copying in Yuan also. From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 01 18:51:27 2025 Received: (at 70342-done) by debbugs.gnu.org; 1 Mar 2025 23:51:27 +0000 Received: from localhost ([127.0.0.1]:46771 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1toWcB-0004uh-7x for submit@debbugs.gnu.org; Sat, 01 Mar 2025 18:51:27 -0500 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]:47331) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1toWc9-0004u6-40 for 70342-done@debbugs.gnu.org; Sat, 01 Mar 2025 18:51:25 -0500 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-5e0573a84fcso4667200a12.2 for <70342-done@debbugs.gnu.org>; Sat, 01 Mar 2025 15:51:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740873079; x=1741477879; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=ZiGv+A3aj7muGH+wntr6fFHF2H6B7JmIaGf71XYID0c=; b=Hi5/DBD1EniVwIFrnzsMZou4EIuNN4Ym5X4VcVF8YmuZioPIGXHlPQQOAfqhCSS/1p BXro43e8tPa4U+Fxuhzam/VEVBJJpWqfO9vYzml5jcAFBkV1XygbnFA0DymqWMHCeqfA 2TSVb7WZsuL0/6SsGqs4cH9nrcKDvOC1Itx3eN96W8lLjxvffcdOgw9IgjsWIzdpF3AU wE/pUBZTHORzlm1bNsUaUk3Urm/zUvBqLb9qKT/NS0KjscI91uOOupeU3rj2WsXskgX4 X2d8d0EhC0vxDI+Y/KDx3FG9fg02Ka9Vd3XqQvwSVCkce9OEPtKitGAo4QDPVYAMoPJu N8lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740873079; x=1741477879; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZiGv+A3aj7muGH+wntr6fFHF2H6B7JmIaGf71XYID0c=; b=Nyp4ROwEzw7J4zuUraOONCRA+H1MqpolDWD3SBsPoydjgg7M2xouu6J/fnRpQ3loUi njjSJDngdpydz4mXI0A7WY4L2sMOEuC8egeL9HciuuU5uiTjNvSllei+wxYRJ0xMhXnb pZ77clFzIMIjthQEZzF7rkXe9VOiNESZrGKco9syQPure8o/ZEcMwr3onDFTJoWhsmp4 GpF0KhUAipnnfaAxHkmtK3QokhzNPHm7N+Kl5VTB4AO7a+32Ui/dhhnAX/yNQ2x/BsEi VbgVV1r9K7DcCgYTX+dwbCDyqqKxr/aFKp9M1AAAHffeGUA4ppGtt2zkj8bC+UQW2F3J lIlg== X-Forwarded-Encrypted: i=1; AJvYcCVMNlfyBhIsJlSkCCjdtMosr7YJ2r2oTWIXZfiwFIdlXxCxoOy+71ZTg3xsR7wBZ2myJ7/AR1kjZIYg@debbugs.gnu.org X-Gm-Message-State: AOJu0YwqGhuUMkSx22v/TVICEi+zBet/jv/hzt3CgJflZFh6QBhtLxPf +mCe2xZejFMfkj19iCBzMr63QBpM+twuHI7QBQuAVQh7pjY2L/MHSATm8Xy8wxAAJaB44+XgCxp SOzyQXOfcdIOh42x5kfLitPmoqra3R1WlMks= X-Gm-Gg: ASbGncsfVMbi1ok2O6oKVG74rn4e3mRvWx114w1zyjca8ksz8f0MdlKLwEv0kWgwj1u fYwi3RQTJEpAwnqOHvTWekzF+QXFJeOO36fnDNqnYYXIzOlrVoJkZmf1+Acf8+6NKS8Yb5T3/b3 RmCVT3aL0SGihQehufMJ2H1qS3wQ== X-Google-Smtp-Source: AGHT+IFiICiAqq4HiGEnKsbzOxd5r586vzihLMzRO/iSyh8Vli3a7qxpuKlj3A3M0mFYU/oa/7Uygh8vQbPhTjO90hg= X-Received: by 2002:a05:6402:268a:b0:5e4:a438:a50c with SMTP id 4fb4d7f45d1cf-5e4d6b69085mr8561481a12.20.1740873078651; Sat, 01 Mar 2025 15:51:18 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sat, 1 Mar 2025 15:51:17 -0800 From: Stefan Kangas In-Reply-To: <86frjxqf1e.fsf@gnu.org> References: <86jzl3u4kr.fsf@gnu.org> <86il0nu3v4.fsf@gnu.org> <86frjxqf1e.fsf@gnu.org> MIME-Version: 1.0 Date: Sat, 1 Mar 2025 15:51:17 -0800 X-Gm-Features: AQ5f1JpbDBGseCll4qnmbuwLaef3xWa16ISvkqHQsDVxs2jDElKgT4jU-yit0m8 Message-ID: Subject: Re: bug#70342: 29.3.50; treesitter and RTLD_GLOBAL To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 70342-done Cc: casouri@gmail.com, mick.lausch@gmail.com, 70342-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Stefan Kangas >> Date: Fri, 28 Feb 2025 18:49:50 -0800 >> Cc: Michael Lausch , 70342@debbugs.gnu.org, >> Yuan Fu >> >> 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. From unknown Sat Jun 21 10:40:20 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 30 Mar 2025 11:24:25 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator