diff options
Diffstat (limited to 'arch/blackfin/kernel/ptrace.c')
-rw-r--r-- | arch/blackfin/kernel/ptrace.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/arch/blackfin/kernel/ptrace.c b/arch/blackfin/kernel/ptrace.c index 140bf00e9974..594e325b40e4 100644 --- a/arch/blackfin/kernel/ptrace.c +++ b/arch/blackfin/kernel/ptrace.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <asm/asm-offsets.h> | 45 | #include <asm/asm-offsets.h> |
46 | #include <asm/dma.h> | 46 | #include <asm/dma.h> |
47 | #include <asm/fixed_code.h> | 47 | #include <asm/fixed_code.h> |
48 | #include <asm/mem_map.h> | ||
48 | 49 | ||
49 | #define TEXT_OFFSET 0 | 50 | #define TEXT_OFFSET 0 |
50 | /* | 51 | /* |
@@ -80,10 +81,12 @@ static inline struct pt_regs *get_user_regs(struct task_struct *task) | |||
80 | /* | 81 | /* |
81 | * Get all user integer registers. | 82 | * Get all user integer registers. |
82 | */ | 83 | */ |
83 | static inline int ptrace_getregs(struct task_struct *tsk, void __user * uregs) | 84 | static inline int ptrace_getregs(struct task_struct *tsk, void __user *uregs) |
84 | { | 85 | { |
85 | struct pt_regs *regs = get_user_regs(tsk); | 86 | struct pt_regs regs; |
86 | return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0; | 87 | memcpy(®s, get_user_regs(tsk), sizeof(regs)); |
88 | regs.usp = tsk->thread.usp; | ||
89 | return copy_to_user(uregs, ®s, sizeof(struct pt_regs)) ? -EFAULT : 0; | ||
87 | } | 90 | } |
88 | 91 | ||
89 | /* Mapping from PT_xxx to the stack offset at which the register is | 92 | /* Mapping from PT_xxx to the stack offset at which the register is |
@@ -157,15 +160,15 @@ put_reg(struct task_struct *task, int regno, unsigned long data) | |||
157 | static inline int is_user_addr_valid(struct task_struct *child, | 160 | static inline int is_user_addr_valid(struct task_struct *child, |
158 | unsigned long start, unsigned long len) | 161 | unsigned long start, unsigned long len) |
159 | { | 162 | { |
160 | struct vm_list_struct *vml; | 163 | struct vm_area_struct *vma; |
161 | struct sram_list_struct *sraml; | 164 | struct sram_list_struct *sraml; |
162 | 165 | ||
163 | /* overflow */ | 166 | /* overflow */ |
164 | if (start + len < start) | 167 | if (start + len < start) |
165 | return -EIO; | 168 | return -EIO; |
166 | 169 | ||
167 | for (vml = child->mm->context.vmlist; vml; vml = vml->next) | 170 | vma = find_vma(child->mm, start); |
168 | if (start >= vml->vma->vm_start && start + len < vml->vma->vm_end) | 171 | if (vma && start >= vma->vm_start && start + len <= vma->vm_end) |
169 | return 0; | 172 | return 0; |
170 | 173 | ||
171 | for (sraml = child->mm->context.sram_list; sraml; sraml = sraml->next) | 174 | for (sraml = child->mm->context.sram_list; sraml; sraml = sraml->next) |
@@ -220,8 +223,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
220 | break; | 223 | break; |
221 | pr_debug("ptrace: user address is valid\n"); | 224 | pr_debug("ptrace: user address is valid\n"); |
222 | 225 | ||
223 | if (L1_CODE_LENGTH != 0 && addr >= L1_CODE_START | 226 | if (L1_CODE_LENGTH != 0 && addr >= get_l1_code_start() |
224 | && addr + sizeof(tmp) <= L1_CODE_START + L1_CODE_LENGTH) { | 227 | && addr + sizeof(tmp) <= get_l1_code_start() + L1_CODE_LENGTH) { |
225 | safe_dma_memcpy (&tmp, (const void *)(addr), sizeof(tmp)); | 228 | safe_dma_memcpy (&tmp, (const void *)(addr), sizeof(tmp)); |
226 | copied = sizeof(tmp); | 229 | copied = sizeof(tmp); |
227 | 230 | ||
@@ -300,8 +303,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
300 | break; | 303 | break; |
301 | pr_debug("ptrace: user address is valid\n"); | 304 | pr_debug("ptrace: user address is valid\n"); |
302 | 305 | ||
303 | if (L1_CODE_LENGTH != 0 && addr >= L1_CODE_START | 306 | if (L1_CODE_LENGTH != 0 && addr >= get_l1_code_start() |
304 | && addr + sizeof(data) <= L1_CODE_START + L1_CODE_LENGTH) { | 307 | && addr + sizeof(data) <= get_l1_code_start() + L1_CODE_LENGTH) { |
305 | safe_dma_memcpy ((void *)(addr), &data, sizeof(data)); | 308 | safe_dma_memcpy ((void *)(addr), &data, sizeof(data)); |
306 | copied = sizeof(data); | 309 | copied = sizeof(data); |
307 | 310 | ||