- Drop the process lock before we call into ptrace_{read|write}_int or
any functions that call them. Calling proc_rwmem() with the proc lock held is not safe. Currently, we're protected from any races by Giant. Eventually proc_rwmem() should require the proc lock and not Giant.
This commit is contained in:
parent
76902f9650
commit
149f26477e
@ -1901,9 +1901,10 @@ ptrace_single_step(struct thread *td)
|
||||
if (td->td_md.md_flags & (MDTD_STEP1|MDTD_STEP2))
|
||||
panic("ptrace_single_step: step breakpoints not removed");
|
||||
|
||||
PROC_UNLOCK(td->td_proc);
|
||||
error = ptrace_read_int(td, pc, &ins.bits);
|
||||
if (error)
|
||||
return error;
|
||||
goto err;
|
||||
|
||||
switch (ins.branch_format.opcode) {
|
||||
|
||||
@ -1943,19 +1944,21 @@ ptrace_single_step(struct thread *td)
|
||||
td->td_md.md_sstep[0].addr = addr[0];
|
||||
error = ptrace_set_bpt(td, &td->td_md.md_sstep[0]);
|
||||
if (error)
|
||||
return error;
|
||||
goto err;
|
||||
if (count == 2) {
|
||||
td->td_md.md_sstep[1].addr = addr[1];
|
||||
error = ptrace_set_bpt(td, &td->td_md.md_sstep[1]);
|
||||
if (error) {
|
||||
ptrace_clear_bpt(td, &td->td_md.md_sstep[0]);
|
||||
return error;
|
||||
goto err;
|
||||
}
|
||||
td->td_md.md_flags |= MDTD_STEP2;
|
||||
} else
|
||||
td->td_md.md_flags |= MDTD_STEP1;
|
||||
|
||||
return 0;
|
||||
err:
|
||||
PROC_LOCK(td->td_proc);
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user