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

2017-05-24 Thread Miroslav Benes
On Tue, 23 May 2017, Josh Poimboeuf wrote: > On Thu, May 18, 2017 at 02:00:42PM +0200, Miroslav Benes wrote: > > @@ -551,3 +551,43 @@ void klp_copy_process(struct task_struct *child) > > > > /* TIF_PATCH_PENDING gets copied in setup_thread_stack() */ > > } > > + > > +/* > > + * Sends a fake

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

2017-05-23 Thread Josh Poimboeuf
On Thu, May 18, 2017 at 02:00:42PM +0200, Miroslav Benes wrote: > @@ -551,3 +551,43 @@ void klp_copy_process(struct task_struct *child) > > /* TIF_PATCH_PENDING gets copied in setup_thread_stack() */ > } > + > +/* > + * Sends a fake signal to all non-kthread tasks with TIF_PATCH_PENDING se

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

2017-05-19 Thread Miroslav Benes
> > If not, we get back to exit_to_usermode_loop() and TIF_PATCH_PENDING is > > cleared. Yes, it is true that TIF_SIGPENDING is still set and we get to > > do_signal() once more. But for the last time. > > Yes, slightly sub-optimal but not really wrong and you can swap > do_signal() and klp_upda

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

2017-05-18 Thread Oleg Nesterov
On 05/18, Miroslav Benes wrote: > > On Thu, 18 May 2017, Oleg Nesterov wrote: > > > > > exit_to_usermode_loop() calls do_signal(), then klp_update_patch_state(). > > So it won't be cleared here. > > Ok, so maybe I misunderstand the code. I see the loop in > exit_to_usermode_loop() for processing AL

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

2017-05-18 Thread Miroslav Benes
On Thu, 18 May 2017, Oleg Nesterov wrote: > I didn't see other patches in series, not sure I understand... There is nothing relevant to this patch, I think. I did not want to bother you with it. > On 05/18, Miroslav Benes wrote: > > > > The very safe marking is done in entry.S on syscall and > >

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

2017-05-18 Thread Oleg Nesterov
I didn't see other patches in series, not sure I understand... On 05/18, Miroslav Benes wrote: > > The very safe marking is done in entry.S on syscall and > interrupt/exception exit paths, and in a stack checking functions of > livepatch. TIF_PATCH_PENDING is cleared and the next > recalc_sigpend

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

2017-05-18 Thread Miroslav Benes
On Thu, 18 May 2017, Libor Pechacek wrote: > On Thu 18-05-17 14:00:42, Miroslav Benes wrote: > [...] > > --- a/include/linux/livepatch.h > > +++ b/include/linux/livepatch.h > > @@ -29,6 +29,9 @@ > > > > #include > > > > +/* values for sysfs force attribute */ > > +#define KLP_FORCE_FAKE

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

2017-05-18 Thread Libor Pechacek
On Thu 18-05-17 14:00:42, Miroslav Benes wrote: [...] > --- a/include/linux/livepatch.h > +++ b/include/linux/livepatch.h > @@ -29,6 +29,9 @@ > > #include > > +/* values for sysfs force attribute */ > +#define KLP_FORCE_FAKE 1 > + Should be documented in Documentation/ABI/testi

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

2017-05-18 Thread Miroslav Benes
Live patching consistency model is of LEAVE_PATCHED_SET and SWITCH_THREAD. This means that all tasks in the system have to be marked one by one as safe to call a new patched function. Safe means when a task is not (sleeping) in a set of patched functions. That is, no patched function is on the task