Date: Mon, 20 Feb 2006 21:17:40 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 92094 for review Message-ID: <200602202117.k1KLHeZs058363@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=92094 Change 92094 by jhb@jhb_slimer on 2006/02/20 21:16:54 ptrace_clear_single_step() needs callers to hold the proc lock and PHOLD/PRELE. Affected files ... .. //depot/projects/smpng/sys/alpha/alpha/trap.c#63 edit .. //depot/projects/smpng/sys/alpha/include/ptrace.h#9 edit .. //depot/projects/smpng/sys/arm/arm/undefined.c#10 edit .. //depot/projects/smpng/sys/kern/kern_kse.c#29 edit Differences ... ==== //depot/projects/smpng/sys/alpha/alpha/trap.c#63 (text+ko) ==== @@ -405,8 +405,12 @@ case ALPHA_IF_CODE_BUGCHK: if (td->td_md.md_flags & (MDTD_STEP1|MDTD_STEP2)) { mtx_lock(&Giant); + PROC_LOCK(p); + _PHOLD(p); ptrace_clear_single_step(td); td->td_frame->tf_regs[FRAME_PC] -= 4; + _PRELE(p); + PROC_UNLOCK(p); mtx_unlock(&Giant); } ucode = a0; /* trap type */ ==== //depot/projects/smpng/sys/alpha/include/ptrace.h#9 (text+ko) ==== @@ -34,7 +34,11 @@ #define _MACHINE_PTRACE_H_ #ifdef _KERNEL -#define FIX_SSTEP(p) ptrace_clear_single_step(p) +#define FIX_SSTEP(p) do { \ + _PHOLD((p)); \ + ptrace_clear_single_step((p)); \ + _PRELE((p)); \ +} while (0) #endif #endif ==== //depot/projects/smpng/sys/arm/arm/undefined.c#10 (text+ko) ==== @@ -261,7 +261,11 @@ break; if (fault_code & FAULT_USER && fault_instruction == PTRACE_BREAKPOINT) { + PROC_LOCK(td->td_proc); + _PHOLD(td->td_proc); ptrace_clear_single_step(td); + _PRELE(td->td_proc); + PROC_UNLOCK(td->td_proc); return; } ==== //depot/projects/smpng/sys/kern/kern_kse.c#29 (text+ko) ==== @@ -787,8 +787,13 @@ */ cpu_set_upcall_kse(newtd, newku->ku_func, newku->ku_mailbox, &newku->ku_stack); - if (p->p_flag & P_TRACED) + PROC_LOCK(p); + if (p->p_flag & P_TRACED) { + _PHOLD(p); ptrace_clear_single_step(newtd); + _PRELE(p); + } + PROC_UNLOCK(p); } } @@ -1381,8 +1386,13 @@ if (!(ku->ku_mflags & KMF_NOUPCALL)) { cpu_set_upcall_kse(td, ku->ku_func, ku->ku_mailbox, &ku->ku_stack); - if (p->p_flag & P_TRACED) + PROC_LOCK(p); + if (p->p_flag & P_TRACED) { + _PHOLD(p); ptrace_clear_single_step(td); + _PRELE(p); + } + PROC_UNLOCK(p); error = suword32(&ku->ku_mailbox->km_lwp, td->td_tid); if (error)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602202117.k1KLHeZs058363>