linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Why do kprobes and uprobes singlestep?
@ 2021-02-23 23:24 Andy Lutomirski
  2021-02-24  1:17 ` Masami Hiramatsu
  2021-03-01 16:51 ` Oleg Nesterov
  0 siblings, 2 replies; 41+ messages in thread
From: Andy Lutomirski @ 2021-02-23 23:24 UTC (permalink / raw)
  To: Oleg Nesterov, Masami Hiramatsu, Peter Zijlstra, LKML,
	Anil S Keshavamurthy, David S. Miller, X86 ML, Andrew Cooper

A while back, I let myself be convinced that kprobes genuinely need to
single-step the kernel on occasion, and I decided that this sucked but
I could live with it.  it would, however, be Really Really Nice (tm)
if we could have a rule that anyone running x86 Linux who single-steps
the kernel (e.g. kgdb and nothing else) gets to keep all the pieces
when the system falls apart around them.  Specifically, if we don't
allow kernel single-stepping and if we suitably limit kernel
instruction breakpoints (the latter isn't actually a major problem),
then we don't really really need to use IRET to return to the kernel,
and that means we can avoid some massive NMI nastiness.

But I was contemplating the code, and I'm no longer convinced.
Uprobes seem to single-step user code for no discernable reason.
(They want to trap after executing an out of line instruction, AFAICT.
Surely INT3 or even CALL after the out-of-line insn would work as well
or better.)  Why does kprobe single-step?  I spend a while staring at
the code, and it was entirely unclear to me what the purpose of the
single-step is.

--Andy

^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2021-03-23 15:15 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-23 23:24 Why do kprobes and uprobes singlestep? Andy Lutomirski
2021-02-24  1:17 ` Masami Hiramatsu
2021-02-24 19:45   ` Andy Lutomirski
2021-02-25  2:22     ` Masami Hiramatsu
2021-02-25  6:03       ` Andy Lutomirski
2021-02-25  9:11         ` Masami Hiramatsu
2021-03-01 14:08       ` [RFC PATCH 0/1] x86/kprobes: Remoev single-step trap from x86 kprobes Masami Hiramatsu
2021-03-01 14:08         ` [RFC PATCH 1/1] x86/kprobes: Use int3 instead of debug trap for single-step Masami Hiramatsu
2021-03-02  8:06           ` Peter Zijlstra
2021-03-02  8:38           ` Peter Zijlstra
2021-03-02  8:41           ` Peter Zijlstra
2021-03-02  8:54             ` Peter Zijlstra
2021-03-02 12:51               ` Masami Hiramatsu
2021-03-02 13:58               ` Peter Zijlstra
2021-03-02 15:25       ` [PATCH -tip 0/3] x86/kprobes: Remoev single-step trap from x86 kprobes Masami Hiramatsu
2021-03-02 15:25         ` [PATCH -tip 1/3] x86/kprobes: Retrieve correct opcode for group instruction Masami Hiramatsu
2021-03-23 15:15           ` [tip: x86/core] " tip-bot2 for Masami Hiramatsu
2021-03-02 15:25         ` [PATCH -tip 2/3] x86/kprobes: Identify far indirect JMP correctly Masami Hiramatsu
2021-03-23 15:15           ` [tip: x86/core] " tip-bot2 for Masami Hiramatsu
2021-03-02 15:25         ` [PATCH -tip 3/3] x86/kprobes: Use int3 instead of debug trap for single-step Masami Hiramatsu
2021-03-23 15:15           ` [tip: x86/core] " tip-bot2 for Masami Hiramatsu
2021-03-17 14:55         ` [PATCH -tip 0/3] x86/kprobes: Remoev single-step trap from x86 kprobes Masami Hiramatsu
2021-03-17 16:26           ` Peter Zijlstra
2021-03-17 17:45             ` Andy Lutomirski
2021-02-25  9:59     ` Why do kprobes and uprobes singlestep? Peter Zijlstra
2021-03-01 16:51 ` Oleg Nesterov
2021-03-02  1:36   ` Andy Lutomirski
2021-03-02 20:24     ` Alexei Starovoitov
2021-03-02 21:02       ` Andy Lutomirski
2021-03-03  1:22         ` Alexei Starovoitov
2021-03-03  1:46           ` Andy Lutomirski
2021-03-03  2:18             ` Alexei Starovoitov
2021-03-03 13:27               ` Oleg Nesterov
2021-03-03 18:11               ` Daniel Xu
2021-03-03 19:14                 ` Andy Lutomirski
2021-03-02 20:25     ` Oleg Nesterov
2021-03-02 20:35       ` Andy Lutomirski
2021-03-02 20:28     ` Oleg Nesterov
2021-03-02  2:22   ` Masami Hiramatsu
2021-03-02  2:48     ` Andy Lutomirski
2021-03-02 20:31     ` Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).