From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#39962: 27.0.90; Crash in Emacs 27.0.90 Date: Fri, 13 Mar 2020 18:30:40 +0200 Message-ID: <831rpw8bf3.fsf@gnu.org> References: <24162.58107.725366.668639@cochabamba.vanoostrum.org> <329e58b1-6255-311e-bdd8-b6f5b3d5208f@cs.ucla.edu> <22225b66-44f6-d132-3036-92181d53c28d@cs.ucla.edu> <89A83582-358F-43DC-B96E-04EE9D655D5F@vanoostrum.org> <63b88e2d-9888-f3ce-a4b0-fcf344e803e5@cs.ucla.edu> <83d09lbgk5.fsf@gnu.org> <837dzqaieq.fsf@gnu.org> <834kuuadod.fsf@gnu.org> <83blp1siku.fsf@gnu.org> <83o8t08ufp.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="78778"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 39962@debbugs.gnu.org, pieter-l@vanoostrum.org, eggert@cs.ucla.edu To: Pip Cet Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Mar 13 17:32:09 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1jCnEH-000KNI-Dh for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 Mar 2020 17:32:09 +0100 Original-Received: from localhost ([::1]:33836 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCnEG-000785-Fv for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 Mar 2020 12:32:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58675) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCnDD-0006ms-VG for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2020 12:31:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCnDC-00085j-Mk for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2020 12:31:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54214) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jCnDC-00084h-Id for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2020 12:31:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jCnDC-0008FF-Fq for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2020 12:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 Mar 2020 16:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39962 X-GNU-PR-Package: emacs Original-Received: via spool by 39962-submit@debbugs.gnu.org id=B39962.158411705631680 (code B ref 39962); Fri, 13 Mar 2020 16:31:02 +0000 Original-Received: (at 39962) by debbugs.gnu.org; 13 Mar 2020 16:30:56 +0000 Original-Received: from localhost ([127.0.0.1]:60187 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jCnD5-0008Et-DQ for submit@debbugs.gnu.org; Fri, 13 Mar 2020 12:30:55 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:43232) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jCnD3-0008Ef-Mi for 39962@debbugs.gnu.org; Fri, 13 Mar 2020 12:30:54 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:48743) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jCnCx-0007CH-E1; Fri, 13 Mar 2020 12:30:47 -0400 Original-Received: from [176.228.60.248] (port=3202 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jCnCv-00065Y-Ev; Fri, 13 Mar 2020 12:30:46 -0400 In-Reply-To: (message from Pip Cet on Fri, 13 Mar 2020 13:56:07 +0000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:177286 Archived-At: > From: Pip Cet > Date: Fri, 13 Mar 2020 13:56:07 +0000 > Cc: pieter-l@vanoostrum.org, 39962@debbugs.gnu.org, eggert@cs.ucla.edu > > On Fri, Mar 13, 2020 at 9:40 AM Eli Zaretskii wrote: > > > > > It doesn't affect visible behavior of any callers, except in the case > > > > > where the previous behavior was buggy. > > > > > > > > I guess we have different notions of "visible" > > > > > > Please say something about your notion of "visible". It doesn't affect > > > any of the existing C callers of valid_lisp_object_p. Are you talking > > > about printing valid_lisp_object_p(x) in a debugger, and not getting > > > the expected value? Or something else? > > > > I'm talking about the behavior documented in the commentary. > > You're right if your point is the comment should be adjusted to omit > the unnecessary, and unused, special behavior on killed buffers. I don't yet think that function's behavior should be changed. See below. > > > > and "buggy". > > > > > > It avoids segfaults or random memory corruption. How is that not "buggy"? > > > > That's not the issue here. You said the proposed change didn't change > > the behavior "except where it was buggy"; I'm saying that it changes > > the behavior unrelated to this bug, where previous behavior was not > > buggy by any measure. > > How so? Can you describe a scenario in which Emacs would behave at all > differently? The behavior of live_buffer_p and valid_lisp_object_p changed, and those functions weren't "buggy" before. > valid_lisp_object_p returns a different value, sure; but > none of its callers care about the difference, so Emacs behavior > overall does not change. I wasn't talking about behavior of Emacs as a whole. And I don't understand why you are arguing about this. You asked me to say something about my notion of "visible", and I did. Will arguing about _my_ notion of that get us to some useful place? > > > (gdb) p current_thread->m_current_buffer > > > $3 = (struct buffer *) 0x555556694b10 > > > (gdb) p valid_lisp_object_p(0x555556694b15) > > > $4 = 1 > > > (gdb) p valid_lisp_object_p(0x555556694b25) > > > $5 = 1 > > > > Why do you consider this incorrect? The Emacs GC is "conservative", > > which means it doesn't collect anything that _might_ be a valid Lisp > > object. In what ways does the above violate that contract? > > GC is conservative; valid_lisp_object_p is documented to be precise: a > return value of 1 or 2 means that the object is valid, not that it's > potentially valid and potentially nonsense. But what does "valid" mean in this case? The part that looks at the stack uses the stack-marking routines, and thus inherits the "conservative" nature of stack marking. The code also makes it quite clear that it only considers "live" objects as valid, and a killed buffer is not "live". So I still don't understand in what way the above results are incorrect. > > Your patch modifies the notion of whether a buffer is "live", > > No, it modifies a specific function (mis)named buffer_live_p. Which, among other things, checks whether a buffer is "live". So it is not necessarily mis-named. > The dozens of places in which we check whether a buffer is "live", > as opposed to "killed", are unaffected. Only GC is affected. No, not only GC is affected. Some of the callers are outside GC, we've been there up-thread, and agreed about that. > A buffer should be marked iff it is reachable > > A buffer is marked iff it is reachable from the heap or it is > reachable from the stack and buffer_live_p returns true > > Therefore, it is invalid for buffer_live_p to return false for a > buffer which is reachable from the stack. This mixes two notions: a "live" buffer and a buffer that should be marked. They are not the same. > > if so, how come stack marking didn't find it? > > Because we are talking about the stack marking! The stack marking > calls buffer_live_p to check whether it should actually mark the > buffer or not. Fine, so you are saying that stack marking should disregard whether a buffer is "live"? Then let's make such a change only for stack marking, not in a function called from other places.