From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lynn Winebarger Newsgroups: gmane.emacs.bugs Subject: bug#56794: Segmentation fault in purecopy while dumping - stack overflow attempting to copy cyclic Lisp value Date: Wed, 27 Jul 2022 10:07:35 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000001fad1e05e4c9f143" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5293"; mail-complaints-to="usenet@ciao.gmane.io" To: 56794@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jul 27 16:16:39 2022 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 1oGhq1-00019l-VS for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 27 Jul 2022 16:16:38 +0200 Original-Received: from localhost ([::1]:59892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGhq0-0003mW-Q9 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 27 Jul 2022 10:16:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46754) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGhhi-0006BH-JU for bug-gnu-emacs@gnu.org; Wed, 27 Jul 2022 10:08:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38614) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGhhi-0000id-9L for bug-gnu-emacs@gnu.org; Wed, 27 Jul 2022 10:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oGhhi-00056N-4o for bug-gnu-emacs@gnu.org; Wed, 27 Jul 2022 10:08:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lynn Winebarger Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Jul 2022 14:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56794 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.165893087719597 (code B ref -1); Wed, 27 Jul 2022 14:08:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Jul 2022 14:07:57 +0000 Original-Received: from localhost ([127.0.0.1]:56596 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oGhhc-000560-OY for submit@debbugs.gnu.org; Wed, 27 Jul 2022 10:07:57 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:38956) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oGhhZ-00055m-8r for submit@debbugs.gnu.org; Wed, 27 Jul 2022 10:07:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGhhZ-000605-2I for bug-gnu-emacs@gnu.org; Wed, 27 Jul 2022 10:07:53 -0400 Original-Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]:46781) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGhhX-0000h9-9m for bug-gnu-emacs@gnu.org; Wed, 27 Jul 2022 10:07:52 -0400 Original-Received: by mail-pf1-x42c.google.com with SMTP id c3so16194441pfb.13 for ; Wed, 27 Jul 2022 07:07:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=88YSDcM7cqJi9V/I53EYSTsC7lJWp07aTaAf0CRibao=; b=G59hz07OWsl8WbjzOQrKwfYax8zG+sexV4gMlPwVyT57r18rOiTEzKMiKNQGXaNGaV pbvu+A0lxFsIwpwj+zH7osmE2AuVuzz3kyzr79EDBeu6GlhTtYewBl2SHMAp8LOH6t+P 4KXYAuXNG7QQbUhu4Z8/wySBxwMfdi8hJhhfI8HumtZ2ifiCCrGlD5Z8YmOxqWBzMSMr a+LmxSgIRLdS5zDBDLBrBFZKyWkKzrggu4y/EGiHBIJ6onj0WCgiFr/M9TMc4FYyjuaj BNvQ0bGQNOAI0LmrNklJo0nYTFNaknys2MVnFdW9lqYBmXpnqK+kWlVorCKWc1LPj5TM jRVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=88YSDcM7cqJi9V/I53EYSTsC7lJWp07aTaAf0CRibao=; b=a0TBCIV0RICkQ2u1judgMgEb79GEN9LMdPLm11GfS6sPAlCjs7Ow/f4Hu5FD/LlbNY AxgogFuTBeRqz6MkizJPSx4RhkDz7g/01Z0/ImsKQ/46+UibL1nn7493gD4l5jGAlPHM I0LXInOVYCrTqGh/ehuw/gUiMtXzTMd5gagDKqSZ3Q/pLHFfk5ya2G8ffGAqRz/q2DQA iUqN9ZjfRFsnhYHG3dWex5uLuKzi6btHdFBveXTIwsg7R7uDHxO5Nx/6Ku6idG3ZfrqW DcucXN47OhFAWbZpomVP9vI2atvBBZ4vEjm0Kf9KQRLRDwS7ieIy/mMr4pQ10NBCPieZ 28Jg== X-Gm-Message-State: AJIora+v87IGsYcM2AUAoGoPeX3fW3b8nMOUcYrXQwnBJnP8Oxe172B7 AhwbPCXDifqlgcFLKUfec55E+S69gKhg3Aj1INmgCYPCM7g= X-Google-Smtp-Source: AGRyM1sMZTlynrT/rnCGb0SqTj6yHjWCHhcfXAnzyZzyaTPybFGbt09TaJdFkO1nuWVYgATYRrbE7Nc4Re9dC2/cWbY= X-Received: by 2002:a05:6a00:298d:b0:52b:cf1f:5738 with SMTP id cj13-20020a056a00298d00b0052bcf1f5738mr22156886pfb.0.1658930868495; Wed, 27 Jul 2022 07:07:48 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=owinebar@gmail.com; helo=mail-pf1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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" Xref: news.gmane.io gmane.emacs.bugs:238040 Archived-At: --0000000000001fad1e05e4c9f143 Content-Type: text/plain; charset="UTF-8" I apologize for not being able to include significant details of the build, as this is happening on a sandboxed system in a proprietary context. I've been attempting to dump emacs built from the 28.1 tarball with a large number of core libraries preloaded. I have observed segmentation faults when attempting to dump with native-compilation enabled and with native-compilation disabled. However, it only happened with one file (nxml/rng-pttrn.el) while dumping several hundred core libraries with native compilation. With native compilation disabled, the problem has appeared with both auth-source.el and emacs-lisp/eieio-core.el, the latter preventing me from proceeding much further in the dump process. Note these were both dumped successfully with native-compilation enabled. I used gdb to look at the backtrace after the segmentation fault while loading auth-source.el, and the stack was in a tight recursive loop in purecopy: for (i = 0; i < size; i++) vec->contents[i] = purecopy (vec->contents[i]); In this case the index I alternated between two values in each pair of stack frames: 0 and 10. I'm not familiar enough with the layout of lisp objects to recognize the pseudo vector type on site, but it's probably a byte-vector with a recursive call - the constants vector in slot 0, and the recursive binding in slot 10 of the constants vector. Plus, the fact that this started happening more frequently with byte-compilation only is suspicious in itself. Since I'm restricted to using official release tarballs with only local modifications, I'd welcome any hints on any "quick fix" to the problem aside from the long-term solution of just eliminating purecopy altogether (unless that can be done with a de minimis change to the code). Lynn --0000000000001fad1e05e4c9f143 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I apologize for not being able to include significant deta= ils of the build, as this is happening on a sandboxed system in a proprieta= ry context.
I've been attempting to dump emacs built from the 28.1 t= arball with a large number of core libraries preloaded.=C2=A0 I have observ= ed segmentation faults when attempting to dump with native-compilation enab= led and with native-compilation disabled.=C2=A0 However, it only happened w= ith one file (nxml/rng-pttrn.el) while dumping several hundred core librari= es with native compilation.=C2=A0 With native compilation disabled, the pro= blem has appeared with both auth-source.el and emacs-lisp/eieio-core.el, th= e latter preventing me from proceeding much further in the dump process.=C2= =A0 Note these were both dumped successfully with native-compilation enable= d.
I used gdb to look at the backtrace after the segmentation fault whil= e loading auth-source.el, and the stack was in a tight recursive loop in pu= recopy:

for (i =3D 0; i < size; i++)
vec->contents[i] =3D purecopy (vec->content= s[i]);
In this case the index I alternated between= two values in each pair of stack frames: 0 and 10.
I'm not familia= r enough with the layout of lisp objects to recognize the pseudo vector typ= e on site, but it's probably a byte-vector with a recursive call - the = constants vector in slot 0, and the recursive binding in slot 10 of the con= stants vector.=C2=A0 Plus, the fact that this started happening more freque= ntly with byte-compilation only is suspicious in itself.
Since I&= #39;m restricted to using official release tarballs with only local modific= ations, I'd welcome any hints on any "quick fix" to the probl= em aside from the long-term solution of just eliminating purecopy altogethe= r (unless that can be done with a de minimis change to the code).

Lynn


--0000000000001fad1e05e4c9f143--