Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 35862
b: refs/heads/master
c: 2ade292
h: refs/heads/master
v: v3
  • Loading branch information
Chuck Ebbert authored and Andi Kleen committed Sep 26, 2006
1 parent 5fe339e commit d94c715
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 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: 91cd444e56ebe0c2acd9576a045d77490b26f607
refs/heads/master: 2ade2920dcefdf5595c6380ebed131c964190855
10 changes: 5 additions & 5 deletions trunk/arch/i386/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,17 @@ static unsigned long convert_eip_to_linear(struct task_struct *child, struct pt_
return addr;
}

static inline int is_at_popf(struct task_struct *child, struct pt_regs *regs)
static inline int is_setting_trap_flag(struct task_struct *child, struct pt_regs *regs)
{
int i, copied;
unsigned char opcode[16];
unsigned char opcode[15];
unsigned long addr = convert_eip_to_linear(child, regs);

copied = access_process_vm(child, addr, opcode, sizeof(opcode), 0);
for (i = 0; i < copied; i++) {
switch (opcode[i]) {
/* popf */
case 0x9d:
/* popf and iret */
case 0x9d: case 0xcf:
return 1;
/* opcode and address size prefixes */
case 0x66: case 0x67:
Expand Down Expand Up @@ -247,7 +247,7 @@ static void set_singlestep(struct task_struct *child)
* don't mark it as being "us" that set it, so that we
* won't clear it by hand later.
*/
if (is_at_popf(child, regs))
if (is_setting_trap_flag(child, regs))
return;

child->ptrace |= PT_DTRACE;
Expand Down
12 changes: 5 additions & 7 deletions trunk/arch/x86_64/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,17 @@ unsigned long convert_rip_to_linear(struct task_struct *child, struct pt_regs *r
return addr;
}

static int is_at_popf(struct task_struct *child, struct pt_regs *regs)
static int is_setting_trap_flag(struct task_struct *child, struct pt_regs *regs)
{
int i, copied;
unsigned char opcode[16];
unsigned char opcode[15];
unsigned long addr = convert_rip_to_linear(child, regs);

copied = access_process_vm(child, addr, opcode, sizeof(opcode), 0);
for (i = 0; i < copied; i++) {
switch (opcode[i]) {
/* popf */
case 0x9d:
/* popf and iret */
case 0x9d: case 0xcf:
return 1;

/* CHECKME: 64 65 */
Expand Down Expand Up @@ -189,10 +189,8 @@ static void set_singlestep(struct task_struct *child)
* ..but if TF is changed by the instruction we will trace,
* don't mark it as being "us" that set it, so that we
* won't clear it by hand later.
*
* AK: this is not enough, LAHF and IRET can change TF in user space too.
*/
if (is_at_popf(child, regs))
if (is_setting_trap_flag(child, regs))
return;

child->ptrace |= PT_DTRACE;
Expand Down

0 comments on commit d94c715

Please sign in to comment.