Re: livepatch: reuse module loader code to write relocations

2015-12-01 Thread Jessica Yu
+++ Jessica Yu [30/11/15 23:21 -0500]: Reuse module loader code to write relocations, thereby eliminating the need for architecture specific relocation code in livepatch. Namely, we reuse apply_relocate_add() in the module loader to write relocations instead of duplicating functionality in

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

2015-11-30 Thread Jessica Yu
ed to module loader. Signed-off-by: Jessica Yu --- arch/x86/include/asm/livepatch.h | 2 - arch/x86/kernel/Makefile | 1 - arch/x86/kernel/livepatch.c | 91 -- include/linux/livepatch.h| 30 ++--- include/linux/module.h

[RFC PATCH v2 3/6] module: s390: keep mod_arch_specific for livepatch modules

2015-11-30 Thread Jessica Yu
) is called in do_init_module(). Keep a reference to syminfo if the module is a livepatch module and free the structures in module_arch_cleanup(). If the module isn't a livepatch module, we free the structures in module_arch_freeing_init() as usual. Signed-off-by: Jessica Yu --- arch/s390/k

[RFC PATCH v2 5/6] samples: livepatch: init reloc section array and mark as klp module

2015-11-30 Thread Jessica Yu
Create the array of klp relocation sections in the sample klp_object (even if the array is empty in this case). In addition, mark the module as a livepatch module so that the module loader can appropriately identify and initialize it. Signed-off-by: Jessica Yu --- samples/livepatch/livepatch

[RFC PATCH v2 2/6] module: preserve Elf information for livepatch modules

2015-11-30 Thread Jessica Yu
cannot be determined at compile time (for example, when kaslr is enabled). Livepatch modules must preserve Elf information such as section indices in order to apply the remaining relocation sections at the appropriate time (i.e. when the target module loads). Signed-off-by: Jessica Yu --- include

[RFC PATCH v2 6/6] Documentation: livepatch: outline the Elf format of a livepatch module

2015-11-30 Thread Jessica Yu
Document the special Elf sections and constants livepatch modules use. Signed-off-by: Jessica Yu --- Documentation/livepatch/patch-module-format.txt | 117 1 file changed, 117 insertions(+) create mode 100644 Documentation/livepatch/patch-module-format.txt diff --git

[RFC PATCH v2 1/6] Elf: add livepatch-specific Elf constants

2015-11-30 Thread Jessica Yu
STB_LIVEPATCH_EXT symbol bind marks the scope of certain livepatch symbols, so that livepatch can appropriately resolve them. Signed-off-by: Jessica Yu --- include/uapi/linux/elf.h | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/include/uapi/linux/elf.h b

[RFC PATCH v2 0/6] (mostly) Arch-independent livepatch

2015-11-30 Thread Jessica Yu
n of livepatch modules - s390: remove redundant vfree() and preserve mod_arch_specific if livepatch module - Use array format instead of a linked list for klp_reloc_secs - Add new documentation describing the format of a livepatch module in Documentation/livepatch Jessica Yu (6): Elf

Re: module: save load_info for livepatch modules

2015-11-13 Thread Jessica Yu
+++ Miroslav Benes [13/11/15 13:56 +0100]: On Fri, 13 Nov 2015, Miroslav Benes wrote: I agree this seems like the best approach. So if we preserve mod_arch_syminfo (in case of s390) we should free it not in module_finalize, but somewhere in free_module... where module_arch_cleanup() is called..

Re: module: save load_info for livepatch modules

2015-11-13 Thread Jessica Yu
+++ Miroslav Benes [13/11/15 13:46 +0100]: On Fri, 13 Nov 2015, Miroslav Benes wrote: As for load_info, I don't have a strong opinion whether to keep it for all modules or for livepatch modules only. I have. We cannot keep it, even for livepatch modules... In info->hdr there is a temporary c

Re: module: save load_info for livepatch modules

2015-11-13 Thread Jessica Yu
+++ Petr Mladek [12/11/15 11:05 +0100]: On Wed 2015-11-11 23:44:08, Jessica Yu wrote: +++ Petr Mladek [11/11/15 15:31 +0100]: >On Mon 2015-11-09 23:45:52, Jessica Yu wrote: >>diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c >>index 6e53441..087a8c7 100644 >>-

Re: livepatch: reuse module loader code to write relocations

2015-11-12 Thread Jessica Yu
+++ Josh Poimboeuf [12/11/15 14:32 -0600]: On Thu, Nov 12, 2015 at 03:22:44PM -0500, Jessica Yu wrote: Looking into this more, I think we do need one __klp_rela section per function being patched. Each rela section is linked to the section to which the relocations apply via the rela section&#

Re: elf: add livepatch-specific elf constants

2015-11-12 Thread Jessica Yu
+++ Josh Poimboeuf [12/11/15 09:45 -0600]: On Mon, Nov 09, 2015 at 11:45:51PM -0500, Jessica Yu wrote: Add livepatch elf reloc section flag, livepatch symbol bind and section index Signed-off-by: Jessica Yu --- include/uapi/linux/elf.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a

Re: module: save load_info for livepatch modules

2015-11-12 Thread Jessica Yu
+++ Miroslav Benes [12/11/15 15:19 +0100]: On Thu, 12 Nov 2015, Petr Mladek wrote: On Wed 2015-11-11 23:44:08, Jessica Yu wrote: > +++ Petr Mladek [11/11/15 15:31 +0100]: > >On Mon 2015-11-09 23:45:52, Jessica Yu wrote: > >>diff --git a/kernel/livepatch/core.c b/kerne

Re: module: save load_info for livepatch modules

2015-11-12 Thread Jessica Yu
+++ Miroslav Benes [12/11/15 14:22 +0100]: On Thu, 12 Nov 2015, Petr Mladek wrote: On Thu 2015-11-12 00:33:12, Jessica Yu wrote: > +++ Miroslav Benes [11/11/15 15:17 +0100]: > >On Mon, 9 Nov 2015, Jessica Yu wrote: > > > >>diff --git a/include/linux/module.h b/include/

Re: module: save load_info for livepatch modules

2015-11-12 Thread Jessica Yu
+++ Josh Poimboeuf [12/11/15 11:05 -0600]: On Thu, Nov 12, 2015 at 04:03:45PM +0100, Petr Mladek wrote: On Thu 2015-11-12 14:22:28, Miroslav Benes wrote: > On Thu, 12 Nov 2015, Petr Mladek wrote: > > > >Maybe I am missing something but isn't it necessary to call vfree() on > > > >info somewhere

Re: livepatch: reuse module loader code to write relocations

2015-11-12 Thread Jessica Yu
+++ Jessica Yu [12/11/15 14:14 -0500]: +++ Miroslav Benes [12/11/15 16:27 +0100]: On Wed, 11 Nov 2015, Jessica Yu wrote: +++ Miroslav Benes [11/11/15 15:30 +0100]: On Mon, 9 Nov 2015, Jessica Yu wrote: So I guess we don't need klp_reloc anymore. Yes, that's correct. I am noticin

Re: livepatch: reuse module loader code to write relocations

2015-11-12 Thread Jessica Yu
+++ Josh Poimboeuf [12/11/15 11:40 -0600]: On Thu, Nov 12, 2015 at 04:27:01PM +0100, Miroslav Benes wrote: On Wed, 11 Nov 2015, Jessica Yu wrote: > +++ Miroslav Benes [11/11/15 15:30 +0100]: > > On Mon, 9 Nov 2015, Jessica Yu wrote: > > > > So I guess we don't need

Re: livepatch: reuse module loader code to write relocations

2015-11-12 Thread Jessica Yu
+++ Miroslav Benes [12/11/15 16:27 +0100]: On Wed, 11 Nov 2015, Jessica Yu wrote: +++ Miroslav Benes [11/11/15 15:30 +0100]: > On Mon, 9 Nov 2015, Jessica Yu wrote: > > So I guess we don't need klp_reloc anymore. Yes, that's correct. I am noticing just now that I f

Re: samples: livepatch: init reloc list and mark as klp module

2015-11-11 Thread Jessica Yu
+++ Petr Mladek [11/11/15 16:42 +0100]: On Mon 2015-11-09 23:45:54, Jessica Yu wrote: Intialize the list of relocation sections in the sample klp_object (even if the list will be empty in this case). Also mark module as a livepatch module so that the module loader can appropriately initialize

Re: module: save load_info for livepatch modules

2015-11-11 Thread Jessica Yu
+++ Miroslav Benes [11/11/15 15:17 +0100]: On Mon, 9 Nov 2015, Jessica Yu wrote: diff --git a/include/linux/module.h b/include/linux/module.h index 3a19c79..c8680b1 100644 --- a/include/linux/module.h +++ b/include/linux/module.h [...] +#ifdef CONFIG_LIVEPATCH +extern void

Re: module: save load_info for livepatch modules

2015-11-11 Thread Jessica Yu
+++ Petr Mladek [11/11/15 15:31 +0100]: On Mon 2015-11-09 23:45:52, Jessica Yu wrote: In livepatch modules, preserve section, symbol, string information from the load_info struct in the module loader. This information is used to patch modules that are not loaded in memory yet; specifically it

Re: livepatch: reuse module loader code to write relocations

2015-11-11 Thread Jessica Yu
+++ Miroslav Benes [11/11/15 15:30 +0100]: On Mon, 9 Nov 2015, Jessica Yu wrote: diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h index 31db7a0..601e892 100644 --- a/include/linux/livepatch.h +++ b/include/linux/livepatch.h @@ -85,7 +85,7 @@ struct klp_reloc { /** * struct

Re: livepatch: reuse module loader code to write relocations

2015-11-11 Thread Jessica Yu
+++ Petr Mladek [11/11/15 16:22 +0100]: On Mon 2015-11-09 23:45:53, Jessica Yu wrote: Reuse module loader code to write relocations, thereby eliminating the need for architecture specific code in livepatch. Namely, we reuse apply_relocate_add() in the module loader to write relocs instead of

Re: samples: livepatch: init reloc list and mark as klp module

2015-11-10 Thread Jessica Yu
+++ Josh Poimboeuf [10/11/15 07:50 -0600]: On Tue, Nov 10, 2015 at 09:15:54AM +0100, Jiri Slaby wrote: On 11/10/2015, 05:45 AM, Jessica Yu wrote: > Intialize the list of relocation sections in the sample > klp_object (even if the list will be empty in this case). > Also mark mo

[RFC PATCH 0/5] Arch-independent livepatch

2015-11-09 Thread Jessica Yu
es these symbols (and does not attempt to resolve them). Finally, the STB_LIVEPATCH_EXT symbol bind marks the scope of certain livepatch symbols, so that livepatch can find the symbol in the right place. These ELF constants were selected from OS-specific ranges according to the definitions f

[RFC PATCH 4/5] samples: livepatch: init reloc list and mark as klp module

2015-11-09 Thread Jessica Yu
Intialize the list of relocation sections in the sample klp_object (even if the list will be empty in this case). Also mark module as a livepatch module so that the module loader can appropriately initialize it. Signed-off-by: Jessica Yu --- samples/livepatch/livepatch-sample.c | 2 ++ 1 file

[RFC PATCH 5/5] livepatch: x86: remove unused relocation code

2015-11-09 Thread Jessica Yu
Architecture-specific relocation code no longer needed, since symbol resolution and relocation work will be offloaded to module loader. Signed-off-by: Jessica Yu --- arch/x86/kernel/Makefile| 1 - arch/x86/kernel/livepatch.c | 91 - 2 files

[RFC PATCH 2/5] module: save load_info for livepatch modules

2015-11-09 Thread Jessica Yu
. Signed-off-by: Jessica Yu --- include/linux/module.h | 25 + kernel/livepatch/core.c | 17 + kernel/module.c | 36 ++-- 3 files changed, 64 insertions(+), 14 deletions(-) diff --git a/include/linux/module.h b/include

[RFC PATCH 1/5] elf: add livepatch-specific elf constants

2015-11-09 Thread Jessica Yu
Add livepatch elf reloc section flag, livepatch symbol bind and section index Signed-off-by: Jessica Yu --- include/uapi/linux/elf.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h index 71e1d0e..967ce1b 100644 --- a/include/uapi/linux

[RFC PATCH 3/5] livepatch: reuse module loader code to write relocations

2015-11-09 Thread Jessica Yu
ation sections, remaining SHN_LIVEPATCH symbols referenced by relocs are resolved and then apply_relocate_add() is called to apply those relocations. Signed-off-by: Jessica Yu --- include/linux/livepatch.h | 11 -- include/linux/module.h| 6 kernel/livepatch/core.c

Re: livepatch: old_name.number scheme in livepatch sysfs directory

2015-11-02 Thread Jessica Yu
example of this issue is documented here: https://github.com/dynup/kpatch/issues/493 Signed-off-by: Chris J Arges Thanks Chris. Verified that the patch fixes the panic caused by multiple functions with the same name and object. Acked-by: Jessica Yu -- To unsubscribe from this list: send

Re: livepatch: old_name@old_addr scheme in livepatch sysfs directory

2015-11-02 Thread Jessica Yu
+++ Jiri Kosina [01/11/15 10:07 +0100]: On Sat, 31 Oct 2015, Chris J Arges wrote: Makes sense to me. Is there a reason why the sysfs entries are visible to non-root users? Well, kptr_restrict applies only to values printed using '%pK'. So if the sysfs handler is using other printk() format st

Re: livepatch: old_name@old_addr scheme in livepatch sysfs directory

2015-10-31 Thread Jessica Yu
+++ Chris J Arges [30/10/15 22:44 -0500]: The following directory structure will allow for cases when the same function name exists in a single object. /sys/kernel/livepatch/// Hi Chris, thanks for the patch. I think the last time this issue was discussed, the conclusion was that conca

[PATCH v2 2/4] Staging: lustre: linux-module: remove unnecessary spaces

2014-07-27 Thread Jessica Yu
Remove extraneous space after open paren and before close paren. Signed-off-by: Jessica Yu --- drivers/staging/lustre/lustre/libcfs/linux/linux-module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers

[PATCH v2 3/4] Staging: lustre: linux-module: remove extraneous parens

2014-07-27 Thread Jessica Yu
Remove unnecessary parens from return statements, return is not a function Signed-off-by: Jessica Yu --- drivers/staging/lustre/lustre/libcfs/linux/linux-module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b

[PATCH v2 4/4] Staging: lustre: linux-module: add const modifier to file_operations

2014-07-27 Thread Jessica Yu
Add the const modifier to the file_operations struct, since it is normally const. Signed-off-by: Jessica Yu --- drivers/staging/lustre/lustre/libcfs/linux/linux-module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c

[PATCH v2 1/4] Staging: lustre: linux-module: fix pointer style issue

2014-07-27 Thread Jessica Yu
Fix pointer code style (foo * bar -> foo *bar) Signed-off-by: Jessica Yu --- drivers/staging/lustre/lustre/libcfs/linux/linux-module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lus

[PATCH v2 0/4] Staging: lustre: linux-module: fix style issues

2014-07-27 Thread Jessica Yu
I revisited my original patch and realized that it should be split into separate parts. Jessica Yu (4): Staging: lustre: linux-module: fix pointer style issue Staging: lustre: linux-module: remove unnecessary spaces Staging: lustre: linux-module: remove extraneous parens Staging: lustre

[PATCH] Staging: lustre: linux-module: fix coding style issues

2014-07-27 Thread Jessica Yu
* bar -> foo *bar) Signed-off-by: Jessica Yu --- drivers/staging/lustre/lustre/libcfs/linux/linux-module.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre/libcfs/linux/li

[PATCH] Staging: lustre: linux-module: fix coding style issues.

2014-07-27 Thread Jessica Yu
Fixed some coding style issues. Signed-off-by: Jessica Yu --- drivers/staging/lustre/lustre/libcfs/linux/linux-module.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre

[PATCH] Staging: lustre: linux-module: fix coding style issues.

2014-07-27 Thread Jessica Yu
Fixed some coding style issues. Signed-off-by: Jessica Yu --- drivers/staging/lustre/lustre/libcfs/linux/linux-module.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre

<    2   3   4   5   6   7