all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Steven Tamm <steventamm@mac.com>
Cc: Andrew Choi <akochoi@shaw.ca>, emacs-devel@gnu.org
Subject: Re: Mac OS X: Rebuild Require after Security Update 2002-11-21
Date: Tue, 26 Nov 2002 08:31:13 -0800	[thread overview]
Message-ID: <7A6C6DA4-015C-11D7-9286-00039390AB82@mac.com> (raw)
In-Reply-To: <200211261453.gAQErhd07777@rum.cs.yale.edu>

It doesn't cause a kernel panic on my box, it just causes the system to  
become totally unresponsive.
The apple version of emacs includes this code around ever call to vfork.

#ifndef PUMA_VFORK_ISSUES_CLEARED_UP
     pid = fork ();
#else
     pid = vfork ();
#endif

Apparently, puma vfork issues are not cleared up, so it appears the  
answer is to use fork.  I started to do some debugging of this issue,  
but the fact that after every run the computer hangs makes things quite  
annoying.  I narrowed down the problem (I think).
This code works:

#include <sys/types.h>
#include <unistd.h>

int main(int argc, char **argv)
{
   pid_t parent = getpid();
   pid_t child;
   printf("Parent pid %x\n", parent);
   child = vfork();
   if (child < 0) {
     perror("vfork");
     _exit(2);
   }
   if (!child) {
     printf("Child pid %x\n", getpid());
     printf("Bad exec return %d\n", execv("/nofile/noplace", argv));
     _exit(1);
   }
   return 0;
}

If you remove the _exit(1), it causes a nasty seg fault (it seems to  
blow away the entire state of the process).
If you remove the _exit(1) and switch to fork() it works.  So I think  
the problem may be with vfork not correctly cleaning up after itself if  
the process goes kablooy.  Andrew, did you report a radar issue  
associated with this?

A couple other people tried to switch bash to use vfork, because in  
later darwin releases the performance of fork seems to have gotten  
worse.  They found similar issues with the system hanging.   
http://lists.apple.com/archives/darwin-kernel/2002/Oct/02/ 
forkexecperformance.txt

-Steven


>> /* The following solves the problem that Emacs hangs when evaluating
>>    (make-comint "test0" "/nodir/nofile" nil "") when /nodir/nofile
>>    does not exist.  */
>> #undef HAVE_WORKING_VFORK
>> #define vfork fork
>> #define DONT_REOPEN_PTY
>>
>> I just tried removing these three lines and Emacs (in fact OS X!)  
>> still
>> hangs when evaluating that expression.
>
> Does it really freeze the kernel or just the UI or just Emacs ?
> If it freezes the kernel, post it to bugtraq as a DoS issue and it
> should get fixed within a few days.
>
>
> 	Stefan
>

  reply	other threads:[~2002-11-26 16:31 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-23 16:04 Mac OS X: Rebuild Require after Security Update 2002-11-21 Andrew Choi
2002-11-23 23:49 ` Jason Rumney
2002-11-24 19:58   ` Andrew Choi
2002-11-24 21:03     ` Jason Rumney
2002-11-25 23:56       ` Steven Tamm
2002-11-26  0:18         ` Jason Rumney
2002-11-26  1:19         ` Andrew Choi
2002-11-26 14:53           ` Stefan Monnier
2002-11-26 16:31             ` Steven Tamm [this message]
2002-11-26 17:29               ` Andrew Choi
2002-11-26 17:45                 ` fork v vfork (was Re: Mac OS X: Rebuild Require after Security Update 2002-11-21) Steven Tamm
2002-11-24  6:13 ` Mac OS X: Rebuild Require after Security Update 2002-11-21 Josh DuBois
2002-11-24 14:31   ` Hugo Wolf
2002-11-24 18:55     ` Josh DuBois
2002-11-24 20:15       ` Hugo Wolf
2002-11-24 21:29         ` Josh DuBois
2002-11-24 22:08           ` Hugo Wolf
2002-11-25  8:11             ` Josh DuBois
2002-11-28 17:48     ` Olle Pellijeff
2002-11-24 20:37 ` Steven Tamm
2002-11-24 21:58   ` Andrew Choi
2002-11-24 23:06     ` Steven Tamm
2002-11-25  4:49 ` Ker Lutyn
2002-11-25  5:02   ` Andrew Choi
2002-11-25  7:40 ` Thorbjørn Ravn Andersen
2002-11-25  8:10   ` Andrew Choi
2002-11-26 11:15   ` Richard Stallman

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=7A6C6DA4-015C-11D7-9286-00039390AB82@mac.com \
    --to=steventamm@mac.com \
    --cc=akochoi@shaw.ca \
    --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 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.