From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#31238: Dynamic Module Crash Date: Fri, 21 Sep 2018 18:48:40 -0400 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1537570032 24382 195.159.176.226 (21 Sep 2018 22:47:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 21 Sep 2018 22:47:12 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 31238@debbugs.gnu.org, =?UTF-8?Q?Tu=E1=BA=A5n?= Anh =?UTF-8?Q?Nguy=E1=BB=85n?= To: Philipp Stephani Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Sep 22 00:47:08 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g3UCZ-0006GE-QG for geb-bug-gnu-emacs@m.gmane.org; Sat, 22 Sep 2018 00:47:07 +0200 Original-Received: from localhost ([::1]:57691 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g3UEg-00035K-Dl for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Sep 2018 18:49:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43870) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g3UEV-00034f-DW for bug-gnu-emacs@gnu.org; Fri, 21 Sep 2018 18:49:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g3UEQ-0003Rk-Ge for bug-gnu-emacs@gnu.org; Fri, 21 Sep 2018 18:49:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44246) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g3UEQ-0003RU-CW for bug-gnu-emacs@gnu.org; Fri, 21 Sep 2018 18:49:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1g3UEQ-0006Mq-1S for bug-gnu-emacs@gnu.org; Fri, 21 Sep 2018 18:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 21 Sep 2018 22:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31238 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31238-submit@debbugs.gnu.org id=B31238.153757012524454 (code B ref 31238); Fri, 21 Sep 2018 22:49:01 +0000 Original-Received: (at 31238) by debbugs.gnu.org; 21 Sep 2018 22:48:45 +0000 Original-Received: from localhost ([127.0.0.1]:48504 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g3UE8-0006MM-Tc for submit@debbugs.gnu.org; Fri, 21 Sep 2018 18:48:45 -0400 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:56413) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g3UE6-0006MB-1Q for 31238@debbugs.gnu.org; Fri, 21 Sep 2018 18:48:42 -0400 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id w8LMmeLY024087; Fri, 21 Sep 2018 18:48:41 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id B55C9617EB; Fri, 21 Sep 2018 18:48:40 -0400 (EDT) In-Reply-To: (Philipp Stephani's message of "Fri, 21 Sep 2018 19:16:44 +0200") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6379=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6379> : inlines <6891> : streams <1799133> : uri <2715274> 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: 208.118.235.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:150535 Archived-At: >>> Emacs 25.3.1 crashes with a segfault when trying to print a value >>> constructed (in certain ways) by a dynamic module. >>> Reproduction: https://github.com/ubolonton/emacs-module-crash >>> Context: https://github.com/ubolonton/emacs-module-rs/issues/2 >> This might be caused by commit 3eb93c07f7a60ac9ce8a16f10c3afd5a3a31243a, IIUC that's just a wild guess, right? >> which removed GC protection for module-allocated values. Not really, no. It just relied on another pre-existing mechanism. > Unless anybody complains, I'll revert that commit. Do we even know that reverting it circumvents this crash? And IIRC this patch is not just an implementation detail, it changes the module's API and ABI, so reverting it shouldn't be done lightly. > Modules can store/use emacs_value objects in arbitrary ways; > there's no way we can rely on stack scanning to reliably find them. We don't blindly rely on stack scanning: there are functions to (un)register other values stored in the (non-Lisp) heap. The previous code wasn't magical either. I don't know nearly enough about Rust's implementation strategy and the `emacs` crate used to guess how its memory management could/should interact with Emacs's. Stefan