From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: changed dlopen flags in dynlib.c, gccemacs crash Date: Sat, 11 Dec 2021 10:23:29 +0200 Message-ID: <83o85nr1mm.fsf@gnu.org> References: <83tufjw848.fsf@gnu.org> <83lf0uuqaq.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1448"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, akrl@sdf.org To: hx Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 11 09:24:56 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mvxgd-0000AQ-Ma for ged-emacs-devel@m.gmane-mx.org; Sat, 11 Dec 2021 09:24:55 +0100 Original-Received: from localhost ([::1]:44494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mvxgY-0003NZ-OE for ged-emacs-devel@m.gmane-mx.org; Sat, 11 Dec 2021 03:24:50 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:37492) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mvxfQ-0002hA-Br for emacs-devel@gnu.org; Sat, 11 Dec 2021 03:23:40 -0500 Original-Received: from [2001:470:142:3::e] (port=49474 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mvxfQ-0005x6-1I; Sat, 11 Dec 2021 03:23:40 -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=fRsp91LYa5+ZsiZlfd6kf7SYLDP2Z7gmI1sK90Yc4Ig=; b=jTUShOVFMH7Y I1x1OGx9rhqjle1Fr2zE9ouJwsizI66t8c/IjShrjYcluiO6fS4YdkecPBJ+oIeAqBgSZd2L+IB+k A2ksoz23OayBHJgnpns3amR/Lad0cfiNnZLtRD8YX7bipwis567oqypS1SMe45SclUzU694vRJMjj OwJ/6mNWiqTq+l+39T+NqhHXztyOrfGMzD1Zz6CkFjaPsKHgzC4NYaxgel9uCymvRh74Z18ZRj4Pk 6JZFBpJR4qvchNcOJYYXTJLyF9AK1AQ5b2ZnUQHPbj/eUGxeEJ5PKej7nBA/iKoH/Roe1JCyeJEsG LjmUtO5eHIUQPP2LZn6spg==; Original-Received: from [87.69.77.57] (port=2663 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mvxfP-00021F-Mq; Sat, 11 Dec 2021 03:23:40 -0500 In-Reply-To: (message from hx on Sat, 11 Dec 2021 10:29:33 +0800) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:281659 Archived-At: > From: hx > Date: Sat, 11 Dec 2021 10:29:33 +0800 > Cc: Andrea Corallo , emacs-devel > > git diff > diff --git a/src/comp.c b/src/comp.c > index 43feac6..2941f84 100644 > --- a/src/comp.c > +++ b/src/comp.c > @@ -5191,6 +5191,8 @@ DEFUN ("comp--register-lambda", Fcomp__register_lambda, > Scomp__register_lambda, > Lisp_Object maxarg, Lisp_Object type, Lisp_Object rest, > Lisp_Object comp_u) > { > + CHECK_CONS(rest); > + > Lisp_Object doc_idx = FIRST (rest); > Lisp_Object intspec = SECOND (rest); > struct Lisp_Native_Comp_Unit *cu = XNATIVE_COMP_UNIT (comp_u); > diff --git a/src/dynlib.c b/src/dynlib.c > index a8c8843..362530b 100644 > --- a/src/dynlib.c > +++ b/src/dynlib.c > @@ -270,7 +270,8 @@ dynlib_close (dynlib_handle_ptr h) > dynlib_handle_ptr > dynlib_open (const char *path) > { > - return dlopen (path, RTLD_LAZY); > + // return dlopen (path, RTLD_LAZY); > + return dlopen (path, RTLD_LAZY|RTLD_GLOBAL); > } > > > delete the eln-cache, execute with -nw -q in gdb, wait a few seconds: > (gdb) bt > #0 _dl_lookup_symbol_x (undef_name=0x555555e3814300 0x555555e3814300>, undef_map=0x555556059380, ref=0x7fffffffc1b8, symbol_scope=0x555556059718, > version=0x0, type_class=0, flags=2, skip_map=0x0) at dl-lookup.c:842 > #1 0x00007ffff4082b74 in do_sym (handle=, name=0x555555e3814300 access memory at address 0x555555e3814300>, who=0x55555580b073 , > vers=vers@entry=0x0, flags=flags@entry=2) at dl-sym.c:165 > #2 0x00007ffff408305d in _dl_sym (handle=, name=, who=) > at dl-sym.c:274 > #3 0x00007ffff5bdf3b4 in dlsym_doit (a=a@entry=0x7fffffffc3f0) at dlsym.c:50 > #4 0x00007ffff4083260 in __GI__dl_catch_exception (exception=exception@entry=0x7fffffffc390, > operate=0x7ffff5bdf3a0 , args=0x7fffffffc3f0) at dl-error-skeleton.c:208 > #5 0x00007ffff408331f in __GI__dl_catch_error (objname=0x555555dab830, errstring=0x555555dab838, > mallocedp=0x555555dab828, operate=, args=) at dl-error-skeleton.c:227 > #6 0x00007ffff5bdfa65 in _dlerror_run (operate=operate@entry=0x7ffff5bdf3a0 , > args=args@entry=0x7fffffffc3f0) at dlerror.c:170 > #7 0x00007ffff5bdf41c in __dlsym (handle=, name=) at dlsym.c:70 > #8 0x000055555580b073 in dynlib_sym (h=0x555556059380, sym=0x555555e3814300 access memory at address 0x555555e3814300>) at dynlib.c:280 > #9 0x0000555555809f63 in make_subr (symbol_name=0x555555e38153, minarg=0x16, maxarg=0x16, > c_name=0x555555e38153, type=0xfc30, doc_idx=0xba, intspec=0x0, comp_u=0x555555df6d1d) at > comp.c:5147 > #10 0x000055555580a156 in Fcomp__register_lambda (reloc_idx=0xa, c_name=0x555555e38153, > minarg=0x16, maxarg=0x16, type=0xfc30, rest=0x555555e17c03, comp_u=0x555555df6d1d) at comp.c:5203 > #11 0x00007fffef0eed34 in late_top_level_run () at > /home/silent/.emacs.d/eln-cache/28.0.90-8dcada16/cconv-3b1f1f98-cca24f72.eln So I think this is a manifestation of the issue that Andrea was talking about: the way we produce native code is incompatible with RTLD_GLOBAL. So at this point, I think this bug report should be treated as "wishlist", i.e. a feature request: to support RTLD_GLOBAL in dynlib with native-comp. Andrea, is that feasible, and if so, what would it entail?