Re: Fix issue with alternatives/paravirt patches

2016-07-21 Thread Miroslav Benes
On Thu, 21 Jul 2016, Jessica Yu wrote: > +++ Miroslav Benes [12/07/16 14:06 +0200]: > > > > Is there a problem when you need to generate a dynrela for paravirt code? > > I mean one does not know during the build of a patch module if paravirt > > would or would not be

A bug in ftrace - dynamic fops

2016-08-08 Thread Miroslav Benes
Hi Steven, I am afraid there is a bug in the current mainline's ftrace when dynamic fops are involved. ftrace_shutdown() relies on schedule_on_each_cpu() which should ensure that no task stays in a ftrace handler. This was sufficient for a long time because every handler was called with the pr

Re: A bug in ftrace - dynamic fops

2016-08-09 Thread Miroslav Benes
On Mon, 8 Aug 2016, Steven Rostedt wrote: > On Mon, 8 Aug 2016 10:57:45 +0200 (CEST) > Miroslav Benes wrote: > > > Hi Steven, > > > > I am afraid there is a bug in the current mainline's ftrace when dynamic > > fops are involved. > > I'm sorr

Re: [PATCH] livepatch/module: make TAINT_LIVEPATCH module-specific

2016-08-25 Thread Miroslav Benes
On Wed, 24 Aug 2016, Josh Poimboeuf wrote: > There's no reliable way to determine which module tainted the kernel > with CONFIG_LIVEPATCH. For example, /sys/module//taint > doesn't report it. Neither does the "mod -t" command in the crash tool. > > Make it crystal clear who the guilty party is

Re: [PATCH] livepatch/module: make TAINT_LIVEPATCH module-specific

2016-08-25 Thread Miroslav Benes
On Thu, 25 Aug 2016, Josh Poimboeuf wrote: > On Thu, Aug 25, 2016 at 04:25:15PM +0200, Miroslav Benes wrote: > > On Wed, 24 Aug 2016, Josh Poimboeuf wrote: > > > > > There's no reliable way to determine which module tainted the kernel > > > with CONFIG_LIVEP

Re: [PATCH v2] livepatch/module: make TAINT_LIVEPATCH module-specific

2016-08-26 Thread Miroslav Benes
flag gets set when the module is loaded rather > than when it's enabled. > > I also renamed find_livepatch_modinfo() to check_modinfo_livepatch() to > better reflect its purpose: it's basically a livepatch-specific > sub-function of check_modinfo(). > > Reported-by: Chunyu Hu > Signed-off-by: Josh Poimboeuf Acked-by: Miroslav Benes Miroslav

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

2017-08-16 Thread Miroslav Benes
+ > + /* No found, add the newly allocated one */ > + klp_shadow_add(new_shadow); > + spin_unlock_irqrestore(&klp_shadow_lock, flags); > + > + return new_shadow->data; > + > +err_exists: > + WARN(1, "Duplicate shadow variable <%p, %lx>\n", obj, id); > +err: > + return NULL; > +} > +EXPORT_SYMBOL_GPL(klp_shadow_attach); Otherwise it looks good. You can add my Acked-by: Miroslav Benes with those nits fixed. Thanks, Miroslav

Re: [PATCH v3 1/2] livepatch: Add dynamic klp_object and klp_func iterators

2017-10-16 Thread Miroslav Benes
On Tue, 10 Oct 2017, Josh Poimboeuf wrote: > On Tue, Oct 10, 2017 at 11:15:33AM -0400, Jason Baron wrote: > > > > > > On 10/06/2017 05:22 PM, Josh Poimboeuf wrote: > > > On Wed, Sep 27, 2017 at 11:41:29PM -0400, Jason Baron wrote: > > >> In preparation to introducing atomic replace, introduce it

Re: [PATCH v3 2/2] livepatch: add atomic replace

2017-10-17 Thread Miroslav Benes
On Tue, 10 Oct 2017, Jason Baron wrote: > > > On 10/06/2017 06:32 PM, Josh Poimboeuf wrote: > > On Wed, Sep 27, 2017 at 11:41:30PM -0400, Jason Baron wrote: > >> Since 'atomic replace' has completely replaced all previous livepatch > >> modules, it explicitly disables all previous livepatch modu

Re: [PATCH v4 1/3] livepatch: use lists to manage patches, objects and functions

2017-10-17 Thread Miroslav Benes
> diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c > index b9628e4..b7f77be 100644 > --- a/kernel/livepatch/core.c > +++ b/kernel/livepatch/core.c > @@ -608,6 +608,7 @@ static int klp_init_func(struct klp_object *obj, struct > klp_func *func) > INIT_LIST_HEAD(&func->stack_node

Re: [PATCH v3 2/2] livepatch: add atomic replace

2017-10-17 Thread Miroslav Benes
On Tue, 17 Oct 2017, Miroslav Benes wrote: > On Tue, 10 Oct 2017, Jason Baron wrote: > > > > > > > On 10/06/2017 06:32 PM, Josh Poimboeuf wrote: > > > On Wed, Sep 27, 2017 at 11:41:30PM -0400, Jason Baron wrote: > > >> Since 'atomic repla

[PATCH] livepatch: Make livepatch dependent on !TRIM_UNUSED_KSYMS

2017-05-26 Thread Miroslav Benes
Signed-off-by: Miroslav Benes --- kernel/livepatch/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/livepatch/Kconfig b/kernel/livepatch/Kconfig index 045022557936..ec4565122e65 100644 --- a/kernel/livepatch/Kconfig +++ b/kernel/livepatch/Kconfig @@ -10,6 +10,7 @@ config

Re: [PATCH 3/3] livepatch: force transition process to finish

2017-05-29 Thread Miroslav Benes
On Fri, 26 May 2017, Josh Poimboeuf wrote: > On Thu, May 18, 2017 at 02:00:43PM +0200, Miroslav Benes wrote: > > @@ -591,3 +591,19 @@ void klp_send_fake_signal(void) > > } > > read_unlock(&tasklist_lock); > > } > > + > > +/* > > + * Drop

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

2017-10-31 Thread Miroslav Benes
, sending the fake 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 Cc: Oleg Nesterov Cc: Michael Ellerman Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin"

[PATCH v3 2/2] livepatch: force transition process to finish

2017-10-31 Thread Miroslav Benes
: Miroslav Benes --- Documentation/ABI/testing/sysfs-kernel-livepatch | 10 + Documentation/livepatch/livepatch.txt| 24 +++-- kernel/livepatch/core.c | 27 kernel/livepatch/transition.c| 25

[PATCH v3 0/2] livepatch: Introduce signal and force sysfs attributes

2017-10-31 Thread Miroslav Benes
idle tasks in klp_force_transitions() too - Josh Miroslav Benes (2): livepatch: send a fake signal to all blocking tasks livepatch: force transition process to finish Documentation/ABI/testing/sysfs-kernel-livepatch | 19 +++ Documentation/livepatch/livepatch.txt| 21

Re: [PATCH 2/2] livepatch: __klp_disable_patch() should never be called for disabled patches

2017-11-01 Thread Miroslav Benes
On Fri, 20 Oct 2017, Petr Mladek wrote: > __klp_disable_patch() should never be called when the patch is not > enabled. Let's add the same warning that we have in __klp_enable_patch(). > > This allows to remove the check when calling klp_pre_unpatch_callback(). > It was strange anyway because it

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; > + > + pr_notic

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-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. Only

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 2/2] livepatch: force transition process to finish

2017-11-03 Thread Miroslav Benes
On Thu, 2 Nov 2017, Josh Poimboeuf wrote: > On Tue, Oct 31, 2017 at 12:48:53PM +0100, Miroslav Benes wrote: > > If a task sleeps in a set of patched functions uninterruptedly, it could > > block the whole transition process indefinitely. Thus it may be useful > > to clear

Re: [PATCH v3 2/2] livepatch: add atomic replace

2017-10-18 Thread Miroslav Benes
On Tue, 17 Oct 2017, Jason Baron wrote: > > > On 10/17/2017 09:50 AM, Miroslav Benes wrote: > > On Tue, 17 Oct 2017, Miroslav Benes wrote: > > > >> On Tue, 10 Oct 2017, Jason Baron wrote: > >> > >>> > >>> > >>> On 10/0

Re: [PATCH v3 2/2] livepatch: add atomic replace

2017-10-18 Thread Miroslav Benes
On Wed, 18 Oct 2017, Josh Poimboeuf wrote: > On Wed, Oct 18, 2017 at 11:10:09AM +0200, Miroslav Benes wrote: > > 3. Drop immediate. It causes problems only and its advantages on x86_64 > > are theoretical. You would still need to solve the interaction with atomic >

Re: [PATCH v6 1/3] livepatch: add (un)patch callbacks

2017-10-18 Thread Miroslav Benes
h/ for examples. > > Signed-off-by: Joe Lawrence Acked-by: Miroslav Benes Miroslav

Re: [PATCH v3 2/2] livepatch: add atomic replace

2017-10-19 Thread Miroslav Benes
On Wed, 18 Oct 2017, Josh Poimboeuf wrote: > On Wed, Oct 18, 2017 at 03:36:42PM +0200, Jiri Kosina wrote: > > On Wed, 18 Oct 2017, Miroslav Benes wrote: > > > > > 3. Drop immediate. It causes problems only and its advantages on x86_64 > > > are theoretical.

Re: [PATCH 0/8] livepatch: klp-convert tool

2017-10-19 Thread Miroslav Benes
On Thu, 19 Oct 2017, Josh Poimboeuf wrote: > On Wed, Oct 11, 2017 at 09:42:09AM -0300, Joao Moreira wrote: > > > Sounds good! For klp-convert to be successful, we really need a > > > strategy for dealing with such optimizations. I'm thinking that a > > > '-fpreserve-function-abi' flag would be t

Re: [PATCH 0/8] livepatch: klp-convert tool

2017-10-19 Thread Miroslav Benes
On Thu, 19 Oct 2017, Josh Poimboeuf wrote: > On Thu, Oct 19, 2017 at 03:24:51PM +0200, Miroslav Benes wrote: > > On Thu, 19 Oct 2017, Josh Poimboeuf wrote: > > > > > On Wed, Oct 11, 2017 at 09:42:09AM -0300, Joao Moreira wrote: > > > > > Sounds good! For

Re: [PATCH 0/8] livepatch: klp-convert tool

2017-10-19 Thread Miroslav Benes
On Thu, 19 Oct 2017, Josh Poimboeuf wrote: > On Thu, Oct 19, 2017 at 04:27:31PM +0200, Miroslav Benes wrote: > > On Thu, 19 Oct 2017, Josh Poimboeuf wrote: > > > > I think that klp-convert can work with both. Even with non-source-based > > > > solution you

Re: [PATCH 2/3] arm64: implement live patching

2018-08-29 Thread Miroslav Benes
On Fri, 10 Aug 2018, Torsten Duwe wrote: > Based on ftrace with regs, do the usual thing. Also allocate a > task flag for whatever consistency handling is implemented. > Watch out for interactions with the graph tracer. > This code has been compile-tested, but has not yet seen any > heavy livepatc

Re: [PATCH v12 00/12]

2018-08-30 Thread Miroslav Benes
On Tue, 28 Aug 2018, Petr Mladek wrote: > livepatch: Atomic replace feature > > The atomic replace allows to create cumulative patches. They > are useful when you maintain many livepatches and want to remove > one that is lower on the stack. In addition it is very useful when > more patches touch

Re: [PATCH] livepatch: Remove reliable stacktrace check in klp_try_switch_task()

2018-07-12 Thread Miroslav Benes
heck in klp_try_switch_task(), > as its not required. > > Signed-off-by: Kamalesh Babulal Acked-by: Miroslav Benes M

Re: [PATCH 2/3] livepatch/rcu: Warn when system consistency is broken in RCU code

2017-05-11 Thread Miroslav Benes
Being somewhat late to the party I missed all the fun... On Wed, 10 May 2017, Josh Poimboeuf wrote: > On Wed, May 10, 2017 at 06:04:23PM +0200, Petr Mladek wrote: > > > IMHO, the point is that RCU must be aware when we call > > rcu_read_lock()/unlock(). > > > > My understanding is that rcu_irq

Re: [PATCH 2/3] livepatch/rcu: Warn when system consistency is broken in RCU code

2017-05-11 Thread Miroslav Benes
On Mon, 8 May 2017, Steven Rostedt wrote: > On Mon, 8 May 2017 14:47:29 -0500 > Josh Poimboeuf wrote: > > > > Although you should have: > > > > > > if (WARN_ONCE(!rcu_is_watching, > > > "Livepatch ...")) > > > return; > > > > > > or something to not cause any dama

Re: [PATCH v5 0/3] livepatch: introduce atomic replace

2018-01-31 Thread Miroslav Benes
> IMHO, it might be easier to run just the callbacks from > the new patch. In reality, the author should always know > what it might be replacing and what needs to be done. I agree. I don't see a good solution to the problem. Imagine a crazy situation in which someone would like to patch the ent

Re: PATCH v6 3/6] livepatch: Initial support for dynamic structures

2018-01-31 Thread Miroslav Benes
c() > is empty. It must be updated when a particular dynamic > klp_func_type is introduced. > > Signed-off-by: Jason Baron > [pmla...@suse.com: Converted into a generic API] > Signed-off-by: Petr Mladek > Cc: Josh Poimboeuf > Cc: Jessica Yu > Cc: Jiri Kosina > Cc: Miro

Re: PATCH v6 4/6] livepatch: Allow to unpatch only functions of the given type

2018-01-31 Thread Miroslav Benes
> +void klp_unpatch_object(struct klp_object *obj, enum klp_func_type ftype) > { > struct klp_func *func; > + bool patched = false; > > - klp_for_each_func(obj, func) > - if (func->patched) > + klp_for_each_func(obj, func) { > + if (!func->patched) > +

Re: PATCH v6 5/6] livepatch: Support separate list for replaced patches.

2018-01-31 Thread Miroslav Benes
On Thu, 25 Jan 2018, Petr Mladek wrote: > From: Jason Baron > > We are going to add a feature called atomic replace. It will allow to > create a patch that would replace all already registered patches. > > The replaced patches will stay registered because they are typically > unregistered by so

Re: PATCH v6 0/6] livepatch: Atomic replace feature

2018-02-01 Thread Miroslav Benes
On Thu, 25 Jan 2018, Petr Mladek wrote: > Hi, > > the atomic replace allows to create cumulative patches. They > are useful when you maintain many livepatches and want to remove > one that is lower on the stack. In addition it is very useful when > more patches touch the same function and there a

Re: PATCH v6 6/6] livepatch: Add atomic replace

2018-02-01 Thread Miroslav Benes
> -struct klp_object *klp_get_or_add_object(struct klp_patch *patch, > +static struct klp_object *klp_get_or_add_object(struct klp_patch *patch, > struct klp_object *old_obj) A nit, but this change belongs to 3/6, doesn't it? > { > struct klp_

Re: PATCH v6 0/6] livepatch: Atomic replace feature

2018-02-01 Thread Miroslav Benes
On Thu, 1 Feb 2018, Joe Lawrence wrote: > On 02/01/2018 08:49 AM, Miroslav Benes wrote: > > > > Well, one more thing. I think there is a problem with shadow variables. > > Similar to callbacks situation. Shadow variables cannot be destroyed the > > way it is shown

Re: PATCH v6 0/6] livepatch: Atomic replace feature

2018-02-01 Thread Miroslav Benes
On Thu, 1 Feb 2018, Josh Poimboeuf wrote: > On Thu, Feb 01, 2018 at 04:08:14PM +0100, Miroslav Benes wrote: > > On Thu, 1 Feb 2018, Joe Lawrence wrote: > > > > > On 02/01/2018 08:49 AM, Miroslav Benes wrote: > > > > > > > > Well, one more thing.

[PATCH v2] livepatch: Remove immediate feature

2018-01-10 Thread Miroslav Benes
y any new live patches and should plan for reboot into an updated kernel. The architectures would now need to provide HAVE_RELIABLE_STACKTRACE to fully support livepatch. Signed-off-by: Miroslav Benes --- v2 changes: - 2/2 from v1 dropped - documentation Documentation/livepatch/livepatc

Re: [PATCH v10 05/10] livepatch: Support separate list for replaced patches.

2018-04-11 Thread Miroslav Benes
On Tue, 10 Apr 2018, Josh Poimboeuf wrote: > > > I agree here. Practically we use only cumulative replacement patches at > > > SUSE. So with that in mind I don't care about the stacking much. But, it > > > may make sense for someone else. Evgenii mentioned they used it for > > > hotfixes. Therefor

Re: [PATCH v10 05/10] livepatch: Support separate list for replaced patches.

2018-04-11 Thread Miroslav Benes
On Tue, 10 Apr 2018, Josh Poimboeuf wrote: > On Tue, Apr 10, 2018 at 10:34:55AM +0200, Petr Mladek wrote: > > > > > > > We were just recently discussing the possibility of not allowing > > > > > > > the > > > > > > > disabling of patches at all. If we're not going that far, let's > > > > > > >

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 v10 05/10] livepatch: Support separate list for replaced patches.

2018-04-11 Thread Miroslav Benes
On Wed, 11 Apr 2018, Josh Poimboeuf wrote: > On Wed, Apr 11, 2018 at 10:07:31AM +0200, Miroslav Benes wrote: > > > > I was confused by wording "in the middle". It suggested that there > > > > might had been enabled patches on the top and the bottom of the st

Re: [PATCH v2] Add livepatch kselftests

2018-04-12 Thread Miroslav Benes
> Questions for v3: > > - Should we split off the atomic replace and shadow variable update > tests so that the this patchset could be merged before the ones > listed above? What Josh said. If we merge it almost together, there is no need to split it. > - I didn't remove any of the

Re: [PATCH v3] selftests/livepatch: introduce tests

2018-04-13 Thread Miroslav Benes
Hi, On Thu, 12 Apr 2018, Joe Lawrence wrote: > Add a few livepatch modules and simple target modules that the included > regression suite can run tests against. Could you include a brief description which features are tested? > Signed-off-by: Joe Lawrence > --- > diff --git a/lib/livepatch/t

Re: [PATCH v10 00/10] livepatch: Atomic replace feature

2018-03-20 Thread Miroslav Benes
On Mon, 12 Mar 2018, Joe Lawrence wrote: > These are the callback tests that I hacked up into a livepatch > kselftest. (Basically I copied a bunch of the sample modules and > verified the expected dmesg output as I had listed in in the > Documentation/livepatch/callbacks.txt file.) The script is

Re: [PATCH v10 05/10] livepatch: Support separate list for replaced patches.

2018-03-20 Thread Miroslav Benes
> > I don't know, does anybody really care about this case (patching on top > > of a disabled patch)? It just adds to the crazy matrix of possible > > scenarios we have to keep in our heads, which means more bugs, for very > > little (hypothetical) gain. > > It depends if the we remove the repla

Re: [PATCH 1/2] livepatch: Initialize shadow variables by init function safely

2018-03-21 Thread Miroslav Benes
> @@ -186,10 +198,13 @@ static void *__klp_shadow_get_or_alloc(void *obj, > unsigned long id, void *data, > * Return: the shadow variable data element, NULL on duplicate or > * failure. > */ > -void *klp_shadow_alloc(void *obj, unsigned long id, void *data, > -size_t siz

Re: [PATCH 2/2] livepatch: Allow to unregister or free shadow data using a custom function

2018-03-21 Thread Miroslav Benes
On Wed, 14 Mar 2018, Josh Poimboeuf wrote: > On Tue, Mar 13, 2018 at 04:54:48PM +0100, Petr Mladek wrote: > > We might need to do some actions before the shadow variable is freed. > > For example, we might need to remove it from a list or free some data > > that it points to. > > > > This is alre

Re: [PATCH 3/8] livepatch: Add atomic replace

2018-04-09 Thread Miroslav Benes
> > +* see klp_init_object_loaded(). > > +*/ > > + if (!func->new_func && !func->nop) > > return -EINVAL; > > > > > INIT_LIST_HEAD(&func->stack_node); > > @@ -742,6 +920,9 @@ static int klp_init_object_loaded(struct klp_patch > > *patch, > > return

Re: [PATCH 4/8] livepatch: Add an extra flag to distinguish registered patches

2018-04-09 Thread Miroslav Benes
to klp_is_patch_on_stack() and used in __klp_enable_patch() > as a new sanity check. > > This patch does not change the existing behavior. In my opinion it could be easier for a review to squash the patch into the next one. > Signed-off-by: Petr Mladek > Cc: Josh Poimboeuf > Cc:

Re: [PATCH 6/8] livepatch: Remove Nop structures when unused

2018-04-10 Thread Miroslav Benes
On Fri, 23 Mar 2018, Petr Mladek wrote: > Replaced patches are removed from the stack when the transition is > finished. It means that Nop structures will never be needed again > and can be removed. Why should we care? > > + Nop structures make false feeling that the function is patched > e

Re: [PATCH v10 05/10] livepatch: Support separate list for replaced patches.

2018-04-10 Thread Miroslav Benes
> > > > I think you're missing my point. This isn't about your patch set, per > > > > se. It's really about our existing code. Today, our patch stack > > > > doesn't follow real stack semantics, because patches in the middle might > > > > be disabled. I see that as a problem. > > > > No, plea

Re: [PATCH] selftests/livepatch: introduce tests

2018-04-10 Thread Miroslav Benes
> > > I love this. Nice work! Yes, it looks really good. > > > As you and Petr discussed, it would be nice to get rid of some of the > > > delays, and also the callback tests will be very important. > > > > I've got v2 WIP that minimizes the delays, cleans up build flags, and > > adds a basic

Re: [PATCH v13 08/12] livepatch: Add atomic replace

2018-11-23 Thread Miroslav Benes
On Mon, 15 Oct 2018, Petr Mladek wrote: > +static int klp_add_object_nops(struct klp_patch *patch, > +struct klp_object *old_obj) > +{ > + struct klp_object *obj; > + struct klp_func *func, *old_func; > + > + obj = klp_find_object(patch, old_obj); > + > +

Re: [PATCH 1/2] module: Overwrite st_size instead of st_info

2018-11-23 Thread Miroslav Benes
On Thu, 22 Nov 2018, Jessica Yu wrote: > +++ Vincent Whitchurch [22/11/18 13:24 +0100]: > >On Thu, Nov 22, 2018 at 12:01:54PM +, Dave Martin wrote: > >> On Mon, Nov 19, 2018 at 05:25:12PM +0100, Vincent Whitchurch wrote: > >> > st_info is currently overwritten after relocation and used to stor

Re: [PATCH v13 02/12] livepatch: Helper macros to define livepatch structures

2018-11-21 Thread Miroslav Benes
On Wed, 24 Oct 2018, Petr Mladek wrote: > On Thu 2018-10-18 07:58:24, Josh Poimboeuf wrote: > > On Thu, Oct 18, 2018 at 01:11:53PM +0200, Petr Mladek wrote: > > > On Wed 2018-10-17 13:17:56, Josh Poimboeuf wrote: > > > > On Mon, Oct 15, 2018 at 02:37:03PM +0200, Petr Mladek wrote: > > > > > The de

Re: [PATCH v13 04/12] livepatch: Consolidate klp_free functions

2018-11-21 Thread Miroslav Benes
> -/* > - * Free all functions' kobjects in the array up to some limit. When limit is > - * NULL, all kobjects are freed. > - */ > -static void klp_free_funcs_limited(struct klp_object *obj, > -struct klp_func *limit) > +static void klp_free_funcs(struct klp_object *

Re: [PATCH] module: make it clearer when we're handling kallsyms symbols vs exported symbols

2018-11-22 Thread Miroslav Benes
On Wed, 21 Nov 2018, Jessica Yu wrote: > The module loader internally works with both exported symbols > represented as struct kernel_symbol, as well as Elf symbols from a > module's symbol table. It's hard to distinguish sometimes which type of > symbol we're handling given that some helper funct

Re: [PATCH] module: make it clearer when we're handling kallsyms symbols vs exported symbols

2018-11-22 Thread Miroslav Benes
On Thu, 22 Nov 2018, Jessica Yu wrote: > +++ Miroslav Benes [22/11/18 11:19 +0100]: > >On Wed, 21 Nov 2018, Jessica Yu wrote: > > > >> The module loader internally works with both exported symbols > >> represented as struct kernel_symbol, as well as Elf symbols

Re: [PATCH v2] module: make it clearer when we're handling kallsyms symbols vs exported symbols

2018-11-29 Thread Miroslav Benes
l? > > Clean up and unify the function naming scheme a bit to make it clear > which kind of symbol we're handling. This change only affects static > functions internal to the module loader. > > Signed-off-by: Jessica Yu Reviewed-by: Miroslav Benes M

Re: [PATCH v14 08/11] livepatch: Remove Nop structures when unused

2018-12-04 Thread Miroslav Benes
because kobject free callbacks are called > asynchronously. We could not wait for them easily. Fortunately, we do > not have to. Any further access can be avoided by removing them from > the dynamic lists. > > Signed-off-by: Petr Mladek Acked-by: Miroslav Benes M

Re: [PATCH v14 09/11] livepatch: Atomic replace and cumulative patches documentation

2018-12-04 Thread Miroslav Benes
On Thu, 29 Nov 2018, Petr Mladek wrote: > User documentation for the atomic replace feature. It makes it easier > to maintain livepatches using so-called cumulative patches. > > Signed-off-by: Petr Mladek Acked-by: Miroslav Benes M

Re: [PATCH v14 10/11] livepatch: Remove ordering and refuse loading conflicting patches

2018-12-05 Thread Miroslav Benes
e time after the transition finishes. It might help > to catch obvious mistakes. But more importantly, we do not need to > handle situation when a patch in the middle of the function stack > (ops->func_stack) is being removed. > > Signed-off-by: Petr Mladek Acked-by: Miroslav Benes M

Re: [PATCH v14 11/11] selftests/livepatch: introduce tests

2018-12-05 Thread Miroslav Benes
allbacks > - shadow variable API > > Signed-off-by: Joe Lawrence > Signed-off-by: Petr Mladek Tested-by: Miroslav Benes I can also ack the changes in Documentation/, but probably someone else should look at the selftests. Miroslav

Re: [PATCH v14 04/11] livepatch: Refuse to unload only livepatches available during a forced transition

2018-12-06 Thread Miroslav Benes
On Thu, 6 Dec 2018, Petr Mladek wrote: > On Mon 2018-12-03 16:29:32, Miroslav Benes wrote: > > You probably forgot to replace the subject with Josh's proposal. > > > > > module_put() is currently never called in klp_complete_transition() when > > > klp_fo

Re: [PATCH v14 05/11] livepatch: Simplify API by removing registration step

2018-12-06 Thread Miroslav Benes
On Thu, 6 Dec 2018, Petr Mladek wrote: > On Wed 2018-12-05 14:32:53, Joe Lawrence wrote: > > > diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c > > > index 972520144713..e01dfa3b58d2 100644 > > > --- a/kernel/livepatch/core.c > > > +++ b/kernel/livepatch/core.c > > > @@ -45,7 +45,7 @

Re: [PATCH v14 00/11] livepatch: Atomic replace feature

2018-12-06 Thread Miroslav Benes
> > I don't have many code comments as the changes appear to safely and > > correctly do what the say. (We are at v14 after all :) I mainly > > compared the text and comments to the implementation and noted typos > > (marked by substitution s/old/new) and awkward wordings (marked by > > "re-wor

Re: [PATCH v5 1/2] module: Overwrite st_size instead of st_info

2018-12-06 Thread Miroslav Benes
t_size is neither used by the module core nor by any > architecture. > > Reviewed-by: Dave Martin > Signed-off-by: Vincent Whitchurch Reviewed-by: Miroslav Benes M

Re: [PATCH v14 01/11] livepatch: Change unsigned long old_addr -> void *old_func in struct klp_func

2018-12-03 Thread Miroslav Benes
+-- > kernel/livepatch/core.c | 6 +++--- > kernel/livepatch/patch.c | 18 ++ > kernel/livepatch/patch.h | 2 +- > kernel/livepatch/transition.c | 4 ++-- > 5 files changed, 18 insertions(+), 16 deletions(-) kernel/livepatch/patch.h also mentions old_addr in a comment. You can add Acked-by: Miroslav Benes with that fixed. Miroslav

Re: [PATCH v14 02/11] livepatch: Shuffle klp_enable_patch()/klp_disable_patch() code

2018-12-03 Thread Miroslav Benes
; This patch does not change the code except of two forward declarations. > > Signed-off-by: Petr Mladek Acked-by: Miroslav Benes M

Re: [PATCH v14 03/11] livepatch: Consolidate klp_free functions

2018-12-03 Thread Miroslav Benes
On Thu, 29 Nov 2018, Petr Mladek wrote: > -static int klp_init_patch(struct klp_patch *patch) > +/* Init operations that must succeed before klp_free_patch() can be called. > */ > +static int klp_init_patch_before_free(struct klp_patch *patch) There is no klp_free_patch() now, so the comment is

Re: [PATCH v14 04/11] livepatch: Refuse to unload only livepatches available during a forced transition

2018-12-03 Thread Miroslav Benes
You probably forgot to replace the subject with Josh's proposal. > module_put() is currently never called in klp_complete_transition() when > klp_force is set. As a result, we might keep the reference count even when > klp_enable_patch() fails and klp_cancel_transition() is called. Correct. > Th

Re: [PATCH v14 05/11] livepatch: Simplify API by removing registration step

2018-12-04 Thread Miroslav Benes
Mainly nits below. Overall it looks good. > The possibility to re-enable a registered patch was useful for immediate > patches where the livepatch module had to stay until the system reboot. > The improved consistency model allows to achieve the same result by > unloading and loading the livepatch

Re: [PATCH v14 06/11] livepatch: Use lists to manage patches, objects and functions

2018-12-04 Thread Miroslav Benes
m: Initialize lists before init calls] > Signed-off-by: Petr Mladek > Cc: Josh Poimboeuf > Cc: Jessica Yu > Cc: Jiri Kosina > Cc: Miroslav Benes Acked-by: Miroslav Benes M

Re: [PATCH v14 07/11] livepatch: Add atomic replace

2018-12-04 Thread Miroslav Benes
+See Documentation/livepatch/cumulative-patches.txt for more details. which is added later in the series. The rest looks good, so Acked-by: Miroslav Benes M

Re: [PATCH v14 05/11] livepatch: Simplify API by removing registration step

2018-12-04 Thread Miroslav Benes
On Tue, 4 Dec 2018, Petr Mladek wrote: > On Tue 2018-12-04 13:54:55, Miroslav Benes wrote: > > > diff --git a/Documentation/livepatch/livepatch.txt > > > b/Documentation/livepatch/livepatch.txt > > > index 2d7ed09dbd59..d849af312576 100644 > > > ---

Re: [PATCH V2] livepatch: fix non-static warnings

2018-12-18 Thread Miroslav Benes
On Mon, 17 Dec 2018, Joe Lawrence wrote: > On 12/17/2018 07:03 AM, Miroslav Benes wrote: > > Hi, > > > > I'm sorry for being late to the party. > > > > On Sun, 16 Dec 2018, Nicholas Mc Guire wrote: > > > >> Sparse reported warnings abou

Re: [PATCH V2] livepatch: fix non-static warnings

2018-12-18 Thread Miroslav Benes
On Mon, 17 Dec 2018, Nicholas Mc Guire wrote: > On Mon, Dec 17, 2018 at 10:44:36AM -0500, Joe Lawrence wrote: > > On 12/17/2018 07:03 AM, Miroslav Benes wrote: > > > Hi, > > > > > > I'm sorry for being late to the party. > > >

Re: objtool warnings for kernel/trace/trace_selftest_dynamic.o

2018-12-18 Thread Miroslav Benes
On Mon, 17 Dec 2018, Josh Poimboeuf wrote: > On Mon, Dec 17, 2018 at 04:06:18PM -0800, Andi Kleen wrote: > > On Mon, Dec 17, 2018 at 05:36:44PM -0500, Steven Rostedt wrote: > > > On Mon, 17 Dec 2018 15:31:26 -0600 > > > Josh Poimboeuf wrote: > > > > > > > On Mon, Dec 17, 2018 at 08:29:38PM +0100

[PATCH] kbuild: use -flive-patching when CONFIG_LIVEPATCH is enabled

2018-12-19 Thread Miroslav Benes
GCC 9 introduces a new option, -flive-patching. It disables certain optimizations which could make a compilation unsafe for later live patching of the running kernel. The option is used only if CONFIG_LIVEPATCH is enabled and $(CC) supports it. Signed-off-by: Miroslav Benes --- Makefile | 4

Re: [PATCH v14 03/11] livepatch: Consolidate klp_free functions

2018-12-14 Thread Miroslav Benes
On Thu, 13 Dec 2018, Josh Poimboeuf wrote: > On Mon, Dec 03, 2018 at 03:59:57PM +0100, Miroslav Benes wrote: > > On Thu, 29 Nov 2018, Petr Mladek wrote: > > > > > -static int klp_init_patch(struct klp_patch *patch) > > > +/* Init operations that must succe

Re: [PATCH 2/2] livepatch: check kzalloc return values

2018-12-17 Thread Miroslav Benes
Petr Mladek for > catching this) and NULL returned. > > Signed-off-by: Nicholas Mc Guire > Fixes: 439e7271dc2b ("livepatch: introduce shadow variable API") Acked-by: Miroslav Benes M

Re: [PATCH V2] livepatch: fix non-static warnings

2018-12-17 Thread Miroslav Benes
Hi, I'm sorry for being late to the party. On Sun, 16 Dec 2018, Nicholas Mc Guire wrote: > Sparse reported warnings about non-static symbols. For the variables > a simple static attribute is fine - for those symbols referenced by > livepatch via klp_func the symbol-names must be unmodified in th

Re: [PATCH] kbuild: use -flive-patching when CONFIG_LIVEPATCH is enabled

2018-12-20 Thread Miroslav Benes
On Wed, 19 Dec 2018, Jiri Kosina wrote: > On Wed, 19 Dec 2018, Josh Poimboeuf wrote: > > > Also the commit message needs an analysis of the performance impacts. > > Agreed. Especially as it's expected (*) to be completely in the noise > particularly for the kernel, it'd be good to have that doc

Re: [PATCH] kbuild: use -flive-patching when CONFIG_LIVEPATCH is enabled

2018-12-21 Thread Miroslav Benes
On Thu, 20 Dec 2018, Josh Poimboeuf wrote: > On Thu, Dec 20, 2018 at 09:33:05AM +0100, Miroslav Benes wrote: > > > > Though, upstream, almost everybody seems to use kpatch-build, for which > > > > this patch doesn't help. And people will continue to do so unt

Re: [PATCH] kbuild: use -flive-patching when CONFIG_LIVEPATCH is enabled

2018-12-21 Thread Miroslav Benes
On Thu, 20 Dec 2018, Joao Moreira wrote: > On 12/20/18 12:33 AM, Miroslav Benes wrote: > > On Wed, 19 Dec 2018, Jiri Kosina wrote: > > > >> On Wed, 19 Dec 2018, Josh Poimboeuf wrote: > >> > >>> Also the commit message needs an analysis of the perform

[PATCH] ring-buffer: Remove unused function ring_buffer_page_len()

2018-12-28 Thread Miroslav Benes
Commit 6b7e633fe9c2 ("tracing: Remove extra zeroing out of the ring buffer page") removed the only caller of ring_buffer_page_len(). The function is now unused and may be removed. Signed-off-by: Miroslav Benes --- I am sorry if you received the patch more than once (hopefully not)

Re: [PATCH v2] arm64/module: use mod->klp_info section header information for livepatch modules

2018-10-29 Thread Miroslav Benes
> diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c > index dd23655fda3a..490e56070a7e 100644 > --- a/arch/arm64/kernel/module.c > +++ b/arch/arm64/kernel/module.c > @@ -461,5 +461,15 @@ int module_finalize(const Elf_Ehdr *hdr, > #endif > } > > +#ifdef CONFIG_LIVEPATCH >

Re: [PATCH v3 3/4] arm64: implement live patching

2018-10-17 Thread Miroslav Benes
On Mon, 1 Oct 2018, Torsten Duwe wrote: > Based on ftrace with regs, do the usual thing. Also allocate a > task flag for whatever consistency handling will be used. > Watch out for interactions with the graph tracer. Similar to what Mark wrote about 2/4, I'd appreciate a better commit log. Could

Re: [PATCH v2] arm64/module: use plt section indices for relocations

2018-11-06 Thread Miroslav Benes
4/include/asm/module.h | 8 +--- > > arch/arm64/kernel/module-plts.c | 36 > > arch/arm64/kernel/module.c | 9 +---- > > 3 files changed, 30 insertions(+), 23 deletions(-) > > Actually, I guess I should just queue this for 4.21 given that it's > completely self-contained. FWIW you can also add my Reviewed-by: Miroslav Benes Thanks, Jessica. Miroslav

Re: [PATCH v4 2/3] arm64: implement live patching

2018-11-06 Thread Miroslav Benes
Hi, On Fri, 26 Oct 2018, Torsten Duwe wrote: > Based on ftrace with regs, do the usual thing. > (see Documentation/livepatch/livepatch.txt) > > Use task flag bit 6 to track patch transisiton state for the consistency > model. Add it to the work mask so it gets cleared on all kernel exits to > us

Re: [PATCH v12 06/12] livepatch: Simplify API by removing registration step

2018-10-15 Thread Miroslav Benes
On Fri, 12 Oct 2018, Petr Mladek wrote: > On Wed 2018-09-05 11:34:06, Miroslav Benes wrote: > > On Tue, 28 Aug 2018, Petr Mladek wrote: > > > Also the API and logic is much easier. It is enough to call > > > klp_enable_patch() in module_init() call. The patch pat

Re: [PATCH v2] arm64/module: use mod->klp_info section header information for livepatch modules

2018-11-01 Thread Miroslav Benes
> >Does this mean we can drop the plt pointer from this struct altogether, and > >simply offset into the section headers when applying the relocations? > > Hmm, if everyone is OK with dropping the plt pointer from struct > mod_plt_sec, then I think we can simplify this patch even further. > > W

Re: [PATCH] arm64/module: use mod->klp_info section header information

2018-10-24 Thread Miroslav Benes
On Tue, 23 Oct 2018, Jessica Yu wrote: > diff --git a/arch/arm64/kernel/module-plts.c b/arch/arm64/kernel/module-plts.c > index f0690c2ca3e0..05067717dfc5 100644 > --- a/arch/arm64/kernel/module-plts.c > +++ b/arch/arm64/kernel/module-plts.c > @@ -210,9 +210,15 @@ int module_frob_arch_sections(Elf

Re: [PATCH] arm64/module: use mod->klp_info section header information

2018-10-25 Thread Miroslav Benes
On Thu, 25 Oct 2018, Petr Mladek wrote: > On Tue 2018-10-23 19:55:54, Jessica Yu wrote: > > The arm64 module loader keeps a pointer into info->sechdrs to keep track > > of section header information for .plt section(s). A pointer to the > > relevent section header (struct elf64_shdr) in info->sech

  1   2   3   4   5   6   7   8   9   >