emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 2f7afef 1/3: Fix pdumper-related GC bug


From: Paul Eggert
Subject: master 2f7afef 1/3: Fix pdumper-related GC bug
Date: Sun, 11 Jul 2021 04:30:18 -0400 (EDT)

branch: master
commit 2f7afef5ffe023a7a12520201ab70643f826abfd
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>

    Fix pdumper-related GC bug
    
    * src/alloc.c (mark_maybe_pointer): Also mark pointers
    to pdumper objects, even when the pointers are tagged.
    Add a FIXME saying why this isn’t enough.
---
 src/alloc.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/alloc.c b/src/alloc.c
index 76d8c7d..752eaec 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4755,6 +4755,17 @@ mark_maybe_pointer (void *p)
      definitely _don't_ have an object.  */
   if (pdumper_object_p (p))
     {
+      /* FIXME: This code assumes that every reachable pdumper object
+        is addressed either by a pointer to the object start, or by
+        the same pointer with an LSB-style tag.  This assumption
+        fails if a pdumper object is reachable only via machine
+        addresses of non-initial object components.  Although such
+        addressing is rare in machine code generated by C compilers
+        from Emacs source code, it can occur in some cases.  To fix
+        this problem, the pdumper code should grok non-initial
+        addresses, as the non-pdumper code does.  */
+      uintptr_t mask = VALMASK;
+      p = (void *) ((uintptr_t) p & mask);
       /* Don't use pdumper_object_p_precise here! It doesn't check the
          tag bits. OBJ here might be complete garbage, so we need to
          verify both the pointer and the tag.  */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]