GNU bug report logs -
#8705
Emacs 24.3 occasionally crashes (segfault) just after starting it
Previous Next
Reported by: Vincent Lefevre <vincent <at> vinc17.net>
Date: Fri, 20 May 2011 08:55:02 UTC
Severity: important
Merged with 18671
Found in version 23.3
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
Message #50 received at 8705 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier wrote:
>> Any news on this bug? Debian's GNU Emacs 24.3.1 is still affected.
>
> Same question here.
Comments from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699325#17:
> What emacs appears to be doing is:
>
> * vfork() in thread A
> - parent: thread A suspended
> - parent: threads B, C, ... (one of which is the Gtk GUI) continue
> - child: "shares all memory with its parent, including the stack"
> per vfork(2)
>
> * child copies environ and modifies the copy as needed
>
> RACE:
> child + parent thread A:
> * changes the global environ pointer, potentially making it point to
> a new mmap() that only exists in the child process (or something?)
> * child: calls execvp()
> * parent: thread A resumes and puts the old environ back
> parent threads B, C...
> * threads B, C, ... continue their work and might call getenv()
>
> If the child wins the race, everything's OK; if the parent's threads B,
> C... "win" the race, everything explodes. It seems that Gtk, in the
> parent's GUI thread, is now more likely to "win" the race and crash,
> because new features like touchscreen support have the side-effect that
> it calls getenv() more often.
>
> On the upstream emacs bug, Troels Nielsen wrote:
> > In the meantime, retaining support for vfork would be nice, because
> > on some platforms, like Cygwin, fork is still very slow
>
> but on Linux (and hopefully also *BSD and Hurd), fork() is quite fast,
> and considerably less crashy. I would suggest changing the vfork() call
> to fork(), making sure the environ rewriting is only done in the child
> side of the fork(), and seeing whether that helps.
>
> Alternatively, emacs could use execvpe() instead of execve() on
> platforms where it exists (including all GNU platforms as far as I
> know), so that it does not need to alter the value of environ at all on
> such platforms. I think that would fix this?
This bug report was last modified 10 years and 225 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.