From: Philipp Stephani <p.stephani2@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: "Basil L. Contovounesios" <contovob@tcd.ie>,
34655@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#34655: 26.1.92; Segfault in module with --module-assertions
Date: Thu, 21 Mar 2019 20:37:24 +0100 [thread overview]
Message-ID: <CAArVCkSGkKOJHO=2VkkgCKgA+U1G3P_5WZ27JSvOL+HcYX+gcw@mail.gmail.com> (raw)
In-Reply-To: <83o964t4de.fsf@gnu.org>
Am Do., 21. März 2019 um 20:27 Uhr schrieb Eli Zaretskii <eliz@gnu.org>:
>
> > > I will CC Stefan, who committed 3eb93c07f7a60ac9ce8a16f10c3afd5a3a31243a.
> > >
> > > I'm not sure we should revert that; we could instead add GC protection
> > > for those parts that need it.
> >
> > Yes, that's what reverting that commit does :-)
>
> AFAIU, it does much more. Stefan intended for the conservative stack
> marking to do the job, so maybe there's a little more that should be
> done to get there. Or maybe Stefan didn't consider some important
> factor(s). In either case, I'd like to hear his POV on this before we
> decide how to proceed.
Let's go back to the known good state first, and then discuss how to
go from there.
>
> > We need to mark the objects in all cases, not just when module
> > assertions are enabled.
>
> If we get stack marking to work, we won't need to mark objects
> explicitly.
We can't get stack marking to work, even theoretically.
A module is free to do
emacs_value x = ...;
uintptr_t y = ((uintrptr_t) x) ^ 0x123456u;
(garbage-collect)
emacs_value z = (emacs_value) (y ^ 0x123456u);
... use z ...
During the garbage collection, x isn't on the stack anywhere, and the
garbage collector couldn't possibly find it.
Or:
emacs_value x = ...;
emacs_value *y = malloc (sizeof emacs_value);
*y = x;
... stop using x...
(garbage-collect)
...use *y ...
Again, during garbage collection x is no longer on the stack.
We can only use stack scanning in Emacs because we control the Emacs
source code and can make sure these patterns don't occur. Module code
is completely arbitrary.
>
> > Note that both the designer of the module API (Daniel) and I as one of
> > its main implementers disagree with commit
> > 3eb93c07f7a60ac9ce8a16f10c3afd5a3a31243a.
>
> OK, but I think Stefan's opinion is not less important.
I value his opinion, but again: let's make the thing work first, and
then discuss options.
>
> > I've already confirmed that reverting commit
> > 3eb93c07f7a60ac9ce8a16f10c3afd5a3a31243a fixes bug#31238, and I can
> > try it with this bug as well.
>
> Please do, it's important to know that, I think.
Basil, could you check that with the revert your code now works? Thanks!
next prev parent reply other threads:[~2019-03-21 19:37 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-25 21:00 bug#34655: 26.1.92; Segfault in module with --module-assertions Basil L. Contovounesios
2019-02-26 2:59 ` Richard Stallman
2019-02-26 11:16 ` Basil L. Contovounesios
2019-02-26 15:27 ` Eli Zaretskii
2019-02-26 18:42 ` Basil L. Contovounesios
2019-02-27 4:10 ` Richard Stallman
2019-02-26 15:45 ` Eli Zaretskii
2019-03-17 16:38 ` Basil L. Contovounesios
2019-03-17 17:08 ` Eli Zaretskii
2019-03-17 23:52 ` Basil L. Contovounesios
2019-03-18 16:21 ` Eli Zaretskii
2019-03-18 16:58 ` Basil L. Contovounesios
2019-03-18 17:53 ` Eli Zaretskii
2019-03-21 16:11 ` Philipp Stephani
2019-03-21 17:00 ` Eli Zaretskii
2019-03-21 18:28 ` Philipp Stephani
2019-03-21 19:23 ` Philipp Stephani
2019-03-21 19:34 ` Eli Zaretskii
2019-03-21 21:29 ` Basil L. Contovounesios
2019-03-22 7:11 ` Eli Zaretskii
2019-03-21 19:27 ` Eli Zaretskii
2019-03-21 19:37 ` Philipp Stephani [this message]
2019-03-21 19:50 ` Eli Zaretskii
2019-03-21 20:01 ` Philipp Stephani
2019-03-21 20:14 ` Eli Zaretskii
2019-03-21 20:26 ` Philipp Stephani
2019-03-21 20:44 ` Eli Zaretskii
2019-03-21 20:48 ` Daniel Colascione
2019-03-22 8:17 ` Eli Zaretskii
2019-03-21 21:31 ` Basil L. Contovounesios
2019-03-22 0:56 ` Stefan Monnier
2019-03-22 8:16 ` 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='CAArVCkSGkKOJHO=2VkkgCKgA+U1G3P_5WZ27JSvOL+HcYX+gcw@mail.gmail.com' \
--to=p.stephani2@gmail.com \
--cc=34655@debbugs.gnu.org \
--cc=contovob@tcd.ie \
--cc=eliz@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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).