Re: [PATCH v2 49/62] kbuild,objtool: Defer objtool validation step for CONFIG_LIVEPATCH

2025-05-28 Thread Joe Lawrence
On 5/9/25 4:17 PM, Josh Poimboeuf wrote: > In preparation for the objtool klp diff subcommand, defer objtool > validation for CONFIG_LIVEPATCH until the final pre-link archive (e.g., > vmlinux.o, module-foo.o) is built. This will simplify the process of > generating livepatch modules. > > Delayed

Re: [PATCH v2 45/62] x86/extable: Define ELF section entry size for exception tables

2025-05-28 Thread Joe Lawrence
On 5/9/25 4:17 PM, Josh Poimboeuf wrote: > In preparation for the objtool klp diff subcommand, define the entry > size for the __ex_table section in its ELF header. This will allow > tooling to extract individual entries. > > Signed-off-by: Josh Poimboeuf > --- > arch/x86/include/asm/asm.h | 20

Re: [PATCH v2 35/62] objtool: Refactor add_jump_destinations()

2025-05-23 Thread Joe Lawrence
On 5/9/25 4:16 PM, Josh Poimboeuf wrote: > The add_jump_destinations() logic is a bit weird and convoluted after > being incrementally tweaked over the years. Refactor it to hopefully be > more logical and straightforward. > > Signed-off-by: Josh Poimboeuf > --- > tools/objtool/check.c

Re: [PATCH v3 0/2] selftests: livepatch: test if ftrace can trace a livepatched function

2025-03-25 Thread Joe Lawrence
> https://lore.kernel.org/r/20250318-ftrace-sftest-livepatch-v2-0-60cb0aa95...@gmail.com > For both patches: Acked-by: Joe Lawrence Thanks, -- Joe

Re: [PATCH v2 2/2] selftests: livepatch: test if ftrace can trace a livepatched function

2025-03-24 Thread Joe Lawrence
On Tue, Mar 18, 2025 at 06:20:36PM -0300, Filipe Xavier wrote: > This new test makes sure that ftrace can trace a > function that was introduced by a livepatch. > > Signed-off-by: Filipe Xavier > --- > tools/testing/selftests/livepatch/test-ftrace.sh | 34 > > 1 file ch

Re: [PATCH v2 1/2] selftests: livepatch: add new ftrace helpers functions

2025-03-24 Thread Joe Lawrence
On Tue, Mar 18, 2025 at 06:20:35PM -0300, Filipe Xavier wrote: > [ ... snip ... ] > > + if [[ -n "$FTRACE_FILTER" ]]; then > + echo "$FTRACE_FILTER" \ > + | sed -e "/ all functions enabled /d" > + > "$SYSFS_TRACING_DIR/set_ftrace_filt

Re: [PATCH v2 1/2] selftests: livepatch: add new ftrace helpers functions

2025-03-24 Thread Joe Lawrence
On Tue, Mar 18, 2025 at 06:20:35PM -0300, Filipe Xavier wrote: > Add new ftrace helpers functions cleanup_tracing, trace_function and > check_traced_functions. > > Signed-off-by: Filipe Xavier > --- > tools/testing/selftests/livepatch/functions.sh | 49 > ++ > 1 file cha

Re: [PATCH v1 18/19] Documentation/livepatch: Update documentation for state, callbacks, and shadow variables

2025-03-07 Thread Joe Lawrence
On 3/7/25 07:26, Petr Mladek wrote: > On Thu 2025-03-06 17:54:41, Joe Lawrence wrote: >> >> With that in mind, a livepatch state could be thought of as an >> indication of "a context needing special handling in a (versioned) way". > > I am not sure abou

Re: [PATCH v1 18/19] Documentation/livepatch: Update documentation for state, callbacks, and shadow variables

2025-03-06 Thread Joe Lawrence
On 1/15/25 03:24, Petr Mladek wrote: > This commit updates the livepatch documentation to reflect recent changes > in the behavior of states, callbacks, and shadow variables. > > Key changes include: > > - Per-state callbacks replace per-object callbacks, invoked only when a > livepatch introdu

Re: [PATCH v2] selftests: livepatch: test if ftrace can trace a livepatched function

2025-01-15 Thread Joe Lawrence
On 1/14/25 12:18, Marcos Paulo de Souza wrote: > On Sat, 2025-01-11 at 15:42 -0300, Filipe Xavier wrote: >> This new test makes sure that ftrace can trace a >> function that was introduced by a livepatch. >> >> Signed-off-by: Filipe Xavier > > Thanks for the new test Filipe! > > I have some nits

Re: [PATCH] selftests: livepatch: test if ftrace can trace a livepatched function

2025-01-11 Thread Joe Lawrence
On 1/10/25 12:13, Filipe Xavier wrote: > Em 07/01/2025 13:23, Joe Lawrence escreveu: > >> On Thu, Jan 02, 2025 at 03:42:10PM -0300, Filipe Xavier wrote: >>> This new test makes sure that ftrace can trace a >>> function that was introduced by a livepatch. >>>

Re: [PATCH] selftests: livepatch: test if ftrace can trace a livepatched function

2025-01-07 Thread Joe Lawrence
On Thu, Jan 02, 2025 at 03:42:10PM -0300, Filipe Xavier wrote: > This new test makes sure that ftrace can trace a > function that was introduced by a livepatch. > Hi Filipe, Thanks for adding a test! Aside: another similar test could verify that the original function, in this case cmdline_proc_s

Re: [PATCH v5 0/3] selftests: livepatch: test livepatching a kprobed function

2024-10-21 Thread Joe Lawrence
+-- > .../selftests/livepatch/test_modules/Makefile | 3 +- > .../livepatch/test_modules/test_klp_kprobe.c | 38 > 11 files changed, 150 insertions(+), 41 deletions(-) > create mode 100755 tools/testing/selftests/livepatch/test-kprobe.sh > create mode 100644 > too

Re: [PATCH v5 1/3] selftests: livepatch: rename KLP_SYSFS_DIR to SYSFS_KLP_DIR

2024-10-21 Thread Joe Lawrence
On 10/17/24 16:01, Michael Vetter wrote: > @@ -246,12 +246,12 @@ function unload_lp() { > function disable_lp() { > local mod="$1" > > - log "% echo 0 > /sys/kernel/livepatch/$mod/enabled" > - echo 0 > /sys/kernel/livepatch/"$mod"/enabled > + log "% echo 0 > $SYSFS_KLP_DIR/$mod

Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

2024-09-13 Thread Joe Lawrence
On Thu, Sep 12, 2024 at 09:44:04AM -0400, Joe Lawrence wrote: > On Wed, Sep 11, 2024 at 12:39:42AM -0700, Josh Poimboeuf wrote: > > On Mon, Sep 02, 2024 at 08:59:43PM -0700, Josh Poimboeuf wrote: > > > Hi, > > > > > > Here's a new way to build livepatch

Re: [PATCH v3 0/6] livepatch: klp-convert tool - Minimal version

2024-09-12 Thread Joe Lawrence
ixed all suggested small changes in v2 > > Previous versions > - > > RFC: > https://lore.kernel.org/r/cover.1477578530.git.jpoim...@redhat.com/ > v2: > https://lore.kernel.org/r/f52d29f7-7d1b-ad3d-050b-a9fa8878f...@redhat.com/ > v3: >

Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

2024-09-12 Thread Joe Lawrence
On Wed, Sep 11, 2024 at 12:39:42AM -0700, Josh Poimboeuf wrote: > On Mon, Sep 02, 2024 at 08:59:43PM -0700, Josh Poimboeuf wrote: > > Hi, > > > > Here's a new way to build livepatch modules called klp-build. > > > > I started working on it when I realized that objtool already does 99% of > > the

Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

2024-09-07 Thread Joe Lawrence
On Fri, Sep 06, 2024 at 06:47:06PM -0700, Josh Poimboeuf wrote: > > Normally I build objtool with > > make tools/objtool > > or just > > make > > Those use the objtool Makefile without all the extra kernel flags. > > How do you normally build objtool? > Usually as part of the kernel buil

Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

2024-09-06 Thread Joe Lawrence
On Fri, Sep 06, 2024 at 10:00:08AM -0700, Josh Poimboeuf wrote: > On Fri, Sep 06, 2024 at 09:56:06AM -0400, Joe Lawrence wrote: > > In the case of klp-diff.c, adding #include will provide the > > memmem prototype. For both files, I needed to #define _GNU_SOURCE for > >

Re: [PATCH] livepatch: introduce klp_func called interface

2024-06-06 Thread Joe Lawrence
Hi Wardenjohn, To follow up, Red Hat kpatch QE pointed me toward this test: https://gitlab.com/redhat/centos-stream/tests/kernel/kernel-tests/-/tree/main/general/kpatch/kpatch-trace?ref_type=heads which reports a few interesting things via systemd service and ftrace: - Patched functions - Trace

Re: [PATCH] livepatch: introduce klp_func called interface

2024-06-04 Thread Joe Lawrence
On Tue, Jun 04, 2024 at 04:14:51PM +0800, zhang warden wrote: > > > > On Jun 1, 2024, at 03:16, Joe Lawrence wrote: > > > > Adding these attributes to livepatch sysfs would be expedient and > > probably easier for us to use, but imposes a recurring burden on us t

Re: [PATCH 0/2] livepatch: Add compiler optimization disclaimer/docs

2024-05-31 Thread Joe Lawrence
On 5/31/24 07:23, Miroslav Benes wrote: > Hi, > > On Tue, 21 Jul 2020, Joe Lawrence wrote: > >> In light of [PATCH] Revert "kbuild: use -flive-patching when >> CONFIG_LIVEPATCH is enabled" [1], we should add some loud disclaimers >> and explanation of t

Re: [PATCH] livepatch: introduce klp_func called interface

2024-05-31 Thread Joe Lawrence
On Tue, May 21, 2024 at 08:34:46AM +0200, Miroslav Benes wrote: > Hello, > > On Mon, 20 May 2024, zhang warden wrote: > > > > > > > > On May 20, 2024, at 14:46, Miroslav Benes wrote: > > > > > > Hi, > > > > > > On Mon, 20 May 2024, Wardenjohn wrote: > > > > > >> Livepatch module usually use

Re: [PATCH v2 2/6] livepatch: Add klp-convert tool

2024-05-30 Thread Joe Lawrence
/list.h, which is a list > implementation. > > Update Makefiles to correctly support the compilation of the new tool, > update MAINTAINERS file and add a .gitignore file. > > [jpoim...@redhat.com: initial version] > Signed-off-by: Josh Poimboeuf > [joe.lawre...@redh

Re: [PATCH v2 2/6] livepatch: Add klp-convert tool

2024-05-29 Thread Joe Lawrence
Hi Lukas, As mentioned offlist, reviewing and testing this is on my TODO list, but here are some early notes ... On Thu, May 16, 2024 at 03:30:05PM +0200, Lukas Hruska wrote: > Livepatches need to access external symbols which can't be handled > by the normal relocation mechanism. It is needed fo

Re: [PATCH] livepatch: Add KLP_IDLE state

2024-04-04 Thread Joe Lawrence
On 4/4/24 11:17, Petr Mladek wrote: > On Tue 2024-04-02 09:52:31, Joe Lawrence wrote: >> On Tue, Apr 02, 2024 at 11:09:54AM +0800, zhangwar...@gmail.com wrote: >>> From: Wardenjohn >>> >>> In livepatch, using KLP_UNDEFINED is seems to be confused. >>>

Re: [PATCH] livepatch: Add KLP_IDLE state

2024-04-02 Thread Joe Lawrence
On Tue, Apr 02, 2024 at 11:09:54AM +0800, zhangwar...@gmail.com wrote: > From: Wardenjohn > > In livepatch, using KLP_UNDEFINED is seems to be confused. > When kernel is ready, livepatch is ready too, which state is > idle but not undefined. What's more, if one livepatch process > is finished, th

Re: [PATCH v2] livepatch: Replace the fake signal sending with TIF_NOTIFY_SIGNAL infrastructure

2021-03-29 Thread Joe Lawrence
(TIF_SIGPENDING); } Looks good to me. Thanks for checking on this and updating. Acked-by: Joe Lawrence -- Joe

Re: [PATCH] livepatch: klp_send_signal should treat PF_IO_WORKER like PF_KTHREAD

2021-03-25 Thread Joe Lawrence
On 3/25/21 5:26 AM, Miroslav Benes wrote: On Thu, 25 Mar 2021, Dong Kai wrote: commit 15b2219facad ("kernel: freezer should treat PF_IO_WORKER like PF_KTHREAD for freezing") is to fix the freezeing issue of IO threads by making the freezer not send them fake signals. Here live patching consist

Re: [PATCH] livepatch: klp_send_signal should treat PF_IO_WORKER like PF_KTHREAD

2021-03-24 Thread Joe Lawrence
hange seems logical to me, so: Acked-by: Joe Lawrence Thanks, -- Joe

Re: [PATCH V2] docs: livepatch: Fix a typo and remove the unnecessary gaps in a sentence

2021-03-05 Thread Joe Lawrence
only/ but knowing me, I probably repeated the same phrasing elsewhere. Up to you, thanks. Acked-by: Joe Lawrence -- Joe

Re: [PATCH] kbuild: add extra-y to targets-for-modules

2020-12-16 Thread Joe Lawrence
On 12/16/20 1:14 AM, Masahiro Yamada wrote: On Tue, Dec 8, 2020 at 11:31 PM Artem Savkov wrote: On Tue, Dec 08, 2020 at 05:20:35PM +0800, WANG Chao wrote: Sorry for the late reply. On 11/25/20 at 10:42P, Masahiro Yamada wrote: On Tue, Nov 24, 2020 at 12:05 AM WANG Chao wrote: On 11/23/20

Re: [PATCH] selftests/lkdtm: Use "comm" instead of "diff" for dmesg

2020-09-09 Thread Joe Lawrence
On 9/9/20 3:49 PM, Kees Cook wrote: On Fri, Jun 26, 2020 at 01:59:43PM -0700, Kees Cook wrote: Instead of full GNU diff (which smaller boot environments may not have), use "comm" which is more available. Reported-by: Naresh Kamboju Link: https://lore.kernel.org/lkml/ca+g9fythp+gg+brr_gkbmxu2

Re: [PATCH] selftests/livepatch: Do not check order when using "comm" for dmesg checking

2020-08-27 Thread Joe Lawrence
ter all. > , "comm" fails with "comm: file 2 is not in sorted order". Suppress the > order checking with --nocheck-order option. > > Signed-off-by: Miroslav Benes Acked-by: Joe Lawrence And not so important for selftests, but helpful for backporting effor

Re: [PATCH v4 00/10] Function Granular KASLR

2020-08-25 Thread Joe Lawrence
d it to KBUILD_LDFLAGS when CONFIG_FG_KASLR and livepatching should work in all cases. I don't have a grasp on how complicated the alternatives might be, so I'll let others comment on best paths forward. I just wanted to note that -z unique-symbol looks like it could reasonable wo

refactoring livepatch documentation was Re: [PATCH 1/2] docs/livepatch: Add new compiler considerations doc

2020-08-10 Thread Joe Lawrence
On 8/6/20 8:03 AM, Petr Mladek wrote: On Wed 2020-07-22 15:51:39, Josh Poimboeuf wrote: On Wed, Jul 22, 2020 at 01:03:03PM -0400, Joe Lawrence wrote: On 7/21/20 7:04 PM, Josh Poimboeuf wrote: On Tue, Jul 21, 2020 at 12:14:06PM -0400, Joe Lawrence wrote: Compiler optimizations can have

Re: [PATCH v4 00/10] Function Granular KASLR

2020-08-04 Thread Joe Lawrence
On Fri, Jul 17, 2020 at 09:59:57AM -0700, Kristen Carlson Accardi wrote: > Function Granular Kernel Address Space Layout Randomization (fgkaslr) > - > > This patch set is an implementation of finer grained kernel address space > r

Re: [PATCH v4 00/10] Function Granular KASLR

2020-08-03 Thread Joe Lawrence
On 8/3/20 1:45 PM, Kees Cook wrote: On Mon, Aug 03, 2020 at 02:39:32PM +0300, Evgenii Shatokhin wrote: There are at least 2 places where high-order memory allocations might happen during module loading. Such allocations may fail if memory is fragmented, while physically contiguous memory areas a

Re: [PATCH 2/7] modules: mark find_symbol static

2020-07-29 Thread Joe Lawrence
On 7/29/20 12:24 PM, Greg Kroah-Hartman wrote: On Wed, Jul 29, 2020 at 06:13:18PM +0200, Jessica Yu wrote: +++ Christoph Hellwig [29/07/20 08:27 +0200]: find_symbol is only used in module.c. Signed-off-by: Christoph Hellwig CCing the livepatching ML, as this may or may not impact its users.

Re: [PATCH 1/2] docs/livepatch: Add new compiler considerations doc

2020-07-22 Thread Joe Lawrence
On 7/21/20 7:04 PM, Josh Poimboeuf wrote: On Tue, Jul 21, 2020 at 12:14:06PM -0400, Joe Lawrence wrote: Compiler optimizations can have serious implications on livepatching. Create a document that outlines common optimization patterns and safe ways to livepatch them. Signed-off-by: Joe

Re: [PATCH v4 00/10] Function Granular KASLR

2020-07-22 Thread Joe Lawrence
On 7/22/20 10:51 AM, Joe Lawrence wrote: On 7/22/20 10:39 AM, Kees Cook wrote: On Wed, Jul 22, 2020 at 11:27:30AM +0200, Miroslav Benes wrote: Let me CC live-patching ML, because from a quick glance this is something which could impact live patching code. At least it invalidates assumptions

Re: [PATCH v4 00/10] Function Granular KASLR

2020-07-22 Thread Joe Lawrence
On 7/22/20 10:39 AM, Kees Cook wrote: On Wed, Jul 22, 2020 at 11:27:30AM +0200, Miroslav Benes wrote: Let me CC live-patching ML, because from a quick glance this is something which could impact live patching code. At least it invalidates assumptions which "sympos" is based on. In a quick skim

[PATCH 1/2] docs/livepatch: Add new compiler considerations doc

2020-07-21 Thread Joe Lawrence
Compiler optimizations can have serious implications on livepatching. Create a document that outlines common optimization patterns and safe ways to livepatch them. Signed-off-by: Joe Lawrence --- .../livepatch/compiler-considerations.rst | 220 ++ Documentation/livepatch

[PATCH 0/2] livepatch: Add compiler optimization disclaimer/docs

2020-07-21 Thread Joe Lawrence
from checking for renamed functions as part of their build, or the selftest scripts, or even adding something to the kernel API. I think we'll have a better idea after reviewing the compiler considerations doc. [1] https://lore.kernel.org/lkml/696262e997359666afa053fe7d1a9fb2bb373964.1595010490

[PATCH 2/2] samples/livepatch: Add README.rst disclaimer

2020-07-21 Thread Joe Lawrence
The livepatch samples aren't very careful with respect to compiler IPA-optimization of target kernel functions. Add a quick disclaimer and pointer to the compiler-considerations.rst file to warn readers. Suggested-by: Josh Poimboeuf Signed-off-by: Joe Lawrence --- samples/livepatch/READM

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

2020-07-20 Thread Joe Lawrence
On 7/20/20 4:50 AM, Kamalesh Babulal wrote: On 20/07/20 9:05 am, Joe Lawrence wrote: On 7/17/20 2:29 PM, Josh Poimboeuf wrote: Use of the new -flive-patching flag was introduced with the following commit:    43bd3a95c98e ("kbuild: use -flive-patching when CONFIG_LIVEPATCH is enabled&qu

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

2020-07-19 Thread Joe Lawrence
On 7/17/20 2:29 PM, Josh Poimboeuf wrote: Use of the new -flive-patching flag was introduced with the following commit: 43bd3a95c98e ("kbuild: use -flive-patching when CONFIG_LIVEPATCH is enabled") This flag has several drawbacks: [ ... snip ... ] - While there *is* a distro which relies o

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

2020-07-14 Thread Joe Lawrence
abled\": Device or resource busy kernel.ftrace_enabled = 0 +livepatch: sysctl: setting key \"kernel.ftrace_enabled\": Device or resource busy % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled livepatch: '$MOD_LIVEPATCH': initializing unpatching transition livepatch: '$MOD_LIVEPATCH': starting unpatching transition Looks good, thanks. Reviewed-by: Joe Lawrence -- Joe

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

2020-07-10 Thread Joe Lawrence
On Fri, Jul 10, 2020 at 05:27:35PM +0200, Petr Mladek wrote: > On Fri 2020-07-10 10:40:43, Kamalesh Babulal wrote: > > With procfs v3.3.16, the sysctl command doesn't prints the set key and > > value on error. This change breaks livepatch selftest test-ftrace.sh, > > that tests the interaction of

Re: [PATCH] selftests/lkdtm: Use "comm" instead of "diff" for dmesg

2020-06-30 Thread Joe Lawrence
uot; || true > +dmesg | comm -13 "$DMESG" - > "$LOG" || true > > cat "$LOG" > # Check for expected output I'm not familiar with running lkdtm tests, but I copied the same fixup for the livepatching selftests and "comm" slides in nicely over there, so, Acked-by: Joe Lawrence -- Joe

Re: [PATCH 1/2] selftests/lkdtm: Don't clear dmesg when running tests

2020-06-26 Thread Joe Lawrence
On 6/26/20 4:02 AM, Petr Mladek wrote: On Wed 2020-06-24 16:12:47, Joe Lawrence wrote: On Wed, Jun 24, 2020 at 10:39:55AM +0200, Petr Mladek wrote: On Tue 2020-06-23 23:48:36, Joe Lawrence wrote: On 6/22/20 4:51 AM, Naresh Kamboju wrote: On Fri, 8 May 2020 at 12:23, Michael Ellerman wrote

Re: [PATCH 1/2] selftests/lkdtm: Don't clear dmesg when running tests

2020-06-24 Thread Joe Lawrence
On Wed, Jun 24, 2020 at 10:39:55AM +0200, Petr Mladek wrote: > On Tue 2020-06-23 23:48:36, Joe Lawrence wrote: > > On 6/22/20 4:51 AM, Naresh Kamboju wrote: > > > On Fri, 8 May 2020 at 12:23, Michael Ellerman wrote: > > > > > > > > It is Very Rude to c

Re: [PATCH 1/2] selftests/lkdtm: Don't clear dmesg when running tests

2020-06-23 Thread Joe Lawrence
On 6/22/20 4:51 AM, Naresh Kamboju wrote: On Fri, 8 May 2020 at 12:23, Michael Ellerman wrote: It is Very Rude to clear dmesg in test scripts. That's because the script may be part of a larger test run, and clearing dmesg potentially destroys the output of other tests. We can avoid using dmes

Re: [PATCH v2 6/9] s390/module: Use s390_kernel_write() for late relocations

2020-04-30 Thread Joe Lawrence
On 4/30/20 12:48 PM, Josh Poimboeuf wrote: On Thu, Apr 30, 2020 at 10:38:21AM -0400, Joe Lawrence wrote: On Thu, Apr 23, 2020 at 01:10:30PM -0500, Josh Poimboeuf wrote: This is more of note for the future, but when/if we add livepatch support on arm64 we'll need to make the very same adjus

Re: [PATCH v2 6/9] s390/module: Use s390_kernel_write() for late relocations

2020-04-30 Thread Joe Lawrence
On Thu, Apr 23, 2020 at 01:10:30PM -0500, Josh Poimboeuf wrote: > On Thu, Apr 23, 2020 at 09:12:28AM -0500, Josh Poimboeuf wrote: > > > > this is strange. While I would have expected an exception similar to > > > > this, it really should have happened on the "sturg" instruction which > > > > does t

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

2019-10-16 Thread Joe Lawrence
On 10/16/19 1:06 PM, Kamalesh Babulal wrote: On 10/16/19 5:03 PM, Miroslav Benes wrote: From: Joe Lawrence Since livepatching depends upon ftrace handlers to implement "patched" code functionality, verify that the ftrace_enabled sysctl value interacts with livepatch registration a

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

2019-10-16 Thread Joe Lawrence
On 10/16/19 1:10 PM, Kamalesh Babulal wrote: On 10/16/19 5:03 PM, Miroslav Benes wrote: 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

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

2019-10-15 Thread Joe Lawrence
On 10/15/19 11:31 AM, Jessica Yu wrote: +++ Joe Lawrence [15/10/19 11:06 -0400]: 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 Joe Lawrence
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) code for a module can be relocated only when the relevant module is loaded. FWIW, w

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

2019-10-15 Thread Joe Lawrence
Thanks, -- Joe -->8-- -->8-- -->8-- -->8-- -->8-- -->8-- -->8-- -->8-- -->8-- -->8-- >From a22ca55b3f429b7c9ceed6be87a571f77520994c Mon Sep 17 00:00:00 2001 From: Joe Lawrence Date: Tue, 15 Oct 2019 10:33:18 -0400 Subject: [PATCH] selftests/livepatch: test interaction w

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

2019-10-15 Thread Joe Lawrence
below. -->8-- -->8-- -->8-- -->8-- -->8-- -->8-- -->8-- -->8-- -->8-- -->8-- >From c8c9f22e3816ca4c90ab7e7159d2ce536eaa5fad Mon Sep 17 00:00:00 2001 From: Joe Lawrence Date: Mon, 14 Oct 2019 18:25:01 -0400 Subject: [PATCH] selftests/livepatch: test

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

2019-10-14 Thread Joe Lawrence
g ftrace_enabled. Equally, a callback with the flag > set cannot be registered if ftrace_enabled is disabled. > > Signed-off-by: Miroslav Benes > --- > v1->v2: > - different logic, proposed by Joe Lawrence > > Two things I am not sure about much: > > - return

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

2019-10-09 Thread Joe Lawrence
On Wed, Oct 09, 2019 at 04:18:59PM +0200, Petr Mladek wrote: > On Fri 2019-10-04 10:47:42, Joe Lawrence wrote: > > On Thu, Oct 03, 2019 at 11:01:37AM +0200, Petr Mladek wrote: > > > Four selftests for the new API. > > > > > > --- /dev/null > > >

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

2019-10-09 Thread Joe Lawrence
On Wed, Oct 09, 2019 at 01:22:34PM +0200, Petr Mladek wrote: > On Tue 2019-10-08 15:35:34, Joe Lawrence wrote: > > On Mon, Oct 07, 2019 at 10:17:11AM +0200, Miroslav Benes wrote: > > > Livepatch uses ftrace for redirection to new patched functions. It is > > > thus

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

2019-10-08 Thread Joe Lawrence
On Mon, Oct 07, 2019 at 10:17:11AM +0200, Miroslav Benes wrote: > Livepatch uses ftrace for redirection to new patched functions. It is > thus directly affected by ftrace sysctl knobs such as ftrace_enabled. > Setting ftrace_enabled to 0 also disables all live patched functions. It > is not a probl

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

2019-10-04 Thread Joe Lawrence
ivepatch/test-state.sh > @@ -0,0 +1,180 @@ > +#!/bin/bash > +# SPDX-License-Identifier: GPL-2.0 > +# Copyright (C) 2018 Joe Lawrence > + nit: this should probably read as: # Copyright (C) 2019 Petr Mladek > +. $(dirname $0)/functions.sh > + > +MOD_LIVEPATCH=test_klp

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

2019-10-04 Thread Joe Lawrence
state.c > create mode 100644 lib/livepatch/test_klp_state2.c > create mode 100644 lib/livepatch/test_klp_state3.c > create mode 100755 tools/testing/selftests/livepatch/test-state.sh > > -- > 2.16.4 > Hi Petr, Thanks for respinning this one with the latest updates. The implementation looks fine to me. I have two really minor nits for the selftest (I'll reply to that commit), but I wouldn't hold up the series for them. Acked-by: Joe Lawrence -- Joe

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

2019-09-06 Thread Joe Lawrence
On 9/6/19 1:51 PM, Miroslav Benes wrote: 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 t

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

2019-09-05 Thread Joe Lawrence
On 9/5/19 7:09 AM, Petr Mladek wrote: On Wed 2019-09-04 21:50:55, Josh Poimboeuf wrote: On Wed, Sep 04, 2019 at 10:49:32AM +0200, Petr Mladek wrote: I wonder what is necessary for a productive discussion on Plumbers: + Josh would like to see what code can get removed when late handling

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

2019-09-04 Thread Joe Lawrence
On 9/4/19 4:49 AM, 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 wrote: I can easily foresee more problems like those in the future. Going forward we have to always keep track of which special

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

2019-09-02 Thread Joe Lawrence
out late module patching. Hi Miroslav, I was tinkering with the "blue-sky" ideas that I mentioned to Josh the other day. I dunno if you had a chance to look at what removing that code looks like, but I can continue to flesh out that idea if it looks interesting: https://github.com/joe

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

2019-08-27 Thread Joe Lawrence
On 8/26/19 10:54 AM, Josh Poimboeuf wrote: On Fri, Aug 23, 2019 at 10:13:06AM +0200, Petr Mladek wrote: On Thu 2019-08-22 17:36:49, Josh Poimboeuf wrote: On Fri, Aug 16, 2019 at 11:46:08AM +0200, Petr Mladek wrote: On Wed 2019-08-14 10:12:44, Josh Poimboeuf wrote: On Wed, Aug 14, 2019 at 01:0

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

2019-08-19 Thread Joe Lawrence
the whole thing one more time? What do you think? Definitely, yes. I occasionally force a push to: https://github.com/joe-lawrence/linux/tree/klp-convert-v5-expanded as I've been updating and collecting feedback from v4. Once updates settle, I'll send out a new v5 set. -- Joe

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

2019-08-19 Thread Joe Lawrence
On 8/18/19 11:50 PM, Masahiro Yamada wrote: Hi Joe, On Sat, Aug 17, 2019 at 4:01 AM Joe Lawrence wrote: I didn't realize that we're supposed to be able to still build external modules after "make clean". If that's the case, then one might want to build an extern

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

2019-08-16 Thread Joe Lawrence
On 8/16/19 8:43 AM, 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 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

Re: [PATCH v4 07/10] livepatch: Add sample livepatch module

2019-08-16 Thread Joe Lawrence
On 8/16/19 7:35 AM, Masahiro Yamada wrote: Hi Joe, On Thu, May 9, 2019 at 11:39 PM Joe Lawrence wrote: --- /dev/null +++ b/samples/livepatch/livepatch-annotated-sample.c @@ -0,0 +1,102 @@ Please use SPDX instead of the license boilerplate. Thanks. Good eye, this revision was spun

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

2019-08-16 Thread Joe Lawrence
On 8/16/19 4:19 AM, Miroslav Benes wrote: 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 limi

Re: [PATCH] selftests: livepatch: add missing fragments to config

2019-08-14 Thread Joe Lawrence
On 8/14/19 7:16 AM, Anders Roxell wrote: When generating config with 'make defconfig kselftest-merge' fragment CONFIG_TEST_LIVEPATCH=m isn't set. Rework to enable CONFIG_LIVEPATCH and CONFIG_DYNAMIC_DEBUG as well. Signed-off-by: Anders Roxell --- tools/testing/selftests/livepatch/config | 2

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

2019-08-12 Thread Joe Lawrence
On Wed, Jul 31, 2019 at 02:58:27PM +0900, 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(livep

Re: [PATCH v4 03/10] livepatch: Add klp-convert tool

2019-08-09 Thread Joe Lawrence
On Wed, Jul 31, 2019 at 12:36:05PM +0900, Masahiro Yamada wrote: > On Wed, Jul 31, 2019 at 11:50 AM Masahiro Yamada > wrote: > > > > On Thu, May 9, 2019 at 11:39 PM Joe Lawrence > > wrote: > > > > > > From: Josh Poimboeuf > > > > > >

Re: [PATCH] kprobes: Allow kprobes coexist with livepatch

2019-07-26 Thread Joe Lawrence
On 7/26/19 12:14 PM, Steven Rostedt wrote: On Thu, 25 Jul 2019 22:07:52 -0400 Joe Lawrence wrote: These results reflect my underestanding of FTRACE_OPS_FL_IPMODIFY in light of your changes, so feel free to add my: Acked-by: Joe Lawrence Is this an urgent patch (needs to go in now and not

Re: [PATCH] kprobes: Allow kprobes coexist with livepatch

2019-07-25 Thread Joe Lawrence
has been live patched % perf record -e probe:cmdline_proc_show -aR sleep 30 event syntax error: 'probe:cmdline_proc_show' \___ unknown tracepoint Error: File /sys/kernel/debug/tracing/events/probe/cmdline_proc_show not found. Hint: Perhaps this kernel misses some CONFIG_ setting to enable this feature?. Run 'perf list' for a list of valid events Usage: perf record [] [] or: perf record [] -- [] -e, --eventevent selector. use 'perf list' to list available events These results reflect my underestanding of FTRACE_OPS_FL_IPMODIFY in light of your changes, so feel free to add my: Acked-by: Joe Lawrence -- Joe

kprobes, livepatch and FTRACE_OPS_FL_IPMODIFY

2019-07-24 Thread Joe Lawrence
Hi Masami, I wanted to revisit FTRACE_OPS_FL_IPMODIFY blocking of kprobes and livepatch, at least in cases where kprobe pre_handlers don't modify regs->ip. (We've discussed this previously at part of a kpatch github issue #47: https://github.com/dynup/kpatch/issues/47) The particular use case I

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

2019-07-16 Thread Joe Lawrence
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 have to be solved. First, reliable and consistent > call chain backtracing

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

2019-06-25 Thread Joe Lawrence
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 expanded github tree), the problem > disappears. > > I haven't spotted any problem in the code and I cannot

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

2019-06-25 Thread Joe Lawrence
On 6/25/19 7:36 AM, Miroslav Benes wrote: > [ ... snip ... ] > So I made a couple of experiments and found that GCC is somehow involved. If klp-convert (from scripts/livepatch/) is compiled with our GCC 4.8.5 from SLE12, the output is incorrect. If I compile it with GCC 7.4.0 from openSUSE Lea

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

2019-06-21 Thread Joe Lawrence
On Fri, Jun 21, 2019 at 10:09:11AM -0400, Joe Lawrence wrote: > More word play: would it be any clearer to drop the use of > "modification" when talking about klp_states? Sometimes I read > modification to mean a change to a klp_state itself rather than the > system at

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

2019-06-21 Thread Joe Lawrence
state.c > @@ -0,0 +1,161 @@ > +// SPDX-License-Identifier: GPL-2.0 > +// Copyright (C) 2019 SUSE > > [ ... snip ... ] > > +MODULE_AUTHOR("Joe Lawrence "); Feel free to update the module author for these. -- Joe

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

2019-06-21 Thread Joe Lawrence
On Tue, Jun 11, 2019 at 03:56:26PM +0200, 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/sy

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

2019-06-21 Thread Joe Lawrence
On Tue, Jun 11, 2019 at 03:56:25PM +0200, Petr Mladek wrote: > The atomic replace runs pre/post (un)install callbacks only from the new > livepatch. There are several reasons for this: > > + Simplicity: clear ordering of operations, no interactions between > old and new callbacks. > > +

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

2019-06-21 Thread Joe Lawrence
On Tue, Jun 11, 2019 at 03:56:24PM +0200, 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 replaces the already installed ones. Therefore it should nit: s/replaces/replaces

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

2019-06-21 Thread Joe Lawrence
On Tue, Jun 11, 2019 at 03:56:22PM +0200, Petr Mladek wrote: > Hi, > > this is another piece in the puzzle that helps to maintain more > livepatches. > > Especially pre/post (un)patch callbacks might change a system state. > Any newly installed livepatch has to somehow deal with system state > mo

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

2019-06-14 Thread Joe Lawrence
On 6/14/19 4:34 AM, 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 of response so far. Maybe you've already noticed but the selftests fail

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

2019-06-13 Thread Joe Lawrence
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 of response so far. >> >> Maybe you've already noticed but the selftests fail. Well, at least in >> my VM. When test

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

2019-06-13 Thread Joe Lawrence
On 6/13/19 9:00 AM, Miroslav Benes wrote: Hi Joe, first, I'm sorry for the lack of response so far. Maybe you've already noticed but the selftests fail. Well, at least in my VM. When test_klp_convert1.ko is loaded, the process is killed with [ 518.041826] BUG: kernel NULL pointer dereference,

Re: Oops caused by race between livepatch and ftrace

2019-05-21 Thread Joe Lawrence
On 5/20/19 5:19 PM, Joe Lawrence wrote: On 5/20/19 5:09 PM, Johannes Erdfelt wrote: On Mon, May 20, 2019, Joe Lawrence wrote: These two testing scenarios might be interesting to add to our selftests suite. Can you post or add the source(s) to livepatch-test.ko to the tarball? I made the

Re: Oops caused by race between livepatch and ftrace

2019-05-20 Thread Joe Lawrence
On 5/20/19 5:09 PM, Johannes Erdfelt wrote: On Mon, May 20, 2019, Joe Lawrence wrote: [ fixed jeyu's email address ] Thank you, the bounce message made it seem like my mail server was blocked and not that the address didn't exist. I think MAINTAINERS needs an update since it sti

Re: Oops caused by race between livepatch and ftrace

2019-05-20 Thread Joe Lawrence
[ fixed jeyu's email address ] On 5/20/19 3:49 PM, Johannes Erdfelt wrote: [ ... snip ... ] I have put together a test case that can reproduce the crash using KVM. The tarball includes a minimal kernel and initramfs, along with a script to run qemu and the .config used to build the kernel. By d

[tip:core/urgent] stacktrace: Unbreak stack_trace_save_tsk_reliable()

2019-05-19 Thread tip-bot for Joe Lawrence
Commit-ID: 7eaf51a2e094229b75cc0c315f1cbbe2f3960058 Gitweb: https://git.kernel.org/tip/7eaf51a2e094229b75cc0c315f1cbbe2f3960058 Author: Joe Lawrence AuthorDate: Fri, 17 May 2019 14:51:17 -0400 Committer: Thomas Gleixner CommitDate: Sun, 19 May 2019 11:43:22 +0200 stacktrace: Unbreak

Re: [PATCH] stacktrace: fix CONFIG_ARCH_STACKWALK stack_trace_save_tsk_reliable return

2019-05-17 Thread Joe Lawrence
On Fri, May 17, 2019 at 02:51:17PM -0400, Joe Lawrence wrote: > Miroslav reported that the livepatch self-tests were failing, > specifically a case in which the consistency model ensures that we do > not patch a current executing function, "TEST: busy target module". > &

  1   2   3   4   5   >