[PATCH] x86: Use helper in kprobes{32|64}.c - Kernel

This is a discussion on [PATCH] x86: Use helper in kprobes{32|64}.c - Kernel ; Signed-off-by: Harvey Harrison --- arch/x86/kernel/kprobes_32.c | 18 +++++++++++------- arch/x86/kernel/kprobes_64.c | 14 ++++++++++++-- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/arch/x86/kernel/kprobes_32.c b/arch/x86/kernel/kprobes_32.c index 2a8acd6..878b0c4 100644 --- a/arch/x86/kernel/kprobes_32.c +++ b/arch/x86/kernel/kprobes_32.c @@ -239,13 +239,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) if ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: [PATCH] x86: Use helper in kprobes{32|64}.c

  1. [PATCH] x86: Use helper in kprobes{32|64}.c

    Signed-off-by: Harvey Harrison
    ---
    arch/x86/kernel/kprobes_32.c | 18 +++++++++++-------
    arch/x86/kernel/kprobes_64.c | 14 ++++++++++++--
    2 files changed, 23 insertions(+), 9 deletions(-)

    diff --git a/arch/x86/kernel/kprobes_32.c b/arch/x86/kernel/kprobes_32.c
    index 2a8acd6..878b0c4 100644
    --- a/arch/x86/kernel/kprobes_32.c
    +++ b/arch/x86/kernel/kprobes_32.c
    @@ -239,13 +239,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
    if (!p->ainsn.insn)
    return -ENOMEM;

    - memcpy(p->ainsn.insn, p->addr, (MAX_INSN_SIZE + 1) * sizeof(kprobe_opcode_t));
    - p->opcode = *p->addr;
    - if (can_boost(p->addr)) {
    - p->ainsn.boostable = 0;
    - } else {
    - p->ainsn.boostable = -1;
    - }
    + arch_copy_kprobe(p);
    return 0;
    }

    @@ -303,6 +297,15 @@ static s32 __kprobes *is_riprel(u8 *insn)

    static void __kprobes arch_copy_kprobe(struct kprobe *p)
    {
    +#ifdef CONFIG_X86_32
    + memcpy(p->ainsn.insn, p->addr, (MAX_INSN_SIZE + 1) * sizeof(kprobe_opcode_t));
    + p->opcode = *p->addr;
    + if (can_boost(p->addr)) {
    + p->ainsn.boostable = 0;
    + } else {
    + p->ainsn.boostable = -1;
    + }
    +#else
    s32 *ripdisp;
    memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE);
    ripdisp = is_riprel(p->ainsn.insn);
    @@ -325,6 +328,7 @@ static void __kprobes arch_copy_kprobe(struct kprobe *p)
    *ripdisp = disp;
    }
    p->opcode = *p->addr;
    +#endif
    }

    void __kprobes arch_arm_kprobe(struct kprobe *p)
    diff --git a/arch/x86/kernel/kprobes_64.c b/arch/x86/kernel/kprobes_64.c
    index 5f02e75..b437f7a 100644
    --- a/arch/x86/kernel/kprobes_64.c
    +++ b/arch/x86/kernel/kprobes_64.c
    @@ -245,9 +245,9 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
    {
    /* insn: must be on special executable page on x86_32|64. */
    p->ainsn.insn = get_insn_slot();
    - if (!p->ainsn.insn) {
    + if (!p->ainsn.insn)
    return -ENOMEM;
    - }
    +
    arch_copy_kprobe(p);
    return 0;
    }
    @@ -306,6 +306,15 @@ static s32 __kprobes *is_riprel(u8 *insn)

    static void __kprobes arch_copy_kprobe(struct kprobe *p)
    {
    +#ifdef CONFIG_X86_32
    + memcpy(p->ainsn.insn, p->addr, (MAX_INSN_SIZE + 1) * sizeof(kprobe_opcode_t));
    + p->opcode = *p->addr;
    + if (can_boost(p->addr)) {
    + p->ainsn.boostable = 0;
    + } else {
    + p->ainsn.boostable = -1;
    + }
    +#else
    s32 *ripdisp;
    memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE);
    ripdisp = is_riprel(p->ainsn.insn);
    @@ -328,6 +337,7 @@ static void __kprobes arch_copy_kprobe(struct kprobe *p)
    *ripdisp = disp;
    }
    p->opcode = *p->addr;
    +#endif
    }

    void __kprobes arch_arm_kprobe(struct kprobe *p)
    --
    1.5.4.rc0.1083.gf568



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

  2. Re: [PATCH] x86: Use helper in kprobes{32|64}.c


    * Harvey Harrison wrote:

    > x86: Use helper in kprobes{32|64}.c


    thanks, i've applied your kprobes pre-unification patches to x86.git.

    While we are at it, it might be nice to reduce the numbers of checkpatch
    warnings:

    $ scripts/checkpatch.pl --file arch/x86/kernel/kprobes*.c | grep total
    total: 10 errors, 9 warnings, 959 lines checked
    total: 10 errors, 8 warnings, 923 lines checked

    to 0/0 ? :-) (but that can happen after the unification too)

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

  3. Re: [PATCH] x86: Use helper in kprobes{32|64}.c

    On Sat, 2007-12-15 at 08:36 +0100, Ingo Molnar wrote:
    > * Harvey Harrison wrote:
    >
    > > x86: Use helper in kprobes{32|64}.c

    >
    > thanks, i've applied your kprobes pre-unification patches to x86.git.
    >
    > While we are at it, it might be nice to reduce the numbers of checkpatch
    > warnings:
    >
    > $ scripts/checkpatch.pl --file arch/x86/kernel/kprobes*.c | grep total
    > total: 10 errors, 9 warnings, 959 lines checked
    > total: 10 errors, 8 warnings, 923 lines checked
    >
    > to 0/0 ? :-) (but that can happen after the unification too)
    >


    That was my plan...you'll notice I already cut ~200 from each file
    though, so the lion's share is done. I'll have the final few in the
    series shortly.

    Harvey

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

+ Reply to Thread