all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Valentin Gatien-Baron <vgatien-baron@janestreet.com>
Cc: 29066@debbugs.gnu.org, schwab@linux-m68k.org, mshinwell@janestreet.com
Subject: bug#29066: 26.0.90; crash in gc involving buffer local symbols
Date: Tue, 31 Oct 2017 21:10:39 +0200	[thread overview]
Message-ID: <83375zt9ow.fsf@gnu.org> (raw)
In-Reply-To: <CAFd54qPr9H1U5Buf+mB0ytf53ewaa3MaAScdRYwYuG=AjzoT-Q@mail.gmail.com> (message from Valentin Gatien-Baron on Tue, 31 Oct 2017 10:52:44 -0400)

> From: Valentin Gatien-Baron <vgatien-baron@janestreet.com>
> Date: Tue, 31 Oct 2017 10:52:44 -0400
> Cc: Eli Zaretskii <eliz@gnu.org>,
> 	29066@debbugs.gnu.org,
> 	Mark Shinwell <mshinwell@janestreet.com>
> 
>  > That was my first attempt, but various macros like SYMBOL_BLV and
>  > SET_SYMBOL_BLV insist on val.blv being non-NULL.
> 
>  SET_SYMBOL_BLV doesn't.  And calling SYMBOL_BLV with a freed symbol is a
>  bug anyway.
> 
> ​SET_SYMBOL_BLV insists that the new value is not NULL, even if it asserts nothing about the current value.
> 
> We do call SYMBOL_BLV after freeing, when we re-sweep the symbol, which is fine because free does
> nothing when given NULL, but triggers the assertion​.
> 
> I would do this, to avoid the assertion failure:
> 
> diff --git a/src/alloc.c b/src/alloc.c
> index da0c3ad4b3..72550e812b 100644
> --- a/src/alloc.c
> +++ b/src/alloc.c
> @@ -7030,8 +7030,10 @@ sweep_symbols (void)
>          {
>            if (!sym->s.gcmarkbit)
>              {
> -              if (sym->s.redirect == SYMBOL_LOCALIZED)
> +              if (sym->s.redirect == SYMBOL_LOCALIZED && sym->s.val.blv) {
>                  xfree (SYMBOL_BLV (&sym->s));
> +                sym->s.val.blv = NULL;
> +              }
>                sym->s.next = symbol_free_list;
>                symbol_free_list = &sym->s;
>                symbol_free_list->function = Vdead;

Thanks, but it makes little sense to me to work around our own
assertions this way.  Why do we have these macros if we sometimes
don't use them?  And why do we have the assertions if they sometimes
get in the way?

> Or changing the redirect type:
> 
> diff --git a/src/alloc.c b/src/alloc.c
> index da0c3ad4b3..6966d96c6d 100644
> --- a/src/alloc.c
> +++ b/src/alloc.c
> @@ -7030,8 +7030,11 @@ sweep_symbols (void)
>          {
>            if (!sym->s.gcmarkbit)
>              {
> -              if (sym->s.redirect == SYMBOL_LOCALIZED)
> +              if (sym->s.redirect == SYMBOL_LOCALIZED) {
>                  xfree (SYMBOL_BLV (&sym->s));
> +                sym->s.redirect = SYMBOL_PLAINVAL;
> +                SET_SYMBOL_VAL (&sym->s, Qunbound);
> +              }

We could do several things, but I still didn't hear even a single
reason why my suggestion isn't OK.  IMO, it's simpler, and the test
for Vdead is already in at least one other place.

So I went ahead and pushed my change.

Is there anything else we need to do before closing this bug?

Thanks.





  reply	other threads:[~2017-10-31 19:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-30 14:36 bug#29066: 26.0.90; crash in gc involving buffer local symbols Valentin Gatien-Baron
2017-10-30 20:38 ` Eli Zaretskii
2017-10-30 22:04   ` Valentin Gatien-Baron
2017-10-31  3:39     ` Eli Zaretskii
2017-10-31  6:32       ` Andreas Schwab
2017-10-31 14:52         ` Valentin Gatien-Baron
2017-10-31 19:10           ` Eli Zaretskii [this message]
2017-10-31 19:58             ` Valentin Gatien-Baron
2017-10-31 20:09               ` Eli Zaretskii
2017-10-31 20:13                 ` Valentin Gatien-Baron
2017-10-31 18:59         ` Eli Zaretskii
2017-10-31 20:23           ` Andreas Schwab
2017-10-31 20:34             ` Eli Zaretskii
2017-10-31 21:03               ` Andreas Schwab
2017-10-31 21:08                 ` Eli Zaretskii
2017-10-31 22:00                   ` Andreas Schwab

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=83375zt9ow.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=29066@debbugs.gnu.org \
    --cc=mshinwell@janestreet.com \
    --cc=schwab@linux-m68k.org \
    --cc=vgatien-baron@janestreet.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.