From: Pip Cet <pipcet@gmail.com>
To: "Nicolas Bértolo" <nicolasbertolo@gmail.com>
Cc: Paul Eggert <eggert@cs.ucla.edu>,
41755@debbugs.gnu.org, Andrea Corallo <akrl@sdf.org>
Subject: bug#41755: feature/native-comp (master?): temacs crash in GC during mark phase
Date: Mon, 08 Jun 2020 19:05:17 +0000 [thread overview]
Message-ID: <87tuzlwf82.fsf@gmail.com> (raw)
In-Reply-To: <CAFnS-OnpWnyWWWqDCVET_LG1HkxsqBHZXmsSRWDbWRYUjQ3haw@mail.gmail.com> ("Nicolas Bértolo"'s message of "Mon, 8 Jun 2020 15:51:14 -0300")
Nicolas Bértolo <nicolasbertolo@gmail.com> writes:
>> I'm wondering what we could do to make such bugs easier to find...
>
> We could add a canary to stack based strings and conses. Then while
> marking if we
> come across a stack based string or cons we check that the canary is
> intact. If
> it is not, then we can be sure that the memory has been written over.
I believe we should never be marking stack-based objects. If we do
that's a GC bug.
Code like
AUTO_STRING (s, "foo");
Lisp_Object c = Fcons (s, s);
garbage_collect ();
...
Fsetcar (c, Qnil);
Fsetcdr (c, Qnil);
shouldn't work. I hope it doesn't :-) (With GC_CHECK_MARKED_OBJECTS, it
should abort; without, it would leave the mark bit of s set, so the
"..." code would presumably crash).
> Something like this:
>
> struct Stack_String
> {
> struct Lisp_String string;
> uint64_t canary = 0x12341234;
> };
>
>> Would GC_CHECK_MARKED_OBJECTS have caught this?
>
> As far as I can see, during a GC we can't know if a stack-based string
> is still alive.
But we can know whether a string is stack-based or not; if it is, we
shouldn't be marking it, so we can abort in that case...
next prev parent reply other threads:[~2020-06-08 19:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-07 19:16 bug#41755: feature/native-comp (master?): temacs crash in GC during mark phase Andrea Corallo
2020-06-07 19:41 ` Pip Cet
2020-06-07 19:57 ` Nicolas Bértolo
2020-06-07 20:18 ` Pip Cet
2020-06-07 23:09 ` Nicolas Bértolo
2020-06-08 3:39 ` Nicolas Bértolo
2020-06-08 6:29 ` Eli Zaretskii
2020-06-08 18:24 ` Nicolas Bértolo
2020-06-08 6:41 ` Pip Cet
2020-06-08 18:51 ` Nicolas Bértolo
2020-06-08 19:05 ` Pip Cet [this message]
2020-06-09 14:20 ` Nicolas Bértolo
2020-06-10 12:53 ` Andrea Corallo
2020-06-27 14:39 ` Andrea Corallo
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tuzlwf82.fsf@gmail.com \
--to=pipcet@gmail.com \
--cc=41755@debbugs.gnu.org \
--cc=akrl@sdf.org \
--cc=eggert@cs.ucla.edu \
--cc=nicolasbertolo@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.