From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.bugs Subject: bug#34655: 26.1.92; Segfault in module with --module-assertions Date: Thu, 21 Mar 2019 20:37:24 +0100 Message-ID: References: <874l8r1t3a.fsf@tcd.ie> <8336oamu3y.fsf@gnu.org> <87h8c1cv6l.fsf@tcd.ie> <83lg1dwhse.fsf@gnu.org> <87va0h12js.fsf@tcd.ie> <835zsgw3ui.fsf@gnu.org> <87ef7486h0.fsf@tcd.ie> <83r2b4ul1c.fsf@gnu.org> <831s30upqd.fsf@gnu.org> <83o964t4de.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="78765"; mail-complaints-to="usenet@blaine.gmane.org" Cc: "Basil L. Contovounesios" , 34655@debbugs.gnu.org, Stefan Monnier To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Mar 21 20:39:58 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h73Xh-000KMk-2u for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Mar 2019 20:39:57 +0100 Original-Received: from localhost ([127.0.0.1]:45767 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h73Xf-0006C0-T1 for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Mar 2019 15:39:56 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:59509) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h73Vw-0004p5-TN for bug-gnu-emacs@gnu.org; Thu, 21 Mar 2019 15:38:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h73Vu-0000hY-RG for bug-gnu-emacs@gnu.org; Thu, 21 Mar 2019 15:38:08 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40086) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h73Vq-0000XW-PD for bug-gnu-emacs@gnu.org; Thu, 21 Mar 2019 15:38:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h73Vq-0007KF-Fv for bug-gnu-emacs@gnu.org; Thu, 21 Mar 2019 15:38:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Mar 2019 19:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34655 X-GNU-PR-Package: emacs Original-Received: via spool by 34655-submit@debbugs.gnu.org id=B34655.155319706328132 (code B ref 34655); Thu, 21 Mar 2019 19:38:02 +0000 Original-Received: (at 34655) by debbugs.gnu.org; 21 Mar 2019 19:37:43 +0000 Original-Received: from localhost ([127.0.0.1]:53630 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h73VX-0007Jg-8e for submit@debbugs.gnu.org; Thu, 21 Mar 2019 15:37:43 -0400 Original-Received: from mail-oi1-f176.google.com ([209.85.167.176]:39796) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h73VV-0007JU-Je for 34655@debbugs.gnu.org; Thu, 21 Mar 2019 15:37:41 -0400 Original-Received: by mail-oi1-f176.google.com with SMTP id b4so5563775oif.6 for <34655@debbugs.gnu.org>; Thu, 21 Mar 2019 12:37:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=UaKkp5g9H4xh7q/2BFkU0u7+eV3jG2rtUOB3Z3JmCdo=; b=CONySdMqtqQVt9OoC+j0H4i7fkalK9R3hRZAu2m4/9dwC4HObjFkSAOg44Fxx5TuND uur09gmAX+rtCffLmNiP+FggT+kc3xCXMmV2vfgw76NdSxLAvo0wNXBoBDWH4fH0gay9 1/G6ta0Vn8ZzYW3RLSrhF3uFfA5GDh7t1FWEqqO2x52yR1k6zg4iuJR/B8mexUSMEEfJ qtJD4Bz/d651a7dEtdYv567pHpXWw9lqEezPMU4Zj1/09dRbyVLIMhFfpIF/45CRIhEM Zn/MNQZ3szSwI39xFjvoam4fvTXS4cTmOVwqcO0YnbdWnMOL0QgXIdwuI+HXUcJsPRUH wopw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=UaKkp5g9H4xh7q/2BFkU0u7+eV3jG2rtUOB3Z3JmCdo=; b=oBdFdPbjW2iom+alAQ5oslRDHsrm86wDR2jBilw8SOb8H5w34SXisqM5wMXHsIHGt4 8NSjGEfto0fXEfUZsaOfzRrF9jaacDmYxcuPhV6xY4uF26pXOpGu6zMLUl9H4HSsOQOJ GfezxE2nPodBYEB3omrdEtx14VcPqe2JSYF70WlpOhGJVYHHKCqW8NsLYDpwpkBhWcvp uzWx5aaubgGwzPjgtr8gbknSXSFMzfbMZh+wZSmcLtqVWa9bKfbs00Aw7ank3b5iRtqC eIdzjFuLCQskdrqSlct+nbCMPQbi3nBRTri0PRYdTiWb1RaET6RHrPUAy6kafsGaNYzl fLTA== X-Gm-Message-State: APjAAAUDXCkNQRFJerxJ3bT2j1W97iZFxBy0Ss+ErRr27jYco3PdgLPl Kpqd6o2UfzBCuR6619cKYtDpKVTx13jmsMiN8Eo= X-Google-Smtp-Source: APXvYqxTRZk2HGCSMqNc9os3ibqE+DdYpdOYSiRsvLBQvI50N6DtE6kxNnguhKfFBTDtWC9HXl+P03jsPP7H27x3yJk= X-Received: by 2002:aca:eb10:: with SMTP id j16mr731071oih.65.1553197055798; Thu, 21 Mar 2019 12:37:35 -0700 (PDT) In-Reply-To: <83o964t4de.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:156577 Archived-At: Am Do., 21. M=C3=A4rz 2019 um 20:27 Uhr schrieb Eli Zaretskii : > > > > I will CC Stefan, who committed 3eb93c07f7a60ac9ce8a16f10c3afd5a3a312= 43a. > > > > > > I'm not sure we should revert that; we could instead add GC protectio= n > > > for those parts that need it. > > > > Yes, that's what reverting that commit does :-) > > AFAIU, it does much more. Stefan intended for the conservative stack > marking to do the job, so maybe there's a little more that should be > done to get there. Or maybe Stefan didn't consider some important > factor(s). In either case, I'd like to hear his POV on this before we > decide how to proceed. Let's go back to the known good state first, and then discuss how to go from there. > > > We need to mark the objects in all cases, not just when module > > assertions are enabled. > > If we get stack marking to work, we won't need to mark objects > explicitly. We can't get stack marking to work, even theoretically. A module is free to do emacs_value x =3D ...; uintptr_t y =3D ((uintrptr_t) x) ^ 0x123456u; (garbage-collect) emacs_value z =3D (emacs_value) (y ^ 0x123456u); ... use z ... During the garbage collection, x isn't on the stack anywhere, and the garbage collector couldn't possibly find it. Or: emacs_value x =3D ...; emacs_value *y =3D malloc (sizeof emacs_value); *y =3D x; ... stop using x... (garbage-collect) ...use *y ... Again, during garbage collection x is no longer on the stack. We can only use stack scanning in Emacs because we control the Emacs source code and can make sure these patterns don't occur. Module code is completely arbitrary. > > > Note that both the designer of the module API (Daniel) and I as one of > > its main implementers disagree with commit > > 3eb93c07f7a60ac9ce8a16f10c3afd5a3a31243a. > > OK, but I think Stefan's opinion is not less important. I value his opinion, but again: let's make the thing work first, and then discuss options. > > > I've already confirmed that reverting commit > > 3eb93c07f7a60ac9ce8a16f10c3afd5a3a31243a fixes bug#31238, and I can > > try it with this bug as well. > > Please do, it's important to know that, I think. Basil, could you check that with the revert your code now works? Thanks!