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#69459: 30.0.50; temacs, SEGV while pdumping Date: Wed, 28 Feb 2024 16:32:09 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9561"; mail-complaints-to="usenet@ciao.gmane.io" To: 69459@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 28 16:34:15 2024 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 1rfLwl-0002Hn-5P for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 28 Feb 2024 16:34:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rfLwA-0000UZ-Eq; Wed, 28 Feb 2024 10:33:38 -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 1rfLw9-0000UD-1n for bug-gnu-emacs@gnu.org; Wed, 28 Feb 2024 10:33:37 -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 1rfLw8-0002I2-Op for bug-gnu-emacs@gnu.org; Wed, 28 Feb 2024 10:33:36 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rfLwY-0007RQ-I1 for bug-gnu-emacs@gnu.org; Wed, 28 Feb 2024 10:34: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: Wed, 28 Feb 2024 15:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 69459 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.170913438328441 (code B ref -1); Wed, 28 Feb 2024 15:34:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Feb 2024 15:33:03 +0000 Original-Received: from localhost ([127.0.0.1]:49090 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rfLvX-0007OF-B7 for submit@debbugs.gnu.org; Wed, 28 Feb 2024 10:33:03 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:56222) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rfLvQ-0007Nt-Q6 for submit@debbugs.gnu.org; Wed, 28 Feb 2024 10:32:57 -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 1rfLut-0000Hf-Ns for bug-gnu-emacs@gnu.org; Wed, 28 Feb 2024 10:32:23 -0500 Original-Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfLuo-000278-7r for bug-gnu-emacs@gnu.org; Wed, 28 Feb 2024 10:32:18 -0500 Original-Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a36126ee41eso709717366b.2 for ; Wed, 28 Feb 2024 07:32:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709134331; x=1709739131; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=eYJNCPcEoGdVlCgaHjbgfsJlgZLb1ML5/v2tIwikEEY=; b=HFwKZWoflRa5B4LXU+M6aOvg+k1Utay2O64thtqxPyd0Z767R3srs+d2DRZfSYcBja nwVcQSOQYnkVXCr1Md+vaaVsnF1Q+Ki+94oHsc0900DCXRssI9h3ouy1ZYhsqAiJZ6Pe 2kXyUPgHq+E0i9J7w8f1/mST6ataetVtV44QebxqDwH4/GKaYnwLvGJQbfNn4Tra9GAi 44vZ6WcUvVEw5VD6gxmN9HpA1PCflc6K7OkEqS+yqh03DfM+s6ywIpf6QfVgFlSGX4CL 3ov8an8bFFknm9oxHWBrHTPyoEDakIVH6dbbyQlOfJ5kDfCNxFDVI28aVjDvp0OqiRLl 8agA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709134331; x=1709739131; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=eYJNCPcEoGdVlCgaHjbgfsJlgZLb1ML5/v2tIwikEEY=; b=kfs0AcSWhlH6P0QtBnxTkdk8apmhZmDD3fHSyHn+8TOYYxSwBWw3Q9okWo/g5HTCnr B9HayWJCsV1CdmMyzsSAssm8QGrbIz7ak64w0FfLgU7o/byibSROY0g0B+jh8t3Lw7Po AKZeMJ/tdt88ExXsG7qdwNjgeODxOBy49ZXi7DPCKytQB1cTZIdIGvjsxb/2J5BchN2V rhA2K4rkBBHyEUvByOVC0gK/F8VEc+hjQVLpvyzTFBkI25TfXxd6OA/C6Gbe50V3ZYX6 TWUB1u76oX37Qb/t71HDemAEuyWD9jbY7RDqVoAz+G0fjOZhNH6IAis4MuY3NGmYyWm7 oUYw== X-Gm-Message-State: AOJu0YwHwNl2nJWnr44aQoQq7bDGcWHffk6SbcZIQS6FOT/1eSVdEN/b WrAD4luuWlEY2lOS3kAUOHreccW7vx5nTPdVIpFfgz8ICEqCcCu3P9i0/1Yg X-Google-Smtp-Source: AGHT+IHBQE0/IK94ofh82k/EOuPaEl6pZ7hkDrmOve/LnSCyr2LUETXRQf54fXVuTnyXcPHbOA9qdw== X-Received: by 2002:a17:906:7c44:b0:a43:bf12:e8a0 with SMTP id g4-20020a1709067c4400b00a43bf12e8a0mr20914ejp.15.1709134331257; Wed, 28 Feb 2024 07:32:11 -0800 (PST) Original-Received: from Pro.fritz.box (p4fe3abca.dip0.t-ipconnect.de. [79.227.171.202]) by smtp.gmail.com with ESMTPSA id h5-20020a1709063c0500b00a432f3bc3a5sm1971105ejg.76.2024.02.28.07.32.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 07:32:10 -0800 (PST) Received-SPF: pass client-ip=2a00:1450:4864:20::62c; envelope-from=gerd.moellmann@gmail.com; helo=mail-ej1-x62c.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, 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:280764 Archived-At: This is with my heavily modified local Emacs, which is based on master. I think it applies to an unmodified master as well. I got a SEGV in temacs while dumping a bootstrap.pdmp: * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x7fd9893b8a34) frame #0: 0x00000001002cb20c temacs`hash_table_index_size(h=0x00007fd9893b89f8) at lisp.h:2717:26 frame #1: 0x00000001002cc4ad temacs`sweep_weak_table(h=0x00007fd9893b89f8, remove_entries_p=false) at fns.c:4980:17 frame #2: 0x0000000100265c5d temacs`mark_and_sweep_weak_table_contents at alloc.c:6303:19 frame #3: 0x000000010026502b temacs`garbage_collect at alloc.c:6554:3 frame #4: 0x0000000100264b26 temacs`maybe_garbage_collect at alloc.c:6390:5 frame #5: 0x00000001002b17ea temacs`maybe_gc at lisp.h:5870:5 frame #6: 0x00000001002abd34 temacs`Ffuncall(nargs=3, args=(struct Lisp_Symbol *) $158 = 0x00007ff8c0a9f000) at eval.c:3073:3 frame #7: 0x00000001002d4388 temacs`inorder(predicate=(struct Lisp_Subr *) $165 = 0x0000000100b51348, a=(struct Lisp_Subr *) $171 = 0x0000000100b4d3a0, b=(struct Lisp_Subr *) $177 = 0x0000000100b55520) at sort.c:116:11 frame #8: 0x00000001002d3987 temacs`count_run(ms=0x00007ff7bfefb9f0, lo=(struct Lisp_Symbol *) $187 = 0x00007fd9895f74e8, hi=(struct Lisp_Symbol *) $198 = 0x00007fd9895fd298, descending=0x00007ff7bfefb9d7) at sort.c:180:7 frame #9: 0x00000001002d308e temacs`tim_sort(predicate=(struct Lisp_Subr *) $205 = 0x0000000100b51348, seq=(struct Lisp_Symbol *) $215 = 0x00007fd9895f74e0, length=2999) at sort.c:943:19 frame #10: 0x00000001002c4070 temacs`sort_list(list=(struct Lisp_Cons *) $222 = 0x00000001763e9a60, predicate=(struct Lisp_Symbol *) $240 = 0x0000000100ba97d0) at fns.c:2362:7 frame #11: 0x00000001002c3e74 temacs`Fsort(seq=(struct Lisp_Cons *) $249 = 0x00000001763e9a60, predicate=(struct Lisp_Symbol *) $267 = 0x0000000100ba97d0) at fns.c:2399:11 frame #12: 0x000000010026f7c6 temacs`dump_sort_copied_objects(ctx=0x00007ff7bfefca78) at pdumper.c:3325:5 * frame #13: 0x000000010026e1df temacs`Fdump_emacs_portable(filename=(struct Lisp_String *) $276 = 0x00007fd88d0326e0, track_referrers=(struct Lisp_Symbol *) $294 = 0x0000000100ba36e0) at pdumper.c:4249:3 As one can see, a GC can run while dumping. Fdump_emacs_portable uses a struct dump_context ctx_buf, which is allocated on the stack (the local variable ctx is a pointer to the local variable ctx_buf). 1. While dumping, pdump creates new Lisp_Objects (hash-tables, conses, ...) that are stored in dump_context or subobjects of it, hash-tables for example. 2. I can't find a function that marks a struct dump_context for GC. If I'm right, nothing protects the objects that pdump creates from GC. As a fix I propose to inhibit GC while pdumping. Would be nice if someone could check if (2) is right.