Re: [PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch()

2015-12-15 Thread Miroslav Benes
Hi, [ sry for late responses. Two weeks of holiday and trying to go through all the emails... ] On Mon, 30 Nov 2015, Li Bin wrote: > There is a potential race as following: > > CPU0 | CPU1 > -|--- >

Re: [PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch()

2015-12-15 Thread Miroslav Benes
Hi, [ sry for late responses. Two weeks of holiday and trying to go through all the emails... ] On Mon, 30 Nov 2015, Li Bin wrote: > There is a potential race as following: > > CPU0 | CPU1 > -|--- >

Re: [PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch()

2015-12-01 Thread Petr Mladek
On Tue 2015-12-01 15:28:19, Jiri Slaby wrote: > On 12/01/2015, 03:13 PM, Petr Mladek wrote: > > --- a/kernel/livepatch/core.c > > +++ b/kernel/livepatch/core.c > > @@ -612,7 +612,19 @@ static ssize_t enabled_store(struct kobject *kobj, > > struct kobj_attribute *attr, > > > > patch =

Re: [PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch()

2015-12-01 Thread Josh Poimboeuf
On Tue, Dec 01, 2015 at 09:50:23AM +0100, Jiri Slaby wrote: > On 12/01/2015, 02:11 AM, Josh Poimboeuf wrote: > > When I try to recreate something similar by putting a delay in > > enabled_store(), klp_free_patch() just sleeps on its call to > > kobject_put() until enabled_store() returns. The

Re: [PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch()

2015-12-01 Thread Jiri Slaby
On 12/01/2015, 03:13 PM, Petr Mladek wrote: > --- a/kernel/livepatch/core.c > +++ b/kernel/livepatch/core.c > @@ -612,7 +612,19 @@ static ssize_t enabled_store(struct kobject *kobj, > struct kobj_attribute *attr, > > patch = container_of(kobj, struct klp_patch, kobj); > > -

Re: [PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch()

2015-12-01 Thread Petr Mladek
On Tue 2015-12-01 09:50:23, Jiri Slaby wrote: > On 12/01/2015, 02:11 AM, Josh Poimboeuf wrote: > > When I try to recreate something similar by putting a delay in > > enabled_store(), klp_free_patch() just sleeps on its call to > > kobject_put() until enabled_store() returns. The unregister stack

Re: [PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch()

2015-12-01 Thread Jiri Slaby
On 12/01/2015, 02:11 AM, Josh Poimboeuf wrote: > When I try to recreate something similar by putting a delay in > enabled_store(), klp_free_patch() just sleeps on its call to > kobject_put() until enabled_store() returns. The unregister stack looks > like: > > [] __kernfs_remove+0x1fb/0x380 >

Re: [PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch()

2015-12-01 Thread Petr Mladek
On Tue 2015-12-01 15:28:19, Jiri Slaby wrote: > On 12/01/2015, 03:13 PM, Petr Mladek wrote: > > --- a/kernel/livepatch/core.c > > +++ b/kernel/livepatch/core.c > > @@ -612,7 +612,19 @@ static ssize_t enabled_store(struct kobject *kobj, > > struct kobj_attribute *attr, > > > > patch =

Re: [PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch()

2015-12-01 Thread Jiri Slaby
On 12/01/2015, 02:11 AM, Josh Poimboeuf wrote: > When I try to recreate something similar by putting a delay in > enabled_store(), klp_free_patch() just sleeps on its call to > kobject_put() until enabled_store() returns. The unregister stack looks > like: > > [] __kernfs_remove+0x1fb/0x380 >

Re: [PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch()

2015-12-01 Thread Josh Poimboeuf
On Tue, Dec 01, 2015 at 09:50:23AM +0100, Jiri Slaby wrote: > On 12/01/2015, 02:11 AM, Josh Poimboeuf wrote: > > When I try to recreate something similar by putting a delay in > > enabled_store(), klp_free_patch() just sleeps on its call to > > kobject_put() until enabled_store() returns. The

Re: [PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch()

2015-12-01 Thread Petr Mladek
On Tue 2015-12-01 09:50:23, Jiri Slaby wrote: > On 12/01/2015, 02:11 AM, Josh Poimboeuf wrote: > > When I try to recreate something similar by putting a delay in > > enabled_store(), klp_free_patch() just sleeps on its call to > > kobject_put() until enabled_store() returns. The unregister stack

Re: [PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch()

2015-12-01 Thread Jiri Slaby
On 12/01/2015, 03:13 PM, Petr Mladek wrote: > --- a/kernel/livepatch/core.c > +++ b/kernel/livepatch/core.c > @@ -612,7 +612,19 @@ static ssize_t enabled_store(struct kobject *kobj, > struct kobj_attribute *attr, > > patch = container_of(kobj, struct klp_patch, kobj); > > -

Re: [PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch()

2015-11-30 Thread libin
Hi Josh, on 2015/12/1 9:11, Josh Poimboeuf wrote: > On Mon, Nov 30, 2015 at 11:54:37AM +0800, Li Bin wrote: >> There is a potential race as following: >> >> CPU0 | CPU1 >> -|--- >> enabled_store() |

Re: [PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch()

2015-11-30 Thread Josh Poimboeuf
On Mon, Nov 30, 2015 at 11:54:37AM +0800, Li Bin wrote: > There is a potential race as following: > > CPU0 | CPU1 > -|--- > enabled_store() | klp_unregister_patch() > |

Re: [PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch()

2015-11-30 Thread Petr Mladek
On Mon 2015-11-30 11:54:37, Li Bin wrote: > There is a potential race as following: > > CPU0 | CPU1 > -|--- > enabled_store() | klp_unregister_patch() > |

Re: [PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch()

2015-11-30 Thread libin
Hi Josh, on 2015/12/1 9:11, Josh Poimboeuf wrote: > On Mon, Nov 30, 2015 at 11:54:37AM +0800, Li Bin wrote: >> There is a potential race as following: >> >> CPU0 | CPU1 >> -|--- >> enabled_store() |

Re: [PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch()

2015-11-30 Thread Josh Poimboeuf
On Mon, Nov 30, 2015 at 11:54:37AM +0800, Li Bin wrote: > There is a potential race as following: > > CPU0 | CPU1 > -|--- > enabled_store() | klp_unregister_patch() > |

Re: [PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch()

2015-11-30 Thread Petr Mladek
On Mon 2015-11-30 11:54:37, Li Bin wrote: > There is a potential race as following: > > CPU0 | CPU1 > -|--- > enabled_store() | klp_unregister_patch() > |

[PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch()

2015-11-29 Thread Li Bin
There is a potential race as following: CPU0 | CPU1 -|--- enabled_store() | klp_unregister_patch() | |-mutex_lock(_mutex); |-mutex_lock(_mutex);|

[PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch()

2015-11-29 Thread Li Bin
There is a potential race as following: CPU0 | CPU1 -|--- enabled_store() | klp_unregister_patch() | |-mutex_lock(_mutex); |-mutex_lock(_mutex);|