Re: [RFC PATCH] x86 single-step (TF) vs system calls & traps

From: Roland McGrath
Date: Thu Jul 01 2004 - 15:26:05 EST


> That's documented in x86 manuals and I don't think we should even try to
> have the userspace-TF to have a different behaviour from what x86 describe.

The behavior described for the chip is that it traps after executing one
instruction. From the user-mode perspective, the system call instruction
is one instruction that does not normally generate any kind of exception.
It just does one magic thing, that being having the kernel do something for
you. If someone sets TF in user mode then they probably expect that they
will get a trap after executing one instruction, even that one.

> Here I meant that if you set SINGLESTEP|SYSGOOD, the patch will give you
> SIGTRAP|0x80, while if you set only SINGLESTEP the patch will give you
> SIGTRAP. Enforcing the SINGLESTEP|SYSGOOD is invalid or only gives SIGTRAP
> should be no more that three lines of code out of the fast path.

There is no "set SINGLESTEP|SYSGOOD". PTRACE_SINGLESTEP is a one-time
operation. PTRACE_O_TRACESYSGOOD is a persistent flag you set when you
intend to at some point use the PTRACE_SYSCALL operation.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/