fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / um / kernel / trap.c
index 8c90a63..6a5a846 100644 (file)
@@ -119,7 +119,7 @@ out_nosemaphore:
  * us unable to handle the page fault gracefully.
  */
 out_of_memory:
-       if (current->pid == 1) {
+       if (is_init(current)) {
                up_read(&mm->mmap_sem);
                yield();
                down_read(&mm->mmap_sem);
@@ -139,14 +139,6 @@ void segv_handler(int sig, union uml_pt_regs *regs)
        segv(*fi, UPT_IP(regs), UPT_IS_USER(regs), regs);
 }
 
-struct kern_handlers handlinfo_kern = {
-       .relay_signal = relay_signal,
-       .winch = winch,
-       .bus_handler = relay_signal,
-       .page_fault = segv_handler,
-       .sigio_handler = sigio_handler,
-       .timer_handler = timer_handler
-};
 /*
  * We give a *copy* of the faultinfo in the regs to segv.
  * This must be done, since nesting SEGVs could overwrite
@@ -201,7 +193,8 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, void *sc)
                 current->thread.arch.faultinfo = fi;
                force_sig_info(SIGBUS, &si, current);
        } else if (err == -ENOMEM) {
-               printk("VM: killing process %s\n", current->comm);
+               printk("VM: killing process %s(%d:#%u)\n",
+                       current->comm, current->pid, current->xid);
                do_exit(SIGKILL);
        } else {
                BUG_ON(err != -EFAULT);
@@ -226,9 +219,16 @@ void bad_segv(struct faultinfo fi, unsigned long ip)
 
 void relay_signal(int sig, union uml_pt_regs *regs)
 {
-       if(arch_handle_signal(sig, regs)) return;
-       if(!UPT_IS_USER(regs))
+       if(arch_handle_signal(sig, regs))
+               return;
+
+       if(!UPT_IS_USER(regs)){
+               if(sig == SIGBUS)
+                       printk("Bus error - the /dev/shm or /tmp mount likely "
+                              "just ran out of space\n");
                panic("Kernel mode signal %d", sig);
+       }
+
         current->thread.arch.faultinfo = *UPT_FAULTINFO(regs);
        force_sig(sig, current);
 }
@@ -245,6 +245,15 @@ void winch(int sig, union uml_pt_regs *regs)
        do_IRQ(WINCH_IRQ, regs);
 }
 
+const struct kern_handlers handlinfo_kern = {
+       .relay_signal = relay_signal,
+       .winch = winch,
+       .bus_handler = bus_handler,
+       .page_fault = segv_handler,
+       .sigio_handler = sigio_handler,
+       .timer_handler = timer_handler
+};
+
 void trap_init(void)
 {
 }