From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Newsgroups: gmane.emacs.bugs Subject: bug#75322: SAFE_ALLOCA assumed to root Lisp_Objects/SSDATA(string) Date: Sun, 05 Jan 2025 11:40:29 +0100 Message-ID: References: <87jzbbke6u.fsf@protonmail.com> <865xmtaeh9.fsf@gnu.org> <86r05h8s9d.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13265"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: pipcet@protonmail.com, 75322@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 05 11:41:21 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 1tUO4O-0003LC-Pq for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Jan 2025 11:41:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tUO48-0002eN-Io; Sun, 05 Jan 2025 05:41:04 -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 1tUO46-0002e8-Lz for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 05:41: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 1tUO46-0000Qx-DG for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 05:41: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:Date:References:In-Reply-To:From:To:Subject; bh=M5X+ROHHV0GltSEw4jdmWkcu0jqHtzdZKAf10W4w03g=; b=APvWTel26Q16YceEMU9ieBJQ+vIt+KaZtQaM/vZafOAFsbeGsjWy8vbPj9o1BhcFv+1uSyQNuAZKqsVJL431/keozQQjWwSpjHkMQpMjqfh/qa/X12r2JEVMQqz4wlyfv1LtdKPOlGmjksmDtH3IddXvdl6ArJfhc+NqTkowlLEZBkDDA4Ej2jyJJZr3fQbGmhJQdUBkY737mgppGpDhzRkgqYYBMe2gzBz+tHJ0HWYmfCrsuNzDohi67CIToyYBqLPaHUn9jjKLig2A1/7N5TZLNh5sZGZSAJg9FMwcBr7uBdEnW3qB1X2gjfIJPDyOCzXzwCtD/RobGDHpuQUe4g==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tUO46-0002UO-87 for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 05:41:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Jan 2025 10:41: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.17360736419518 (code B ref 75322); Sun, 05 Jan 2025 10:41:02 +0000 Original-Received: (at 75322) by debbugs.gnu.org; 5 Jan 2025 10:40:41 +0000 Original-Received: from localhost ([127.0.0.1]:60045 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tUO3k-0002TS-Ft for submit@debbugs.gnu.org; Sun, 05 Jan 2025 05:40:40 -0500 Original-Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:59794) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tUO3i-0002TC-7q for 75322@debbugs.gnu.org; Sun, 05 Jan 2025 05:40:38 -0500 Original-Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-436281c8a38so96361115e9.3 for <75322@debbugs.gnu.org>; Sun, 05 Jan 2025 02:40:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736073632; x=1736678432; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M5X+ROHHV0GltSEw4jdmWkcu0jqHtzdZKAf10W4w03g=; b=Dtqi7ueUSerSdvZ/PFbgG6Vq6lnkxtZGxa7Opkj2ph07U7sXfOLr55j9AqrcBUhTRf 6WIOvfB+UPWX/Po9oIsSTQ6ONSJF03JsoyPvbAVBp2VzaHW+HqyCVF18HY8uvPADZ8lz 9ixPLExQ3AIc0FQqLU3r2PtldyOegNa1jkffTpo72H7BIkJAPE8FGkE9txVTxKEwIlP/ 5m7RfxrGLJL2EGoen4DAYxRe+CkgmzN/2ZRpkA1vjBBl2WI9I4no6fGeYBnEoE11Qxix dDbG2OF1eKHdy8GBvNo5KwJSLadk4uA8XN4yU6PyXGpGgPAcJ4d05lRVkfx4f06ufC2S Ib1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736073632; x=1736678432; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=M5X+ROHHV0G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wO07w2DTUw== X-Received: by 2002:a05:600c:3596:b0:434:9dfe:20e6 with SMTP id 5b1f17b1804b1-43668b5dfc0mr415785015e9.23.1736073631579; Sun, 05 Jan 2025 02:40:31 -0800 (PST) Original-Received: from pro2 (p200300e0b747500078d774d9859911e7.dip0.t-ipconnect.de. [2003:e0:b747:5000:78d7:74d9:8599:11e7]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43656a0b361sm568674735e9.0.2025.01.05.02.40.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2025 02:40:31 -0800 (PST) In-Reply-To: <86r05h8s9d.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 05 Jan 2025 12:33:18 +0200") 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:298533 Archived-At: Eli Zaretskii writes: >> From: Gerd M=C3=B6llmann >> Cc: pipcet@protonmail.com, 75322@debbugs.gnu.org >> Date: Sun, 05 Jan 2025 09:19:17 +0100 >>=20 >> 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? Haven't checked others yet. I have that on my todo list now. > >> 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. More roots =3D more to scan for GC. > 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. Works well for me so far.=20