Reproducible kernel panic on forkpty bomb

Originator:thakis
Number:rdar://10707993 Date Originated:2012-02-17
Status: Resolved:
Product:Mac OS X Product Version:10.7.2
Classification:Crash/Hang/Data Loss Reproducible:100%
 
17-Jan-2012 09:58 AM Nico Weber:
Summary:

A fork bomb using forkpty() causes a 100% reproducible kernel panic.

Steps to Reproduce:

$ cat ptytest.cc
#include <unistd.h>
#include <util.h>

int main() {
  for (int i = 0; i < 10000; ++i) {
    printf("Allocating pty %d\n", i + 1);
    int master, slave;
    pid_t p = forkpty(&master, NULL, NULL, NULL);
    if (p < 0) {
      perror("forkpty failed");
      return 1;
    }
  }
}
$ gcc -o ptytest ptytest.cc
$ ./ptytest

Expected Results:

The process is killed as when it exceeds per-user limits.

Actual Results:

Kernel panic.

Regression:

Don't know.

Notes:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!