summaryrefslogtreecommitdiffstats
path: root/arch/blackfin
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-02-14 22:49:59 +0000
committerMike Frysinger <vapier@gentoo.org>2010-03-09 00:30:51 -0500
commit5f09c77d2ad69397498b6555f0d3cd697304253c (patch)
tree0e14bceda7eb4eb756febbd838c6b87ef69890f4 /arch/blackfin
parentf5b99627a3065858ad5c678703ed7af5363dca39 (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')
-rw-r--r--arch/blackfin/kernel/ptrace.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/arch/blackfin/kernel/ptrace.c b/arch/blackfin/kernel/ptrace.c
index 895302df21c..14118e40f18 100644
--- a/arch/blackfin/kernel/ptrace.c
+++ b/arch/blackfin/kernel/ptrace.c
@@ -31,12 +31,6 @@
* in exit.c or in signal.c.
*/
-/* determines which bits in the SYSCFG reg the user has access to. */
-/* 1 = access 0 = no access */
-#define SYSCFG_MASK 0x0007 /* SYSCFG reg */
-/* sets the trace bits. */
-#define TRACE_BITS 0x0001
-
/* Find the stack offset for a register, relative to thread.esp0. */
#define PT_REG(reg) ((long)&((struct pt_regs *)0)->reg)
@@ -162,9 +156,8 @@ static inline int is_user_addr_valid(struct task_struct *child,
void ptrace_enable(struct task_struct *child)
{
- unsigned long tmp;
- tmp = get_reg(child, PT_SYSCFG) | (TRACE_BITS);
- put_reg(child, PT_SYSCFG, tmp);
+ struct pt_regs *regs = task_pt_regs(child);
+ regs->syscfg |= SYSCFG_SSSTEP;
}
/*
@@ -174,10 +167,8 @@ void ptrace_enable(struct task_struct *child)
*/
void ptrace_disable(struct task_struct *child)
{
- unsigned long tmp;
- /* make sure the single step bit is not set. */
- tmp = get_reg(child, PT_SYSCFG) & ~TRACE_BITS;
- put_reg(child, PT_SYSCFG, tmp);
+ struct pt_regs *regs = task_pt_regs(child);
+ regs->syscfg &= ~SYSCFG_SSSTEP;
}
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)
break;
}
- if (addr >= (sizeof(struct pt_regs))) {
+ /* Ignore writes to SYSCFG and other pseudo regs */
+ if (addr >= PT_SYSCFG) {
ret = 0;
break;
}
- if (addr == PT_SYSCFG) {
- data &= SYSCFG_MASK;
- data |= get_reg(child, PT_SYSCFG);
- }
ret = put_reg(child, addr, data);
break;