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: Sun, 05 Jan 2025 12:33:18 +0200 Message-ID: <86r05h8s9d.fsf@gnu.org> References: <87jzbbke6u.fsf@protonmail.com> <865xmtaeh9.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="28642"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 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 Sun Jan 05 11:34:18 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 1tUNxZ-0007K6-Lk for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Jan 2025 11:34:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tUNxL-0001nP-V7; Sun, 05 Jan 2025 05:34:03 -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 1tUNxK-0001nC-8B for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 05:34:02 -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 1tUNxJ-00060z-VO for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 05:34:02 -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=Kr8wbFHYG1V8Hi+QH5XGLDQJsU2kQWKHp1Dcjqk21t4=; b=OFDUBzx4lzDB0zxRkKAS+n9Dh0kmZlgvhqjVgYw75LJZbVsBAIwKIY7SFpzCYuQkw+B8VWS8nQiFkzbUH6rNMrECp0PXV/Q0YBsQdDf6SXa8a6xeD5eUBarZ8kBGEKINGOODsA7dDqShNW3p4RcOyCeL7u9vxe8zt7XncSXamuX0TIcizfNwQYHmCmrLS5GmmB6TwL4QZdGeGJaClrxFp5jF2XtrhCpMbuK2eqLrxm+hgwG4ZLU5iMK+S85bctZ08A+FN0GnIQEg3F+NgNX8gSzKHRUfQ2eUdiqlyi3fDatBWMTUaiepzAnahD9QLMhibDBezjqgQ/uhrb+rTUU7qw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tUNxJ-000240-M6 for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 05:34:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Jan 2025 10:34:01 +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.17360732147892 (code B ref 75322); Sun, 05 Jan 2025 10:34:01 +0000 Original-Received: (at 75322) by debbugs.gnu.org; 5 Jan 2025 10:33:34 +0000 Original-Received: from localhost ([127.0.0.1]:60019 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tUNwr-00023E-L2 for submit@debbugs.gnu.org; Sun, 05 Jan 2025 05:33:34 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35768) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tUNwp-000230-Ou for 75322@debbugs.gnu.org; Sun, 05 Jan 2025 05:33:32 -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 1tUNwh-0005zH-8B; Sun, 05 Jan 2025 05:33:25 -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=Kr8wbFHYG1V8Hi+QH5XGLDQJsU2kQWKHp1Dcjqk21t4=; b=U/iWSy7s79AaHhhazEdl BlYiVZAzzEIYImJIKjU30Aouv0vndcunA4n5KBkeebgVUvSeOy+ul2fBQ+XMPBmgjE3dVWZl4cCXn Ez2FM8P8NtCwd/2UFHzEFF9EW2H9+JiIiIXDH50V8JfIpv2uG4hNbdareJAmeD2HcfLZJ7r0vGyDo fNVqluyNcNRimjD3bwEdk3w08FuNZLPVlWXe5Okcf6E/dXv1VoG10Jg4WkArTdZk51OAywU3tOAe1 GjANbUsdWFoolCKRpwS7Obu2Do+mnp8iby4VoauzxmTdiJbD1K/5ukq4eWKoT6oZk57aHaz2t+NH8 liAxBA0piqKqOA==; In-Reply-To: (message from Gerd =?UTF-8?Q?M=C3=B6llmann?= on Sun, 05 Jan 2025 09:19:17 +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:298530 Archived-At: > From: Gerd Möllmann > Cc: pipcet@protonmail.com, 75322@debbugs.gnu.org > Date: Sun, 05 Jan 2025 09:19:17 +0100 > > I'd grep for SAFE_NALLOCA, and for each occurrence, see what is stored > in the memory allocated. Is only SAFE_NALLOCA a potential problem? What about the other members of the SAFE_*ALLOC* family? > If that is a reference to MPS-allocated memory > (a pointer or Lisp_Object), it should be changed, because it then hides > references from MPS in malloc'd memory. Or can hide, to be more precise, > in the case it doesn't use alloca. Does using igc_xnmalloc_ambig have any significant adverse effect on GC? Like makes it slower or forces it to scan more memory? Because if we make SAFE_NALLOCA do this by default, there could be quite a lot more such ambiguous roots by the time GC starts. If this could impact performance or has some other adverse effects, I think I'd prefer to have a new argument to SAFE_NALLOCA telling it whether to call igc_xnmalloc_ambig, and we will then need to audit our code to use that argument where what's stored in the memory it allocates could be a Lisp object. This is more error-prone, but performance does count, especially where it comes to GC. > I think the performance impact of that is negligible because this > path is only executed when SAFE_ALLOCA does not use alloca. MAX_ALLOCA is only 16KB (and Paul Eggert says it's dangerous to make it significantly larger), so I'm not sure your assumption about negligible performance impact is necessarily correct.