Re: [PATCH] livepatch: add (un)patch hooks

2017-07-28 Thread Josh Poimboeuf
On Fri, Jul 28, 2017 at 02:08:33PM -0400, Joe Lawrence wrote: > On 07/27/2017 05:36 PM, Josh Poimboeuf wrote: > > On Thu, Jul 27, 2017 at 04:43:58PM -0400, Joe Lawrence wrote: > >> On 07/20/2017 12:17 AM, Josh Poimboeuf wrote: > >>> - The post-patch and post-unpatch hooks will need to be run from e

Re: [PATCH] livepatch: add (un)patch hooks

2017-07-28 Thread Joe Lawrence
On 07/27/2017 05:36 PM, Josh Poimboeuf wrote: > On Thu, Jul 27, 2017 at 04:43:58PM -0400, Joe Lawrence wrote: >> On 07/20/2017 12:17 AM, Josh Poimboeuf wrote: >>> - The post-patch and post-unpatch hooks will need to be run from either >>> klp_complete_transition() or klp_module_coming/going(), de

Re: [PATCH] livepatch: add (un)patch hooks

2017-07-27 Thread Josh Poimboeuf
On Thu, Jul 27, 2017 at 04:43:58PM -0400, Joe Lawrence wrote: > On 07/20/2017 12:17 AM, Josh Poimboeuf wrote: > > - The pre-patch and pre-unpatch hooks can be run before the > > patching/unpatching process begins. > > Hi Josh, > > By "(un)patching process" are you referring to the klp_patch at

Re: [PATCH] livepatch: add (un)patch hooks

2017-07-27 Thread Joe Lawrence
On 07/20/2017 12:17 AM, Josh Poimboeuf wrote: > - The pre-patch and pre-unpatch hooks can be run before the > patching/unpatching process begins. Hi Josh, By "(un)patching process" are you referring to the klp_patch at large or each klp_object? ie, would all klp_objects execute their hooks bef

Re: [PATCH] livepatch: add (un)patch hooks

2017-07-20 Thread Josh Poimboeuf
On Thu, Jul 20, 2017 at 05:50:04PM +0200, Petr Mladek wrote: > On Wed 2017-07-19 23:17:23, Josh Poimboeuf wrote: > > - patching otherwise unpatchable code (i.e., assembly) > > > > In many/most cases, it seems like stop_machine() would be very useful > > to avoid concurrency issues. > > I am

Re: [PATCH] livepatch: add (un)patch hooks

2017-07-20 Thread Petr Mladek
On Wed 2017-07-19 23:17:23, Josh Poimboeuf wrote: > On Wed, Jul 19, 2017 at 03:49:52PM -0500, Josh Poimboeuf wrote: > > > I am sorry for the long mail. But I have really troubles to > > > understand and describe what can be done with these hooks > > > a safe way. > > > > > > It might help if you s

Re: [PATCH] livepatch: add (un)patch hooks

2017-07-20 Thread Petr Mladek
On Wed 2017-07-19 14:59:48, Joe Lawrence wrote: > On 07/17/2017 11:51 AM, Petr Mladek wrote: > > On Wed 2017-07-12 10:10:00, Joe Lawrence wrote: > > We need to make it clear that there are 4 basic situations > > where these hooks are called: > > > > + patch hook is called when: > > > > 1. l

Re: [PATCH] livepatch: add (un)patch hooks

2017-07-19 Thread Josh Poimboeuf
On Wed, Jul 19, 2017 at 11:17:23PM -0500, Josh Poimboeuf wrote: > This one was interesting: > > 6f442be2fb22 ("x86_64, traps: Stop using IST for #SS") > > A livepatch patch for it is below. We had something similar for kpatch. > The below patch is completely untested because we don't have > kp

Re: [PATCH] livepatch: add (un)patch hooks

2017-07-19 Thread Josh Poimboeuf
On Wed, Jul 19, 2017 at 11:17:23PM -0500, Josh Poimboeuf wrote: > +static void swapgs_unload_hook(void) > +{ > + if (paravirt_enabled() && strcmp(pv_info.name, "KVM")) > + return; > + > + write_cr0(read_cr0() & ~X86_CR0_WP); > + barrier(); > + > + set_intr_gate_ist(X86_T

Re: [PATCH] livepatch: add (un)patch hooks

2017-07-19 Thread Josh Poimboeuf
On Wed, Jul 19, 2017 at 03:49:52PM -0500, Josh Poimboeuf wrote: > > I am sorry for the long mail. But I have really troubles to > > understand and describe what can be done with these hooks > > a safe way. > > > > It might help if you share some real-life examples. > > Agreed, we should share som

Re: [PATCH] livepatch: add (un)patch hooks

2017-07-19 Thread Josh Poimboeuf
On Mon, Jul 17, 2017 at 05:51:44PM +0200, Petr Mladek wrote: > On Wed 2017-07-12 10:10:00, Joe Lawrence wrote: > > When the livepatch core executes klp_(un)patch_object, call out to a > > livepatch-module specified array of callback hooks. These hooks provide > > a notification mechanism for livep

Re: [PATCH] livepatch: add (un)patch hooks

2017-07-19 Thread Miroslav Benes
On Tue, 18 Jul 2017, Josh Poimboeuf wrote: > On Tue, Jul 18, 2017 at 01:15:16PM +0200, Miroslav Benes wrote: > > On Thu, 13 Jul 2017, Josh Poimboeuf wrote: > > > > > On Wed, Jul 12, 2017 at 10:10:00AM -0400, Joe Lawrence wrote: > > > > When the livepatch core executes klp_(un)patch_object, call o

Re: [PATCH] livepatch: add (un)patch hooks

2017-07-19 Thread Joe Lawrence
On 07/17/2017 11:51 AM, Petr Mladek wrote: > On Wed 2017-07-12 10:10:00, Joe Lawrence wrote: >> When the livepatch core executes klp_(un)patch_object, call out to a >> livepatch-module specified array of callback hooks. These hooks provide >> a notification mechanism for livepatch modules when klp

Re: [PATCH] livepatch: add (un)patch hooks

2017-07-19 Thread Petr Mladek
On Tue 2017-07-18 21:08:57, Josh Poimboeuf wrote: > On Tue, Jul 18, 2017 at 01:15:16PM +0200, Miroslav Benes wrote: > > On Thu, 13 Jul 2017, Josh Poimboeuf wrote: > > > > > On Wed, Jul 12, 2017 at 10:10:00AM -0400, Joe Lawrence wrote: > > > > When the livepatch core executes klp_(un)patch_object,

Re: [PATCH] livepatch: add (un)patch hooks

2017-07-18 Thread Josh Poimboeuf
On Tue, Jul 18, 2017 at 01:15:16PM +0200, Miroslav Benes wrote: > On Thu, 13 Jul 2017, Josh Poimboeuf wrote: > > > On Wed, Jul 12, 2017 at 10:10:00AM -0400, Joe Lawrence wrote: > > > When the livepatch core executes klp_(un)patch_object, call out to a > > > livepatch-module specified array of call

Re: [PATCH] livepatch: add (un)patch hooks

2017-07-18 Thread Miroslav Benes
On Thu, 13 Jul 2017, Josh Poimboeuf wrote: > On Wed, Jul 12, 2017 at 10:10:00AM -0400, Joe Lawrence wrote: > > When the livepatch core executes klp_(un)patch_object, call out to a > > livepatch-module specified array of callback hooks. These hooks provide > > a notification mechanism for livepatc

Re: [PATCH] livepatch: add (un)patch hooks

2017-07-18 Thread Miroslav Benes
> > > For the enable case, I think it would be a nice feature if we checked > > > the return code and aborted the patching operation on error. I think > > > that should be easy enough. > > > > Yeah, that should be easy. To be specific, you're only talking about > > the patching operation on the

Re: [PATCH] livepatch: add (un)patch hooks

2017-07-17 Thread Petr Mladek
On Wed 2017-07-12 10:10:00, Joe Lawrence wrote: > When the livepatch core executes klp_(un)patch_object, call out to a > livepatch-module specified array of callback hooks. These hooks provide > a notification mechanism for livepatch modules when klp_objects are > (un)patching. This may be most in

Re: [PATCH] livepatch: add (un)patch hooks

2017-07-14 Thread Josh Poimboeuf
On Fri, Jul 14, 2017 at 09:23:29AM -0400, Joe Lawrence wrote: > > On Wed, Jul 12, 2017 at 10:10:00AM -0400, Joe Lawrence wrote: > > > When the livepatch core executes klp_(un)patch_object, call out to a > > > livepatch-module specified array of callback hooks. These hooks provide > > > a notificat

Re: [PATCH] livepatch: add (un)patch hooks

2017-07-14 Thread Joe Lawrence
ek , Chris J Arges > > Subject: Re: [PATCH] livepatch: add (un)patch hooks > User-Agent: Mutt/1.6.0.1 (2016-04-01) > > On Wed, Jul 12, 2017 at 10:10:00AM -0400, Joe Lawrence wrote: > > When the livepatch core executes klp_(un)patch_object, call out to a > > livepatch-mod

Re: [PATCH] livepatch: add (un)patch hooks

2017-07-13 Thread Josh Poimboeuf
On Wed, Jul 12, 2017 at 10:10:00AM -0400, Joe Lawrence wrote: > When the livepatch core executes klp_(un)patch_object, call out to a > livepatch-module specified array of callback hooks. These hooks provide > a notification mechanism for livepatch modules when klp_objects are > (un)patching. This

[PATCH] livepatch: add (un)patch hooks

2017-07-12 Thread Joe Lawrence
When the livepatch core executes klp_(un)patch_object, call out to a livepatch-module specified array of callback hooks. These hooks provide a notification mechanism for livepatch modules when klp_objects are (un)patching. This may be most interesting when another kernel module is a klp_object tar