unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Pip Cet <pipcet@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 42832@debbugs.gnu.org, Paul Eggert <eggert@cs.ucla.edu>
Subject: bug#42832: 28.0.50; "Bus error" when compiling Emacs now on Debian bullseye
Date: Fri, 14 Aug 2020 19:08:56 +0000	[thread overview]
Message-ID: <CAOqdjBePXvj8x6tAS7i6OT0Y6K4wQC8zLaPJGBwM2EkAN3iiSg@mail.gmail.com> (raw)
In-Reply-To: <87sgcp44s9.fsf@gnus.org>

[-- Attachment #1: Type: text/plain, Size: 520 bytes --]

On Fri, Aug 14, 2020 at 3:37 PM Lars Ingebrigtsen <larsi@gnus.org> wrote:
> Pip Cet <pipcet@gmail.com> writes:
> > I've gone with the last idea. This patch should fix things,
> It does!  With that patch, I'm not able to reproduce the bug.

Oops. There was a bug in the patch which would have resulted in assert
failures had I tested it with assertions. Fixed version attached.

The crash was looking at a hash table created, most likely, by
cl--generic-get-dispatcher; so that makes my theory sound more
plausible, too.

[-- Attachment #2: 0001-Try-to-avoid-marking-zombie-pdumper-objects.patch --]
[-- Type: text/x-patch, Size: 2870 bytes --]

From e9b53aa1c6cdfb8f31bb9de76ae1aa20659752f1 Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet@gmail.com>
Date: Fri, 14 Aug 2020 14:56:19 +0000
Subject: [PATCH] Try to avoid marking zombie pdumper objects.

---
 src/pdumper.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/pdumper.c b/src/pdumper.c
index bc41afc7c5..c05b88ea6d 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -4871,6 +4871,8 @@ dump_bitset_clear (struct dump_bitset *bitset)
   struct dump_header header;
   /* Mark bits for objects in the dump; used during GC.  */
   struct dump_bitset mark_bits;
+  /* Mark bits for objects in the dump; used during GC.  */
+  struct dump_bitset last_mark_bits;
   /* Time taken to load the dump.  */
   double load_time;
   /* Dump file name.  */
@@ -4995,6 +4997,10 @@ pdumper_find_object_type_impl (const void *obj)
     return PDUMPER_NO_OBJECT;
   const struct dump_reloc *reloc =
     dump_find_relocation (&dump_private.header.object_starts, offset);
+  ptrdiff_t bitno = offset / DUMP_ALIGNMENT;
+  if (offset < dump_private.header.cold_start
+      && !dump_bitset_bit_set_p (&dump_private.last_mark_bits, bitno))
+    return PDUMPER_NO_OBJECT;
   return (reloc != NULL && dump_reloc_get_offset (*reloc) == offset)
     ? reloc->type
     : PDUMPER_NO_OBJECT;
@@ -5021,12 +5027,16 @@ pdumper_set_marked_impl (const void *obj)
   eassert (offset < dump_private.header.cold_start);
   eassert (offset < dump_private.header.discardable_start);
   ptrdiff_t bitno = offset / DUMP_ALIGNMENT;
+  eassert (dump_bitset_bit_set_p (&dump_private.last_mark_bits, bitno));
   dump_bitset_set_bit (&dump_private.mark_bits, bitno);
 }
 
 void
 pdumper_clear_marks_impl (void)
 {
+  memcpy (dump_private.last_mark_bits.bits, dump_private.mark_bits.bits,
+	  sizeof (dump_private.last_mark_bits.bits[0])
+	  * dump_private.mark_bits.number_words);
   dump_bitset_clear (&dump_private.mark_bits);
 }
 
@@ -5244,6 +5254,7 @@ pdumper_load (const char *dump_filename)
   dump_off adj_discardable_start;
 
   struct dump_bitset mark_bits;
+  struct dump_bitset last_mark_bits;
   size_t mark_bits_needed;
 
   struct dump_header header_buf = { 0 };
@@ -5360,12 +5371,19 @@ pdumper_load (const char *dump_filename)
   if (!dump_bitset_init (&mark_bits, mark_bits_needed))
     goto out;
 
+  if (!dump_bitset_init (&last_mark_bits, mark_bits_needed))
+    goto out;
+
+  memset (last_mark_bits.bits, 0xff, sizeof (last_mark_bits.bits[0])
+	  * last_mark_bits.number_words);
+
   /* Point of no return.  */
   err = PDUMPER_LOAD_SUCCESS;
   dump_base = (uintptr_t) sections[DS_HOT].mapping;
   gflags.dumped_with_pdumper_ = true;
   dump_private.header = *header;
   dump_private.mark_bits = mark_bits;
+  dump_private.last_mark_bits = last_mark_bits;
   dump_public.start = dump_base;
   dump_public.end = dump_public.start + dump_size;
 
-- 
2.28.0


  reply	other threads:[~2020-08-14 19:08 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-12 17:12 bug#42832: 28.0.50; "Bus error" when compiling Emacs now on Debian bullseye Lars Ingebrigtsen
2020-08-12 18:22 ` Lars Ingebrigtsen
2020-08-12 18:30   ` Lars Ingebrigtsen
2020-08-12 18:50     ` Eli Zaretskii
2020-08-12 18:58       ` Lars Ingebrigtsen
2020-08-12 19:28         ` Lars Ingebrigtsen
2020-08-12 19:33           ` Lars Ingebrigtsen
2020-08-12 20:40             ` Paul Eggert
2020-08-12 20:47               ` Lars Ingebrigtsen
2020-08-12 21:42                 ` Pip Cet
2020-08-12 21:54                   ` Lars Ingebrigtsen
2020-08-13 10:05                     ` Pip Cet
2020-08-13 10:12                       ` Lars Ingebrigtsen
2020-08-13 10:15                         ` Lars Ingebrigtsen
2020-08-13 14:08                           ` Pip Cet
2020-08-14 11:48                             ` Lars Ingebrigtsen
2020-08-14 12:05                               ` Pip Cet
2020-08-14 12:34                                 ` Lars Ingebrigtsen
2020-08-14 14:24                             ` Pip Cet
2020-08-14 15:01                               ` Pip Cet
2020-08-14 15:37                                 ` Lars Ingebrigtsen
2020-08-14 19:08                                   ` Pip Cet [this message]
2020-08-14 19:35                                     ` Lars Ingebrigtsen
2020-08-14 21:10                                     ` Lars Ingebrigtsen
2020-08-14 21:48                                     ` Paul Eggert
2020-08-14 22:25                                       ` Pip Cet
2020-08-14 22:52                                         ` Paul Eggert
2020-08-12 22:00                   ` Lars Ingebrigtsen
2020-08-12 18:34   ` Eli Zaretskii
2020-08-12 18:41     ` Lars Ingebrigtsen
2020-08-12 19:26 ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOqdjBePXvj8x6tAS7i6OT0Y6K4wQC8zLaPJGBwM2EkAN3iiSg@mail.gmail.com \
    --to=pipcet@gmail.com \
    --cc=42832@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).