Re: FInal kprobes rollup patches

From: Harvey Harrison
Date: Mon Dec 17 2007 - 14:20:37 EST


On Mon, 2007-12-17 at 19:52 +0530, Srikar Dronamraju wrote:
> * Ingo Molnar <mingo@xxxxxxx> [2007-12-15 14:12:04]:
>
>
> Hi Ingo, Harvey
>
> In file include/asm-x86/kprobes_32.h
> typedef u8 kprobe_opcode_t;
> hence sizeof(kprobe_opcode_t) turns out to be 1.
>
> Hence
>
> memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
> is correct.
>

OK, but this would be much clearer to adopt the X86_64 way, define
MAX_INSN_SIZE one smaller and make this line:

/* Copy original instruction plus space for 1 byte relative jump */
memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE + sizeof(kprobe_opcode_t));

See the first patch of my cleanup work that unified MAX_INSN_SIZE
and you'll see why this jumped out.

Harvey

--
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/