Re: [PATCH 2/2] powerpc/module_64: Fix "expected nop" error on module re-patching

2023-01-27 Thread Miroslav Benes
the warning and the instruction write. > > Signed-off-by: Josh Poimboeuf Reviewed-by: Miroslav Benes M

Re: [PATCH 1/2] powerpc/module_64: Improve restore_r2() return semantics

2023-01-27 Thread Miroslav Benes
On Tue, 24 Jan 2023, Josh Poimboeuf wrote: > restore_r2() returns 1 on success, which is surprising for a non-boolean > function. Change it to return 0 on success and -errno on error to match > kernel coding convention. > > Signed-off-by: Josh Poimboeuf Reviewed-by: Miroslav Benes M

Re: [PATCH v6] livepatch: Clear relocation targets on a module removal

2022-12-12 Thread Miroslav Benes
> > Petr has commented on the code aspects. I will just add that s390x was not > > dealt with at the time because there was no live patching support for > > s390x back then if I remember correctly and my notes do not lie. The same > > applies to powerpc32. I think that both should be fixed as well

Re: [PATCH v6] livepatch: Clear relocation targets on a module removal

2022-12-09 Thread Miroslav Benes
Hi, first thank you for taking over and I also appologize for not replying much sooner. On Thu, 1 Sep 2022, Song Liu wrote: > From: Miroslav Benes > > Josh reported a bug: > > When the object to be patched is a module, and that module is > rmmod'ed and reloaded

Re: [PATCH v6] livepatch: Clear relocation targets on a module removal

2022-12-09 Thread Miroslav Benes
> > > --- a/kernel/livepatch/core.c > > > +++ b/kernel/livepatch/core.c > > > @@ -316,6 +316,45 @@ int klp_apply_section_relocs(struct module *pmod, > > > Elf_Shdr *sechdrs, > > > return apply_relocate_add(sechdrs, strtab, symndx, secndx, pmod); > > > } > > > > > > +static void

Re: [PATCH] livepatch: Remove klp_arch_set_pc() and asm/livepatch.h

2022-03-29 Thread Miroslav Benes
only thing remaining in asm/livepatch.h > on x86 and s390, remove asm/livepatch.h > > livepatch.h remains on powerpc but its content is exclusively used > by powerpc specific code. > > Signed-off-by: Christophe Leroy Acked-by: Miroslav Benes M

Re: [RFC PATCH 1/3] objtool: Move common code to utils.c

2022-03-23 Thread Miroslav Benes
> +#define sym_for_each_insn(file, sym, insn) \ > + for (insn = find_insn(file, sym->sec, sym->offset); \ > + insn && >list != >insn_list && \ > + insn->sec == sym->sec &&\ > +

Re: [PATCH v2 0/5] Allocate module text and data separately

2022-02-09 Thread Miroslav Benes
On Thu, 27 Jan 2022, Christophe Leroy wrote: > This series allow architectures to request having modules data in > vmalloc area instead of module area. > > This is required on powerpc book3s/32 in order to set data non > executable, because it is not possible to set executability on page >

Re: [PATCH 6/7] modules: Add CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC

2022-01-27 Thread Miroslav Benes
> @@ -195,6 +208,9 @@ static void mod_tree_remove(struct module *mod) > { > __mod_tree_remove(>core_layout.mtn, _tree); > mod_tree_remove_init(mod); > +#ifdef CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC > + __mod_tree_remove(>core_layout.mtn, _data_tree); s/core_layout/data_layout/

Re: [PATCH v2 09/13] powerpc/ftrace: Implement CONFIG_DYNAMIC_FTRACE_WITH_ARGS

2021-12-22 Thread Miroslav Benes
On Mon, 20 Dec 2021, Christophe Leroy wrote: > Implement CONFIG_DYNAMIC_FTRACE_WITH_ARGS. It accelerates the call > of livepatching. > > Also note that powerpc being the last one to convert to > CONFIG_DYNAMIC_FTRACE_WITH_ARGS, it will now be possible to remove > klp_arch_set_pc() on all

Re: [PATCH v2 04/13] powerpc/ftrace: Add support for livepatch to PPC32

2021-12-22 Thread Miroslav Benes
On Mon, 20 Dec 2021, Christophe Leroy wrote: > PPC64 needs some special logic to properly set up the TOC. > See commit 85baa095497f ("powerpc/livepatch: Add live patching support > on ppc64le") for details. > > PPC32 doesn't have TOC so it doesn't need that logic, so adding > LIVEPATCH support

Re: [PATCH v2 01/13] livepatch: Fix build failure on 32 bits processors

2021-12-22 Thread Miroslav Benes
ight types instead of forcing 64 bits types. > > Fixes: 7c8e2bdd5f0d ("livepatch: Apply vmlinux-specific KLP relocations > early") > Signed-off-by: Christophe Leroy > Acked-by: Petr Mladek Acked-by: Miroslav Benes M

Re: [PATCH v1 0/5] Implement livepatch on PPC32

2021-11-01 Thread Miroslav Benes
Hi, On Thu, 28 Oct 2021, Christophe Leroy wrote: > This series implements livepatch on PPC32. > > This is largely copied from what's done on PPC64. > > Christophe Leroy (5): > livepatch: Fix build failure on 32 bits processors > powerpc/ftrace: No need to read LR from stack in _mcount() >

Re: [PATCH v5 1/2] ftrace: disable preemption when recursion locked

2021-10-26 Thread Miroslav Benes
Hi, > diff --git a/include/linux/trace_recursion.h b/include/linux/trace_recursion.h > index abe1a50..2bc1522 100644 > --- a/include/linux/trace_recursion.h > +++ b/include/linux/trace_recursion.h > @@ -135,6 +135,9 @@ static __always_inline int trace_get_context_bit(void) > # define

Re: [PATCH v3 1/2] ftrace: disable preemption between ftrace_test_recursion_trylock/unlock()

2021-10-14 Thread Miroslav Benes
node); > @@ -120,7 +122,6 @@ static void notrace klp_ftrace_handler(unsigned long ip, > klp_arch_set_pc(fregs, (unsigned long)func->new_func); > > unlock: > - preempt_enable_notrace(); > ftrace_test_recursion_unlock(bit); > } Acked-by: Miroslav Benes for the livepatch par

Re: [RESEND PATCH v2 1/2] ftrace: disable preemption between ftrace_test_recursion_trylock/unlock()

2021-10-13 Thread Miroslav Benes
> > Side note... the comment will eventually conflict with peterz's > > https://lore.kernel.org/all/20210929152429.125997...@infradead.org/. > > Steven, would you like to share your opinion on this patch? > > If klp_synchronize_transition() will be removed anyway, the comments > will be

Re: [RESEND PATCH v2 1/2] ftrace: disable preemption between ftrace_test_recursion_trylock/unlock()

2021-10-13 Thread Miroslav Benes
> diff --git a/include/linux/trace_recursion.h b/include/linux/trace_recursion.h > index a9f9c57..101e1fb 100644 > --- a/include/linux/trace_recursion.h > +++ b/include/linux/trace_recursion.h > @@ -208,13 +208,29 @@ static __always_inline void trace_clear_recursion(int > bit) > * Use this for

Re: [PATCH 1/2] ftrace: disable preemption on the testing of recursion

2021-10-12 Thread Miroslav Benes
> diff --git a/include/linux/trace_recursion.h b/include/linux/trace_recursion.h > index a9f9c57..805f9c4 100644 > --- a/include/linux/trace_recursion.h > +++ b/include/linux/trace_recursion.h > @@ -214,7 +214,14 @@ static __always_inline void trace_clear_recursion(int > bit) > static

Re: [PATCH 10/13] module: pass struct find_symbol_args to find_symbol

2021-02-03 Thread Miroslav Benes
mbol_args to find_symbol > > Simplify the calling convention by passing the find_symbol_args structure > to find_symbol instead of initializing it inside the function. > > Signed-off-by: Christoph Hellwig Reviewed-by: Miroslav Benes M

Re: [PATCH 10/13] module: pass struct find_symbol_args to find_symbol

2021-02-02 Thread Miroslav Benes
> void *__symbol_get(const char *symbol) > { > - struct module *owner; > - const struct kernel_symbol *sym; > + struct find_symbol_arg fsa = { > + .name = symbol, > + .gplok = true, > + .warn = true, > + }; > > preempt_disable(); >

Re: [PATCH 13/13] module: remove EXPORT_UNUSED_SYMBOL*

2021-02-02 Thread Miroslav Benes
On Tue, 2 Feb 2021, Christoph Hellwig wrote: > EXPORT_UNUSED_SYMBOL* is not actually used anywhere. Remove the > unused functionality as we generally just remove unused code anyway. > > Signed-off-by: Christoph Hellwig Reviewed-by: Miroslav Benes M

Re: [PATCH 12/13] module: remove EXPORT_SYMBOL_GPL_FUTURE

2021-02-02 Thread Miroslav Benes
On Tue, 2 Feb 2021, Christoph Hellwig wrote: > As far as I can tell this has never been used at all, and certainly > not any time recently. Right, I've always wondered about this one. > Signed-off-by: Christoph Hellwig Reviewed-by: Miroslav Benes M

Re: [PATCH 11/13] module: move struct symsearch to module.c

2021-02-02 Thread Miroslav Benes
On Tue, 2 Feb 2021, Christoph Hellwig wrote: > struct symsearch is only used inside of module.h, so move the definition > out of module.h. > > Signed-off-by: Christoph Hellwig Reviewed-by: Miroslav Benes M

Re: [PATCH 09/13] module: merge each_symbol_section into find_symbol

2021-02-02 Thread Miroslav Benes
On Tue, 2 Feb 2021, Christoph Hellwig wrote: > each_symbol_section is only called by find_symbol, so merge the two > functions. > > Signed-off-by: Christoph Hellwig Reviewed-by: Miroslav Benes M

Re: [PATCH 08/13] module: remove each_symbol_in_section

2021-02-02 Thread Miroslav Benes
On Tue, 2 Feb 2021, Christoph Hellwig wrote: > each_symbol_in_section just contains a trivial loop over its arguments. > Just open code the loop in the two callers. > > Signed-off-by: Christoph Hellwig Reviewed-by: Miroslav Benes M

Re: [PATCH 07/13] module: mark module_mutex static

2021-02-02 Thread Miroslav Benes
-off-by: Christoph Hellwig Reviewed-by: Miroslav Benes M

Re: [PATCH 06/13] kallsyms: only build {, module_}kallsyms_on_each_symbol when required

2021-02-02 Thread Miroslav Benes
On Tue, 2 Feb 2021, Christoph Hellwig wrote: > kallsyms_on_each_symbol and module_kallsyms_on_each_symbol are only used > by the livepatching code, so don't build them if livepatching is not > enabled. > > Signed-off-by: Christoph Hellwig Reviewed-by: Miroslav Benes M

Re: [PATCH 05/13] kallsyms: refactor {,module_}kallsyms_on_each_symbol

2021-02-02 Thread Miroslav Benes
On Mon, 1 Feb 2021, Christoph Hellwig wrote: > On Mon, Feb 01, 2021 at 02:37:12PM +0100, Miroslav Benes wrote: > > > > This change is not needed. (objname == NULL) means that we are > > > > interested only in symbols in "vmlinux". > > > > > &g

Re: [PATCH 05/13] kallsyms: refactor {,module_}kallsyms_on_each_symbol

2021-02-01 Thread Miroslav Benes
One more thing... > @@ -4379,8 +4379,7 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, > const char *, > unsigned int i; > int ret; > > - module_assert_mutex(); > - > + mutex_lock(_mutex); > list_for_each_entry(mod, , list) { > /* We hold

Re: [PATCH 05/13] kallsyms: refactor {,module_}kallsyms_on_each_symbol

2021-02-01 Thread Miroslav Benes
On Mon, 1 Feb 2021, Christoph Hellwig wrote: > On Fri, Jan 29, 2021 at 10:43:36AM +0100, Petr Mladek wrote: > > > --- a/kernel/livepatch/core.c > > > +++ b/kernel/livepatch/core.c > > > @@ -164,12 +164,8 @@ static int klp_find_object_symbol(const char > > > *objname, const char *name, > > >

Re: [PATCH 04/13] module: use RCU to synchronize find_module

2021-02-01 Thread Miroslav Benes
On Mon, 1 Feb 2021, Jessica Yu wrote: > +++ Miroslav Benes [29/01/21 16:29 +0100]: > >On Thu, 28 Jan 2021, Christoph Hellwig wrote: > > > >> Allow for a RCU-sched critical section around find_module, following > >> the lower level find_module_all helper, and sw

Re: [PATCH 04/13] module: use RCU to synchronize find_module

2021-01-29 Thread Miroslav Benes
On Thu, 28 Jan 2021, Christoph Hellwig wrote: > Allow for a RCU-sched critical section around find_module, following > the lower level find_module_all helper, and switch the two callers > outside of module.c to use such a RCU-sched critical section instead > of module_mutex. That's a nice idea.

Re: [PATCH 03/13] module: unexport find_module and module_mutex

2021-01-29 Thread Miroslav Benes
On Thu, 28 Jan 2021, Christoph Hellwig wrote: > find_module is not used by modular code any more, and random driver code > has no business calling it to start with. > > Signed-off-by: Christoph Hellwig Reviewed-by: Miroslav Benes M

Re: [PATCH] On ppc64le we HAVE_RELIABLE_STACKTRACE

2017-12-12 Thread Miroslav Benes
On Tue, 12 Dec 2017, Torsten Duwe wrote: > Hi all, > > The "Power Architecture 64-Bit ELF V2 ABI" says in section 2.3.2.3: > > [...] There are several rules that must be adhered to in order to ensure > reliable and consistent call chain backtracing: > > * Before a function calls any other

[PATCH v4 1/2] livepatch: send a fake signal to all blocking tasks

2017-11-15 Thread Miroslav Benes
ake signal is not automatic. It is done only when admin requests it by writing 1 to signal sysfs attribute in livepatch sysfs directory. Signed-off-by: Miroslav Benes <mbe...@suse.cz> Cc: Oleg Nesterov <o...@redhat.com> Cc: Michael Ellerman <m...@ellerman.id.au> Cc: Thomas Glei

Re: [PATCH v3 1/2] livepatch: send a fake signal to all blocking tasks

2017-11-03 Thread Miroslav Benes
On Thu, 2 Nov 2017, Josh Poimboeuf wrote: > On Tue, Oct 31, 2017 at 12:48:52PM +0100, Miroslav Benes wrote: > > diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c > > index bf8c8fd72589..b7c60662baf3 100644 > > --- a/kernel/livepatch/core.c > > ++

Re: [PATCH v3 1/2] livepatch: send a fake signal to all blocking tasks

2017-11-03 Thread Miroslav Benes
On Thu, 2 Nov 2017, Josh Poimboeuf wrote: > On Tue, Oct 31, 2017 at 12:48:52PM +0100, Miroslav Benes wrote: > > + > > +/* > > + * Sends a fake signal to all non-kthread tasks with TIF_PATCH_PENDING set. > > + * Kthreads with TIF_PATCH_PENDING set are woken up.

Re: [PATCH v3 1/2] livepatch: send a fake signal to all blocking tasks

2017-11-02 Thread Miroslav Benes
On Wed, 1 Nov 2017, Oleg Nesterov wrote: > On 11/01, Petr Mladek wrote: > > > > On Tue 2017-10-31 12:48:52, Miroslav Benes wrote: > > > + if (task->flags & PF_KTHREAD) { > > > + /* > > > + * Wa

Re: [PATCH v3 1/2] livepatch: send a fake signal to all blocking tasks

2017-11-01 Thread Miroslav Benes
> +/* > + * Sends a fake signal to all non-kthread tasks with TIF_PATCH_PENDING set. > + * Kthreads with TIF_PATCH_PENDING set are woken up. Only admin can request > this > + * action currently. > + */ > +void klp_force_signals(void) > +{ > + struct task_struct *g, *task; > + > +

[PATCH v3 1/2] livepatch: send a fake signal to all blocking tasks

2017-10-31 Thread Miroslav Benes
ake signal is not automatic. It is done only when admin requests it by writing 1 to signal sysfs attribute in livepatch sysfs directory. Signed-off-by: Miroslav Benes <mbe...@suse.cz> Cc: Oleg Nesterov <o...@redhat.com> Cc: Michael Ellerman <m...@ellerman.id.au> Cc: Thomas Glei

Re: [PATCH v2 2/3] livepatch: send a fake signal to all blocking tasks

2017-08-14 Thread Miroslav Benes
On Fri, 11 Aug 2017, Josh Poimboeuf wrote: > On Thu, Aug 10, 2017 at 12:48:14PM +0200, Miroslav Benes wrote: > > Last, sending the fake signal is not automatic. It is done only when > > admin requests it by writing 1 to force sysfs attribute in livepatch > > sysfs direc

[PATCH v2 2/3] livepatch: send a fake signal to all blocking tasks

2017-08-10 Thread Miroslav Benes
g the fake signal is not automatic. It is done only when admin requests it by writing 1 to force sysfs attribute in livepatch sysfs directory. Signed-off-by: Miroslav Benes <mbe...@suse.cz> Cc: Oleg Nesterov <o...@redhat.com> Cc: Michael Ellerman <m...@ellerman.id.au> Cc: Thomas

Re: [PATCH v5.1 15/15] livepatch: allow removal of a disabled patch

2017-03-07 Thread Miroslav Benes
ay and prevent these > races by design. But it made the patch definition more complicated > and opened another can of worms. See > https://lkml.kernel.org/r/1464018848-4303-1-git-send-email-pmla...@suse.com > > [Thanks to Petr Mladek for improving the commit message.] > > Signed-off-by: Mi

Re: [PATCH v5 13/15] livepatch: change to a per-task consistency model

2017-03-07 Thread Miroslav Benes
e /sys/kernel/livepatch//enabled file while > the transition is in progress. Then all the tasks will attempt to > converge back to the original patch state. > > [1] https://lkml.kernel.org/r/20141107140458.ga21...@suse.cz > > Signed-off-by: Josh Poimboeuf <jpoim...@redhat.com> I looked at the patch again and could not see any problem with it. I tested it with a couple of live patches too and it worked as expected. Good job. Acked-by: Miroslav Benes <mbe...@suse.cz> Thanks, Miroslav

Re: [PATCH v5 13/15] livepatch: change to a per-task consistency model

2017-02-22 Thread Miroslav Benes
On Tue, 21 Feb 2017, Josh Poimboeuf wrote: > On Fri, Feb 17, 2017 at 09:51:29AM +0100, Miroslav Benes wrote: > > On Thu, 16 Feb 2017, Josh Poimboeuf wrote: > > > What do you think about the following? I tried to put the logic in > > > klp_complete_transition(),

Re: [PATCH v5 00/15] livepatch: hybrid consistency model

2017-02-17 Thread Miroslav Benes
On Mon, 13 Feb 2017, Josh Poimboeuf wrote: > Here's v5 of the consistency model, targeted for 4.12. Only a few minor > changes this time. > > v5: > - return -EINVAL in __save_stack_trace_reliable() > - only call show_stack() once > - add save_stack_trace_tsk_reliable() define for

Re: [PATCH v5 13/15] livepatch: change to a per-task consistency model

2017-02-17 Thread Miroslav Benes
On Thu, 16 Feb 2017, Josh Poimboeuf wrote: > On Thu, Feb 16, 2017 at 03:33:26PM +0100, Miroslav Benes wrote: > > > > > @@ -347,22 +356,36 @@ static int __klp_enable_patch(struct klp_patch > > > *patch) > > > > > > pr_not

Re: [PATCH v5 13/15] livepatch: change to a per-task consistency model

2017-02-16 Thread Miroslav Benes
> @@ -347,22 +356,36 @@ static int __klp_enable_patch(struct klp_patch *patch) > > pr_notice("enabling patch '%s'\n", patch->mod->name); > > + klp_init_transition(patch, KLP_PATCHED); > + > + /* > + * Enforce the order of the func->transition writes in > + *

Re: [PATCH v5 01/15] stacktrace/x86: add function for detecting reliable stack traces

2017-02-15 Thread Miroslav Benes
tries array > > Such issues are reported by checking unwind_error() and !unwind_done(). > > Also add CONFIG_HAVE_RELIABLE_STACKTRACE so arch-independent code can > determine at build time whether the function is implemented. > > Signed-off-by: Josh Poimboeuf <jpoim...@redhat.c

Re: [PATCH v4 13/15] livepatch: change to a per-task consistency model

2017-02-07 Thread Miroslav Benes
> > And finally, the section "Limitations" has this text under the first > > bullet: > > > > + The patch must not change the semantic of the patched functions. > > > > The current implementation guarantees only that either the old > > or the new function is called. The functions are

Re: [PATCH v4 15/15] livepatch: allow removal of a disabled patch

2017-02-03 Thread Miroslav Benes
On Thu, 19 Jan 2017, Josh Poimboeuf wrote: > From: Miroslav Benes <mbe...@suse.cz> > > Currently we do not allow patch module to unload since there is no > method to determine if a task is still running in the patched code. > > The consistency model gives us the way bec

Re: [PATCH v4 13/15] livepatch: change to a per-task consistency model

2017-02-03 Thread Miroslav Benes
Petr has already mentioned majority of things I too found out, so only couple of nits... > diff --git a/Documentation/ABI/testing/sysfs-kernel-livepatch > b/Documentation/ABI/testing/sysfs-kernel-livepatch > index da87f43..24b6570 100644 > --- a/Documentation/ABI/testing/sysfs-kernel-livepatch

Re: [PATCH v4 13/15] livepatch: change to a per-task consistency model

2017-02-03 Thread Miroslav Benes
On Thu, 2 Feb 2017, Petr Mladek wrote: > > diff --git a/Documentation/livepatch/livepatch.txt > > b/Documentation/livepatch/livepatch.txt > > index 7f04e13..fb00d66 100644 > > --- a/Documentation/livepatch/livepatch.txt > > +++ b/Documentation/livepatch/livepatch.txt > > > + In that case,

Re: [PATCH v4.1 01/15] stacktrace/x86: add function for detecting reliable stack traces

2017-02-02 Thread Miroslav Benes
tries array > > Such issues are reported by checking unwind_error() and !unwind_done(). > > Also add CONFIG_HAVE_RELIABLE_STACKTRACE so arch-independent code can > determine at build time whether the function is implemented. > > Signed-off-by: Josh Poimboeuf <jpoim...@redhat.com> Looks good to me. Reviewed-by: Miroslav Benes <mbe...@suse.cz> Miroslav

Re: [PATCH v4 00/15] livepatch: hybrid consistency model

2017-02-01 Thread Miroslav Benes
On Wed, 1 Feb 2017, Josh Poimboeuf wrote: > On Thu, Jan 19, 2017 at 09:46:08AM -0600, Josh Poimboeuf wrote: > > Here's v4, based on linux-next/master. Mostly minor changes this time, > > primarily due to Petr's v3 comments. > > So far, the only review comments have been related to the first

Re: [PATCH v4 14/15] livepatch: add /proc//patch_state

2017-02-01 Thread Miroslav Benes
On Tue, 31 Jan 2017, Josh Poimboeuf wrote: > On Tue, Jan 31, 2017 at 03:31:39PM +0100, Miroslav Benes wrote: > > On Thu, 19 Jan 2017, Josh Poimboeuf wrote: > > > > > Expose the per-task patch state value so users can determine which tasks > > > are holding up c

Re: [PATCH v4 14/15] livepatch: add /proc//patch_state

2017-01-31 Thread Miroslav Benes
On Thu, 19 Jan 2017, Josh Poimboeuf wrote: > Expose the per-task patch state value so users can determine which tasks > are holding up completion of a patching operation. > > Signed-off-by: Josh Poimboeuf <jpoim...@redhat.com> > Reviewed-by: Petr Mladek <pmla...@suse.com&

Re: [PATCH v4 03/15] livepatch: create temporary klp_update_patch_state() stub

2017-01-27 Thread Miroslav Benes
; > Reviewed-by: Petr Mladek <pmla...@suse.com> Acked-by: Miroslav Benes <mbe...@suse.cz> Miroslav

Re: [PATCH v4 01/15] stacktrace/x86: add function for detecting reliable stack traces

2017-01-27 Thread Miroslav Benes
> diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h > index 0a34489..8e8b67b 100644 > --- a/include/linux/stacktrace.h > +++ b/include/linux/stacktrace.h > @@ -18,6 +18,8 @@ extern void save_stack_trace_regs(struct pt_regs *regs, > struct

Re: [PATCH v3 13/15] livepatch: change to a per-task consistency model

2017-01-10 Thread Miroslav Benes
> > > --- a/kernel/sched/idle.c > > > +++ b/kernel/sched/idle.c > > > @@ -9,6 +9,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > > > > #include > > > > > > @@ -264,6 +265,9 @@ static void do_idle(void) > > > > > > sched_ttwu_pending(); > > >

Re: [PATCH v3 13/15] livepatch: change to a per-task consistency model

2017-01-05 Thread Miroslav Benes
> @@ -740,6 +809,14 @@ int klp_register_patch(struct klp_patch *patch) > return -ENODEV; > > /* > + * Architectures without reliable stack traces have to set > + * patch->immediate because there's currently no way to patch kthreads > + * with the consistency

Re: [PATCH v3 15/15] livepatch: allow removal of a disabled patch

2017-01-04 Thread Miroslav Benes
> diff --git a/samples/livepatch/livepatch-sample.c > b/samples/livepatch/livepatch-sample.c > index bb61c65..0625f38 100644 > --- a/samples/livepatch/livepatch-sample.c > +++ b/samples/livepatch/livepatch-sample.c > @@ -89,7 +89,6 @@ static int livepatch_init(void) > > static void

Re: [PATCH v3 14/15] livepatch: add /proc//patch_state

2017-01-04 Thread Miroslav Benes
On Thu, 8 Dec 2016, Josh Poimboeuf wrote: > Expose the per-task patch state value so users can determine which tasks > are holding up completion of a patching operation. > > Signed-off-by: Josh Poimboeuf <jpoim...@redhat.com> Reviewed-by: Miroslav Benes <mbe...@suse.cz> Miroslav

Re: [PATCH v3 13/15] livepatch: change to a per-task consistency model

2017-01-04 Thread Miroslav Benes
On Thu, 8 Dec 2016, Josh Poimboeuf wrote: > +void klp_start_transition(void) > +{ > + struct task_struct *g, *task; > + unsigned int cpu; > + > + WARN_ON_ONCE(klp_target_state == KLP_UNDEFINED); > + > + pr_notice("'%s': %s...\n", klp_transition_patch->mod->name, > +

Re: [PATCH v3 12/15] livepatch: store function sizes

2016-12-23 Thread Miroslav Benes
On Thu, 8 Dec 2016, Josh Poimboeuf wrote: > For the consistency model we'll need to know the sizes of the old and > new functions to determine if they're on the stacks of any tasks. > > Signed-off-by: Josh Poimboeuf <jpoim...@redhat.com> Acked-by: Miroslav Benes <mbe...@suse.cz> Miroslav

Re: [PATCH v3 11/15] livepatch: use kstrtobool() in enabled_store()

2016-12-23 Thread Miroslav Benes
toul(buf, 10, ); > > > + ret = kstrtobool(buf, ); > > > if (ret) > > > return -EINVAL; > > > > I would return "ret" here. It is -EINVAL as well but... ;-) > > That was a preexisting issue with the kstrtoul() return code, but I'll > sneak your suggested change into this patch if nobody objects. Fine with me. Acked-by: Miroslav Benes <mbe...@suse.cz> Miroslav

Re: [PATCH v3 10/15] livepatch: move patching functions into patch.c

2016-12-23 Thread Miroslav Benes
On Thu, 8 Dec 2016, Josh Poimboeuf wrote: > Move functions related to the actual patching of functions and objects > into a new patch.c file. > > Signed-off-by: Josh Poimboeuf <jpoim...@redhat.com> Acked-by: Miroslav Benes <mbe...@suse.cz> Miroslav

Re: [PATCH v3 09/15] livepatch: remove unnecessary object loaded check

2016-12-23 Thread Miroslav Benes
ff-by: Josh Poimboeuf <jpoim...@redhat.com> Acked-by: Miroslav Benes <mbe...@suse.cz> Miroslav

Re: [PATCH v3 08/15] livepatch: separate enabled and patched states

2016-12-23 Thread Miroslav Benes
not necessarily > fully applied). > > - Patched means that an object's funcs are registered with ftrace and > added to the klp_ops func stack. > > Also, since these states are binary, represent them with booleans > instead of ints. > > Signed-off-by: Josh Poimboeuf <

Re: [PATCH v3 13/15] livepatch: change to a per-task consistency model

2016-12-23 Thread Miroslav Benes
> > > diff --git a/kernel/livepatch/patch.c b/kernel/livepatch/patch.c > > > index 5efa262..e79ebb5 100644 > > > --- a/kernel/livepatch/patch.c > > > +++ b/kernel/livepatch/patch.c > > > @@ -29,6 +29,7 @@ > > > #include > > > #include > > > #include "patch.h" > > > +#include "transition.h" >

Re: [PATCH v3 06/15] livepatch/s390: reorganize TIF thread flag bits

2016-12-21 Thread Miroslav Benes
<jpoim...@redhat.com> I believe there is no harm doing that and we need it for _TIF_PATCH_PENDING later. Reviewed-by: Miroslav Benes <mbe...@suse.cz> Miroslav

Re: [PATCH v3 05/15] livepatch/powerpc: add TIF_PATCH_PENDING thread flag

2016-12-21 Thread Miroslav Benes
> > The bit is included in the _TIF_USER_WORK_MASK macro so that > do_notify_resume() and klp_update_patch_state() get called when the bit > is set. > > Signed-off-by: Josh Poimboeuf <jpoim...@redhat.com> Looks good to me. You can add my Reviewed-by: Miroslav Benes <mbe...@suse.cz> Miroslav

Re: [PATCH v3 04/15] livepatch/x86: add TIF_PATCH_PENDING thread flag

2016-12-21 Thread Miroslav Benes
> > The bit is placed in the _TIF_ALLWORK_MASK macro, which results in > exit_to_usermode_loop() calling klp_update_patch_state() when it's set. > > Signed-off-by: Josh Poimboeuf <jpoim...@redhat.com> Reviewed-by: Miroslav Benes <mbe...@suse.cz> Miroslav

Re: [PATCH v3 01/15] stacktrace/x86: add function for detecting reliable stack traces

2016-12-19 Thread Miroslav Benes
On Mon, 19 Dec 2016, Josh Poimboeuf wrote: > On Mon, Dec 19, 2016 at 05:25:19PM +0100, Miroslav Benes wrote: > > On Thu, 8 Dec 2016, Josh Poimboeuf wrote: > > > > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > > > index 215612c..b4a6663 100644 > > &g

Re: [PATCH v3 02/15] x86/entry: define _TIF_ALLWORK_MASK flags explicitly

2016-12-19 Thread Miroslav Benes
ne the flags explicitly. > > Signed-off-by: Josh Poimboeuf <jpoim...@redhat.com> With _TIF_SINGLESTEP and _TIF_NEED_RESCHED swapped you can add my Reviewed-by: Miroslav Benes <mbe...@suse.cz> Miroslav > --- > arch/x86/include/asm/thread_info.h | 9 - > 1 fil

Re: [PATCH v3 01/15] stacktrace/x86: add function for detecting reliable stack traces

2016-12-19 Thread Miroslav Benes
On Thu, 8 Dec 2016, Josh Poimboeuf wrote: > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > index 215612c..b4a6663 100644 > --- a/arch/x86/Kconfig > +++ b/arch/x86/Kconfig > @@ -155,6 +155,7 @@ config X86 > select HAVE_PERF_REGS > select HAVE_PERF_USER_STACK_DUMP > select

Re: [RFC PATCH v2 17/18] livepatch: change to a per-task consistency model

2016-05-10 Thread Miroslav Benes
On Thu, 28 Apr 2016, Josh Poimboeuf wrote: > Change livepatch to use a basic per-task consistency model. This is the > foundation which will eventually enable us to patch those ~10% of > security patches which change function or data semantics. This is the > biggest remaining piece needed to

Re: barriers: was: [RFC PATCH v2 17/18] livepatch: change to a per-task consistency model

2016-05-09 Thread Miroslav Benes
On Wed, 4 May 2016, Josh Poimboeuf wrote: > On Wed, May 04, 2016 at 04:12:05PM +0200, Petr Mladek wrote: > > On Wed 2016-05-04 14:39:40, Petr Mladek wrote: > > >* > > >* Note that the task must never be migrated to the target > > >* state when being inside this

Re: [RFC PATCH v2 17/18] livepatch: change to a per-task consistency model

2016-05-09 Thread Miroslav Benes
[...] > +static int klp_target_state; [...] > +void klp_init_transition(struct klp_patch *patch, int state) > +{ > + struct task_struct *g, *task; > + unsigned int cpu; > + struct klp_object *obj; > + struct klp_func *func; > + int initial_state = !state; > + > +

Re: [RFC PATCH v2 17/18] livepatch: change to a per-task consistency model

2016-05-05 Thread Miroslav Benes
On Wed, 4 May 2016, Josh Poimboeuf wrote: > On Wed, May 04, 2016 at 10:42:23AM +0200, Petr Mladek wrote: > > On Thu 2016-04-28 15:44:48, Josh Poimboeuf wrote: > > > Change livepatch to use a basic per-task consistency model. This is the > > > foundation which will eventually enable us to patch

Re: [RFC PATCH v2 10/18] livepatch/powerpc: add TIF_PATCH_PENDING thread flag

2016-05-03 Thread Miroslav Benes
On Tue, 3 May 2016, Petr Mladek wrote: > On Thu 2016-04-28 15:44:41, Josh Poimboeuf wrote: > > Add the TIF_PATCH_PENDING thread flag to enable the new livepatch > > per-task consistency model for powerpc. The bit getting set indicates > > the thread has a pending patch which needs to be applied

Re: [PATCH v2] livepatch: Add some basic LivePatch documentation

2016-04-27 Thread Miroslav Benes
On Tue, 26 Apr 2016, Balbir Singh wrote: > > + + Anything inlined into __schedule() can not be patched. > > + > > +The switch_to macro is inlined into __schedule(). It switches the > > +context between two processes in the middle of the macro. It does > > +not save RIP in x86_64

Re: Live patching for powerpc

2016-04-15 Thread Miroslav Benes
On Thu, 14 Apr 2016, Jessica Yu wrote: > +++ Miroslav Benes [14/04/16 15:28 +0200]: > > On Wed, 13 Apr 2016, Jessica Yu wrote: > > > > A second concern I have is that apply_relocate_add() relies on > > > sections like .stubs and .toc (for 64-bit) and .init.plt and .

Re: [PATCH 2/5] livepatch: Allow architectures to specify an alternate ftrace location

2016-04-14 Thread Miroslav Benes
On Thu, 14 Apr 2016, Michael Ellerman wrote: > On Thu, 2016-04-14 at 14:01 +0200, Miroslav Benes wrote: > > On Wed, 13 Apr 2016, Michael Ellerman wrote: > > > > static void klp_disable_func(struct klp_func *func) > > > { > > > struct klp_ops *ops;

Re: Live patching for powerpc

2016-04-14 Thread Miroslav Benes
On Wed, 13 Apr 2016, Jessica Yu wrote: > +++ Miroslav Benes [13/04/16 15:01 +0200]: > > On Wed, 13 Apr 2016, Michael Ellerman wrote: > > > > > This series adds live patching support for powerpc (ppc64le only ATM). > > > > > > It's unchan

Re: [PATCH 3/5] powerpc/livepatch: Add livepatch header

2016-04-14 Thread Miroslav Benes
On Thu, 14 Apr 2016, Miroslav Benes wrote: > On Wed, 13 Apr 2016, Michael Ellerman wrote: > > > Add the powerpc specific livepatch definitions. In particular we provide > > a non-default implementation of klp_get_ftrace_location(). > > > > This is required beca

Re: [PATCH 3/5] powerpc/livepatch: Add livepatch header

2016-04-14 Thread Miroslav Benes
On Wed, 13 Apr 2016, Michael Ellerman wrote: > Add the powerpc specific livepatch definitions. In particular we provide > a non-default implementation of klp_get_ftrace_location(). > > This is required because the location of the mcount call is not constant > when using -mprofile-kernel (which

Re: [PATCH 2/5] livepatch: Allow architectures to specify an alternate ftrace location

2016-04-14 Thread Miroslav Benes
On Wed, 13 Apr 2016, Michael Ellerman wrote: > When livepatch tries to patch a function it takes the function address > and asks ftrace to install the livepatch handler at that location. > ftrace will look for an mcount call site at that exact address. > > On powerpc the mcount location is not

Re: [PATCH 0/5] Live patching for powerpc

2016-04-13 Thread Miroslav Benes
On Wed, 13 Apr 2016, Michael Ellerman wrote: > This series adds live patching support for powerpc (ppc64le only ATM). > > It's unchanged since the version I posted on March 24, with the exception that > I've dropped the first patch, which was a testing-only patch. > > If there's no further

Re: [PATCH] livepatch: Add some basic LivePatch documentation

2016-03-15 Thread Miroslav Benes
> > potential developers of the framework itself. > > Thanks for starting the efforts; this is really needed if we want the > infrastructure to be used also by someone else than its developers :) Indeed. Great job, Petr. > [ ... snip ... ] > > +7. Limitations > &g

Re: [PATCH][v6][RFC] livepatch/ppc: Enable livepatching on powerpc

2016-03-15 Thread Miroslav Benes
On Wed, 9 Mar 2016, Balbir Singh wrote: > > The previous revision was nacked by Torsten, but compared to the alternatives > at hand I think we should test this approach. Ideally we want all the > complexity > of live-patching in the live-patching code and not in the patch. The other > option >

Re: [PATCH][v4] livepatch/ppc: Enable livepatching on powerpc

2016-03-04 Thread Miroslav Benes
Hi, On Fri, 4 Mar 2016, Michael Ellerman wrote: > Hi Petr, > > On Thu, 2016-03-03 at 17:52 +0100, Petr Mladek wrote: > > > From: Balbir Singh > > > > Changelog v4: > > 1. Renamed klp_matchaddr() to klp_get_ftrace_location() > >and used it just to convert

Re: [PATCH v8 6/8] Implement kernel live patching for ppc64le (ABIv2)

2016-02-11 Thread Miroslav Benes
On Wed, 10 Feb 2016, Torsten Duwe wrote: > diff --git a/arch/powerpc/include/asm/livepatch.h > b/arch/powerpc/include/asm/livepatch.h > new file mode 100644 > index 000..44e8a2d > --- /dev/null > +++ b/arch/powerpc/include/asm/livepatch.h > @@ -0,0 +1,45 @@ > +/* > + * livepatch.h -

Re: [PATCH v6 8/9] Implement kernel live patching for ppc64le (ABIv2)

2016-01-26 Thread Miroslav Benes
[ added Petr to CC list ] On Mon, 25 Jan 2016, Torsten Duwe wrote: > * create the appropriate files+functions > arch/powerpc/include/asm/livepatch.h > klp_check_compiler_support, > klp_arch_set_pc > arch/powerpc/kernel/livepatch.c with a stub for >

Re: [PATCH v6 8/9] Implement kernel live patching for ppc64le (ABIv2)

2016-01-26 Thread Miroslav Benes
[ Jessica added to CC list so she is aware that there are plans to implement livepatch on ppc64le ] On Tue, 26 Jan 2016, Torsten Duwe wrote: > On Tue, Jan 26, 2016 at 11:50:25AM +0100, Miroslav Benes wrote: > > > + */ > > > +int klp_write_module_reloc(struct module *mo