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.bugs Subject: bug#75322: SAFE_ALLOCA assumed to root Lisp_Objects/SSDATA(string) Date: Sat, 04 Jan 2025 10:23:40 +0200 Message-ID: <86cyh3f0mr.fsf@gnu.org> References: <87jzbbke6u.fsf@protonmail.com> <86sepzf4h3.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24975"; mail-complaints-to="usenet@ciao.gmane.io" Cc: eller.helmut@gmail.com, pipcet@protonmail.com, 75322@debbugs.gnu.org To: Gerd =?UTF-8?Q?M=C3=B6llmann?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 04 09:24:36 2025 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 1tTzSV-0006LC-OB for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Jan 2025 09:24:35 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTzS2-0007GF-R6; Sat, 04 Jan 2025 03:24:06 -0500 Original-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 1tTzRz-0007FE-Og for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 03:24:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTzRy-0000jP-Gn for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 03:24:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-version:References:In-Reply-To:From:Date:To:Subject; bh=iE2Z6/AqxzMy9Bm1yO/MkCIhyQ0RDS0OA/34wOZoSz4=; b=npb4bYQvkvspYmW57+JDvYwhjmjFemUEkfu+riQiV0A+HVjRYin5HbXG06RQ9Ls3tqVk+QuU/iARUSN870JGoMnsJxOwsDWt0lrrnoafJg+H5ZF2WVoZte21QQWcOh70sYKx++9cAO1ywxZCuugfc3b/Yp3q8eBOCxHY2021GDzFzM+MOvk7Ybu2JIGIzsiBHe/sIVu1+7SErsff8UO12Li+9OMbXlYCUNZSXRVAd//ghwpZvc/IBD0SjBXmj/9E5pAxHzIIziEJWrWo913OJ6PpQZH/ZxTvYh8/p7l0+a0+fXkQbiwi+EFM96HIYQrl8MbCRkxxAnyNrX4q6h3wkg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tTzRy-0002Ii-3B for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 03:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Jan 2025 08:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75322 X-GNU-PR-Package: emacs Original-Received: via spool by 75322-submit@debbugs.gnu.org id=B75322.17359790328827 (code B ref 75322); Sat, 04 Jan 2025 08:24:02 +0000 Original-Received: (at 75322) by debbugs.gnu.org; 4 Jan 2025 08:23:52 +0000 Original-Received: from localhost ([127.0.0.1]:53281 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tTzRo-0002II-AQ for submit@debbugs.gnu.org; Sat, 04 Jan 2025 03:23:52 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51806) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tTzRl-0002I3-CD for 75322@debbugs.gnu.org; Sat, 04 Jan 2025 03:23:50 -0500 Original-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 1tTzRf-0000gt-Qz; Sat, 04 Jan 2025 03:23:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=iE2Z6/AqxzMy9Bm1yO/MkCIhyQ0RDS0OA/34wOZoSz4=; b=hFRORV5KaBipuVbMqNTM X8sT6BHmLPASLRMxgg6Jezfl15JGFgBG3REHdcQ1PEJD7qbtZgSgnq5n7QhakyQLJ3J7bWg7FvoXk nWEZ2CHZqThOr7edQNuwFRL+Tg/PY9fECTKfgzDyefVlc2afUYSPIuhxy6MK3kmv4t3duJ/423jqB BUJ2mOLe6aG+vi81tTalM0sVW7rqJQyxswMSmAY0DV0hVtB8L6gqiscjGMmK/vKJ1xZ6eCzYlzIPr AzM+iS5CiPAqZYFQhoXMFzeZc32mHgmT08/InvOtTdubaR/twGYR4jIVu3T1E1b7tsopuQSZC65uq MKgmZ7m89gnN6w==; In-Reply-To: (message from Gerd =?UTF-8?Q?M=C3=B6llmann?= on Sat, 04 Jan 2025 08:17:34 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:298339 Archived-At: > From: Gerd Möllmann > Cc: pipcet@protonmail.com, 75322@debbugs.gnu.org, Helmut Eller > > Date: Sat, 04 Jan 2025 08:17:34 +0100 > > Eli Zaretskii writes: > > > The current code in callproc.c assumes that GC cannot run while we are > > parked in posix_spawn or vfork. Is that assumption false with MPS? > > If so, what would trigger GC during that time? > > Okay, so it's safe with the old GC, I assume. Do you know if it is done > with an inhibit_garbage_collection? No, without. Unless posix_spawn could somehow call back to us in a way that posix_spawn will later return and resume running (as opposed to via a fatal signal), how could GC happen? > Not that we run into the trap that somewhere on the way to the > actual fork maybe_quit is called which can GC and so on, like we had > it in the regexp engine a while back. This can be established by examining the code, right? > For MPS, I don't know for sure. I have seen in passing while git > grepping in their repo recently, that they write something about forking > and child processes, but I don't know what they do. Maybe someone having > read the code can answer that. (Added Helmut in CC). We are talking about vfork, not fork. In our case, the forked process runs a completely separate program, in most cases not even Emacs, so MPS has no bearing on that, I think. > > Another question is about the global Lisp variables in 'globals'. For > > example, Vprocess_environment actually globals.f_Vprocess_environment. > > Is this large struct protected from GC, i.e. can GC ever decide that > > process-environment is not used and free it? If it's protected, where > > and how is it protected? And if it is protected, then any members of > > the list that is the value of process-environment are also protected > > and cannot be freed by GC. > > > > If 'globals' is not protected, I think we should protect it, no? > > process-environment is a DEFVAR_LISP, and is root in both GCs via the > staticpro mechanism (staticvec array). OK, so it's impossible that some member of the process-environment's list will be GCed, right? AFAIU, Pip was considering a situation where some of these member strings are GCed, and then subroutines of posix_spawn use a bad address, to explain the error message Ihor reported. This seems impossible because process-environment is staticpro'd, right?