Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1395106

Re: [RFC PATCH] livepatch: allow removal of a disabled patch

From Josh Poimboeuf <jpoimboe@redhat.com>
Newsgroups linux.kernel
Subject Re: [RFC PATCH] livepatch: allow removal of a disabled patch
Date 2016-05-05 15:30 +0200
Message-ID <rvrvQ-MH-11@gated-at.bofh.it> (permalink)
References (5 earlier) <rv3Dd-38F-39@gated-at.bofh.it> <rv4SC-4va-5@gated-at.bofh.it> <rv685-5L8-81@gated-at.bofh.it> <rv7GN-7iY-7@gated-at.bofh.it> <rvmPE-4Dm-161@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, May 05, 2016 at 10:28:12AM +0200, Miroslav Benes wrote:
> I think it boils down to the following problem.
> 
> 1. CONFIG_DEBUG_KOBJECT_RELEASE=y
> 
> 2. we have dynamic kobjects, so there is a pointer in klp_patch to struct 
> kobject
> 
> 3. it is allocated during klp_init_patch() and all is fine
> 
> 4. now we want to remove the patch module. It is disabled and module_put()
> is called. User calls rmmod on the module.
> 
> 5. klp_unregister_patch() is called in __exit method.
> 
> 6. klp_free_patch() is called.
> 
> 7. kobject_put(patch->kobj) is called.
> 
> ...now it gets interesting...
> 
> 8. among others kobject_cleanup() is scheduled as a delayed work (this is 
> important).
> 
> 9. there is no completion, so kobject_put returns and the module goes 
> away.
> 
> 10. someone calls patch enabled_store attribute (for example). They can 
> because kobject_cleanup() has not been called yet. It is delayed 
> scheduled.
> 
> ...crash...

But what exactly causes the crash?  In enabled_store() we can see that
the patch isn't in the list, so we can return -EINVAL.

-- 
Josh

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH] livepatch: allow removal of a disabled patch Miroslav Benes <mbenes@suse.cz> - 2016-05-02 14:00 +0200
  Re: [RFC PATCH] livepatch: allow removal of a disabled patch Josh Poimboeuf <jpoimboe@redhat.com> - 2016-05-02 17:10 +0200
    Re: [RFC PATCH] livepatch: allow removal of a disabled patch Miroslav Benes <mbenes@suse.cz> - 2016-05-03 10:20 +0200
  Re: [RFC PATCH] livepatch: allow removal of a disabled patch Josh Poimboeuf <jpoimboe@redhat.com> - 2016-05-03 23:40 +0200
    Re: [RFC PATCH] livepatch: allow removal of a disabled patch Jiri Kosina <jikos@kernel.org> - 2016-05-04 00:40 +0200
      Re: [RFC PATCH] livepatch: allow removal of a disabled patch Josh Poimboeuf <jpoimboe@redhat.com> - 2016-05-04 04:40 +0200
        Re: [RFC PATCH] livepatch: allow removal of a disabled patch Josh Poimboeuf <jpoimboe@redhat.com> - 2016-05-04 05:40 +0200
          Re: [RFC PATCH] livepatch: allow removal of a disabled patch Miroslav Benes <mbenes@suse.cz> - 2016-05-04 14:00 +0200
            Re: [RFC PATCH] livepatch: allow removal of a disabled patch Josh Poimboeuf <jpoimboe@redhat.com> - 2016-05-04 15:20 +0200
              Re: [RFC PATCH] livepatch: allow removal of a disabled patch Miroslav Benes <mbenes@suse.cz> - 2016-05-04 16:40 +0200
                Re: [RFC PATCH] livepatch: allow removal of a disabled patch Josh Poimboeuf <jpoimboe@redhat.com> - 2016-05-04 18:20 +0200
                Re: [RFC PATCH] livepatch: allow removal of a disabled patch Miroslav Benes <mbenes@suse.cz> - 2016-05-05 10:30 +0200
                Re: [RFC PATCH] livepatch: allow removal of a disabled patch Josh Poimboeuf <jpoimboe@redhat.com> - 2016-05-05 15:30 +0200
                Re: [RFC PATCH] livepatch: allow removal of a disabled patch Miroslav Benes <mbenes@suse.cz> - 2016-05-05 16:30 +0200
                Re: [RFC PATCH] livepatch: allow removal of a disabled patch Josh Poimboeuf <jpoimboe@redhat.com> - 2016-05-05 17:10 +0200
                Re: [RFC PATCH] livepatch: allow removal of a disabled patch Jiri Kosina <jikos@kernel.org> - 2016-05-05 23:10 +0200
                Re: livepatch: allow removal of a disabled patch Jessica Yu <jeyu@redhat.com> - 2016-05-06 02:50 +0200
                Re: livepatch: allow removal of a disabled patch Miroslav Benes <mbenes@suse.cz> - 2016-05-06 10:00 +0200

csiph-web