Re: [PATCH v2 1/2] livepatch: Initialize shadow variables safely by a custom callback

2018-04-11 Thread Miroslav Benes
On Thu, 5 Apr 2018, Petr Mladek wrote: > The existing API allows to pass a sample data to initialize the shadow > data. It works well when the data are position independent. But it fails > miserably when we need to set a pointer to the shadow structure itself. > > Unfortunately, we might need to

Re: [PATCH v2 1/2] livepatch: Initialize shadow variables safely by a custom callback

2018-04-10 Thread Petr Mladek
On Fri 2018-04-06 17:34:20, Josh Poimboeuf wrote: > On Thu, Apr 05, 2018 at 02:23:14PM +0200, Petr Mladek wrote: > > @@ -150,6 +149,23 @@ static void *__klp_shadow_get_or_alloc(void *obj, > > unsigned long id, void *data, > > goto exists; > > } > > > > + new_shadow->obj = obj;

Re: [PATCH v2 1/2] livepatch: Initialize shadow variables safely by a custom callback

2018-04-06 Thread Josh Poimboeuf
On Thu, Apr 05, 2018 at 02:23:14PM +0200, Petr Mladek wrote: > @@ -150,6 +149,23 @@ static void *__klp_shadow_get_or_alloc(void *obj, > unsigned long id, void *data, > goto exists; > } > > + new_shadow->obj = obj; > + new_shadow->id = id; > + > + if (ctor) { > +

[PATCH v2 1/2] livepatch: Initialize shadow variables safely by a custom callback

2018-04-05 Thread Petr Mladek
The existing API allows to pass a sample data to initialize the shadow data. It works well when the data are position independent. But it fails miserably when we need to set a pointer to the shadow structure itself. Unfortunately, we might need to initialize the pointer surprisingly often because