lkml.org 
[lkml]   [2015]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC][PATCH 1/9] klp: Fix obvious RCU fail
    On Sat, Feb 28, 2015 at 10:24:48PM +0100, Peter Zijlstra wrote:
    > While one must hold RCU-sched (aka. preempt_disable) for find_symbol()
    > one must equally hold it over the use of the object returned.
    >
    > The moment you release the RCU-sched read lock, the object can be dead
    > and gone.
    >
    > Cc: Seth Jennings <sjenning@redhat.com>
    > Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    > Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
    > Cc: Miroslav Benes <mbenes@suse.cz>
    > Cc: Petr Mladek <pmladek@suse.cz>
    > Cc: Jiri Kosina <jkosina@suse.cz>
    > Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
    > Cc: Rusty Russell <rusty@rustcorp.com.au>
    > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>

    Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>

    > ---
    > kernel/livepatch/core.c | 3 ++-
    > 1 file changed, 2 insertions(+), 1 deletion(-)
    >
    > --- a/kernel/livepatch/core.c
    > +++ b/kernel/livepatch/core.c
    > @@ -248,11 +248,12 @@ static int klp_find_external_symbol(stru
    > /* first, check if it's an exported symbol */
    > preempt_disable();
    > sym = find_symbol(name, NULL, NULL, true, true);
    > - preempt_enable();
    > if (sym) {
    > *addr = sym->value;
    > + preempt_enable();
    > return 0;
    > }
    > + preempt_enable();
    >
    > /* otherwise check if it's in another .o within the patch module */
    > return klp_find_object_symbol(pmod->name, name, addr);
    >
    >

    --
    Josh


    \
     
     \ /
      Last update: 2015-03-02 22:21    [W:4.872 / U:0.076 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site