lkml.org 
[lkml]   [2021]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH] kretprobe: avoid re-registration of the same kretprobe earlier
    From
    Date
    Dear Masami and Steve,

    I have sent v2 but still have confusions:

    > OK, I think it is simpler to check the rp->kp.addr && rp->kp.symbol_name
    > because it is not allowed (it can lead inconsistent setting).
    >
    > How about this code? Is this work for you?
    >
    > diff --git a/kernel/kprobes.c b/kernel/kprobes.c
    > index 41fdbb7953c6..73500be564be 100644
    > --- a/kernel/kprobes.c
    > +++ b/kernel/kprobes.c
    > @@ -2103,6 +2103,14 @@ int register_kretprobe(struct kretprobe *rp)
    > int i;
    > void *addr;
    >
    > + /* It is not allowed to specify addr and symbol_name at the same time */
    > + if (rp->kp.addr && rp->kp.symbol_name)
    > + return -EINVAL;
    > +

    above sentence can be removed because of kprobe_on_func_entry() do it:

    kprobe_on_func_entry()

         -=>_kprobe_addr() {if (rp->kp.addr && rp->kp.symbol_name) ...}

    > + /* If only rp->kp.addr is specified, check reregistering kprobes */
    > + if (rp->kp.addr && check_kprobe_rereg(&rp->kp))
    > + return -EINVAL;

    for arch arm64,x86_64, above sentence can be moved behind following
    sentence.

    kprobe_on_func_entry()

        -=>arch_kprobe_on_func_entry() {kp->offset can not be 0 ; ...}

    So if offset of kprobe if not 0, do not waste time to excute above sentence.


    But for Arch ppc64,  I still not figure out better one solution.


    Thank you

    -- Wang ShaoBo

    > if (!kprobe_on_func_entry(rp->kp.addr, rp->kp.symbol_name, rp->kp.offset))
    > return -EINVAL;
    >
    >
    > Thank you,
    >

    \
     
     \ /
      Last update: 2021-01-29 04:40    [W:3.329 / U:1.244 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site