Re: [PATCH v5 00/15] livepatch: hybrid consistency model

2017-03-08 Thread Jiri Kosina
On Mon, 13 Feb 2017, Josh Poimboeuf wrote:

> Here's v5 of the consistency model

I have ammended the patches with all the received ACKs and applied to 
'for-4.12/klp-hybrid-consistency-model' branch of livepatching.git.

Thanks,

-- 
Jiri Kosina
SUSE Labs



Re: [PATCH v5 00/15] livepatch: hybrid consistency model

2017-03-07 Thread Ingo Molnar

* Josh Poimboeuf  wrote:

>  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   |  13 +-
>  arch/x86/include/asm/unwind.h|   6 +
>  arch/x86/kernel/stacktrace.c |  96 +++-
>  arch/x86/kernel/unwind_frame.c   |   2 +

for the x86 and scheduler changes:

Acked-by: Ingo Molnar 

Thanks,

Ingo


Re: [PATCH v5 00/15] livepatch: hybrid consistency model

2017-02-17 Thread Miroslav Benes
On Mon, 13 Feb 2017, Josh Poimboeuf wrote:

> Here's v5 of the consistency model, targeted for 4.12.  Only a few minor
> changes this time.
> 
> v5:
> - return -EINVAL in __save_stack_trace_reliable()
> - only call show_stack() once
> - add save_stack_trace_tsk_reliable() define for !CONFIG_STACKTRACE
> - update kernel version and date in ABI doc
> - make suggested improvements to livepatch.txt
> - update barrier comments
> - remove klp_try_complete_transition() call from klp_start_transition()
> - move end of klp_try_complete_transition() into klp_complete_transition()
> - fix __klp_enable_patch() error path
> - check for transition in klp_module_going()

All the changes since v4 look good to me (except for module_put() in 
__klp_enable_patch() mentioned elsewhere).

Thanks,
Miroslav


[PATCH v5 00/15] livepatch: hybrid consistency model

2017-02-13 Thread Josh Poimboeuf
Here's v5 of the consistency model, targeted for 4.12.  Only a few minor
changes this time.

I would very much appreciate reviews/acks from the following:

- Michael Ellerman for the powerpc changes in patch 5.

- Heiko Carstens for the s390 changes in patches 6 & 7.

- Peter Zijlstra/Ingo Molnar for the use of task_rq_lock() and the
  modification of do_idle() in patch 13.

Thanks!

Based on linux-next/master (20170213).

v5:
- return -EINVAL in __save_stack_trace_reliable()
- only call show_stack() once
- add save_stack_trace_tsk_reliable() define for !CONFIG_STACKTRACE
- update kernel version and date in ABI doc
- make suggested improvements to livepatch.txt
- update barrier comments
- remove klp_try_complete_transition() call from klp_start_transition()
- move end of klp_try_complete_transition() into klp_complete_transition()
- fix __klp_enable_patch() error path
- check for transition in klp_module_going()

v4:
- add warnings for "impossible" scenarios in __save_stack_trace_reliable()
- sort _TIF_ALLWORK_MASK flags
- move klp_transition_work to transition.c.  This resulted in the following 
  related changes:
  - klp_mutex is now visible to transition.c
  - klp_start_transition() now calls klp_try_complete_transition()
  - klp_try_complete_transition() now sets up the work
  - rearrange code in transition.c accordingly
- klp_reverse_transition(): clear TIF flags and call synchronize_rcu()
- klp_try_complete_transition(): do synchronize_rcu() only when unpatching
- klp_start_transition(): only set TIF flags when necessary
- klp_complete_transition(): add synchronize_rcu() when patching
- klp_ftrace_handler(): put WARN_ON_ONCE back in and add comment
- use for_each_possible_cpu() to patch offline idle tasks
- add warnings to sample module when setting patch.immediate
- don't use pr_debug() with the task rq lock
- add documentation about porting consistency model to other arches
- move klp_patch_pending() to patch 13
- improve several comments and commit messages

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