diff options
author | Mike Frysinger <vapier@gentoo.org> | 2010-02-14 17:49:59 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2010-03-09 00:30:51 -0500 |
commit | 5f09c77d2ad69397498b6555f0d3cd697304253c (patch) | |
tree | 0e14bceda7eb4eb756febbd838c6b87ef69890f4 /arch/blackfin/kernel | |
parent | f5b99627a3065858ad5c678703ed7af5363dca39 (diff) |
Blackfin: simplify SYSCFG code a bit and ignore attempts to change it
We don't want to let user space modify the SYSCFG register arbitrarily as
the settings are system wide (SNEN/CNEN) and can cause misbehavior. The
only other bit here (SSSTEP) has proper controls via PTRACE_SINGLESTEP.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/kernel')
-rw-r--r-- | arch/blackfin/kernel/ptrace.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/arch/blackfin/kernel/ptrace.c b/arch/blackfin/kernel/ptrace.c index 895302df21c1..14118e40f18f 100644 --- a/arch/blackfin/kernel/ptrace.c +++ b/arch/blackfin/kernel/ptrace.c | |||
@@ -31,12 +31,6 @@ | |||
31 | * in exit.c or in signal.c. | 31 | * in exit.c or in signal.c. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | /* determines which bits in the SYSCFG reg the user has access to. */ | ||
35 | /* 1 = access 0 = no access */ | ||
36 | #define SYSCFG_MASK 0x0007 /* SYSCFG reg */ | ||
37 | /* sets the trace bits. */ | ||
38 | #define TRACE_BITS 0x0001 | ||
39 | |||
40 | /* Find the stack offset for a register, relative to thread.esp0. */ | 34 | /* Find the stack offset for a register, relative to thread.esp0. */ |
41 | #define PT_REG(reg) ((long)&((struct pt_regs *)0)->reg) | 35 | #define PT_REG(reg) ((long)&((struct pt_regs *)0)->reg) |
42 | 36 | ||
@@ -162,9 +156,8 @@ static inline int is_user_addr_valid(struct task_struct *child, | |||
162 | 156 | ||
163 | void ptrace_enable(struct task_struct *child) | 157 | void ptrace_enable(struct task_struct *child) |
164 | { | 158 | { |
165 | unsigned long tmp; | 159 | struct pt_regs *regs = task_pt_regs(child); |
166 | tmp = get_reg(child, PT_SYSCFG) | (TRACE_BITS); | 160 | regs->syscfg |= SYSCFG_SSSTEP; |
167 | put_reg(child, PT_SYSCFG, tmp); | ||
168 | } | 161 | } |
169 | 162 | ||
170 | /* | 163 | /* |
@@ -174,10 +167,8 @@ void ptrace_enable(struct task_struct *child) | |||
174 | */ | 167 | */ |
175 | void ptrace_disable(struct task_struct *child) | 168 | void ptrace_disable(struct task_struct *child) |
176 | { | 169 | { |
177 | unsigned long tmp; | 170 | struct pt_regs *regs = task_pt_regs(child); |
178 | /* make sure the single step bit is not set. */ | 171 | regs->syscfg &= ~SYSCFG_SSSTEP; |
179 | tmp = get_reg(child, PT_SYSCFG) & ~TRACE_BITS; | ||
180 | put_reg(child, PT_SYSCFG, tmp); | ||
181 | } | 172 | } |
182 | 173 | ||
183 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) | 174 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) |
@@ -343,14 +334,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
343 | break; | 334 | break; |
344 | } | 335 | } |
345 | 336 | ||
346 | if (addr >= (sizeof(struct pt_regs))) { | 337 | /* Ignore writes to SYSCFG and other pseudo regs */ |
338 | if (addr >= PT_SYSCFG) { | ||
347 | ret = 0; | 339 | ret = 0; |
348 | break; | 340 | break; |
349 | } | 341 | } |
350 | if (addr == PT_SYSCFG) { | ||
351 | data &= SYSCFG_MASK; | ||
352 | data |= get_reg(child, PT_SYSCFG); | ||
353 | } | ||
354 | ret = put_reg(child, addr, data); | 342 | ret = put_reg(child, addr, data); |
355 | break; | 343 | break; |
356 | 344 | ||