Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / arch / um / kernel / tt / tracer.c
index 257a16e..9882342 100644 (file)
@@ -12,8 +12,6 @@
 #include <sched.h>
 #include <string.h>
 #include <sys/mman.h>
-#include <sys/ptrace.h>
-#include <linux/ptrace.h>
 #include <sys/time.h>
 #include <sys/wait.h>
 #include "user.h"
 #include "sigcontext.h"
 #include "sysdep/sigcontext.h"
 #include "os.h"
-#include "signal_user.h"
 #include "user_util.h"
 #include "mem_user.h"
 #include "process.h"
 #include "kern_util.h"
 #include "chan_user.h"
 #include "ptrace_user.h"
+#include "irq_user.h"
 #include "mode.h"
 #include "tt.h"
 
@@ -35,7 +33,7 @@ static int tracer_winch[2];
 
 int is_tracer_winch(int pid, int fd, void *data)
 {
-       if(pid != tracing_pid)
+       if(pid != os_getpgrp())
                return(0);
 
        register_winch_irq(tracer_winch[0], fd, -1, data);
@@ -91,8 +89,10 @@ void tracer_panic(char *format, ...)
 
 static void tracer_segv(int sig, struct sigcontext sc)
 {
+        struct faultinfo fi;
+        GET_FAULTINFO_FROM_SC(fi, &sc);
        printf("Tracing thread segfault at address 0x%lx, ip 0x%lx\n",
-              SC_FAULT_ADDR(&sc), SC_IP(&sc));
+               FAULT_ADDRESS(fi), SC_IP(&sc));
        while(1)
                pause();
 }
@@ -119,6 +119,7 @@ static int signal_tramp(void *arg)
        signal(SIGSEGV, (__sighandler_t) sig_handler);
        set_cmdline("(idle thread)");
        set_init_pid(os_getpid());
+       init_irq_signals(0);
        proc = arg;
        return((*proc)(NULL));
 }
@@ -184,9 +185,8 @@ int tracing_pid = -1;
 int tracer(int (*init_proc)(void *), void *sp)
 {
        void *task = NULL;
-       unsigned long eip = 0;
        int status, pid = 0, sig = 0, cont_type, tracing = 0, op = 0;
-       int last_index, proc_id = 0, n, err, old_tracing = 0, strace = 0;
+       int proc_id = 0, n, err, old_tracing = 0, strace = 0;
        int local_using_sysemu = 0;
 
        signal(SIGPIPE, SIG_IGN);
@@ -279,22 +279,6 @@ int tracer(int (*init_proc)(void *), void *sp)
                else if(WIFSTOPPED(status)){
                        proc_id = pid_to_processor_id(pid);
                        sig = WSTOPSIG(status);
-                       if(signal_index[proc_id] == 1024){
-                               signal_index[proc_id] = 0;
-                               last_index = 1023;
-                       }
-                       else last_index = signal_index[proc_id] - 1;
-                       if(((sig == SIGPROF) || (sig == SIGVTALRM) || 
-                           (sig == SIGALRM)) &&
-                          (signal_record[proc_id][last_index].signal == sig)&&
-                          (signal_record[proc_id][last_index].pid == pid))
-                               signal_index[proc_id] = last_index;
-                       signal_record[proc_id][signal_index[proc_id]].pid = pid;
-                       gettimeofday(&signal_record[proc_id][signal_index[proc_id]].time, NULL);
-                       eip = ptrace(PTRACE_PEEKUSER, pid, PT_IP_OFFSET, 0);
-                       signal_record[proc_id][signal_index[proc_id]].addr = eip;
-                       signal_record[proc_id][signal_index[proc_id]++].signal = sig;
-                       
                        if(proc_id == -1){
                                sleeping_process_signal(pid, sig);
                                continue;
@@ -467,19 +451,6 @@ __uml_setup("debugtrace", uml_debugtrace_setup,
 "    the debug switch.\n\n"
 );
 
-static int __init uml_honeypot_setup(char *line, int *add)
-{
-       jail_setup("", add);
-       honeypot = 1;
-       return 0;
-}
-__uml_setup("honeypot", uml_honeypot_setup, 
-"honeypot\n"
-"    This makes UML put process stacks in the same location as they are\n"
-"    on the host, allowing expoits such as stack smashes to work against\n"
-"    UML.  This implies 'jail'.\n\n"
-);
-
 /*
  * Overrides for Emacs so that we follow Linus's tabbing style.
  * Emacs will notice this stuff at the end of the file and automatically