lkml.org 
[lkml]   [2008]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] kprobes: bugfix: try_module_get even if calling_mod is NULL
    Get probed module even if the caller is in the kernel core code.

    Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
    ---

    >> One question, off topic.
    >> If calling_mod is NULL, no try_module_get(), is that OK?
    >
    > Good question. Currently, kprobes is called only from kernel modules,
    > so calling_mod should be always !NULL.
    > However, it should be fixed, because the logic is not correct.

    Thank you so much. So here is the additional bugfix patch.

    kernel/kprobes.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    Index: 2.6.28-rc3/kernel/kprobes.c
    ===================================================================
    --- 2.6.28-rc3.orig/kernel/kprobes.c
    +++ 2.6.28-rc3/kernel/kprobes.c
    @@ -634,7 +634,7 @@ static int __kprobes __register_kprobe(s
    * avoid incrementing the module refcount, so as to allow
    * unloading of self probing modules.
    */
    - if (calling_mod && calling_mod != probed_mod) {
    + if (calling_mod != probed_mod) {
    if (unlikely(!try_module_get(probed_mod))) {
    preempt_enable();
    return -EINVAL;
    --
    Masami Hiramatsu

    Software Engineer
    Hitachi Computer Products (America) Inc.
    Software Solutions Division

    e-mail: mhiramat@redhat.com



    \
     
     \ /
      Last update: 2008-11-06 01:11    [W:0.040 / U:0.796 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site