Commit 8de1926c authored by David Mosberger's avatar David Mosberger Committed by Tony Luck

[IA64] fix ptrace debug-register handling bug

I noticed that the PTRACE_POKEUSR code incorrectly clears bits 56-58
of _all_ debug registers.  The intention was to only clear it for
odd-numbered registers, to ensure that user-level can only set
user-level data/instruction-breakpoints.  Patch below fixes this problem.
The patch also replaces explicit clearing of the single-step and
taken-branch PSR bits with a call to ptrace_disable() for PTRACE_KILL.
Signed-off-by: default avatarDavid Mosberger-Tang <davidm@hpl.hp.com>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent 1197f3e0
......@@ -1052,12 +1052,11 @@ access_uarea (struct task_struct *child, unsigned long addr,
ptr += regnum;
if (write_access)
if ((regnum & 1) && write_access) {
/* don't let the user set kernel-level breakpoints: */
*ptr = *data & ~(7UL << 56);
else
*data = *ptr;
return 0;
return 0;
}
}
if (write_access)
*ptr = *data;
......@@ -1521,13 +1520,7 @@ sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data)
goto out_tsk;
child->exit_code = SIGKILL;
/*
* Make sure the single step/take-branch trap bits are
* not set:
*/
ia64_psr(pt)->ss = 0;
ia64_psr(pt)->tb = 0;
ptrace_disable(child);
wake_up_process(child);
ret = 0;
goto out_tsk;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment