From: Pip Cet <pipcet@protonmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Pure space
Date: Sat, 17 Aug 2024 14:35:13 +0000 [thread overview]
Message-ID: <ttWQ2RyBHb-C89er37ztxU_Y0PBr-5dpTDyJ5-goM7mj6Cbb9P9Ievg51RPoHYQZumfz9btMWfq4Bc9PC6ESV6ZbkfoTywOFhWIeasR2DHo=@protonmail.com> (raw)
In-Reply-To: <86mslb1aug.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 563 bytes --]
On Saturday, August 17th, 2024 at 14:29, Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Sat, 17 Aug 2024 13:26:08 +0000
>
> > From: Pip Cet pipcet@protonmail.com
> > Cc: emacs-devel@gnu.org
> >
> > "Eli Zaretskii" eliz@gnu.org writes:
> > > I saw no patch attached to the original message (nor any other message
> > > in this thread). Am I lying again?
> >
> > No, this time it's me being inconsistent. Patch attached (this time,
> > hopefully).
>
> Ahm... ENPATCH
Ah, it is my email client, then. Let me try again with the web client.
Pip
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Avoid-crashes-when-pure-space-overflows.patch --]
[-- Type: text/x-patch; name=0001-Avoid-crashes-when-pure-space-overflows.patch, Size: 1700 bytes --]
From 29b919dcce693135cc7f5d2952c551d2ac446602 Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet@protonmail.com>
Date: Fri, 16 Aug 2024 19:00:38 +0000
Subject: [PATCH] Avoid crashes when pure space overflows
When pure space has overflowed, all objects are potentially pure. This
means we cannot use 'SDATA_OF_STRING' on them, or assume they're invalid
when printing them.
* src/alloc.c (string_bytes):
(pin_string): Do nothing after pure space overflow.
(valid_lisp_object_p): Never return 0 after pure space overflow.
---
src/alloc.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/alloc.c b/src/alloc.c
index 06fe12cff3d..616ec3083b9 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1797,7 +1797,7 @@ string_bytes (struct Lisp_String *s)
(s->u.s.size_byte < 0 ? s->u.s.size & ~ARRAY_MARK_FLAG : s->u.s.size_byte);
if (!PURE_P (s) && !pdumper_object_p (s) && s->u.s.data
- && nbytes != SDATA_NBYTES (SDATA_OF_STRING (s)))
+ && !pure_bytes_used_before_overflow && nbytes != SDATA_NBYTES (SDATA_OF_STRING (s)))
emacs_abort ();
return nbytes;
}
@@ -2644,7 +2644,7 @@ pin_string (Lisp_Object string)
if (!(size > LARGE_STRING_BYTES
|| PURE_P (data) || pdumper_object_p (data)
- || s->u.s.size_byte == -3))
+ || s->u.s.size_byte == -3 || pure_bytes_used_before_overflow))
{
eassert (s->u.s.size_byte == -1);
sdata *old_sdata = SDATA_OF_STRING (s);
@@ -5606,6 +5606,9 @@ valid_lisp_object_p (Lisp_Object obj)
if (pdumper_object_p (p))
return pdumper_object_p_precise (p) ? 1 : 0;
+ if (pure_bytes_used_before_overflow)
+ return -1;
+
struct mem_node *m = mem_find (p);
if (m == MEM_NIL)
--
2.45.2
next prev parent reply other threads:[~2024-08-17 14:35 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 19:07 Pure space Pip Cet
2024-08-17 6:18 ` Eli Zaretskii
2024-08-17 6:59 ` Stefan Kangas
2024-08-17 8:14 ` Po Lu
2024-08-17 12:10 ` Stefan Kangas
2024-08-17 12:53 ` Eli Zaretskii
2024-08-17 13:36 ` Po Lu
2024-08-17 14:12 ` Eli Zaretskii
2024-08-17 8:45 ` Pip Cet
2024-08-17 10:51 ` Eli Zaretskii
2024-08-17 11:38 ` Pip Cet
2024-08-17 13:13 ` Eli Zaretskii
2024-08-17 13:26 ` Pip Cet
2024-08-17 14:29 ` Eli Zaretskii
2024-08-17 14:35 ` Pip Cet [this message]
2024-08-17 13:11 ` Stefan Kangas
2024-08-17 14:30 ` Pip Cet
2024-08-17 15:34 ` Andrea Corallo
2024-08-17 15:41 ` Pip Cet
2024-08-17 8:16 ` Po Lu
2024-08-17 8:28 ` Po Lu
2024-08-17 8:31 ` Po Lu
2024-08-17 8:57 ` Pip Cet
2024-08-17 11:06 ` Eli Zaretskii
2024-08-17 10:45 ` Eli Zaretskii
2024-08-17 11:46 ` Po Lu
2024-08-17 12:49 ` Eli Zaretskii
2024-08-17 13:44 ` Po Lu
2024-08-17 14:17 ` Eli Zaretskii
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='ttWQ2RyBHb-C89er37ztxU_Y0PBr-5dpTDyJ5-goM7mj6Cbb9P9Ievg51RPoHYQZumfz9btMWfq4Bc9PC6ESV6ZbkfoTywOFhWIeasR2DHo=@protonmail.com' \
--to=pipcet@protonmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.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).