static int exec_tramp(void *sig_stack) { init_new_thread_stack(sig_stack, NULL); init_new_thread_signals(); os_stop_process(os_getpid()); return(0); }
static int ptrace_child(void *arg) { int ret; int pid = os_getpid(), ppid = getppid(); int sc_result; if(ptrace(PTRACE_TRACEME, 0, 0, 0) < 0){ perror("ptrace"); os_kill_process(pid, 0); } os_stop_process(pid); /*This syscall will be intercepted by the parent. Don't call more than * once, please.*/ sc_result = os_getpid(); if (sc_result == pid) ret = 1; /*Nothing modified by the parent, we are running normally.*/ else if (sc_result == ppid) ret = 0; /*Expected in check_ptrace and check_sysemu when they succeed in modifying the stack frame*/ else ret = 2; /*Serious trouble! This could be caused by a bug in host 2.6 SKAS3/2.6 patch before release -V6, together with a bug in the UML code itself.*/ _exit(ret); }
static int userspace_tramp(void *arg) { init_new_thread_signals(0); enable_timer(); ptrace(PTRACE_TRACEME, 0, 0, 0); os_stop_process(os_getpid()); return(0); }
void suspend_new_thread(int fd) { int err; char c; os_stop_process(os_getpid()); err = os_read_file(fd, &c, sizeof(c)); if(err != sizeof(c)) panic("read failed in suspend_new_thread, err = %d", -err); }
static int start_kernel_proc(void *unused) { int pid; block_signals(); pid = os_getpid(); cpu_tasks[0].pid = pid; cpu_tasks[0].task = current; #ifdef CONFIG_SMP cpu_online_map = cpumask_of_cpu(0); #endif if(debug) os_stop_process(pid); start_kernel(); return(0); }
static int signal_tramp(void *arg) { int (*proc)(void *); if(honeypot && munmap((void *) (host_task_size - 0x10000000), 0x10000000)) panic("Unmapping stack failed"); if(ptrace(PTRACE_TRACEME, 0, 0, 0) < 0) panic("ptrace PTRACE_TRACEME failed"); os_stop_process(os_getpid()); change_sig(SIGWINCH, 0); signal(SIGUSR1, SIG_IGN); change_sig(SIGCHLD, 0); signal(SIGSEGV, (__sighandler_t) sig_handler); set_cmdline("(idle thread)"); set_init_pid(os_getpid()); proc = arg; return((*proc)(NULL)); }