[PATCH v6 4/5] livepatch: reuse module loader code to write relocations

2016-03-22 Thread Jessica Yu
Reuse module loader code to write relocations, thereby eliminating the need for architecture specific relocation code in livepatch. Specifically, reuse the apply_relocate_add() function in the module loader to write relocations instead of duplicating functionality in livepatch's arch-dependent klp_

Re: livepatch: reuse module loader code to write relocations

2016-03-22 Thread Jessica Yu
+++ Jiri Kosina [21/03/16 23:02 +0100]: On Mon, 21 Mar 2016, Josh Poimboeuf wrote: According to my test that still results in the literal value of "(64 - 8)". Alright. But we should be able to special-case it with a two #if checks on the __SIZEOF_LONG__ value and BUILD_BUG_ON() when __SIZEOF_

Re: livepatch: reuse module loader code to write relocations

2016-03-21 Thread Jiri Kosina
On Mon, 21 Mar 2016, Josh Poimboeuf wrote: > According to my test that still results in the literal value of > "(64 - 8)". Alright. But we should be able to special-case it with a two #if checks on the __SIZEOF_LONG__ value and BUILD_BUG_ON() when __SIZEOF_LONG__ is not of one of the ususal siz

Re: livepatch: reuse module loader code to write relocations

2016-03-21 Thread Josh Poimboeuf
On Mon, Mar 21, 2016 at 10:16:17PM +0100, Jiri Kosina wrote: > On Mon, 21 Mar 2016, Jessica Yu wrote: > > > Yes, this is a concern and I'm not sure what the best way to fix it > > is. If both MODULE_NAME_LEN and KSYM_NAME_LEN were straight up > > constants, then I think Josh's stringify approach w

Re: livepatch: reuse module loader code to write relocations

2016-03-21 Thread Jiri Kosina
On Mon, 21 Mar 2016, Jessica Yu wrote: > Yes, this is a concern and I'm not sure what the best way to fix it > is. If both MODULE_NAME_LEN and KSYM_NAME_LEN were straight up > constants, then I think Josh's stringify approach would have worked > perfectly. However since MODULE_NAME_LEN translates

Re: livepatch: reuse module loader code to write relocations

2016-03-21 Thread Josh Poimboeuf
On Mon, Mar 21, 2016 at 03:18:32PM -0400, Jessica Yu wrote: > +++ Miroslav Benes [21/03/16 14:55 +0100]: > >On Wed, 16 Mar 2016, Jessica Yu wrote: > > > >[...] > > > >>+struct klp_buf { > >>+ char symname[KSYM_SYMBOL_LEN]; > > > >I think it is better to make this KSYM_NAME_LEN. KSYM_SYMBOL_LEN lo

Re: livepatch: reuse module loader code to write relocations

2016-03-21 Thread Jessica Yu
+++ Miroslav Benes [21/03/16 14:55 +0100]: On Wed, 16 Mar 2016, Jessica Yu wrote: [...] +struct klp_buf { + char symname[KSYM_SYMBOL_LEN]; I think it is better to make this KSYM_NAME_LEN. KSYM_SYMBOL_LEN looks like something different and KSYM_NAME_LEN is 128 which you reference below.

Re: livepatch: reuse module loader code to write relocations

2016-03-21 Thread Jessica Yu
+++ Josh Poimboeuf [21/03/16 12:36 -0500]: On Mon, Mar 21, 2016 at 11:46:51AM -0500, Josh Poimboeuf wrote: On Mon, Mar 21, 2016 at 05:31:57PM +0100, Petr Mladek wrote: > > diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c > > index 780f00c..2aa20fa 100644 > > --- a/kernel/livepatch/

Re: [PATCH v5 4/6] livepatch: reuse module loader code to write relocations

2016-03-21 Thread Josh Poimboeuf
On Mon, Mar 21, 2016 at 11:46:51AM -0500, Josh Poimboeuf wrote: > On Mon, Mar 21, 2016 at 05:31:57PM +0100, Petr Mladek wrote: > > > diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c > > > index 780f00c..2aa20fa 100644 > > > --- a/kernel/livepatch/core.c > > > +++ b/kernel/livepatch/co

Re: [PATCH v5 4/6] livepatch: reuse module loader code to write relocations

2016-03-21 Thread Josh Poimboeuf
On Mon, Mar 21, 2016 at 05:31:57PM +0100, Petr Mladek wrote: > > diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c > > index 780f00c..2aa20fa 100644 > > --- a/kernel/livepatch/core.c > > +++ b/kernel/livepatch/core.c > > +static int klp_resolve_symbols(Elf_Shdr *relasec, struct module

Re: [PATCH v5 4/6] livepatch: reuse module loader code to write relocations

2016-03-21 Thread Petr Mladek
On Wed 2016-03-16 15:47:06, Jessica Yu wrote: > Reuse module loader code to write relocations, thereby eliminating the need > for architecture specific relocation code in livepatch. Specifically, reuse > the apply_relocate_add() function in the module loader to write relocations > instead of duplic

Re: [PATCH v5 4/6] livepatch: reuse module loader code to write relocations

2016-03-21 Thread Josh Poimboeuf
On Wed, Mar 16, 2016 at 03:47:06PM -0400, Jessica Yu wrote: > Reuse module loader code to write relocations, thereby eliminating the need > for architecture specific relocation code in livepatch. Specifically, reuse > the apply_relocate_add() function in the module loader to write relocations > ins

Re: [PATCH v5 4/6] livepatch: reuse module loader code to write relocations

2016-03-21 Thread Miroslav Benes
On Wed, 16 Mar 2016, Jessica Yu wrote: [...] > +struct klp_buf { > + char symname[KSYM_SYMBOL_LEN]; I think it is better to make this KSYM_NAME_LEN. KSYM_SYMBOL_LEN looks like something different and KSYM_NAME_LEN is 128 which you reference below. > + char objname[MODULE_NAME_LEN]; >

[PATCH v5 4/6] livepatch: reuse module loader code to write relocations

2016-03-19 Thread Jessica Yu
Reuse module loader code to write relocations, thereby eliminating the need for architecture specific relocation code in livepatch. Specifically, reuse the apply_relocate_add() function in the module loader to write relocations instead of duplicating functionality in livepatch's arch-dependent klp_

Re: livepatch: reuse module loader code to write relocations

2016-02-09 Thread Jessica Yu
+++ Petr Mladek [09/02/16 15:01 +0100]: On Wed 2016-02-03 20:11:09, Jessica Yu wrote: Reuse module loader code to write relocations, thereby eliminating the need for architecture specific relocation code in livepatch. Specifically, reuse the apply_relocate_add() function in the module loader to

Re: livepatch: reuse module loader code to write relocations

2016-02-09 Thread Jessica Yu
+++ Josh Poimboeuf [08/02/16 14:26 -0600]: On Wed, Feb 03, 2016 at 08:11:09PM -0500, Jessica Yu wrote: Reuse module loader code to write relocations, thereby eliminating the need for architecture specific relocation code in livepatch. Specifically, reuse the apply_relocate_add() function in the

Re: [RFC PATCH v4 4/6] livepatch: reuse module loader code to write relocations

2016-02-09 Thread Miroslav Benes
On Tue, 9 Feb 2016, Petr Mladek wrote: > On Wed 2016-02-03 20:11:09, Jessica Yu wrote: > > Reuse module loader code to write relocations, thereby eliminating the need > > for architecture specific relocation code in livepatch. Specifically, reuse > > the apply_relocate_add() function in the module

Re: [RFC PATCH v4 4/6] livepatch: reuse module loader code to write relocations

2016-02-09 Thread Petr Mladek
On Wed 2016-02-03 20:11:09, Jessica Yu wrote: > Reuse module loader code to write relocations, thereby eliminating the need > for architecture specific relocation code in livepatch. Specifically, reuse > the apply_relocate_add() function in the module loader to write relocations > instead of duplic

Re: [RFC PATCH v4 4/6] livepatch: reuse module loader code to write relocations

2016-02-09 Thread Miroslav Benes
> > +/* .klp.sym.[objname].symbol_name,sympos */ > > +static int klp_get_sym_objname(char *s, char **result) > > +{ > > Do we need result to be a double-pointer? If I am not mistaken just 'char > *result' could be sufficient. You check the return value, so result could > be NULL or objname as f

Re: [RFC PATCH v4 4/6] livepatch: reuse module loader code to write relocations

2016-02-08 Thread Josh Poimboeuf
On Wed, Feb 03, 2016 at 08:11:09PM -0500, Jessica Yu wrote: > Reuse module loader code to write relocations, thereby eliminating the need > for architecture specific relocation code in livepatch. Specifically, reuse > the apply_relocate_add() function in the module loader to write relocations > ins

Re: [RFC PATCH v4 4/6] livepatch: reuse module loader code to write relocations

2016-02-08 Thread Miroslav Benes
Hi, several minor things and nits below. Otherwise it is ok. On Wed, 3 Feb 2016, Jessica Yu wrote: > + * Check if a livepatch symbol is formatted properly. > + * > + * See Documentation/livepatch/module-elf-format.txt for a > + * detailed outline of requirements. > + */ > +static int klp_check_

[RFC PATCH v4 4/6] livepatch: reuse module loader code to write relocations

2016-02-03 Thread Jessica Yu
Reuse module loader code to write relocations, thereby eliminating the need for architecture specific relocation code in livepatch. Specifically, reuse the apply_relocate_add() function in the module loader to write relocations instead of duplicating functionality in livepatch's arch-dependent klp_