Re: [PATCH v3 1/6] x86/alternatives: Teach text_poke_bp() to emulate instructions
From: Steven Rostedt
Date: Tue Oct 08 2019 - 11:04:17 EST
On Tue, 8 Oct 2019 16:54:24 +0200
Borislav Petkov <bp@xxxxxxxxx> wrote:
> On Tue, Oct 08, 2019 at 04:48:34PM +0200, Peter Zijlstra wrote:
> > Can, but why? That's more lines for no raisin ;-)
>
> Here's a raisin: I was looking at this and then all of a sudden went:
> "W00t, why is this do_sync part of the loop at all? Do they belong
> together? Nope."
>
But it is part of the loop...
+ for (do_sync = 0, i = 0; i < nr_entries; i++) {
+ if (tp[i].text[0] == INT3_INSN_OPCODE)
+ continue;
+
+ text_poke(tp[i].addr, tp[i].text, sizeof(int3));
+ do_sync++;
+ }
+
The difference between do_sync and i is that i gets incremented at
every iteration, where do_sync gets incremented only when the first
conditional is false. But I still see do_sync as a loop variable.
-- Steve