Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24233
b: refs/heads/master
c: 81efcd3
h: refs/heads/master
i:
  24231: 5892158
v: v3
  • Loading branch information
Bodo Stroesser authored and Linus Torvalds committed Mar 27, 2006
1 parent e9996e2 commit d876e9b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f206aabb035318ac4bafbf0b87798335de3634df
refs/heads/master: 81efcd3300754462537ffac60336158b2f773b4e
15 changes: 12 additions & 3 deletions trunk/arch/um/sys-i386/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <linux/config.h>
#include <linux/compiler.h>
#include "linux/sched.h"
#include "linux/mm.h"
#include "asm/elf.h"
#include "asm/ptrace.h"
#include "asm/uaccess.h"
Expand All @@ -26,9 +27,17 @@ int is_syscall(unsigned long addr)

n = copy_from_user(&instr, (void __user *) addr, sizeof(instr));
if(n){
printk("is_syscall : failed to read instruction from 0x%lx\n",
addr);
return(0);
/* access_process_vm() grants access to vsyscall and stub,
* while copy_from_user doesn't. Maybe access_process_vm is
* slow, but that doesn't matter, since it will be called only
* in case of singlestepping, if copy_from_user failed.
*/
n = access_process_vm(current, addr, &instr, sizeof(instr), 0);
if(n != sizeof(instr)) {
printk("is_syscall : failed to read instruction from "
"0x%lx\n", addr);
return(1);
}
}
/* int 0x80 or sysenter */
return((instr == 0x80cd) || (instr == 0x340f));
Expand Down
22 changes: 21 additions & 1 deletion trunk/arch/um/sys-x86_64/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <asm/ptrace.h>
#include <linux/sched.h>
#include <linux/errno.h>
#include <linux/mm.h>
#include <asm/uaccess.h>
#include <asm/elf.h>

Expand Down Expand Up @@ -136,9 +137,28 @@ void arch_switch(void)
*/
}

/* XXX Mostly copied from sys-i386 */
int is_syscall(unsigned long addr)
{
panic("is_syscall");
unsigned short instr;
int n;

n = copy_from_user(&instr, (void __user *) addr, sizeof(instr));
if(n){
/* access_process_vm() grants access to vsyscall and stub,
* while copy_from_user doesn't. Maybe access_process_vm is
* slow, but that doesn't matter, since it will be called only
* in case of singlestepping, if copy_from_user failed.
*/
n = access_process_vm(current, addr, &instr, sizeof(instr), 0);
if(n != sizeof(instr)) {
printk("is_syscall : failed to read instruction from "
"0x%lx\n", addr);
return(1);
}
}
/* sysenter */
return(instr == 0x050f);
}

int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu )
Expand Down

0 comments on commit d876e9b

Please sign in to comment.