Re: [PATCH] Revert "kbuild: use -flive-patching when CONFIG_LIVEPATCH is enabled"

2020-07-21 Thread Miroslav Benes
; > This reverts commit 43bd3a95c98e1a86b8b55d97f745c224ecff02b9. > > Fixes: 43bd3a95c98e ("kbuild: use -flive-patching when CONFIG_LIVEPATCH is > enabled") > Reported-by: Randy Dunlap > Signed-off-by: Josh Poimboeuf Acked-by: Miroslav Benes M

Re: [PATCH 3/3] arm64: stacktrace: Convert to ARCH_STACKWALK

2020-07-17 Thread Miroslav Benes
On Thu, 16 Jul 2020, Mark Brown wrote: > On Thu, Jul 16, 2020 at 01:56:13PM +0200, Miroslav Benes wrote: > > On Wed, 15 Jul 2020, Mark Brown wrote: > > > > -void save_stack_trace(struct stack_trace *trace) > > > -{ > > > - __save_stack_trace(current,

Re: [PATCH 1/3] stacktrace: Remove reliable argument from arch_stack_walk() callback

2020-07-17 Thread Miroslav Benes
On Wed, 15 Jul 2020, Mark Brown wrote: > Currently the callback passed to arch_stack_walk() has an argument called > reliable passed to it to indicate if the stack entry is reliable, a comment > says that this is used by some printk() consumers. However in the current > kernel none of the

Re: [PATCH 3/3] arm64: stacktrace: Convert to ARCH_STACKWALK

2020-07-16 Thread Miroslav Benes
Hi, On Wed, 15 Jul 2020, Mark Brown wrote: > Historically architectures have had duplicated code in their stack trace > implementations for filtering what gets traced. In order to avoid this > duplication some generic code has been provided using a new interface > arch_stack_walk(), enabled by

Re: linux-next: Tree for Jun 23 (objtool (2))

2020-07-16 Thread Miroslav Benes
On Wed, 15 Jul 2020, Josh Poimboeuf wrote: > On Wed, Jul 15, 2020 at 03:41:55PM +0200, Petr Mladek wrote: > > On Wed 2020-07-15 14:10:54, Petr Mladek wrote: > > > On Wed 2020-07-15 13:11:14, Miroslav Benes wrote: > > > > Petr, would you agree to revert -flive-patch

Re: linux-next: Tree for Jun 23 (objtool (2))

2020-07-15 Thread Miroslav Benes
On Tue, 14 Jul 2020, Josh Poimboeuf wrote: > On Tue, Jul 14, 2020 at 12:56:21PM +0200, Miroslav Benes wrote: > > On Thu, 2 Jul 2020, Josh Poimboeuf wrote: > > > > > On Tue, Jun 23, 2020 at 08:06:07AM -0700, Randy Dunlap wrote: > > > > On 6/22/20 11:28 PM, Step

Re: [PATCH v2] selftests/livepatch: adopt to newer sysctl error format

2020-07-14 Thread Miroslav Benes
sions using '-q' option. > > Explicitly print the final status on success so that it can be verified > in the log. The error message is enough on failure. > > Reported-by: Kamalesh Babulal > Signed-off-by: Petr Mladek Acked-by: Miroslav Benes M

Re: linux-next: Tree for Jun 23 (objtool (2))

2020-07-14 Thread Miroslav Benes
On Thu, 2 Jul 2020, Josh Poimboeuf wrote: > On Tue, Jun 23, 2020 at 08:06:07AM -0700, Randy Dunlap wrote: > > On 6/22/20 11:28 PM, Stephen Rothwell wrote: > > > Hi all, > > > > > > Changes since 20200622: > > > > > > > on x86_64: > > > > arch/x86/kernel/cpu/mce/core.o: warning: objtool:

Re: [RFC][PATCH v5 03/51] objtool: Make recordmcount into mcount subcmd

2020-06-25 Thread Miroslav Benes
On Thu, 18 Jun 2020, Matt Helsley wrote: > Rather than a standalone executable merge recordmcount as a sub command > of objtool. This is a small step towards cleaning up recordmcount and > eventually sharing ELF code with objtool. > > For the initial step all that's required is a bit of

Re: [RFC][PATCH v5 01/51] objtool: Factor out reasons to build objtool

2020-06-24 Thread Miroslav Benes
Hi, this is a nice improvement. > diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile > index 7770edcda3a0..aa0c6d3d2d46 100644 > --- a/tools/objtool/Makefile > +++ b/tools/objtool/Makefile > @@ -1,6 +1,7 @@ > # SPDX-License-Identifier: GPL-2.0 > include ../scripts/Makefile.include >

Re: [PATCH] objtool: Free memory in error case in special_get_alts

2020-06-15 Thread Miroslav Benes
Hi, On Fri, 12 Jun 2020, Tobias Klauser wrote: > Avoid a memory leak in case get_alt_entry returns an error. yes, this is not the only one, but I doubt we want to spend time on that. The process is about to exit anyway. Miroslav > Signed-off-by: Tobias Klauser > --- >

Re: [PATCH 0/7] Make check implementation arch agnostic

2020-06-10 Thread Miroslav Benes
5 add abstraction to handle alternatives > - Patch 6 adds abstraction to handle jump table > - Patch 7 abstracts the use of unwind hints. Adding it as RFC as I'm sure > there's room for improvement. Reviewed-by: Miroslav Benes for patches 1-6. M

Re: [RFC PATCH 7/7] objtool: Make unwind_hints available for all architectures

2020-06-10 Thread Miroslav Benes
Hi Julien, On Mon, 8 Jun 2020, Julien Thierry wrote: > Unwind hints are useful to give some information about the call frame > or stack states in non-standard code. > > Despite unwind hints being used in arch-independent code, the > unwind_hint structure type itself is define in x86 kernel

Re: [PATCH v2 0/4] Remove dependency of check subcmd upon orc

2020-06-09 Thread Miroslav Benes
4.html > [2] https://lkml.org/lkml/2020/6/4/675 Reviewed-by: Miroslav Benes M

Re: [PATCH v2 1/4] selftests/livepatch: simplify test-klp-callbacks busy target tests

2020-06-05 Thread Miroslav Benes
gt; Signed-off-by: Joe Lawrence Acked-by: Miroslav Benes M

Re: [PATCH 4/4] objtool: orc_gen: Move orc_entry out of instruction structure

2020-06-05 Thread Miroslav Benes
Hi, a nit below... On Thu, 4 Jun 2020, Julien Thierry wrote: > One orc_entry is associated with each instruction in the object file, > but having the orc_entry contained by the instruction structure forces > architectures not implementing the orc subcommands to provide a dummy > definition of

Re: [PATCH] kernel/modules: fix build without ARCH_HAS_STRICT_MODULE_RWX

2020-06-05 Thread Miroslav Benes
Hi, On Thu, 4 Jun 2020, Max Filippov wrote: > On configurations with CONFIG_ARCH_HAS_STRICT_MODULE_RWX disabled kernel > build fails with the following message: > > kernel/module.c:3593:2: error: implicit declaration of function > ‘module_enable_ro’; > > Add empty module_enable_ro

Re: [PATCH] module: make module symbols visible after init

2020-06-03 Thread Miroslav Benes
Hi, I'm confused... On Wed, 3 Jun 2020, Cheng Jian wrote: > When lookup the symbols of module by module_kallsyms_lookup_name(), > the symbols address is visible only if the module's status isn't > MODULE_STATE_UNFORMED, This is problematic. > > When complete_formation is done, the state of the

Re: linux-next: Tree for May 21 (objtool warnings)

2020-05-26 Thread Miroslav Benes
On Tue, 26 May 2020, Josh Poimboeuf wrote: > On Mon, May 25, 2020 at 01:07:27PM +0200, Miroslav Benes wrote: > > > I'll try to find out which optimization does this, because it is a > > > slightly different scenario than hiding __noreturn from the callees. > > >

Re: linux-next: Tree for May 21 (objtool warnings)

2020-05-25 Thread Miroslav Benes
> I'll try to find out which optimization does this, because it is a > slightly different scenario than hiding __noreturn from the callees. > Probably -fno-ipa-pure-const again. And it is indeed -fno-ipa-pure-const again. Miroslav

Re: linux-next: Tree for May 21 (objtool warnings)

2020-05-25 Thread Miroslav Benes
On Thu, 21 May 2020, Randy Dunlap wrote: > On 5/21/20 7:12 AM, Stephen Rothwell wrote: > > Hi all, > > > > Changes since 20200519: > > These are indeed caused by -flive-patching > on x86_64: > > fs/open.o: warning: objtool: chmod_common()+0x104: unreachable instruction > fs/namei.o:

Re: [PATCH -tip urgent] x86/unwind/orc: Fix error handling in __unwind_start()

2020-05-15 Thread Miroslav Benes
inder/orc: Dont bail on stack overflow") > Fixes: 98d0c8ebf77e ("x86/unwind/orc: Prevent unwinding before ORC > initialization") > Reported-by: Pavel Machek > Signed-off-by: Josh Poimboeuf Reviewed-by: Miroslav Benes M

Re: [PATCH] MAINTAINERS: add lib/livepatch to LIVE PATCHING

2020-05-15 Thread Miroslav Benes
On Fri, 15 May 2020, Kamalesh Babulal wrote: > Add lib/livepatch to list of livepatching F: patterns in MAINTAINERS. > > Suggested-by: Jiri Kosina > Signed-off-by: Kamalesh Babulal Acked-by: Miroslav Benes M

Re: [PATCH] MAINTAINERS: Update LIVE PATCHING file list

2020-05-11 Thread Miroslav Benes
> > Signed-off-by: Kamalesh Babulal Acked-by: Miroslav Benes M

Re: linux-next: manual merge of the livepatching tree with the modules tree

2020-05-11 Thread Miroslav Benes
On Fri, 8 May 2020, Stephen Rothwell wrote: > Hi all, > > Today's linux-next merge of the livepatching tree got a conflict in: > > kernel/module.c > > between commits: > > db991af02f11 ("module: break nested ARCH_HAS_STRICT_MODULE_RWX and > STRICT_MODULE_RWX #ifdefs") > 5c3a7db0c7ec

Re: [patch V4 part 1 05/36] x86/entry: Flip _TIF_SIGPENDING and _TIF_NOTIFY_RESUME handling

2020-05-06 Thread Miroslav Benes
On Tue, 5 May 2020, Thomas Gleixner wrote: > Make sure task_work runs before any kind of userspace -- very much > including signals -- is invoked. I might be missing something, but isn't this guaranteed by do_signal()->get_signal()->task_work_run() path? Miroslav

[tip: objtool/core] objtool: Move the IRET hack into the arch decoder

2020-05-01 Thread tip-bot2 for Miroslav Benes
The following commit has been merged into the objtool/core branch of tip: Commit-ID: b490f45362002fef57996388e395efc974b013f4 Gitweb: https://git.kernel.org/tip/b490f45362002fef57996388e395efc974b013f4 Author:Miroslav Benes AuthorDate:Fri, 24 Apr 2020 16:30:42 +02:00

Re: [PATCH v4 11/11] module: Make module_enable_ro() static again

2020-04-30 Thread Miroslav Benes
ce this patch is separate from the rest and it's based on > modules-next, I can just take this last patch through the modules tree. It depends on 8/11 of the series. Acked-by: Miroslav Benes for the patch. M

Re: [PATCH v2 00/14] objtool vs retpoline

2020-04-29 Thread Miroslav Benes
on for them, which > in turn means we can now unwind through a retpoline. > > New since last time: > > - 1-3, alternatives vs ORC unwind > - 7-9: implement some suggestions from Julien > - addressed feedback You can add my Reviewed-by: Miroslav Benes to patches 1A, 1B and

Re: [PATCH v2 02/14] objtool: Fix ORC vs alternatives

2020-04-29 Thread Miroslav Benes
On Wed, 29 Apr 2020, Peter Zijlstra wrote: > On Wed, Apr 29, 2020 at 04:33:31PM +0200, Miroslav Benes wrote: > > On Tue, 28 Apr 2020, Peter Zijlstra wrote: > > > /* > > > + * Alternatives should not contain any ORC entries, this in turn means > > > they >

Re: [PATCH v2 02/14] objtool: Fix ORC vs alternatives

2020-04-29 Thread Miroslav Benes
On Tue, 28 Apr 2020, Peter Zijlstra wrote: > Jann reported that (for instance) entry_64.o:general_protection has > very odd ORC data: > > 0f40 : > ###sp:sp+8 bp:(und) type:iret end:0 > f40: 90 nop > ###sp:(und) bp:(und) type:call end:0 >

Re: [PATCH v3 00/10] livepatch,module: Remove .klp.arch and module_disable_ro()

2020-04-28 Thread Miroslav Benes
| 177 +++--- > kernel/module.c | 23 +-- > 12 files changed, 277 insertions(+), 228 deletions(-) > delete mode 100644 arch/x86/kernel/livepatch.c With the small issue in patch 2 fixed Acked-by: Miroslav Benes Great stuff. I am happy we will get rid of the arch-specific code. M

Re: [PATCH v3 02/10] livepatch: Apply vmlinux-specific KLP relocations early

2020-04-28 Thread Miroslav Benes
> @@ -738,18 +765,23 @@ static int klp_init_object_loaded(struct klp_patch > *patch, > int ret; > > mutex_lock(_mutex); > - > module_disable_ro(patch->mod); > - ret = klp_write_object_relocations(patch->mod, obj); > - if (ret) { > -

Re: [PATCH v3 5/6] x86/ftrace: Use text_poke()

2019-10-23 Thread Miroslav Benes
On Tue, 22 Oct 2019, Josh Poimboeuf wrote: > On Tue, Oct 22, 2019 at 10:27:49AM +0200, Miroslav Benes wrote: > > > Does that sound like what you had in mind or am I totally off? > > > > Sort of. What I had in mind was that we could get rid of all special .klp > >

Re: [PATCH v3 5/6] x86/ftrace: Use text_poke()

2019-10-22 Thread Miroslav Benes
On Wed, 16 Oct 2019, Peter Zijlstra wrote: > On Wed, Oct 16, 2019 at 08:51:27AM +0200, Miroslav Benes wrote: > > On Tue, 15 Oct 2019, Joe Lawrence wrote: > > > > > On 10/15/19 10:13 AM, Miroslav Benes wrote: > > > > Yes, it does. klp_module_comin

Re: [PATCH v3 5/6] x86/ftrace: Use text_poke()

2019-10-22 Thread Miroslav Benes
On Fri, 18 Oct 2019, Jessica Yu wrote: > +++ Miroslav Benes [16/10/19 15:29 +0200]: > >On Wed, 16 Oct 2019, Miroslav Benes wrote: > > > >> On Wed, 16 Oct 2019, Peter Zijlstra wrote: > >> > >> > On Tue, Oct 15, 2019 at 06:27:05PM -0400, Steven Roste

Re: [PATCH v3 0/3] ftrace: Introduce PERMANENT ftrace_ops flag

2019-10-16 Thread Miroslav Benes
On Wed, 16 Oct 2019, Steven Rostedt wrote: > On Wed, 16 Oct 2019 13:33:12 +0200 > Miroslav Benes wrote: > > > Livepatch uses ftrace for redirection to new patched functions. It means > > that if ftrace is disabled, all live patched functions are disabled as >

Re: [PATCH v3 5/6] x86/ftrace: Use text_poke()

2019-10-16 Thread Miroslav Benes
On Wed, 16 Oct 2019, Miroslav Benes wrote: > On Wed, 16 Oct 2019, Peter Zijlstra wrote: > > > On Tue, Oct 15, 2019 at 06:27:05PM -0400, Steven Rostedt wrote: > > > > > (7) Seventh session, titled "klp-convert and livepatch relocations", was > > &g

[PATCH v3 2/3] selftests/livepatch: Make dynamic debug setup and restore generic

2019-10-16 Thread Miroslav Benes
From: Joe Lawrence Livepatch selftests currently save the current dynamic debug config and tweak it for the selftests. The config is restored at the end. Make the infrastructure generic, so that more variables can be saved and restored. Signed-off-by: Joe Lawrence Signed-off-by: Miroslav Benes

[PATCH v3 3/3] selftests/livepatch: Test interaction with ftrace_enabled

2019-10-16 Thread Miroslav Benes
nvironment configuration that is saved and restored when running the selftests. Signed-off-by: Joe Lawrence Signed-off-by: Miroslav Benes --- tools/testing/selftests/livepatch/Makefile| 3 +- .../testing/selftests/livepatch/functions.sh | 14 +++- .../selftests/livepatch/test-ftrace.sh

[PATCH v3 1/3] ftrace: Introduce PERMANENT ftrace_ops flag

2019-10-16 Thread Miroslav Benes
-by: Miroslav Benes Reviewed-by: Petr Mladek Reviewed-by: Kamalesh Babulal --- Documentation/trace/ftrace-uses.rst | 8 Documentation/trace/ftrace.rst | 4 +++- include/linux/ftrace.h | 3 +++ kernel/livepatch/patch.c| 3 ++- kernel/trace/ftrace.c

[PATCH v3 0/3] ftrace: Introduce PERMANENT ftrace_ops flag

2019-10-16 Thread Miroslav Benes
action with ftrace_enabled Miroslav Benes (1): ftrace: Introduce PERMANENT ftrace_ops flag Documentation/trace/ftrace-uses.rst | 8 +++ Documentation/trace/ftrace.rst| 4 +- include/linux/ftrace.h| 3 + kernel/livepatch/patch.c

Re: [PATCH v3 5/6] x86/ftrace: Use text_poke()

2019-10-16 Thread Miroslav Benes
On Wed, 16 Oct 2019, Peter Zijlstra wrote: > On Tue, Oct 15, 2019 at 06:27:05PM -0400, Steven Rostedt wrote: > > > (7) Seventh session, titled "klp-convert and livepatch relocations", was led > > by Joe Lawrence. > > > > Joe started the session with problem statement: accessing non exported /

Re: [PATCH v3 5/6] x86/ftrace: Use text_poke()

2019-10-16 Thread Miroslav Benes
On Wed, 16 Oct 2019, Peter Zijlstra wrote: > > which are not compatible with livepatching. GCC upstream now has > > -flive-patching option, which disables all those interfering optimizations. > > Which, IIRC, has a significant performance impact and should thus really > not be used...

Re: [PATCH v3 5/6] x86/ftrace: Use text_poke()

2019-10-16 Thread Miroslav Benes
On Tue, 15 Oct 2019, Joe Lawrence wrote: > On 10/15/19 10:13 AM, Miroslav Benes wrote: > > Yes, it does. klp_module_coming() calls module_disable_ro() on all > > patching modules which patch the coming module in order to call > > apply_relocate_add(). New (patching)

Re: [PATCH v3 5/6] x86/ftrace: Use text_poke()

2019-10-15 Thread Miroslav Benes
[ live-patching ML CCed ] On Tue, 15 Oct 2019, Peter Zijlstra wrote: > On Tue, Oct 15, 2019 at 03:07:40PM +0200, Jessica Yu wrote: > > > > The fact that it is executable; also the fact that you do it right after > > > we mark it ro. Flipping the memory protections back and forth is just > > >

Re: [PATCH v2] ftrace: Introduce PERMANENT ftrace_ops flag

2019-10-15 Thread Miroslav Benes
On Tue, 15 Oct 2019, Joe Lawrence wrote: > On 10/15/19 7:23 AM, Miroslav Benes wrote: > >> Hi Miroslav, > >> > >> Maybe we should add a test to verify this new behavior? See sample > >> version below (lightly tested). We can add to this one,

Re: [PATCH v2] ftrace: Introduce PERMANENT ftrace_ops flag

2019-10-15 Thread Miroslav Benes
> Hi Miroslav, > > Maybe we should add a test to verify this new behavior? See sample > version below (lightly tested). We can add to this one, or patch > seperately if you prefer. Thanks a lot, Joe. It looks nice. I'll include it in v3. One question below. > -->8-- -->8-- -->8-- -->8--

Re: [PATCH v2] ftrace: Introduce PERMANENT ftrace_ops flag

2019-10-15 Thread Miroslav Benes
On Tue, 15 Oct 2019, Petr Mladek wrote: > On Mon 2019-10-14 11:17:19, Steven Rostedt wrote: > > On Mon, 14 Oct 2019 12:59:23 +0200 > > Miroslav Benes wrote: > > > > > int > > > ftrace_enable_sysctl(struct ctl_table *table, int write, > > >

[PATCH v2] ftrace: Introduce PERMANENT ftrace_ops flag

2019-10-14 Thread Miroslav Benes
-by: Miroslav Benes --- v1->v2: - different logic, proposed by Joe Lawrence Two things I am not sure about much: - return codes. I chose EBUSY, because it seemed the least inappropriate. I usually pick the wrong one, so suggestions are welcome. - I did not add any pr_* reporting the prob

Re: [PATCH 0/3] ftrace: Introduce PERMANENT ftrace_ops flag

2019-10-10 Thread Miroslav Benes
On Thu, 10 Oct 2019, Steven Rostedt wrote: > On Thu, 10 Oct 2019 10:50:35 +0200 > Petr Mladek wrote: > > > It will make the flag unusable for other ftrace users. But it > > will be already be the case when it can't be disabled. > > Honestly, I hate that flag. Most people don't even know about

Re: [PATCH 0/3] ftrace: Introduce PERMANENT ftrace_ops flag

2019-10-09 Thread Miroslav Benes
On Tue, 8 Oct 2019, Steven Rostedt wrote: > On Tue, 8 Oct 2019 15:35:34 -0400 > Joe Lawrence wrote: > > > > > I wonder if the opposite would be more intuitive: when ftrace_enabled is > > not set, don't allow livepatches to register ftrace filters and > > likewise, don't allow ftrace_enabled to

Re: [PATCH v2 3/4] module: Properly propagate MODULE_STATE_COMING failure

2019-10-08 Thread Miroslav Benes
On Mon, 7 Oct 2019, Peter Zijlstra wrote: > Now that notifiers got unbroken; use the proper interface to handle > notifier errors and propagate them. > > There were already MODULE_STATE_COMING notifiers that failed; notably: > > - jump_label_module_notifier() > - tracepoint_module_notify() >

[PATCH 1/3] ftrace: Make test_rec_ops_needs_regs() generic

2019-10-07 Thread Miroslav Benes
Function test_rec_ops_needs_regs() tests whether ftrace_ops registered on a record needs saved regs. That is, it tests for FTRACE_OPS_FL_SAVE_REGS being set. The same logic will be reused for newly introduced FTRACE_OPS_FL_PERMANENT flag, so make the function generic. Signed-off-by: Miroslav

[PATCH 0/3] ftrace: Introduce PERMANENT ftrace_ops flag

2019-10-07 Thread Miroslav Benes
, but it still may be surprising. Introduce PERMANENT ftrace_ops flag to amend this. If the FTRACE_OPS_FL_PERMANENT is set, the tracing of the function is not disabled. Such ftrace_ops can still be unregistered in a standard way. The patch set passes ftrace and livepatch kselftests. Miroslav Benes (3

[PATCH 3/3] livepatch: Use FTRACE_OPS_FL_PERMANENT

2019-10-07 Thread Miroslav Benes
Use FTRACE_OPS_FL_PERMANENT flag to be immune to toggling the 'ftrace_enabled' sysctl knob. Signed-off-by: Miroslav Benes --- kernel/livepatch/patch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/livepatch/patch.c b/kernel/livepatch/patch.c index bd43537702bd

[PATCH 2/3] ftrace: Introduce PERMANENT ftrace_ops flag

2019-10-07 Thread Miroslav Benes
, but it still may be surprising. Introduce PERMANENT ftrace_ops flag to amend this. If the FTRACE_OPS_FL_PERMANENT is set, the tracing of the function is not disabled. Such ftrace_ops can still be unregistered in a standard way. Signed-off-by: Miroslav Benes --- Documentation/trace/ftrace-uses.rst

Re: [RFC PATCH v2 1/3] livepatch: Clear relocation targets on a module removal

2019-10-03 Thread Miroslav Benes
On Wed, 2 Oct 2019, Josh Poimboeuf wrote: > On Thu, Sep 05, 2019 at 02:45:12PM +0200, Miroslav Benes wrote: > > Josh reported a bug: > > > > When the object to be patched is a module, and that module is > > rmmod'ed and reloaded, it fails to load with: >

Re: [RFC PATCH v2 3/3] livepatch: Clean up klp_update_object_relocations() return paths

2019-10-03 Thread Miroslav Benes
On Wed, 2 Oct 2019, Petr Mladek wrote: > On Thu 2019-09-05 14:45:14, Miroslav Benes wrote: > > Signed-off-by: Miroslav Benes > > This might depend on personal preferences. True. > What was the motivation > for this patch, please? Did it just follow some common > style

Re: [RFC PATCH v2 1/3] livepatch: Clear relocation targets on a module removal

2019-10-03 Thread Miroslav Benes
On Wed, 2 Oct 2019, Petr Mladek wrote: > On Thu 2019-09-05 14:45:12, Miroslav Benes wrote: > > We thus decided to reverse the relocation patching (clear all relocation > > targets on x86_64, or return back nops on powerpc). The solution is not > > universal and is t

Re: [RFC PATCH v2 0/3] livepatch: Clear relocation targets on a module removal

2019-10-01 Thread Miroslav Benes
On Thu, 5 Sep 2019, Miroslav Benes wrote: > Updated version with Petr's feedback. It looks a bit different and > better now (I would say). Not that it should be considered before we > decide what to do with late module patching, but I finished it before > the discussion started and s

Re: [RFC patch 14/15] workpending: Provide infrastructure for work before entering a guest

2019-09-26 Thread Miroslav Benes
> --- a/include/linux/entry-common.h > +++ b/include/linux/entry-common.h [...] > +#define EXIT_TO_GUESTMODE_WORK > \ > + (_TIF_NEED_RESCHED | _TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \ > + ARCH_EXIT_TO_GUESTMODE_WORK) [...] > ---

Re: [RFC PATCH 2/2] livepatch: Clear relocation targets on a module removal

2019-09-06 Thread Miroslav Benes
> > Now, I don't think that replacing .ko on disk is a good idea. We've > > already discussed it. It would lead to a maintenance/packaging problem, > > because you never know which version of the module is loaded in the > > system. The state space grows rather rapidly there. > > What exactly

Re: [RFC PATCH 2/2] livepatch: Clear relocation targets on a module removal

2019-09-05 Thread Miroslav Benes
On Thu, 5 Sep 2019, Josh Poimboeuf wrote: > On Thu, Sep 05, 2019 at 02:03:34PM +0200, Miroslav Benes wrote: > > > > + I would like to better understand the scope of the current > > > > problems. It is about modifying code in the livepatch that > > > >

[RFC PATCH v2 2/3] livepatch: Unify functions for writing and clearing object relocations

2019-09-05 Thread Miroslav Benes
Functions klp_write_object_relocations() and klp_clear_object_relocations() share a lot of code. Take the code out to a common function and provide the specific actions through callbacks. Signed-off-by: Miroslav Benes --- kernel/livepatch/core.c | 84 + 1

[RFC PATCH v2 0/3] livepatch: Clear relocation targets on a module removal

2019-09-05 Thread Miroslav Benes
/20190719122840.15353-1-mbe...@suse.cz Tested on x86_64, ppc64le and s390x. Cross-compiled on arm64 to verify that nothing is broken. [1] 20180602161151.apuhs2dygsexmcg2@treble [2] 1561019068-132672-1-git-send-email-cj.chengj...@huawei.com [3] 20180607092949.1706-1-mbe...@suse.cz Miroslav Benes (3

[RFC PATCH v2 3/3] livepatch: Clean up klp_update_object_relocations() return paths

2019-09-05 Thread Miroslav Benes
Signed-off-by: Miroslav Benes --- kernel/livepatch/core.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c index 023c9333c276..73d5add5 100644 --- a/kernel/livepatch/core.c +++ b/kernel/livepatch/core.c @@ -251,7

[RFC PATCH v2 1/3] livepatch: Clear relocation targets on a module removal

2019-09-05 Thread Miroslav Benes
us decided to reverse the relocation patching (clear all relocation targets on x86_64, or return back nops on powerpc). The solution is not universal and is too much arch-specific, but it may prove to be simpler in the end. Reported-by: Josh Poimboeuf Signed-off-by: Miroslav Benes --- arch/powe

Re: [RFC PATCH 2/2] livepatch: Clear relocation targets on a module removal

2019-09-05 Thread Miroslav Benes
On Wed, 4 Sep 2019, Josh Poimboeuf wrote: > On Tue, Sep 03, 2019 at 03:02:34PM +0200, Miroslav Benes wrote: > > On Mon, 2 Sep 2019, Joe Lawrence wrote: > > > > > On 9/2/19 12:13 PM, Miroslav Benes wrote: > > > >> I can easily foresee more pr

Re: [RFC PATCH 2/2] livepatch: Clear relocation targets on a module removal

2019-09-05 Thread Miroslav Benes
On Wed, 4 Sep 2019, Josh Poimboeuf wrote: > On Wed, Sep 04, 2019 at 10:49:32AM +0200, Petr Mladek wrote: > > On Tue 2019-09-03 15:02:34, Miroslav Benes wrote: > > > On Mon, 2 Sep 2019, Joe Lawrence wrote: > > > > > > > On 9/2/19 12:13 PM, Miroslav Benes

Re: [RFC PATCH 2/2] livepatch: Clear relocation targets on a module removal

2019-09-05 Thread Miroslav Benes
[...] > I wonder what is necessary for a productive discussion on Plumbers: [...] > + It might be useful to prepare overview of the existing proposals > and agree on the positives and negatives. I am afraid that some > of them might depend on the customer base and > use

Re: [RFC PATCH 2/2] livepatch: Clear relocation targets on a module removal

2019-09-03 Thread Miroslav Benes
On Mon, 2 Sep 2019, Joe Lawrence wrote: > On 9/2/19 12:13 PM, Miroslav Benes wrote: > >> I can easily foresee more problems like those in the future. Going > >> forward we have to always keep track of which special sections are > >> needed for which architecture

Re: [RFC PATCH 2/2] livepatch: Clear relocation targets on a module removal

2019-09-02 Thread Miroslav Benes
> I can easily foresee more problems like those in the future. Going > forward we have to always keep track of which special sections are > needed for which architectures. Those special sections can change over > time, or can simply be overlooked for a given architecture. It's > fragile.

Re: [PATCH 1/3] ftrace: introdue ftrace_call_init

2019-08-20 Thread Miroslav Benes
Hi, On Mon, 19 Aug 2019, Jisheng Zhang wrote: > On some arch, the FTRACE_WITH_REGS is implemented with gcc's > -fpatchable-function-entry (=2), gcc adds 2 NOPs at the beginning > of each function, so this makes the MCOUNT_ADDR useless. In ftrace > common framework, MCOUNT_ADDR is mostly used to

Re: [PATCH v4 06/10] modpost: Add modinfo flag to livepatch modules

2019-08-20 Thread Miroslav Benes
> > How is this feature supposed to work for external modules? > > > > klp-convert receives: > > "symbols from vmlinux" + "symbols from no-klp in-tree modules" > > + "symbols from no-klp external modules" ?? > > > > I don't think that this use-case has been previously thought out (Miroslav, >

Re: [PATCH v4 06/10] modpost: Add modinfo flag to livepatch modules

2019-08-19 Thread Miroslav Benes
On Mon, 19 Aug 2019, Masahiro Yamada wrote: > On Fri, Aug 16, 2019 at 9:43 PM Joe Lawrence wrote: > > > > On 8/16/19 4:19 AM, Miroslav Benes wrote: > > > Hi, > > > > > >> I cleaned up the build system, and pushed it based on my > > >>

Re: [PATCH v4 06/10] modpost: Add modinfo flag to livepatch modules

2019-08-16 Thread Miroslav Benes
Hi, > I cleaned up the build system, and pushed it based on my > kbuild tree. > > Please see: > > git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git > klp-cleanup This indeed looks much simpler and cleaner (as far as I can judge with my limited kbuild knowledge). We just

Re: [RFC PATCH 2/2] livepatch: Clear relocation targets on a module removal

2019-08-14 Thread Miroslav Benes
On Mon, 22 Jul 2019, Petr Mladek wrote: > On Fri 2019-07-19 14:28:40, Miroslav Benes wrote: > > Josh reported a bug: > > > > When the object to be patched is a module, and that module is > > rmmod'ed and reloaded, it fails to load with: > > > >

Re: [RFC PATCH 2/2] livepatch: Clear relocation targets on a module removal

2019-08-14 Thread Miroslav Benes
On Sun, 28 Jul 2019, Josh Poimboeuf wrote: > On Fri, Jul 19, 2019 at 02:28:40PM +0200, Miroslav Benes wrote: > > Josh reported a bug: > > > > When the object to be patched is a module, and that module is > > rmmod'ed and reloaded, it fails to load with: >

Re: [PATCH] s390/livepatch: Implement reliable stack tracing for the consistency model

2019-08-14 Thread Miroslav Benes
> > diff --git a/arch/s390/include/asm/unwind.h b/arch/s390/include/asm/unwind.h > > index d827b5b9a32c..1cc96c54169c 100644 > > --- a/arch/s390/include/asm/unwind.h > > +++ b/arch/s390/include/asm/unwind.h > > @@ -45,6 +45,25 @@ void __unwind_start(struct unwind_state *state, struct > >

Re: [PATCH] s390/livepatch: Implement reliable stack tracing for the consistency model

2019-08-13 Thread Miroslav Benes
On Sun, 28 Jul 2019, Josh Poimboeuf wrote: > On Wed, Jul 17, 2019 at 01:01:27PM +0200, Miroslav Benes wrote: > > > On a related note, do you think it would be feasible to extend (in > > > another patchset) the reliable stack unwinding code a bit so that we > > >

Re: [PATCH v2 0/5] livepatch: new API to track system state changes

2019-08-13 Thread Miroslav Benes
logic in klp_is_state_compatible() [Miroslav] > + Document how livepatches should handle the state [Nicolai] > + Fix some typos, formulation, module metadata [Joe, Miroslav] I noticed couple of typos along the way but apart from that Acked-by: Miroslav Benes Miroslav

Re: [PATCH v2 4/5] livepatch: Documentation of the new API for tracking system state changes

2019-08-13 Thread Miroslav Benes
On Fri, 19 Jul 2019, Petr Mladek wrote: > Documentation explaining the motivation, capabilities, and usage > of the new API for tracking system state changes. > > Signed-off-by: Petr Mladek > --- > Documentation/livepatch/index.rst| 1 + > Documentation/livepatch/system-state.rst |

Re: [PATCH v2 3/5] livepatch: Allow to distinguish different version of system state changes

2019-08-13 Thread Miroslav Benes
> diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h > index 9c8b637f17cd..bc5766f45442 100644 > --- a/include/linux/livepatch.h > +++ b/include/linux/livepatch.h > @@ -133,10 +133,12 @@ struct klp_object { > /** > * struct klp_state - state of the system modified by the

Re: [PATCH v2 2/5] livepatch: Basic API to track system state changes

2019-08-13 Thread Miroslav Benes
On Fri, 19 Jul 2019, Petr Mladek wrote: > This is another step how to help maintaining more livepatches. > > One big help was the atomic replace and cumulative livepatches. These > livepatches replace the already installed ones. Therefore it should > be enough when each cumulative livepatch is

Re: [PATCH v2 1/5] livepatch: Keep replaced patches until post_patch callback is called

2019-08-13 Thread Miroslav Benes
On Fri, 19 Jul 2019, Petr Mladek wrote: > Pre/post (un)patch callbacks might manipulate the system state. Cumulative > livepatches might need to take over the changes made by the replaced > ones. For this they might need to access some data stored or referenced > by the old livepatches. > >

Re: [PATCH v4 06/10] modpost: Add modinfo flag to livepatch modules

2019-08-13 Thread Miroslav Benes
On Wed, 31 Jul 2019, Masahiro Yamada wrote: > Hi Joe, > > > On Thu, May 9, 2019 at 11:39 PM Joe Lawrence wrote: > > > > From: Miroslav Benes > > > > Currently, livepatch infrastructure in the kernel relies on > > MODULE_INFO(livepatch, "Y")

[RFC PATCH 0/2] livepatch: Clear relocation targets on a module removal

2019-07-19 Thread Miroslav Benes
welcome Lightly tested on both x86_64 and ppc64le and it looked ok. [1] 20180602161151.apuhs2dygsexmcg2@treble [2] 1561019068-132672-1-git-send-email-cj.chengj...@huawei.com [3] 20180607092949.1706-1-mbe...@suse.cz Miroslav Benes (2): livepatch: Nullify obj->mod in klp_module_coming()'s er

[PATCH 1/2] livepatch: Nullify obj->mod in klp_module_coming()'s error path

2019-07-19 Thread Miroslav Benes
gt;mod variable and could currently give a wrong return value. The bug is probably harmless as of now. Signed-off-by: Miroslav Benes Reviewed-by: Petr Mladek --- kernel/livepatch/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c

[RFC PATCH 2/2] livepatch: Clear relocation targets on a module removal

2019-07-19 Thread Miroslav Benes
us decided to reverse the relocation patching (clear all relocation targets on x86_64, or return back nops on powerpc). The solution is not universal and is too much arch-specific, but it may prove to be simpler in the end. Reported-by: Josh Poimboeuf Signed-off-by: Miroslav Benes --- arch/powe

Re: [PATCH] s390/livepatch: Implement reliable stack tracing for the consistency model

2019-07-17 Thread Miroslav Benes
On Tue, 16 Jul 2019, Joe Lawrence wrote: > On Wed, Jul 10, 2019 at 12:59:18PM +0200, Miroslav Benes wrote: > > The livepatch consistency model requires reliable stack tracing > > architecture support in order to work properly. In order to achieve > > this, two main issues hav

[PATCH] s390/livepatch: Implement reliable stack tracing for the consistency model

2019-07-10 Thread Miroslav Benes
t considered to be a stack corruption. Signed-off-by: Miroslav Benes --- - based on Linus' master - passes livepatch kselftests - passes tests from https://github.com/lpechacek/qa_test_klp, which stress the consistency model and the unwinder a bit more arch/s390/Kconfig | 1 +

Re: [PATCH] ftrace: Remove possible deadlock between register_kprobe() and ftrace_run_update_code()

2019-06-28 Thread Miroslav Benes
> is implemented for arm or nds32. These architectures call > set_all_modules_text_rw() and use stop_machine() at the same time. > > Fixes: 9f255b632bf12c4dd7 ("module: Fix livepatch/ftrace module text > permissions race") > Signed-off-by: Petr Mladek Reported-by: Mir

Re: [PATCH v4 00/10] klp-convert livepatch build tooling

2019-06-26 Thread Miroslav Benes
On Tue, 25 Jun 2019, Joe Lawrence wrote: > On Tue, Jun 25, 2019 at 01:36:37PM +0200, Miroslav Benes wrote: > > > > [ ... snip ... ] > > > > If I revert commit d59cadc0a8f8 ("[squash] klp-convert: make > > convert_rela() list-safe") (from Joe's expand

Re: [PATCH 1/3] module: Fix livepatch/ftrace module text permissions race

2019-06-26 Thread Miroslav Benes
tching > > operations -- and their respective permissions changes -- are protected > > by the text_mutex. > > > > Reported-by: Johannes Erdfelt > > Fixes: 444d13ff10fb ("modules: add ro_after_init support") > > Signed-off-by: Josh Poimboeuf > &g

Re: [PATCH v4 00/10] klp-convert livepatch build tooling

2019-06-25 Thread Miroslav Benes
On Fri, 14 Jun 2019, Petr Mladek wrote: > On Thu 2019-06-13 16:48:02, Joe Lawrence wrote: > > On 6/13/19 9:15 AM, Joe Lawrence wrote: > > > On 6/13/19 9:00 AM, Miroslav Benes wrote: > > >> Hi Joe, > > >> > > >> first, I'm sorry for the lack

Re: [PATCH] Revert "x86/module: Detect and skip invalid relocations"

2019-06-24 Thread Miroslav Benes
On Sat, 22 Jun 2019, Thomas Gleixner wrote: > Miroslav, > > On Thu, 20 Jun 2019, Miroslav Benes wrote: > > On Thu, 20 Jun 2019, Cheng Jian wrote: > > > > > This reverts commit eda9cec4c9a12208a6f69fbe68f72a6311d50032. > > > > > > Since commit (e

Re: [RFC 5/5] livepatch: Selftests of the API for tracking system state changes

2019-06-21 Thread Miroslav Benes
> diff --git a/lib/livepatch/test_klp_state.c b/lib/livepatch/test_klp_state.c > new file mode 100644 > index ..c43dc2f2e01d > --- /dev/null > +++ b/lib/livepatch/test_klp_state.c > @@ -0,0 +1,161 @@ > +// SPDX-License-Identifier: GPL-2.0 > +// Copyright (C) 2019 SUSE > + > +#define

Re: [RFC 3/5] livepatch: Allow to distinguish different version of system state changes

2019-06-21 Thread Miroslav Benes
> +/* Check if the patch is able to deal with the given system state. */ > +static bool klp_is_state_compatible(struct klp_patch *patch, > + struct klp_state *state) > +{ > + struct klp_state *new_state; > + > + new_state = klp_get_state(patch, state->id); >

Re: [PATCH] Revert "x86/module: Detect and skip invalid relocations"

2019-06-20 Thread Miroslav Benes
On Thu, 20 Jun 2019, Cheng Jian wrote: > This reverts commit eda9cec4c9a12208a6f69fbe68f72a6311d50032. > > Since commit (eda9cec4c9a1 'x86/module: Detect and skip invalid > relocations') add some sanity check in apply_relocate_add, borke > re-insmod a kernel module which has been patched before,

<    1   2   3   4   5   6   7   8   9   10   >