⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uml-2.6.10-fc3.patch

📁 lustre 1.6.5 source code
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
+ * Emacs will notice this stuff at the end of the file and automatically+ * adjust the settings for this buffer only.  This must remain at the end+ * of the file.+ * ---------------------------------------------------------------------------+ * Local variables:+ * c-file-style: "linux"+ * End:+ */+/*+ * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)+ * Licensed under the GPL+ */++#ifndef __SKAS_UACCESS_H+#define __SKAS_UACCESS_H++#include "asm/errno.h"  #define access_ok_skas(type, addr, size) \ 	((segment_eq(get_fs(), KERNEL_DS)) || \Index: linux-2.6.10/arch/um/kernel/tt/syscall_user.c===================================================================--- linux-2.6.10.orig/arch/um/kernel/tt/syscall_user.c	2004-12-25 05:35:01.000000000 +0800+++ linux-2.6.10/arch/um/kernel/tt/syscall_user.c	2005-04-07 22:05:29.489759064 +0800@@ -42,37 +42,31 @@ 	syscall_trace(regs, 1); 	record_syscall_end(index, result); }--int do_syscall(void *task, int pid, int local_using_sysemu)-{-	unsigned long proc_regs[FRAME_SIZE];-	union uml_pt_regs *regs;-	int syscall;--	if(ptrace_getregs(pid, proc_regs) < 0)-		tracer_panic("Couldn't read registers");-	syscall = PT_SYSCALL_NR(proc_regs);--	regs = TASK_REGS(task);-	UPT_SYSCALL_NR(regs) = syscall;--	if(syscall < 0)-		return(0);--	if((syscall != __NR_sigreturn) &&-	   ((unsigned long *) PT_IP(proc_regs) >= &_stext) && -	   ((unsigned long *) PT_IP(proc_regs) <= &_etext))-		tracer_panic("I'm tracing myself and I can't get out");--	if(local_using_sysemu)-		return(1);--	if(ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET, -		  __NR_getpid) < 0)-		tracer_panic("do_syscall : Nullifying syscall failed, "-			     "errno = %d", errno);-	return(1);-}+  + void do_sigtrap(void *task)+ {+ 	UPT_SYSCALL_NR(TASK_REGS(task)) = -1;+ }+ + void do_syscall(void *task, int pid, int local_using_sysemu)+  {+  	unsigned long proc_regs[FRAME_SIZE];+  +  	if(ptrace_getregs(pid, proc_regs) < 0)+  		tracer_panic("Couldn't read registers");+  + 	UPT_SYSCALL_NR(TASK_REGS(task)) = PT_SYSCALL_NR(proc_regs);+  + 	if(((unsigned long *) PT_IP(proc_regs) >= &_stext) &&+  	   ((unsigned long *) PT_IP(proc_regs) <= &_etext))+  		tracer_panic("I'm tracing myself and I can't get out");+  + 	/* syscall number -1 in sysemu skips syscall restarting in host */+  	if(ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET, + 		  local_using_sysemu ? -1 : __NR_getpid) < 0)+  		tracer_panic("do_syscall : Nullifying syscall failed, "+  			     "errno = %d", errno);+  }  /*  * Overrides for Emacs so that we follow Linus's tabbing style.Index: linux-2.6.10/arch/um/kernel/tt/sys-i386/Makefile===================================================================--- linux-2.6.10.orig/arch/um/kernel/tt/sys-i386/Makefile	2004-12-25 05:34:32.000000000 +0800+++ linux-2.6.10/arch/um/kernel/tt/sys-i386/Makefile	2005-04-07 19:34:21.197950744 +0800@@ -1,12 +0,0 @@-# -# Copyright (C) 2002 Jeff Dike (jdike@karaya.com)-# Licensed under the GPL-#--obj-y = sigcontext.o--USER_OBJS = sigcontext.o-USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))--$(USER_OBJS) : %.o: %.c-	$(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $<Index: linux-2.6.10/arch/um/kernel/tt/sys-i386/sigcontext.c===================================================================--- linux-2.6.10.orig/arch/um/kernel/tt/sys-i386/sigcontext.c	2004-12-25 05:35:39.000000000 +0800+++ linux-2.6.10/arch/um/kernel/tt/sys-i386/sigcontext.c	2005-04-07 19:34:21.197950744 +0800@@ -1,60 +0,0 @@-/* - * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)- * Licensed under the GPL- */--#include <stdlib.h>-#include <asm/sigcontext.h>-#include "kern_util.h"-#include "sysdep/frame.h"--int copy_sc_from_user_tt(void *to_ptr, void *from_ptr, void *data)-{-	struct arch_frame_data *arch = data;-	struct sigcontext *to = to_ptr, *from = from_ptr;-	struct _fpstate *to_fp, *from_fp;-	unsigned long sigs;-	int err;--	to_fp = to->fpstate;-	from_fp = from->fpstate;-	sigs = to->oldmask;-	err = copy_from_user_proc(to, from, sizeof(*to));-	to->oldmask = sigs;-	if(to_fp != NULL){-		err |= copy_from_user_proc(&to->fpstate, &to_fp,-					   sizeof(to->fpstate));-		err |= copy_from_user_proc(to_fp, from_fp, arch->fpstate_size);-	}-	return(err);-}--int copy_sc_to_user_tt(void *to_ptr, void *fp, void *from_ptr, void *data)-{-	struct arch_frame_data *arch = data;-	struct sigcontext *to = to_ptr, *from = from_ptr;-	struct _fpstate *to_fp, *from_fp;-	int err;--	to_fp = (struct _fpstate *) -		(fp ? (unsigned long) fp : ((unsigned long) to + sizeof(*to)));-	from_fp = from->fpstate;-	err = copy_to_user_proc(to, from, sizeof(*to));-	if(from_fp != NULL){-		err |= copy_to_user_proc(&to->fpstate, &to_fp,-					 sizeof(to->fpstate));-		err |= copy_to_user_proc(to_fp, from_fp, arch->fpstate_size);-	}-	return(err);-}--/*- * Overrides for Emacs so that we follow Linus's tabbing style.- * Emacs will notice this stuff at the end of the file and automatically- * adjust the settings for this buffer only.  This must remain at the end- * of the file.- * ---------------------------------------------------------------------------- * Local variables:- * c-file-style: "linux"- * End:- */Index: linux-2.6.10/arch/um/kernel/tt/exec_user.c===================================================================--- linux-2.6.10.orig/arch/um/kernel/tt/exec_user.c	2004-12-25 05:35:24.000000000 +0800+++ linux-2.6.10/arch/um/kernel/tt/exec_user.c	2005-04-07 22:05:29.490758912 +0800@@ -10,6 +10,7 @@ #include <errno.h> #include <sys/wait.h> #include <sys/ptrace.h>+#include <linux/ptrace.h> #include <signal.h> #include "user_util.h" #include "kern_util.h"@@ -35,7 +36,10 @@ 		tracer_panic("do_exec failed to get registers - errno = %d", 			     errno); -	kill(old_pid, SIGKILL);+	os_kill_ptraced_process(old_pid, 0);++	if (ptrace(PTRACE_OLDSETOPTIONS, new_pid, 0, (void *)PTRACE_O_TRACESYSGOOD) < 0)+		tracer_panic("do_exec: PTRACE_SETOPTIONS failed, errno = %d", errno);  	if(ptrace_setregs(new_pid, regs) < 0) 		tracer_panic("do_exec failed to start new proc - errno = %d",Index: linux-2.6.10/arch/um/kernel/tt/tracer.c===================================================================--- linux-2.6.10.orig/arch/um/kernel/tt/tracer.c	2004-12-25 05:33:49.000000000 +0800+++ linux-2.6.10/arch/um/kernel/tt/tracer.c	2005-04-07 22:10:59.446598000 +0800@@ -13,6 +13,7 @@ #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"@@ -25,7 +26,6 @@ #include "mem_user.h" #include "process.h" #include "kern_util.h"-#include "frame.h" #include "chan_user.h" #include "ptrace_user.h" #include "mode.h"@@ -72,6 +72,8 @@ 	   (ptrace(PTRACE_CONT, pid, 0, 0) < 0)) 		tracer_panic("OP_FORK failed to attach pid"); 	wait_for_stop(pid, SIGSTOP, PTRACE_CONT, NULL);+	if (ptrace(PTRACE_OLDSETOPTIONS, pid, 0, (void *)PTRACE_O_TRACESYSGOOD) < 0)+		tracer_panic("OP_FORK: PTRACE_SETOPTIONS failed, errno = %d", errno); 	if(ptrace(PTRACE_CONT, pid, 0, 0) < 0) 		tracer_panic("OP_FORK failed to continue process"); }@@ -141,7 +143,7 @@ 	 * any more, the trace of those will land here.  So, we need to just  	 * PTRACE_SYSCALL it. 	 */-	case SIGTRAP:+	case (SIGTRAP|SYSCALL_TRAP): 		if(ptrace(PTRACE_SYSCALL, pid, 0, 0) < 0) 			tracer_panic("sleeping_process_signal : Failed to " 				     "PTRACE_SYSCALL pid %d, errno = %d\n",@@ -184,9 +186,8 @@ 	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 pt_syscall_parm, local_using_sysemu;+	int pt_syscall_parm, local_using_sysemu = 0; -	capture_signal_stack(); 	signal(SIGPIPE, SIG_IGN); 	setup_tracer_winch(); 	tracing_pid = os_getpid();@@ -198,6 +199,10 @@ 		printf("waitpid on idle thread failed, errno = %d\n", errno); 		exit(1); 	}+	if (ptrace(PTRACE_OLDSETOPTIONS, pid, 0, (void *)PTRACE_O_TRACESYSGOOD) < 0) {+		printf("Failed to PTRACE_SETOPTIONS for idle thread, errno = %d\n", errno);+		exit(1);+	} 	if((ptrace(PTRACE_CONT, pid, 0, 0) < 0)){ 		printf("Failed to continue idle thread, errno = %d\n", errno); 		exit(1);@@ -265,7 +270,25 @@ #endif 		else if(WIFSIGNALED(status)){ 			sig = WTERMSIG(status);-			if(sig != 9){+		        if(sig == SIGKILL){+                                /* This is to make sure that processes die+                                * immediately without becoming zombies on+                                * all hosts. Before 2.6.9, kill(pid, SIGKILL)+                                * was enough to make sure a process went away+                                * immediately. After 2.6.9, they don't run+                                * any more, but they remain as zombies. So,+                                * a PTRACE_CONT is necessary in order to put+                                * them in a normal run state so that they die.+                                * I do a PTRACE_KILL here for good measure.+                                * Might as well kill it by all available+                                * means. These calls will likely fail when+                                * they are not needed because the process has+                                * already disappeared. However, they don't+                                * hurt.+                                */+                               ptrace(PTRACE_KILL, pid, 0, 0);+                               ptrace(PTRACE_CONT, pid, 0, 0);+                        } else { 				printf("Child %d exited with signal %d\n", pid, 				       sig); 			}@@ -297,7 +320,8 @@ 			task = cpu_tasks[proc_id].task; 			tracing = is_tracing(task); 			old_tracing = tracing;-+ 			if ( tracing ) /* Assume: no syscall, when coming from user */+ 				do_sigtrap(task); 			local_using_sysemu = get_using_sysemu(); 			pt_syscall_parm = local_using_sysemu ? PTRACE_SYSEMU : PTRACE_SYSCALL; @@ -306,6 +330,15 @@ 				sig = 0; 				op = do_proc_op(task, proc_id); 				switch(op){+				/*+ 				 * This is called when entering user mode; after+ 				 * this, we start intercepting syscalls.+ 				 *+ 				 * In fact, a process is started in kernel mode,+ 				 * so with is_tracing() == 0 (and that is reset+ 				 * when executing syscalls, since UML kernel has+ 				 * the right to do syscalls);+ 				 */ 				case OP_TRACE_ON: 					arch_leave_kernel(task, pid); 					tracing = 1;@@ -314,7 +347,13 @@ 				case OP_HALT: 					unmap_physmem(); 					kmalloc_ok = 0;-					ptrace(PTRACE_KILL, pid, 0, 0);+					os_kill_ptraced_process(pid, 0);+					/* Now let's reap remaining zombies */+					errno = 0;+					do {+						waitpid(-1, &status,+							WUNTRACED);+					} while (errno != ECHILD); 					return(op == OP_REBOOT); 				case OP_NONE: 					printf("Detaching pid %d\n", pid);@@ -328,14 +367,26 @@ 				 */ 				pid = cpu_tasks[proc_id].pid; 				break;+			case (SIGTRAP|SYSCALL_TRAP):+ 				if(!tracing && (debugger_pid != -1)){+ 					child_signal(pid, W_STOPCODE(SIGTRAP));+ 					continue;+ 				}+ 				tracing = 0;+ 				/* local_using_sysemu has been already set+ 				 * below, since if we are here, is_tracing() on+ 				 * the traced task was 1, i.e. the process had+ 				 * already run through one iteration of the+ 				 * loop which executed a OP_TRACE_ON request.*/+ 				do_syscall(task, pid, local_using_sysemu);+ 				sig = SIGUSR2;+ 				break; 			case SIGTRAP: 				if(!tracing && (debugger_pid != -1)){ 					child_signal(pid, status); 					continue; 				} 				tracing = 0;-				if(do_syscall(task, pid, local_using_sysemu))-					sig = SIGUSR2; 				break; 			case SIGPROF: 				if(tracing) sig = 0;@@ -371,6 +422,9 @@ 				continue; 			} + 			local_using_sysemu = get_using_sysemu();+ 			pt_syscall_parm = local_using_sysemu ? PTRACE_SYSEMU : PTRACE_SYSCALL;+  			if(tracing){ 				if(singlestepping(task)) 					cont_type = PTRACE_SINGLESTEP;Index: linux-2.6.10/arch/um/kernel/tt/Makefile===================================================================--- linux-2.6.10.orig/arch/um/kernel/tt/Makefile	2004-12-25 05:34:57.000000000 +0800+++ linux-2.6.10/arch/um/kernel/tt/Makefile	2005-04-07 22:05:29.491758760 +0800@@ -8,7 +8,7 @@  obj-y = exec_kern.o exec_user.o gdb.o ksyms.o mem.o mem_user.o process_kern.o \ 	syscall_kern.o syscall_user.o time.o tlb.o tracer.o trap_user.o \-	uaccess.o uaccess_user.o sys-$(SUBARCH)/+	uaccess.o uaccess_user.o   obj-$(CONFIG_PT_PROXY) += gdb_kern.o ptproxy/ Index: linux-2.6.10/arch/um/kernel/tt/include/mode-tt.h===================================================================--- linux-2.6.10.orig/arch/um/kernel/tt/include/mode-tt.h	2004-12-25 05:35:01.000000000 +0800+++ linux-2.6.10/arch/um/kernel/tt/include/mode-tt.h	2005-04-07 22:05:29.491758760 +0800@@ -14,6 +14,41 @@  extern int tracer(int (*init_proc)(void *), void *sp); extern void user_time_init_tt(void);+extern void sig_handler_common_tt(int sig, void *sc);+extern void syscall_handler_tt(int sig, union uml_pt_regs *regs);+extern void reboot_tt(void);+extern void halt_tt(void);+extern int is_tracer_winch(int pid, int fd, void *data);+extern void kill_off_processes_tt(void);++#endif++/*+ * Overrides for Emacs so that we follow Linus's tabbing style.+ * Emacs will notice this stuff at the end of the file and automatically+ * adjust the settings for this buffer only.  This must remain at the end+ * of the file.+ * ---------------------------------------------------------------------------+ * Local variables:+ * c-file-style: "linux"+ * End:+ */+/*+ * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)+ * Licensed under the GPL+ */++#ifndef __MODE_TT_H__+#define __MODE_TT_H__++#include "sysdep/ptrace.h"++enum { OP_NONE, OP_EXEC, OP_FORK, OP_TRACE_ON, OP_REBOOT, OP_HALT, OP_CB };++extern int tracing_pid;++extern int tracer(int (*init_proc)(void *), void *sp);+extern void user_time_init_tt(void); extern int copy_sc_from_user_tt(void *to_ptr, void *from_ptr, void *data); extern int copy_sc_to_user_tt(void *to_ptr, void *fp, void *from_ptr, 			      void *data);Index: linux-2.6.10/arch/um/kernel/tt/include/tt.h=================================

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -