]> git.eshelyaron.com Git - emacs.git/commitdiff
Prevent unrelocated symbols with position from being dumped
authorPo Lu <luangruo@yahoo.com>
Thu, 17 Apr 2025 01:33:06 +0000 (09:33 +0800)
committerEshel Yaron <me@eshelyaron.com>
Thu, 17 Apr 2025 07:18:58 +0000 (09:18 +0200)
* src/pdumper.c (dump_builtin_symbol_p): Test BARE_SYMBOL_P
\(object) rather than SYMBOLP to avoid depending on the value of
symbols_with_pos_enabled or depositing non-relocated references
to vectorlikes in the dump file.  Clarify commentary.

(cherry picked from commit 0fc2fc9a4de3855cf14b6e1f548795831099981b)

src/pdumper.c

index 1deb8473956cefe87fac52c40672544ee172a4c9..5cd849952262ef97b0b4d48976f00aaab5937657 100644 (file)
@@ -727,12 +727,18 @@ emacs_offset (const void *emacs_ptr)
   return ptrdiff_t_to_dump_off (emacs_ptr_relative);
 }
 
-/* Return whether OBJECT is a symbol the storage of which is built
-   into Emacs (and so is invariant across ASLR).  */
+/* Return whether OBJECT is a symbol the storage of which is built into
+   Emacs (and hence is implicitly offset from an address in the Emacs
+   image).  */
+
 static bool
 dump_builtin_symbol_p (Lisp_Object object)
 {
-  return SYMBOLP (object) && c_symbol_p (XSYMBOL (object));
+  /* Symbols with position cannot be dumped, but not returning true for
+     them avoids producing references to unrelocated Lisp_Objects in
+     fixup processing or depending on the value of
+     symbols_with_pos_enabled.  */
+  return BARE_SYMBOL_P (object) && c_symbol_p (XSYMBOL (object));
 }
 
 /* Return whether OBJECT has the same bit pattern in all Emacs