linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 00/15] livepatch: hybrid consistency model
@ 2016-12-08 18:08 Josh Poimboeuf
  2016-12-08 18:08 ` [PATCH v3 01/15] stacktrace/x86: add function for detecting reliable stack traces Josh Poimboeuf
                   ` (15 more replies)
  0 siblings, 16 replies; 78+ messages in thread
From: Josh Poimboeuf @ 2016-12-08 18:08 UTC (permalink / raw)
  To: Jessica Yu, Jiri Kosina, Miroslav Benes, Petr Mladek
  Cc: linux-kernel, live-patching, Michael Ellerman, Heiko Carstens,
	x86, linuxppc-dev, linux-s390, Vojtech Pavlik, Jiri Slaby,
	Chris J Arges, Andy Lutomirski, Ingo Molnar, Peter Zijlstra

Dusting the cobwebs off the consistency model again.  This is based on
linux-next/master.

v1 was posted on 2015-02-09:

  https://lkml.kernel.org/r/cover.1423499826.git.jpoimboe@redhat.com

v2 was posted on 2016-04-28:

  https://lkml.kernel.org/r/cover.1461875890.git.jpoimboe@redhat.com

The biggest issue from v2 was finding a decent way to detect preemption
and page faults on the stack of a sleeping task.  That problem was
solved by rewriting the x86 stack unwinder.  The new unwinder helps
detect such cases by finding all pt_regs on the stack.  When
preemption/page faults are detected, the stack is considered unreliable
and the patching of the task is deferred.

For more details about the consistency model, see patch 13/15.

---

v3:
- rebase on new x86 unwinder
- force !HAVE_RELIABLE_STACKTRACE arches to use patch->immediate for
  now, because we don't have a way to transition kthreads otherwise
- rebase s390 TIF_PATCH_PENDING patch onto latest entry code
- update barrier comments and move barrier from the end of
  klp_init_transition() to its callers
- "klp_work" -> "klp_transition_work"
- "klp_patch_task()" -> "klp_update_patch_state()"
- explicit _TIF_ALLWORK_MASK
- change klp_reverse_transition() to not try to complete transition.
  instead modify the work queue delay to zero.
- get rid of klp_schedule_work() in favor of calling
  schedule_delayed_work() directly with a KLP_TRANSITION_DELAY
- initialize klp_target_state to KLP_UNDEFINED
- move klp_target_state assignment to before patch->immediate check in
  klp_init_transition()
- rcu_read_lock() in klp_update_patch_state(), test the thread flag in
  patch task, synchronize_rcu() in klp_complete_transition()
- use kstrtobool() in enabled_store()
- change task_rq_lock() argument type to struct rq_flags
- add several WARN_ON_ONCE assertions for klp_target_state and
  task->patch_state

v2:
- "universe" -> "patch state"
- rename klp_update_task_universe() -> klp_patch_task()
- add preempt IRQ tracking (TF_PREEMPT_IRQ)
- fix print_context_stack_reliable() bug
- improve print_context_stack_reliable() comments
- klp_ftrace_handler comment fixes
- add "patch_state" proc file to tid_base_stuff
- schedule work even for !RELIABLE_STACKTRACE
- forked child inherits patch state from parent
- add detailed comment to livepatch.h klp_func definition about the
  klp_func patched/transition state transitions
- update exit_to_usermode_loop() comment
- clear all TIF_KLP_NEED_UPDATE flags in klp_complete_transition()
- remove unnecessary function externs
- add livepatch documentation, sysfs documentation, /proc documentation
- /proc/pid/patch_state: -1 means no patch is currently being applied/reverted
- "TIF_KLP_NEED_UPDATE" -> "TIF_PATCH_PENDING"
- support for s390 and powerpc-le
- don't assume stacks with dynamic ftrace trampolines are reliable
- add _TIF_ALLWORK_MASK info to commit log

v1.9:
- revive from the dead and rebased
- reliable stacks!
- add support for immediate consistency model
- add a ton of comments
- fix up memory barriers
- remove "allow patch modules to be removed" patch for now, it still 
  needs more discussion and thought - it can be done with something
- "proc/pid/universe" -> "proc/pid/patch_status"
- remove WARN_ON_ONCE from !func condition in ftrace handler -- can
  happen because of RCU
- keep klp_mutex private by putting the work_fn in core.c
- convert states from int to boolean
- remove obsolete '@state' comments
- several header file and include improvements suggested by Jiri S
- change kallsyms_lookup_size_offset() errors from EINVAL -> ENOENT
- change proc file permissions S_IRUGO -> USR
- use klp_for_each_object/func helpers

---

Jiri Slaby (1):
  livepatch/s390: reorganize TIF thread flag bits

Josh Poimboeuf (12):
  stacktrace/x86: add function for detecting reliable stack traces
  x86/entry: define _TIF_ALLWORK_MASK flags explicitly
  livepatch: temporary stubs for klp_patch_pending() and
    klp_update_patch_state()
  livepatch/x86: add TIF_PATCH_PENDING thread flag
  livepatch/powerpc: add TIF_PATCH_PENDING thread flag
  livepatch: separate enabled and patched states
  livepatch: remove unnecessary object loaded check
  livepatch: move patching functions into patch.c
  livepatch: use kstrtobool() in enabled_store()
  livepatch: store function sizes
  livepatch: change to a per-task consistency model
  livepatch: add /proc/<pid>/patch_state

Miroslav Benes (2):
  livepatch/s390: add TIF_PATCH_PENDING thread flag
  livepatch: allow removal of a disabled patch

 Documentation/ABI/testing/sysfs-kernel-livepatch |   8 +
 Documentation/filesystems/proc.txt               |  18 +
 Documentation/livepatch/livepatch.txt            | 156 ++++++--
 arch/Kconfig                                     |   6 +
 arch/powerpc/include/asm/thread_info.h           |   4 +-
 arch/powerpc/kernel/signal.c                     |   4 +
 arch/s390/include/asm/thread_info.h              |  24 +-
 arch/s390/kernel/entry.S                         |  31 +-
 arch/x86/Kconfig                                 |   1 +
 arch/x86/entry/common.c                          |   9 +-
 arch/x86/include/asm/thread_info.h               |  11 +-
 arch/x86/include/asm/unwind.h                    |   6 +
 arch/x86/kernel/stacktrace.c                     |  59 ++-
 arch/x86/kernel/unwind_frame.c                   |   1 +
 fs/proc/base.c                                   |  15 +
 include/linux/init_task.h                        |   9 +
 include/linux/livepatch.h                        |  66 ++-
 include/linux/sched.h                            |   3 +
 include/linux/stacktrace.h                       |   8 +-
 kernel/fork.c                                    |   3 +
 kernel/livepatch/Makefile                        |   2 +-
 kernel/livepatch/core.c                          | 446 +++++++++------------
 kernel/livepatch/patch.c                         | 261 ++++++++++++
 kernel/livepatch/patch.h                         |  33 ++
 kernel/livepatch/transition.c                    | 487 +++++++++++++++++++++++
 kernel/livepatch/transition.h                    |  14 +
 kernel/sched/idle.c                              |   4 +
 kernel/stacktrace.c                              |  12 +-
 samples/livepatch/livepatch-sample.c             |   8 +-
 29 files changed, 1367 insertions(+), 342 deletions(-)
 create mode 100644 kernel/livepatch/patch.c
 create mode 100644 kernel/livepatch/patch.h
 create mode 100644 kernel/livepatch/transition.c
 create mode 100644 kernel/livepatch/transition.h

-- 
2.7.4

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

end of thread, other threads:[~2017-01-11 15:26 UTC | newest]

Thread overview: 78+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-08 18:08 [PATCH v3 00/15] livepatch: hybrid consistency model Josh Poimboeuf
2016-12-08 18:08 ` [PATCH v3 01/15] stacktrace/x86: add function for detecting reliable stack traces Josh Poimboeuf
2016-12-16 13:07   ` Petr Mladek
2016-12-16 22:09     ` Josh Poimboeuf
2016-12-19 16:25   ` Miroslav Benes
2016-12-19 17:25     ` Josh Poimboeuf
2016-12-19 18:23       ` Miroslav Benes
2016-12-20  9:39       ` Petr Mladek
2016-12-20 21:21         ` Josh Poimboeuf
2016-12-08 18:08 ` [PATCH v3 02/15] x86/entry: define _TIF_ALLWORK_MASK flags explicitly Josh Poimboeuf
2016-12-16 14:17   ` Petr Mladek
2016-12-16 22:13     ` Josh Poimboeuf
2016-12-19 16:39   ` Miroslav Benes
2017-01-10  8:49   ` Kamalesh Babulal
2016-12-08 18:08 ` [PATCH v3 03/15] livepatch: temporary stubs for klp_patch_pending() and klp_update_patch_state() Josh Poimboeuf
2016-12-16 14:41   ` Petr Mladek
2016-12-16 22:15     ` Josh Poimboeuf
2016-12-08 18:08 ` [PATCH v3 04/15] livepatch/x86: add TIF_PATCH_PENDING thread flag Josh Poimboeuf
2016-12-08 18:27   ` Andy Lutomirski
2016-12-16 15:39   ` Petr Mladek
2016-12-21 13:54   ` Miroslav Benes
2017-01-11  7:06   ` Kamalesh Babulal
2016-12-08 18:08 ` [PATCH v3 05/15] livepatch/powerpc: " Josh Poimboeuf
2016-12-16 16:00   ` Petr Mladek
2016-12-21 14:30   ` Miroslav Benes
2017-01-10  8:29   ` Kamalesh Babulal
2016-12-08 18:08 ` [PATCH v3 06/15] livepatch/s390: reorganize TIF thread flag bits Josh Poimboeuf
2016-12-21 15:29   ` Miroslav Benes
2016-12-08 18:08 ` [PATCH v3 07/15] livepatch/s390: add TIF_PATCH_PENDING thread flag Josh Poimboeuf
2016-12-08 18:08 ` [PATCH v3 08/15] livepatch: separate enabled and patched states Josh Poimboeuf
2016-12-16 16:21   ` Petr Mladek
2016-12-23 12:54   ` Miroslav Benes
2017-01-10  9:10   ` Kamalesh Babulal
2016-12-08 18:08 ` [PATCH v3 09/15] livepatch: remove unnecessary object loaded check Josh Poimboeuf
2016-12-16 16:26   ` Petr Mladek
2016-12-23 12:58   ` Miroslav Benes
2017-01-10  9:14   ` Kamalesh Babulal
2016-12-08 18:08 ` [PATCH v3 10/15] livepatch: move patching functions into patch.c Josh Poimboeuf
2016-12-16 16:49   ` Petr Mladek
2016-12-23 13:06   ` Miroslav Benes
2017-01-10  9:15   ` Kamalesh Babulal
2016-12-08 18:08 ` [PATCH v3 11/15] livepatch: use kstrtobool() in enabled_store() Josh Poimboeuf
2016-12-16 16:55   ` Petr Mladek
2016-12-16 22:19     ` Josh Poimboeuf
2016-12-23 13:13       ` Miroslav Benes
2016-12-08 18:08 ` [PATCH v3 12/15] livepatch: store function sizes Josh Poimboeuf
2016-12-19 13:10   ` Petr Mladek
2016-12-23 13:40   ` Miroslav Benes
2017-01-11 10:09   ` Kamalesh Babulal
2016-12-08 18:08 ` [PATCH v3 13/15] livepatch: change to a per-task consistency model Josh Poimboeuf
2016-12-20 17:32   ` Petr Mladek
2016-12-21 21:25     ` Josh Poimboeuf
2016-12-22 14:34       ` Petr Mladek
2016-12-22 18:31         ` Josh Poimboeuf
2017-01-10 13:00           ` Petr Mladek
2017-01-10 20:46             ` Josh Poimboeuf
2017-01-11 15:18               ` Petr Mladek
2017-01-11 15:26                 ` Josh Poimboeuf
2016-12-23  9:24       ` Miroslav Benes
2016-12-23 10:18         ` Petr Mladek
2017-01-06 20:07           ` Josh Poimboeuf
2017-01-10 10:40             ` Petr Mladek
2017-01-04 13:44   ` Miroslav Benes
2017-01-06 21:01     ` Josh Poimboeuf
2017-01-10 10:45       ` Miroslav Benes
2017-01-05  9:34   ` Miroslav Benes
2017-01-06 21:04     ` Josh Poimboeuf
2016-12-08 18:08 ` [PATCH v3 14/15] livepatch: add /proc/<pid>/patch_state Josh Poimboeuf
2016-12-21 11:20   ` Petr Mladek
2017-01-04 14:50   ` Miroslav Benes
2016-12-08 18:08 ` [PATCH v3 15/15] livepatch: allow removal of a disabled patch Josh Poimboeuf
2016-12-21 14:44   ` Petr Mladek
2017-01-04 14:57   ` Miroslav Benes
2017-01-06 21:04     ` Josh Poimboeuf
2016-12-10  5:46 ` [PATCH v3 00/15] livepatch: hybrid consistency model Balbir Singh
2016-12-10 17:17   ` Josh Poimboeuf
2016-12-11  2:08     ` Balbir Singh
2016-12-12 14:04       ` Josh Poimboeuf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).