Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-31 Thread Miroslav Benes
> > Could you also add a comment above klp_shadow_lock definition about what > > it aims to protect? > > > > How about "klp_shadow_lock provides exclusive access to the > klp_shadow_hash and the shadow variables it references." or were > thinking of something more detailed? No, this is good.

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-31 Thread Miroslav Benes
> > Could you also add a comment above klp_shadow_lock definition about what > > it aims to protect? > > > > How about "klp_shadow_lock provides exclusive access to the > klp_shadow_hash and the shadow variables it references." or were > thinking of something more detailed? No, this is good.

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-21 Thread Petr Mladek
On Fri 2017-08-18 16:25:42, Joe Lawrence wrote: > On 08/17/2017 10:05 AM, Petr Mladek wrote: > > On Mon 2017-08-14 16:02:43, Joe Lawrence wrote: > >> [ ... snip ... ] > >> + /* Allocate a new shadow variable for use inside the lock below */ > >> + new_shadow = kzalloc(size + sizeof(*new_shadow),

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-21 Thread Petr Mladek
On Fri 2017-08-18 16:25:42, Joe Lawrence wrote: > On 08/17/2017 10:05 AM, Petr Mladek wrote: > > On Mon 2017-08-14 16:02:43, Joe Lawrence wrote: > >> [ ... snip ... ] > >> + /* Allocate a new shadow variable for use inside the lock below */ > >> + new_shadow = kzalloc(size + sizeof(*new_shadow),

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-18 Thread Joe Lawrence
On 08/17/2017 10:05 AM, Petr Mladek wrote: > On Mon 2017-08-14 16:02:43, Joe Lawrence wrote: >> [ ... snip ... ] >> +/* Allocate a new shadow variable for use inside the lock below */ >> +new_shadow = kzalloc(size + sizeof(*new_shadow), gfp_flags); > > We should print an error message

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-18 Thread Joe Lawrence
On 08/17/2017 10:05 AM, Petr Mladek wrote: > On Mon 2017-08-14 16:02:43, Joe Lawrence wrote: >> [ ... snip ... ] >> +/* Allocate a new shadow variable for use inside the lock below */ >> +new_shadow = kzalloc(size + sizeof(*new_shadow), gfp_flags); > > We should print an error message

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-18 Thread Josh Poimboeuf
On Fri, Aug 18, 2017 at 11:42:50AM +0200, Petr Mladek wrote: > On Thu 2017-08-17 12:01:33, Joe Lawrence wrote: > > On 08/17/2017 10:05 AM, Petr Mladek wrote: > > >> diff --git a/kernel/livepatch/shadow.c b/kernel/livepatch/shadow.c > > >> new file mode 100644 > > >> index

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-18 Thread Josh Poimboeuf
On Fri, Aug 18, 2017 at 11:42:50AM +0200, Petr Mladek wrote: > On Thu 2017-08-17 12:01:33, Joe Lawrence wrote: > > On 08/17/2017 10:05 AM, Petr Mladek wrote: > > >> diff --git a/kernel/livepatch/shadow.c b/kernel/livepatch/shadow.c > > >> new file mode 100644 > > >> index

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-18 Thread Petr Mladek
On Fri 2017-08-18 09:46:08, Joe Lawrence wrote: > On 08/17/2017 10:05 AM, Petr Mladek wrote: > > On Mon 2017-08-14 16:02:43, Joe Lawrence wrote: > >> [ ... snip ... ] > >> diff --git a/samples/livepatch/livepatch-shadow-fix1.c > >> b/samples/livepatch/livepatch-shadow-fix1.c > >> new file mode

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-18 Thread Petr Mladek
On Fri 2017-08-18 09:46:08, Joe Lawrence wrote: > On 08/17/2017 10:05 AM, Petr Mladek wrote: > > On Mon 2017-08-14 16:02:43, Joe Lawrence wrote: > >> [ ... snip ... ] > >> diff --git a/samples/livepatch/livepatch-shadow-fix1.c > >> b/samples/livepatch/livepatch-shadow-fix1.c > >> new file mode

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-18 Thread Nicolai Stange
Joe Lawrence writes: > On 08/18/2017 10:04 AM, Petr Mladek wrote: >> On Fri 2017-08-18 15:44:29, Nicolai Stange wrote: >>> Joe Lawrence writes: >>> >>> + +/** + * klp_shadow_get() - retrieve a shadow variable data pointer +

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-18 Thread Nicolai Stange
Joe Lawrence writes: > On 08/18/2017 10:04 AM, Petr Mladek wrote: >> On Fri 2017-08-18 15:44:29, Nicolai Stange wrote: >>> Joe Lawrence writes: >>> >>> + +/** + * klp_shadow_get() - retrieve a shadow variable data pointer + * @obj: pointer to parent object + * @id:

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-18 Thread Joe Lawrence
On 08/18/2017 10:04 AM, Petr Mladek wrote: > On Fri 2017-08-18 15:44:29, Nicolai Stange wrote: >> Joe Lawrence writes: >> >> >>> + >>> +/** >>> + * klp_shadow_get() - retrieve a shadow variable data pointer >>> + * @obj: pointer to parent object >>> + * @id:

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-18 Thread Joe Lawrence
On 08/18/2017 10:04 AM, Petr Mladek wrote: > On Fri 2017-08-18 15:44:29, Nicolai Stange wrote: >> Joe Lawrence writes: >> >> >>> + >>> +/** >>> + * klp_shadow_get() - retrieve a shadow variable data pointer >>> + * @obj: pointer to parent object >>> + * @id:data identifier >>> + *

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-18 Thread Petr Mladek
On Fri 2017-08-18 15:44:29, Nicolai Stange wrote: > Joe Lawrence writes: > > > > + > > +/** > > + * klp_shadow_get() - retrieve a shadow variable data pointer > > + * @obj: pointer to parent object > > + * @id:data identifier > > + * > > + * Return: the

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-18 Thread Petr Mladek
On Fri 2017-08-18 15:44:29, Nicolai Stange wrote: > Joe Lawrence writes: > > > > + > > +/** > > + * klp_shadow_get() - retrieve a shadow variable data pointer > > + * @obj: pointer to parent object > > + * @id:data identifier > > + * > > + * Return: the shadow variable data

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-18 Thread Joe Lawrence
On 08/17/2017 10:05 AM, Petr Mladek wrote: > On Mon 2017-08-14 16:02:43, Joe Lawrence wrote: >> [ ... snip ... ] >> diff --git a/samples/livepatch/livepatch-shadow-fix1.c >> b/samples/livepatch/livepatch-shadow-fix1.c >> new file mode 100644 >> index ..5acc838463d1 >> --- /dev/null >>

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-18 Thread Joe Lawrence
On 08/17/2017 10:05 AM, Petr Mladek wrote: > On Mon 2017-08-14 16:02:43, Joe Lawrence wrote: >> [ ... snip ... ] >> diff --git a/samples/livepatch/livepatch-shadow-fix1.c >> b/samples/livepatch/livepatch-shadow-fix1.c >> new file mode 100644 >> index ..5acc838463d1 >> --- /dev/null >>

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-18 Thread Nicolai Stange
Joe Lawrence writes: > + > +/** > + * klp_shadow_get() - retrieve a shadow variable data pointer > + * @obj: pointer to parent object > + * @id: data identifier > + * > + * Return: the shadow variable data element, NULL on failure. > + */ > +void

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-18 Thread Nicolai Stange
Joe Lawrence writes: > + > +/** > + * klp_shadow_get() - retrieve a shadow variable data pointer > + * @obj: pointer to parent object > + * @id: data identifier > + * > + * Return: the shadow variable data element, NULL on failure. > + */ > +void *klp_shadow_get(void *obj,

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-18 Thread Petr Mladek
On Thu 2017-08-17 12:01:33, Joe Lawrence wrote: > On 08/17/2017 10:05 AM, Petr Mladek wrote: > >> diff --git a/kernel/livepatch/shadow.c b/kernel/livepatch/shadow.c > >> new file mode 100644 > >> index ..0ebd4b635e4f > >> --- /dev/null > >> +++ b/kernel/livepatch/shadow.c > >> +/** >

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-18 Thread Petr Mladek
On Thu 2017-08-17 12:01:33, Joe Lawrence wrote: > On 08/17/2017 10:05 AM, Petr Mladek wrote: > >> diff --git a/kernel/livepatch/shadow.c b/kernel/livepatch/shadow.c > >> new file mode 100644 > >> index ..0ebd4b635e4f > >> --- /dev/null > >> +++ b/kernel/livepatch/shadow.c > >> +/** >

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-17 Thread Josh Poimboeuf
On Thu, Aug 17, 2017 at 12:01:33PM -0400, Joe Lawrence wrote: > Without a good real-world example, you've convinced me that > klp_shadow_update_or_attach() could be dropped. I think this will also > simplify the requirements of a shared __klp_shadow_get_or_attach() like > you sketched out

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-17 Thread Josh Poimboeuf
On Thu, Aug 17, 2017 at 12:01:33PM -0400, Joe Lawrence wrote: > Without a good real-world example, you've convinced me that > klp_shadow_update_or_attach() could be dropped. I think this will also > simplify the requirements of a shared __klp_shadow_get_or_attach() like > you sketched out

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-17 Thread Joe Lawrence
On 08/17/2017 10:05 AM, Petr Mladek wrote: > On Mon 2017-08-14 16:02:43, Joe Lawrence wrote: >> Add exported API for livepatch modules: >> >> klp_shadow_get() >> klp_shadow_attach() >> klp_shadow_get_or_attach() >> klp_shadow_update_or_attach() >> klp_shadow_detach() >>

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-17 Thread Joe Lawrence
On 08/17/2017 10:05 AM, Petr Mladek wrote: > On Mon 2017-08-14 16:02:43, Joe Lawrence wrote: >> Add exported API for livepatch modules: >> >> klp_shadow_get() >> klp_shadow_attach() >> klp_shadow_get_or_attach() >> klp_shadow_update_or_attach() >> klp_shadow_detach() >>

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-17 Thread Petr Mladek
On Mon 2017-08-14 16:02:43, Joe Lawrence wrote: > Add exported API for livepatch modules: > > klp_shadow_get() > klp_shadow_attach() > klp_shadow_get_or_attach() > klp_shadow_update_or_attach() > klp_shadow_detach() > klp_shadow_detach_all() > > that implement "shadow" variables,

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-17 Thread Petr Mladek
On Mon 2017-08-14 16:02:43, Joe Lawrence wrote: > Add exported API for livepatch modules: > > klp_shadow_get() > klp_shadow_attach() > klp_shadow_get_or_attach() > klp_shadow_update_or_attach() > klp_shadow_detach() > klp_shadow_detach_all() > > that implement "shadow" variables,

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-16 Thread Joe Lawrence
On 08/16/2017 08:43 AM, Miroslav Benes wrote: > >> [ ... snip ... ] > > There is a comment above about locking and we do not take the spinlock > here. That could surprise someone. So I'd keep only klp_shadow_add() > comment, because there it is strictly needed. It depends on the context in >

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-16 Thread Joe Lawrence
On 08/16/2017 08:43 AM, Miroslav Benes wrote: > >> [ ... snip ... ] > > There is a comment above about locking and we do not take the spinlock > here. That could surprise someone. So I'd keep only klp_shadow_add() > comment, because there it is strictly needed. It depends on the context in >

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-16 Thread Miroslav Benes
> +/* > + * klp_shadow_set() - initialize a shadow variable > + * @shadow: shadow variable to initialize > + * @obj: pointer to parent object > + * @id: data identifier > + * @data:pointer to data to attach to parent > + * @size:size of attached data > + * > + * Callers

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-16 Thread Miroslav Benes
> +/* > + * klp_shadow_set() - initialize a shadow variable > + * @shadow: shadow variable to initialize > + * @obj: pointer to parent object > + * @id: data identifier > + * @data:pointer to data to attach to parent > + * @size:size of attached data > + * > + * Callers

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-15 Thread Josh Poimboeuf
On Mon, Aug 14, 2017 at 04:02:43PM -0400, Joe Lawrence wrote: > Add exported API for livepatch modules: > > klp_shadow_get() > klp_shadow_attach() > klp_shadow_get_or_attach() > klp_shadow_update_or_attach() > klp_shadow_detach() > klp_shadow_detach_all() > > that implement "shadow"

Re: [PATCH v4] livepatch: introduce shadow variable API

2017-08-15 Thread Josh Poimboeuf
On Mon, Aug 14, 2017 at 04:02:43PM -0400, Joe Lawrence wrote: > Add exported API for livepatch modules: > > klp_shadow_get() > klp_shadow_attach() > klp_shadow_get_or_attach() > klp_shadow_update_or_attach() > klp_shadow_detach() > klp_shadow_detach_all() > > that implement "shadow"