Module Name: src Committed By: bouyer Date: Sat Feb 4 16:58:00 UTC 2012
Modified Files: src/sys/arch/amd64/amd64 [netbsd-5]: syscall.c src/sys/arch/i386/i386 [netbsd-5]: syscall.c trap.c src/sys/kern [netbsd-5]: kern_sig.c kern_sleepq.c kern_subr.c sys_process.c src/sys/secmodel/bsd44 [netbsd-5]: secmodel_bsd44_suser.c src/sys/sys [netbsd-5]: proc.h ptrace.h Log Message: Apply patch, requested by jmcneill in ticket #1668: sys/arch/amd64/amd64/syscall.c patch sys/arch/i386/i386/syscall.c patch sys/arch/i386/i386/trap.c patch sys/kern/kern_sig.c patch sys/kern/kern_sleepq.c patch sys/kern/kern_subr.c patch sys/kern/sys_process.c patch sys/secmodel/bsd44/secmodel_bsd44_suser.c patch sys/sys/proc.h patch sys/sys/ptrace.h patch arch/i386/i386/machdep.c, arch/amd64/amd64/machdep.c (from arch/x86/x86/machdep.c) by christos: Remove code that was used to avoid register spills. setcontext(2) can change the registers, so re-fetching will produce the wrong result for trace_exit(). arch/i386/i386/trap.c by reinoud: Fix the illegal instruction return address. It was using the value of the cpu's %cr2 register but thats not valid: CR2 Contains a value called Page Fault Linear Address (PFLA). When a page fault occurs, the address the program attempted to access is stored in the CR2 register. And this is thus NOT the illegal instruction address! kern/kern_sig.c by christos: PR kern/45327: Jared McNeill: ptrace: siginfo doesn't work with traced processes When saving the signal in p->p_xstat, clear it from the pending mask, but don't remove it from the siginfo queue, so that next time the debugger delivers it, the original information is found. When posting a signal from the debugger l->l_sigpendset is not set, so we use the process pending signal and add it back to the process pending set. Split sigget into sigget() and siggetinfo(). When a signal comes from the debugger (l->l_sigpendset == NULL), using siggetinfo() try to fetch the siginfo information from l->l_sigpend and then from p->p_sigpend if it was not found. This allows us to pass siginfo information for traps from the debugger. don't delete signal from the debugger. kern/kern_sleepq.c by christos: PR kern/40594: Antti Kantee: Don't call issignal() here to determine what errno to set for the interrupted syscall, because issignal() will consume the signal and it will not be delivered to the process afterwards. Instead call sigispending() (which now returns the first pending signal) and does not consume the signal. We need to process SA_STOP signals immediately, and not deliver them to the process. Instead of re-structuring the code to do that, call issignal() like before in that case. (tail -F /file^Zfg should not get interrupted). kern/kern_subr.c by jmcneill, christos: PR kern/45312: ptrace: PT_SETREGS can't alter system calls Add a new PT_SYSCALLEMU request that cancels the current syscall, for use with PT_SYSCALL. For PT_SYSCALLEMU, no need to stop again on syscall exit. ifdef unused variable with -UPTRACE kern/sys_process.c, sys/proc.h, sys/ptrace.h, secmodel/bsd44/secmodel_bsd44_suser.c by jmcneill, christos: PR kern/43681: PT_SYSCALL appears to be broken sys_ptrace: For PT_CONTINUE/PT_SYSCALL/PT_DETACH, modify the p_trace_enabled flag of the target process, not the calling process. Process the signal now, otherwise calling issignal() and ignoring the return will lose the signal if it came from the debugger (issignal() clears p->p_xstat) PR kern/45312: ptrace: PT_SETREGS can't alter system calls Add a new PT_SYSCALLEMU request that cancels the current syscall, for use with PT_SYSCALL. PR kern/45330: ptrace: signals can alter syscall return values process_stoptrace: defer signal processing to userret, ok christos@ To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.44.4.1 src/sys/arch/amd64/amd64/syscall.c cvs rdiff -u -r1.57 -r1.57.4.1 src/sys/arch/i386/i386/syscall.c cvs rdiff -u -r1.241.4.3 -r1.241.4.4 src/sys/arch/i386/i386/trap.c cvs rdiff -u -r1.289.4.6 -r1.289.4.7 src/sys/kern/kern_sig.c cvs rdiff -u -r1.35 -r1.35.4.1 src/sys/kern/kern_sleepq.c cvs rdiff -u -r1.192.4.1 -r1.192.4.2 src/sys/kern/kern_subr.c cvs rdiff -u -r1.143.4.1 -r1.143.4.2 src/sys/kern/sys_process.c cvs rdiff -u -r1.59 -r1.59.4.1 src/sys/secmodel/bsd44/secmodel_bsd44_suser.c cvs rdiff -u -r1.282 -r1.282.4.1 src/sys/sys/proc.h cvs rdiff -u -r1.40 -r1.40.20.1 src/sys/sys/ptrace.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.