Commit 972559a0 authored by Petr Tesarik's avatar Petr Tesarik Committed by Tony Luck

[IA64] access user RBS directly

Because the user RBS of a process is now completely stored in
user-mode when the process is ptrace-stopped, accesses to the
RBS should no longer augment any part of the kernel RBS.

This means we can get rid of most ia64_peek() and ia64_poke()
calls.
Signed-off-by: default avatarPetr Tesarik <ptesarik@suse.cz>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent 29e8c3c3
...@@ -908,7 +908,7 @@ static int ...@@ -908,7 +908,7 @@ static int
access_uarea (struct task_struct *child, unsigned long addr, access_uarea (struct task_struct *child, unsigned long addr,
unsigned long *data, int write_access) unsigned long *data, int write_access)
{ {
unsigned long *ptr, regnum, urbs_end, rnat_addr, cfm; unsigned long *ptr, regnum, urbs_end, cfm;
struct switch_stack *sw; struct switch_stack *sw;
struct pt_regs *pt; struct pt_regs *pt;
# define pt_reg_addr(pt, reg) ((void *) \ # define pt_reg_addr(pt, reg) ((void *) \
...@@ -1093,16 +1093,8 @@ access_uarea (struct task_struct *child, unsigned long addr, ...@@ -1093,16 +1093,8 @@ access_uarea (struct task_struct *child, unsigned long addr,
return 0; return 0;
case PT_AR_RNAT: case PT_AR_RNAT:
urbs_end = ia64_get_user_rbs_end(child, pt, NULL); ptr = pt_reg_addr(pt, ar_rnat);
rnat_addr = (long) ia64_rse_rnat_addr((long *) break;
urbs_end);
if (write_access)
return ia64_poke(child, sw, urbs_end,
rnat_addr, *data);
else
return ia64_peek(child, sw, urbs_end,
rnat_addr, data);
case PT_R1: case PT_R1:
ptr = pt_reg_addr(pt, r1); ptr = pt_reg_addr(pt, r1);
break; break;
...@@ -1541,11 +1533,10 @@ asmlinkage long ...@@ -1541,11 +1533,10 @@ asmlinkage long
sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data) sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data)
{ {
struct pt_regs *pt; struct pt_regs *pt;
unsigned long urbs_end, peek_or_poke; unsigned long peek_or_poke;
struct task_struct *child; struct task_struct *child;
struct switch_stack *sw; struct switch_stack *sw;
long ret; long ret;
struct unw_frame_info info;
lock_kernel(); lock_kernel();
ret = -EPERM; ret = -EPERM;
...@@ -1593,26 +1584,19 @@ sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data) ...@@ -1593,26 +1584,19 @@ sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data)
case PTRACE_PEEKTEXT: case PTRACE_PEEKTEXT:
case PTRACE_PEEKDATA: case PTRACE_PEEKDATA:
/* read word at location addr */ /* read word at location addr */
urbs_end = ia64_get_user_rbs_end(child, pt, NULL); if (access_process_vm(child, addr, &data, sizeof(data), 0)
ret = ia64_peek(child, sw, urbs_end, addr, &data); != sizeof(data)) {
if (ret == 0) { ret = -EIO;
ret = data; goto out_tsk;
/* ensure "ret" is not mistaken as an error code: */
force_successful_syscall_return();
} }
ret = data;
/* ensure "ret" is not mistaken as an error code */
force_successful_syscall_return();
goto out_tsk; goto out_tsk;
case PTRACE_POKETEXT: /* PTRACE_POKETEXT and PTRACE_POKEDATA is handled
case PTRACE_POKEDATA: * by the generic ptrace_request().
/* write the word at location addr */ */
urbs_end = ia64_get_user_rbs_end(child, pt, NULL);
ret = ia64_poke(child, sw, urbs_end, addr, data);
/* Make sure user RBS has the latest data */
unw_init_from_blocked_task(&info, child);
do_sync_rbs(&info, ia64_sync_user_rbs);
goto out_tsk;
case PTRACE_PEEKUSR: case PTRACE_PEEKUSR:
/* read the word at addr in the USER area */ /* read the word at addr in the USER area */
......
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