All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] livepatch: Introduce force sysfs attribute
@ 2017-08-10 10:48 Miroslav Benes
  2017-08-10 10:48 ` [PATCH v2 1/3] livepatch: Add " Miroslav Benes
                   ` (4 more replies)
  0 siblings, 5 replies; 24+ messages in thread
From: Miroslav Benes @ 2017-08-10 10:48 UTC (permalink / raw)
  To: jpoimboe, jeyu, jikos
  Cc: pmladek, lpechacek, live-patching, linux-kernel, Miroslav Benes,
	Andy Lutomirski, H. Peter Anvin, Ingo Molnar, Michael Ellerman,
	Oleg Nesterov, Thomas Gleixner

Currently, livepatch gradually migrate the system from an unpatched to a
patched state (or vice versa). Each task drops its TIF_PATCH_PENDING
itself when crossing the kernel/user space boundary or it is cleared
using the stack checking approach. If there is a task which sleeps on a
patched function, the whole transition can get stuck indefinitely.

Livepatch has means which can be used in these cases. The transition can
be cancelled and/or immediate flag may be used for the live patch. On
the other hand it might be useful to poke the system a little bit and
help the transition to finish by doing so.

That is what the fake signal can be used for. A task sleeping/waiting in
the kernel gets TIF_SIGPENDING set, it handles it and during that its
TIF_PATCH_PENDING is cleared. Kthreads are only woken up, they do not
handle signals suitably.

Still, there are cases which neither fake signal can solve. A task can
sleep uninterruptibly without reacting to signals at all. Even then, it
may be safe to clear the task's TIF_PATCH_PENDING. As a last resort,
admin may force such clearing for all tasks in the system with this
patch set.

We use the fake signal in SLES for a long time. Moreover, we don't have
a stack checking there, so we rely on the fake signal a lot. We send it
automatically and periodically.

The first patch is only preparatory. It introduces the sysfs attribute
through which both actions are performed. The second patch adds the fake
signal and the third one forced clearing of the flag.

Changes from v1:
- better wording, typos, comments, documentation - Libor, Josh
- symbolic names in sysfs instead of numbers - Libor
- exit_to_usermode_loop(), call klp_update_patch_state() before do_signal() - Oleg
- better names - Josh
- mutex and WARN_ON_ONCE not added to klp_force_transitions() - Petr, Josh
- handle idle tasks in klp_force_transitions() too - Josh

TODO:
Now there is a sysfs attribute called "force", which provides two
functionalities, "signal" and "force" (previously "unmark"). I haven't
managed to come up with better names. Proposals are welcome. On the
other hand I do not mind it much.

Miroslav Benes (3):
  livepatch: Add force sysfs attribute
  livepatch: send a fake signal to all blocking tasks
  livepatch: force transition process to finish

 Documentation/ABI/testing/sysfs-kernel-livepatch | 18 +++++++
 Documentation/livepatch/livepatch.txt            | 14 +++++
 arch/powerpc/kernel/signal.c                     |  6 +--
 arch/x86/entry/common.c                          |  6 +--
 kernel/livepatch/core.c                          | 50 ++++++++++++++++++
 kernel/livepatch/transition.c                    | 65 ++++++++++++++++++++++++
 kernel/livepatch/transition.h                    |  2 +
 kernel/signal.c                                  |  4 +-
 8 files changed, 158 insertions(+), 7 deletions(-)

-- 
2.13.3

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2017-10-02 11:18 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-10 10:48 [PATCH v2 0/3] livepatch: Introduce force sysfs attribute Miroslav Benes
2017-08-10 10:48 ` [PATCH v2 1/3] livepatch: Add " Miroslav Benes
2017-08-11 21:13   ` Josh Poimboeuf
2017-08-14 14:03     ` Miroslav Benes
2017-08-16 13:15   ` Petr Mladek
2017-08-28 14:58     ` Miroslav Benes
2017-10-02 11:05       ` Petr Mladek
2017-08-10 10:48 ` [PATCH v2 2/3] livepatch: send a fake signal to all blocking tasks Miroslav Benes
2017-08-11 21:30   ` Josh Poimboeuf
2017-08-12 20:03     ` Jiri Kosina
2017-08-14 14:29     ` Miroslav Benes
2017-08-16 14:37   ` Petr Mladek
2017-08-10 10:48 ` [PATCH v2 3/3] livepatch: force transition process to finish Miroslav Benes
2017-08-30  7:24   ` Pavel Machek
2017-08-30 12:48     ` Miroslav Benes
2017-08-30 15:29       ` Josh Poimboeuf
2017-08-11 21:11 ` [PATCH v2 0/3] livepatch: Introduce force sysfs attribute Josh Poimboeuf
2017-08-14  8:49   ` Miroslav Benes
2017-08-16 14:50   ` Petr Mladek
2017-08-16 15:26     ` Josh Poimboeuf
2017-08-30 12:51       ` Miroslav Benes
2017-10-02 11:18         ` Petr Mladek
2017-08-16 13:31 ` Petr Mladek
2017-08-30 12:52   ` Miroslav Benes

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.