Re: [PATCH v12 00/12]

2018-10-11 Thread Petr Mladek
On Thu 2018-08-30 13:58:15, Miroslav Benes wrote: > On Tue, 28 Aug 2018, Petr Mladek wrote: > > > livepatch: Atomic replace feature > > > > The atomic replace allows to create cumulative patches. They > > are useful when you maintain many livepatches and want to r

Re: [RFC][PATCH 0/3] printk: some pr_cont tweaks and cleanups

2018-10-12 Thread Petr Mladek
On Tue 2018-10-02 11:38:33, Sergey Senozhatsky wrote: > Hello, > > RFC > > Forked from "printk feature for syzbot". Let's have a separate > discussion thread. > A buch of pr_cont tweaks and cleanups, please see commits and > commits' messages for more details. > > Sergey

Re: [PATCH] printk: fix integer overflow in setup_log_buf()

2018-10-12 Thread Petr Mladek
On Wed 2018-10-10 20:33:08, Sergey Senozhatsky wrote: > The way we calculate logbuf free space percentage overflows signed > integer: > > int free; > > free = __LOG_BUF_LEN - log_next_idx; > pr_info("early log buf free: %u(%u%%)\n", > free, (free * 100) / __LOG_BUF

Re: [PATCH] printk: fix integer overflow in setup_log_buf()

2018-10-12 Thread Petr Mladek
On Fri 2018-10-12 18:27:24, Sergey Senozhatsky wrote: > On (10/12/18 11:01), Petr Mladek wrote: > > > Make "free" unsigned integer and use appropriate printk() specifier. > > > > > > Signed-off-by: Sergey Senozhatsky > > > > I have pushed th

Re: [PATCH v12 04/12] livepatch: Consolidate klp_free functions

2018-10-12 Thread Petr Mladek
On Fri 2018-08-31 12:39:23, Miroslav Benes wrote: > On Tue, 28 Aug 2018, Petr Mladek wrote: > > > The code for freeing livepatch structures is a bit scattered and tricky: > > > > + direct calls to klp_free_*_limited() and kobject_put() are > > used to release

Re: [PATCH v12 07/12] livepatch: Use lists to manage patches, objects and functions

2018-10-12 Thread Petr Mladek
On Mon 2018-09-03 18:00:45, Miroslav Benes wrote: > > > -#define klp_for_each_object(patch, obj) \ > > +#define klp_for_each_object_static(patch, obj) \ > > for (obj = patch->objs; obj->funcs || obj->name; obj++) > > > > -#define klp_for_each_func(obj, func) \ > > +#define klp_for_each_objec

Re: [PATCH v12 06/12] livepatch: Simplify API by removing registration step

2018-10-12 Thread Petr Mladek
On Wed 2018-09-05 11:34:06, Miroslav Benes wrote: > On Tue, 28 Aug 2018, Petr Mladek wrote: > > Also the API and logic is much easier. It is enough to call > > klp_enable_patch() in module_init() call. The patch patch can be disabled > > by writing '0' into /sys/kern

[PATCH v13 00/12] livepatch: Atomic replace feature

2018-10-15 Thread Petr Mladek
replace Joe Lawrence (1): selftests/livepatch: introduce tests Petr Mladek (9): livepatch: Change void *new_func -> unsigned long new_addr in struct klp_func livepatch: Helper macros to define livepatch structures livepatch: Shuffle klp_enable_patch()/klp_disable_patch() c

[PATCH v13 12/12] selftests/livepatch: introduce tests

2018-10-15 Thread Petr Mladek
From: Joe Lawrence Add a few livepatch modules and simple target modules that the included regression suite can run tests against: - basic livepatching (multiple patches, atomic replace) - pre/post (un)patch callbacks - shadow variable API Signed-off-by: Joe Lawrence --- Documentation/l

[PATCH v13 11/12] livepatch: Remove ordering and refuse loading conflicting patches

2018-10-15 Thread Petr Mladek
dle of the function stack (ops->func_stack) is being removed. Signed-off-by: Petr Mladek --- Documentation/livepatch/cumulative-patches.txt | 11 ++--- Documentation/livepatch/livepatch.txt | 30 +++-- kernel/livepatch/core.c| 60 ++

[PATCH v13 10/12] livepatch: Atomic replace and cumulative patches documentation

2018-10-15 Thread Petr Mladek
User documentation for the atomic replace feature. It makes it easier to maintain livepatches using so-called cumulative patches. Signed-off-by: Petr Mladek --- Documentation/livepatch/cumulative-patches.txt | 105 + 1 file changed, 105 insertions(+) create mode 100644

[PATCH v13 05/12] livepatch: Refuse to unload only livepatches available during a forced transition

2018-10-15 Thread Petr Mladek
ill be in use after a forced transition. Newly loaded livepatches might be eventually completely removed later. It is not a big deal. But the code is at least consistent with the reality. Signed-off-by: Petr Mladek --- include/linux/livepatch.h | 2 ++ kernel/livepatch/core.c |

[PATCH v13 01/12] livepatch: Change void *new_func -> unsigned long new_addr in struct klp_func

2018-10-15 Thread Petr Mladek
sted-by: Josh Poimboeuf Signed-off-by: Petr Mladek --- include/linux/livepatch.h| 6 +++--- kernel/livepatch/core.c | 4 ++-- kernel/livepatch/patch.c | 2 +- kernel/livepatch/transition.c| 4 ++-- samples/livep

[PATCH v13 04/12] livepatch: Consolidate klp_free functions

2018-10-15 Thread Petr Mladek
tch->kobj was really released via the _start() part. This patch does not change the existing behavior. Signed-off-by: Petr Mladek Cc: Josh Poimboeuf Cc: Miroslav Benes Cc: Jessica Yu Cc: Jiri Kosina Cc: Jason Baron --- kernel/livepatch/core.c | 79 +++--

[PATCH v13 09/12] livepatch: Remove Nop structures when unused

2018-10-15 Thread Petr Mladek
dynamic lists. Signed-off-by: Petr Mladek --- include/linux/livepatch.h | 6 kernel/livepatch/core.c | 72 ++- kernel/livepatch/core.h | 2 +- kernel/livepatch/patch.c | 31 --- kernel/livepatch/patch.h | 1

[PATCH v13 08/12] livepatch: Add atomic replace

2018-10-15 Thread Petr Mladek
s done by __disable_patch() and klp_complete_transition(). But it is a fast track without all the transaction-related stuff. Signed-off-by: Jason Baron [pmla...@suse.com: Split, reuse existing code, simplified] Signed-off-by: Petr Mladek Cc: Josh Poimboeuf Cc: Jessica Yu Cc: Jiri Kosina Cc: Mir

[PATCH v13 06/12] livepatch: Simplify API by removing registration step

2018-10-15 Thread Petr Mladek
reference is taken. + try_module_get() is called before initializing patch->kobj. It makes it more symmetric with the moved module_put(). + module_put() is the last action also in klp_free_patch_sync_end(). It makes it safe for an use outside module_init(). Suggested-by: Josh Poimboeuf Sign

[PATCH v13 07/12] livepatch: Use lists to manage patches, objects and functions

2018-10-15 Thread Petr Mladek
klp_init_func() calls. Therefore it reduces the further changes to the code. This patch does not change the existing behavior. Signed-off-by: Jason Baron [pmla...@suse.com: Initialize lists before init calls] Signed-off-by: Petr Mladek Cc: Josh Poimboeuf Cc: Jessica Yu Cc: Jiri Kosina Cc: Miroslav

[PATCH v13 02/12] livepatch: Helper macros to define livepatch structures

2018-10-15 Thread Petr Mladek
ule_B, funcs_module_B), KLP_OBJECT_END }; Signed-off-by: Petr Mladek --- include/linux/livepatch.h| 40 samples/livepatch/livepatch-callbacks-demo.c | 55 +++- samples/livepatch/livepatch-sample.c | 13 +++ s

[PATCH v13 03/12] livepatch: Shuffle klp_enable_patch()/klp_disable_patch() code

2018-10-15 Thread Petr Mladek
. Signed-off-by: Petr Mladek --- kernel/livepatch/core.c | 330 1 file changed, 166 insertions(+), 164 deletions(-) diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c index 577ebeb43024..b3956cce239e 100644 --- a/kernel/livepatch/core.c +++ b

Re: 4.14 backport request for dbdda842fe96f: "printk: Add console owner and waiter logic to load balance console writes"

2018-10-04 Thread Petr Mladek
On Wed 2018-10-03 13:37:04, Steven Rostedt wrote: > On Wed, 3 Oct 2018 10:16:08 -0700 > Daniel Wang wrote: > > > On Wed, Oct 3, 2018 at 2:14 AM Petr Mladek wrote: > > > > > > On Tue 2018-10-02 21:23:27, Steven Rostedt wrote: > > > > I don't

Re: 4.14 backport request for dbdda842fe96f: "printk: Add console owner and waiter logic to load balance console writes"

2018-10-04 Thread Petr Mladek
On Thu 2018-10-04 16:44:42, Sergey Senozhatsky wrote: > On (10/03/18 11:37), Daniel Wang wrote: > > When `softlockup_panic` is set (which is what my original repro had and > > what we use in production), without the backport patch, the expected panic > > would hit a seemingly deadlock. So even when

Re: [PATCH v5 1/4] printk: Fix panic caused by passing log_buf_len to command line

2018-10-08 Thread Petr Mladek
On Sun 2018-09-30 00:45:50, zhe...@windriver.com wrote: > From: He Zhe > > log_buf_len_setup does not check input argument before passing it to > simple_strtoull. The argument would be a NULL pointer if "log_buf_len", > without its value, is set in command line and thus causes the following > pan

Re: [PATCH v5 2/4] printk: Correct wrong casting

2018-10-08 Thread Petr Mladek
On Tue 2018-10-02 14:50:18, Sergey Senozhatsky wrote: > On (09/30/18 00:45), zhe...@windriver.com wrote: > > Correct wrong casting that might cut off the normal output. > > A commit message probably could have been a bit more descriptive, > mentioning that log_first_seq and console_seq are 64-bit

Re: [PATCH v5 3/4] printk: Add KBUILD_MODNAME and remove a redundant print prefix

2018-10-08 Thread Petr Mladek
On Sun 2018-09-30 00:45:52, zhe...@windriver.com wrote: > From: He Zhe > > Add KBUILD_MODNAME to make prints more clear. > > Signed-off-by: He Zhe JFYI, I have pushed this patch into printk.git, for-4.20 branch. Best Regards, Petr

Re: [PATCH v5 4/4] printk: Give error on attempt to set log buffer length to over 4G

2018-10-08 Thread Petr Mladek
up to 2G. Give an explicit error for users who want to use larger log buffer. Also fix printk formatting to show the 2G as a positive number. Suggested-by: Sergey Senozhatsky Signed-off-by: He Zhe Signed-off-by: Petr Mladek --- kernel/printk/printk.c | 17 +++-- 1 file changed, 11 ins

Re: [PATCH] printk: inject caller information into the body of message

2018-10-08 Thread Petr Mladek
On Tue 2018-10-02 15:38:51, Sergey Senozhatsky wrote: > On (10/01/18 20:21), Tetsuo Handa wrote: > > Maybe "struct printk_buffer" after all becomes identical to "struct cont". > > But > > I guess that even 16 printk_buffer-s is practically sufficient for 1024 CPUs > > system, and allocating NR_CPU

Re: [PATCH] printk: inject caller information into the body of message

2018-10-08 Thread Petr Mladek
extra data > > that you can get with a new interface from the kernel logs. Not a > > "let's just a add it to all lines and make every line uglier and > > harder to read. > > > > Linus > > but we also know that syzbot cannot

Re: [PATCHv3] panic: avoid deadlocks in re-entrant console drivers

2018-11-01 Thread Petr Mladek
On Thu 2018-11-01 10:48:21, Sergey Senozhatsky wrote: > On (10/31/18 13:27), Petr Mladek wrote: > > > > > > Signed-off-by: Sergey Senozhatsky > > > > The patch makes sense to me. The locks should stay busted also for > > console_flush_on_pa

Re: [PATCH v5] printk: Add line-buffered printk() API.

2018-11-01 Thread Petr Mladek
On Wed 2018-10-24 19:11:10, Tetsuo Handa wrote: > Sometimes we want to print a whole line without being disturbed by > concurrent printk() from interrupts and/or other threads, for printk() > which does not end with '\n' can be disturbed. > > Since mixed printk() output makes it hard to interpret,

Re: [RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-23 Thread Petr Mladek
On Tue 2018-10-16 14:04:25, Sergey Senozhatsky wrote: > >From printk()/serial console point of view panic() is special, because > it may force CPU to re-enter printk() or/and serial console driver. > Therefore, some of serial consoles drivers are re-entrant. E.g. 8250: > > serial8250_console_write

Re: [PATCH v4] printk: Add line-buffered printk() API.

2018-10-23 Thread Petr Mladek
On Wed 2018-10-17 18:54:52, Tetsuo Handa wrote: > Petr Mladek wrote: > > On Sat 2018-10-13 13:39:40, Tetsuo Handa wrote: > > > +struct printk_buffer; > > > +#if defined(CONFIG_PRINTK_LINE_BUFFERED) > > > +struct printk_buffer *get_printk_buffer(void); &g

Re: [PATCH v12 06/12] livepatch: Simplify API by removing registration step

2018-10-24 Thread Petr Mladek
On Tue 2018-10-23 11:39:43, Josh Poimboeuf wrote: > On Mon, Oct 22, 2018 at 03:25:10PM +0200, Petr Mladek wrote: > > On Fri 2018-10-19 09:36:04, Josh Poimboeuf wrote: > > > On Fri, Oct 19, 2018 at 02:16:19PM +0200, Miroslav Benes wrote: > > > > On Thu, 18

Re: [PATCH v13 02/12] livepatch: Helper macros to define livepatch structures

2018-10-24 Thread Petr Mladek
On Thu 2018-10-18 07:58:24, Josh Poimboeuf wrote: > On Thu, Oct 18, 2018 at 01:11:53PM +0200, Petr Mladek wrote: > > On Wed 2018-10-17 13:17:56, Josh Poimboeuf wrote: > > > On Mon, Oct 15, 2018 at 02:37:03PM +0200, Petr Mladek wrote: > > > > The definition of

[GIT PULL] printk for 4.20

2018-10-24 Thread Petr Mladek
address for netdev bits fallback He Zhe (4): printk: Fix panic caused by passing log_buf_len to command line printk: Correct wrong casting printk: Add KBUILD_MODNAME and remove a redundant print prefix printk: Give error on attempt to set log buffer length to over 2G Petr

Re: [PATCH] arm64/module: use mod->klp_info section header information

2018-10-25 Thread Petr Mladek
On Tue 2018-10-23 19:55:54, Jessica Yu wrote: > The arm64 module loader keeps a pointer into info->sechdrs to keep track > of section header information for .plt section(s). A pointer to the > relevent section header (struct elf64_shdr) in info->sechdrs is stored > in mod->arch.{init,core}.plt. Thi

Re: [RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-25 Thread Petr Mladek
On Tue 2018-10-23 20:54:33, Sergey Senozhatsky wrote: > On (10/23/18 13:07), Petr Mladek wrote: > > Though this looks a bit weird. > > > > I have just realized that console_unblank() is called by > > bust_spinlocks(0) and does basically the same as > > console_f

Re: [RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-25 Thread Petr Mladek
On Tue 2018-10-23 21:12:30, Sergey Senozhatsky wrote: > On (10/23/18 21:04), Sergey Senozhatsky wrote: > > > > Seems that s390 is the only arch which defines its own bust_spinlocks(). > > Not sure why... Just to play games with console_loglevel? > > > > --- > > > > void bust_spinlocks(int yes) >

Re: [PATCH v13 02/12] livepatch: Helper macros to define livepatch structures

2018-10-18 Thread Petr Mladek
On Wed 2018-10-17 13:17:56, Josh Poimboeuf wrote: > On Mon, Oct 15, 2018 at 02:37:03PM +0200, Petr Mladek wrote: > > The definition of struct klp_func might be a bit confusing. > > The original function is defined by name as a string. > > The new function is defined by name

Re: [PATCH v13 04/12] livepatch: Consolidate klp_free functions

2018-10-18 Thread Petr Mladek
On Wed 2018-10-17 13:22:54, Josh Poimboeuf wrote: > On Mon, Oct 15, 2018 at 02:37:05PM +0200, Petr Mladek wrote: > > @@ -637,6 +647,7 @@ static int klp_init_patch(struct klp_patch *patch) > > mutex_lock(&klp_mutex); > > > > patch->enabled = false; &

Re: [PATCH v13 05/12] livepatch: Refuse to unload only livepatches available during a forced transition

2018-10-18 Thread Petr Mladek
On Wed 2018-10-17 13:35:19, Josh Poimboeuf wrote: > I'm having trouble parsing the subject. How about: > > Allow unloading of patches added after using 'force' ok > > --- a/kernel/livepatch/core.c > > +++ b/kernel/livepatch/core.c > > @@ -45,7 +45,8 @@ > > */ > > DEFINE_MUTEX(klp_mutex); >

Re: [PATCH v13 06/12] livepatch: Simplify API by removing registration step

2018-10-18 Thread Petr Mladek
On Wed 2018-10-17 14:06:57, Josh Poimboeuf wrote: > On Mon, Oct 15, 2018 at 02:37:07PM +0200, Petr Mladek wrote: > > @@ -319,96 +316,66 @@ forced it is guaranteed that no task sleeps or runs > > in the old code. > > 5. Livepatch life-cycle > >

Re: [PATCH v13 07/12] livepatch: Use lists to manage patches, objects and functions

2018-10-18 Thread Petr Mladek
On Wed 2018-10-17 15:31:07, Josh Poimboeuf wrote: > On Mon, Oct 15, 2018 at 02:37:08PM +0200, Petr Mladek wrote: > > +static int klp_init_lists(struct klp_patch *patch) > > +{ > > + struct klp_object *obj; > > + struct klp_func *func; > > + > > + INIT_

Re: [PATCH v13 09/12] livepatch: Remove Nop structures when unused

2018-10-18 Thread Petr Mladek
On Wed 2018-10-17 15:48:21, Josh Poimboeuf wrote: > On Mon, Oct 15, 2018 at 02:37:10PM +0200, Petr Mladek wrote: > > +void klp_discard_replaced_stuff(struct klp_patch *new_patch) > > +{ > > + klp_discard_replaced_patches(new_patch); > > +

Re: [PATCH v3] mm: memcontrol: Don't flood OOM messages with no eligible task.

2018-10-18 Thread Petr Mladek
On Thu 2018-10-18 13:27:39, Sergey Senozhatsky wrote: > On (10/18/18 11:46), Tetsuo Handa wrote: > > Sergey Senozhatsky wrote: > > > > > > int printk_ratelimit_interval(void) > > > { > > >int ret = DEFAULT_RATELIMIT_INTERVAL; > > >struct tty_driver *driver = NULL; > > >spee

Re: [PATCH v12 06/12] livepatch: Simplify API by removing registration step

2018-10-18 Thread Petr Mladek
On Mon 2018-10-15 18:01:43, Miroslav Benes wrote: > On Fri, 12 Oct 2018, Petr Mladek wrote: > > > On Wed 2018-09-05 11:34:06, Miroslav Benes wrote: > > > On Tue, 28 Aug 2018, Petr Mladek wrote: > > > > Also the API and logic is much easier. It is enough to c

Re: 4.14 backport request for dbdda842fe96f: "printk: Add console owner and waiter logic to load balance console writes"

2018-10-22 Thread Petr Mladek
On Sun 2018-10-21 11:09:22, Daniel Wang wrote: > Just got back from vacation. Thanks for the continued discussion. Just so > I understand the current state. Looks like we've got a pretty good explanation > of what's going on (though not completely sure), and backporting Steven's > patches is still

Re: [PATCH v12 06/12] livepatch: Simplify API by removing registration step

2018-10-22 Thread Petr Mladek
On Fri 2018-10-19 09:36:04, Josh Poimboeuf wrote: > On Fri, Oct 19, 2018 at 02:16:19PM +0200, Miroslav Benes wrote: > > On Thu, 18 Oct 2018, Josh Poimboeuf wrote: > > > > > On Thu, Oct 18, 2018 at 04:54:56PM +0200, Petr Mladek wrote: > > > > OK, what about hav

Re: [RFC][PATCHv2 2/4] printk: move printk_safe macros to printk header

2018-10-22 Thread Petr Mladek
On Wed 2018-10-17 16:00:44, Peter Zijlstra wrote: > On Wed, Oct 17, 2018 at 12:50:15PM +0200, Petr Mladek wrote: > > Also note that by deferred printk I mean deferring the console > > handling! IMHO, there are _no more problems_ with storing > > the messages into the buffer

Re: [PATCH v3] mm: memcontrol: Don't flood OOM messages with no eligible task.

2018-10-23 Thread Petr Mladek
On Fri 2018-10-19 09:18:16, Tetsuo Handa wrote: > Petr Mladek wrote: > > This looks very complex and I see even more problems: > > > > + You would need to update the rate limit intervals when > > new console is attached. Note that the ratelimits might > >

Re: [PATCH v3] mm: memcontrol: Don't flood OOM messages with no eligible task.

2018-10-23 Thread Petr Mladek
On Fri 2018-10-19 19:35:53, Tetsuo Handa wrote: > On 2018/10/19 8:54, Sergey Senozhatsky wrote: > > On (10/18/18 20:58), Tetsuo Handa wrote: > >> That boils down to a "user interaction" problem. > >> Not limiting > >> > >> "%s invoked oom-killer: gfp_mask=%#x(%pGg), nodemask=%*pbl, order=%d, > >

Re: [PATCH v1 1/5] livepatch: Create and include UAPI headers

2024-01-05 Thread Petr Mladek
On Mon 2023-11-06 17:25:09, Lukas Hruska wrote: > From: Josh Poimboeuf > > Define klp prefixes in include/uapi/linux/livepatch.h, and use them for > replacing hard-coded values in kernel/livepatch/core.c. > > Signed-off-by: Josh Poimboeuf > Signed-off-by: Lukas Hrusk

Re: [PATCH v1 2/5] livepatch: Add klp-convert tool

2024-01-05 Thread Petr Mladek
On Mon 2023-11-06 17:25:10, Lukas Hruska wrote: > Livepatches need to access external symbols which can't be handled > by the normal relocation mechanism. It is needed for two types > of symbols: > > + Symbols which can be local for the original livepatched function. > The alternative implem

Re: [PATCH v1 3/5] kbuild/modpost: integrate klp-convert

2024-01-05 Thread Petr Mladek
resolved by klp-convert. > Signed-off-by: Josh Poimboeuf > Signed-off-by: Lukas Hruska Otherwise the code looks good. With the updated commit message: Reviewed-by: Petr Mladek Best Regards, Petr

Re: [PATCH v1 4/5] livepatch: Add sample livepatch module

2024-01-05 Thread Petr Mladek
suggest to livepatch a symbol from another test module so that it does not modify the running system and the result is predictable. Otherwise it looks good. With a better module name: Reviewed-by: Petr Mladek Best Regards, Petr

Re: [PATCH v1 5/5] documentation: Update on livepatch elf format

2024-01-05 Thread Petr Mladek
On Mon 2023-11-06 17:25:13, Lukas Hruska wrote: > Add a section to Documentation/livepatch/module-elf-format.rst > describing how klp-convert works for fixing relocations. > > Signed-off-by: Lukas Hruska Looks good to me: Reviewed-by: Petr Mladek Best Regards, Petr

Re: [PATCH v1 2/5] livepatch: Add klp-convert tool

2024-01-05 Thread Petr Mladek
On Mon 2023-11-06 17:25:10, Lukas Hruska wrote: > Livepatches need to access external symbols which can't be handled > by the normal relocation mechanism. It is needed for two types > of symbols: > > --- /dev/null > +++ b/scripts/livepatch/klp-convert.c > @@ -0,0 +1,283 @@ [...] > +/* > + * Format

Re: [PATCH] livepatch: Add KLP_IDLE state

2024-04-04 Thread Petr Mladek
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. > > When kernel is ready, livepatch is ready too, which state is > > idle but not undefi

Re: [PATCH] livepatch.h: Add comment to klp transition state

2024-05-06 Thread Petr Mladek
On Mon 2024-05-06 10:04:26, zhang warden wrote: > > > > On May 6, 2024, at 05:00, Josh Poimboeuf wrote: > > > > On Mon, Apr 29, 2024 at 03:26:28PM +0800, zhangwar...@gmail.com wrote: > >> From: Wardenjohn > >> > >> livepatch.h use KLP_UNDEFINED\KLP_UNPATCHED\KLP_PATCHED for klp transition >

Re: [PATCH 1/1] livepatch: Rename KLP_* to KLP_TRANSITION_*

2024-05-07 Thread Petr Mladek
rdenjohn Looks good to me: Reviewed-by: Petr Mladek Tested-by: Petr Mladek Best Regards, Petr

Re: [PATCH 1/1] livepatch: Rename KLP_* to KLP_TRANSITION_*

2024-05-09 Thread Petr Mladek
On Tue 2024-05-07 13:01:11, zhangwar...@gmail.com wrote: > From: Wardenjohn > > The original macros of KLP_* is about the state of the transition. > Rename macros of KLP_* to KLP_TRANSITION_* to fix the confusing > description of klp transition state. > > Signed-off-by: Wardenjohn JFYI, the pa

[GIT PULL] livepatching for 6.10

2024-05-15 Thread Petr Mladek
Hi Linus, please pull the latest changes for the kernel livepatching from git://git.kernel.org/pub/scm/linux/kernel/git/livepatching/livepatching tags/livepatching-for-6.10 == - Use more informative names for the livepatch transition states. -

Re: [PATCH] livepatch: introduce klp_func called interface

2024-05-21 Thread Petr Mladek
On Tue 2024-05-21 08:34:46, 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 used to modify ke

Re: [PATCH v5] scripts/link-vmlinux.sh: Add alias to duplicate symbols for kallsyms

2023-10-10 Thread Petr Mladek
On Mon 2023-10-09 15:14:28, Alessandro Carminati wrote: > Hello Kris, > > Thank you for your contribution and for having your thought shared with me. > > Allow me to begin this conversation by explaining what came to mind when > I decided to propose a patch that creates aliases. > > The objectiv

[GIT PULL] livepatching for 6.7

2023-11-02 Thread Petr Mladek
Hi Linus, please pull a fix for livepatching from git://git.kernel.org/pub/scm/linux/kernel/git/livepatching/livepatching tags/livepatching-for-6.7 === - Add missing newline character to avoid waiting for a continuous message.

[POC 0/7] livepatch: Make livepatch states, callbacks, and shadow variables work together

2023-11-10 Thread Petr Mladek
mentation is not updated. + More selftest might be needed [**] [*] There is some mystery in a selftest when the migration gets blocked, see the comments in the 5th patch. [**] In fact, many selftests would deserve some cleanup and better split into categories. Petr Mladek

[POC 1/7] livepatch: Add callbacks for introducing and removing states

2023-11-10 Thread Petr Mladek
rred. The per-object callbacks were called after the barrier. They were using and already existing for-cycle. And nobody did mind about the ordering. Signed-off-by: Petr Mladek --- include/linux/livepatch.h | 28 kernel/livepatch/core.c

[POC 2/7] livepatch: Allow to handle lifetime of shadow variables using the livepatch state

2023-11-10 Thread Petr Mladek
dow variables using state->callbacks.shadow_dtor callback when provided. Signed-off-by: Petr Mladek --- include/linux/livepatch.h | 15 ++- kernel/livepatch/state.c | 14 ++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/include/linux/livepatch.h b/inc

[POC 3/7] livepatch: Use per-state callbacks in state API tests

2023-11-10 Thread Petr Mladek
per-state. + Remove callbacks needed to transfer the pointer between states. + Keep the versioning of the state to prevent downgrade. The problem is artificial because no callbacks are needed to transfer or free the shadow variable anymore. Signed-off-by: Petr Mladek --- lib/livepa

[POC 4/7] livepatch: Do not use callbacks when testing sysfs interface

2023-11-10 Thread Petr Mladek
ctionality which might be used in more tests. It would allow to create tests focusing on some particular feature with an easier output. Signed-off-by: Petr Mladek --- lib/livepatch/Makefile| 2 + lib/livepatch/test_klp_speaker.c | 34 + lib

[POC 5/7] livepatch: Convert klp module callbacks tests into livepatch module tests

2023-11-10 Thread Petr Mladek
Better organize the tests. test-module.sh combines tests of various aspects which might better be suited somewhere else. As a first step, test-callbacks.sh has been renamed to test-modules.sh. But there still might be a better name. - Split this huge patch. Add the

[POC 6/7] livepatch: Remove the obsolete per-object callbacks

2023-11-10 Thread Petr Mladek
postponed until the approach has been approved in the POC stage. Signed-off-by: Petr Mladek --- Documentation/livepatch/callbacks.rst | 133 Documentation/livepatch/index.rst | 1 - include/linux/livepatch.h | 25 --- kernel/livepatch/core.c

[POC 7/7] livepatching: Remove per-state version

2023-11-10 Thread Petr Mladek
-off-by: Petr Mladek --- include/linux/livepatch.h | 7 +- kernel/livepatch/core.c | 17 ++- kernel/livepatch/state.c | 27 +++-- kernel/livepatch/state.h | 1 + lib/livepatch/test_klp_state.c

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

2024-05-22 Thread Petr Mladek
On Thu 2024-05-16 15:30:05, Lukas Hruska wrote: > Livepatches need to access external symbols which can't be handled > by the normal relocation mechanism. It is needed for two types > of symbols: > > + Symbols which can be local for the original livepatched function. > The alternative implem

Re: [PATCH v2 4/6] livepatch: Add sample livepatch module

2024-05-22 Thread Petr Mladek
annotated with > KLP_RELOC_SYMBOL macro. > > The livepatch sample updates the function cmdline_proc_show to print the > string referenced by the symbol saved_command_line appended by the > string "livepatch=1". > > Signed-off-by: Josh Poimboeuf > Signed

Re: [PATCH v2 6/6] selftests: livepatch: Test livepatching function using an external symbol

2024-05-22 Thread Petr Mladek
'\(tainting\|taints\) kernel' | \ > - sed 's/^\[[ 0-9.]*\] //') > + sed 's/^\[[ 0-9.]*\] //' | sed 's/^test_klp_log: //') The prefix "test_klp_log:" is not used anywhere. It seems that this change is not needed in the final

Re: [PATCH] kallsyms, livepatch: Fix livepatch with CONFIG_LTO_CLANG

2024-07-01 Thread Petr Mladek
On Fri 2024-06-28 10:36:45, Luis Chamberlain wrote: > On Fri, Jun 28, 2024 at 02:23:49PM +0200, Miroslav Benes wrote: > > On Fri, 7 Jun 2024, Song Liu wrote: > > > > > Hi Miroslav, > > > > > > Thanks for reviewing the patch! > > > > > > On Fri, Jun 7, 2024 at 6:06 AM Miroslav Benes wrote: > > >

Re: [PATCH] kallsyms, livepatch: Fix livepatch with CONFIG_LTO_CLANG

2024-07-04 Thread Petr Mladek
On Wed 2024-07-03 08:30:33, Luis Chamberlain wrote: > On Tue, Jul 02, 2024 at 10:56:41PM -0700, Josh Poimboeuf wrote: > > On Mon, Jul 01, 2024 at 03:13:23PM +0200, Petr Mladek wrote: > > > So, you suggest to search the symbols by a hash. Do I get it correctly? > > I meant

[GIT PULL] livepatching for 6.11

2024-07-23 Thread Petr Mladek
sts. Marcos Paulo de Souza (1): selftests: livepatch: Test atomic replace against multiple modules Petr Mladek (1): Merge branch 'for-6.11/sysfs-patch-replace' into for-linus Ryan Sullivan (1): selfte

Re: [PATCH] livepatch: Add using attribute to klp_func for using func show

2024-07-24 Thread Petr Mladek
On Sat 2024-07-20 13:56:56, zhang warden wrote: > > > is this always correct though? See the logic in klp_ftrace_handler(). If > > there is a transition running, it is a little bit more complicated. > > > > Miroslav > > Hi! Miroslav. > > In reality, we often encounter such situation that serva

Re: [PATCH 2/3] kallsyms: Add APIs to match symbol without .llmv. suffix.

2024-08-02 Thread Petr Mladek
On Wed 2024-07-31 01:00:34, Song Liu wrote: > Hi Masami, > > > On Jul 30, 2024, at 6:03 AM, Masami Hiramatsu wrote: > > > > On Mon, 29 Jul 2024 17:54:32 -0700 > > Song Liu wrote: > > > >> With CONFIG_LTO_CLANG=y, the compiler may add suffix to function names > >> to avoid duplication. This ca

Re: [PATCH v2 3/3] tracing/kprobes: Use APIs that matches symbols without .XXX suffix

2024-08-08 Thread Petr Mladek
On Wed 2024-08-07 19:46:31, Song Liu wrote: > > > > On Aug 7, 2024, at 7:58 AM, zhang warden wrote: > > > > > >> In my GCC built, we have suffixes like ".constprop.0", ".part.0", > >> ".isra.0", > >> and ".isra.0.cold". > > > > A fresher's eye, I met sometime when try to build a livepatch m

Re: [PATCH v2 3/3] tracing/kprobes: Use APIs that matches symbols without .XXX suffix

2024-08-08 Thread Petr Mladek
On Wed 2024-08-07 20:48:48, Song Liu wrote: > > > > On Aug 7, 2024, at 8:33 AM, Sami Tolvanen wrote: > > > > Hi, > > > > On Wed, Aug 7, 2024 at 3:08 AM Masami Hiramatsu wrote: > >> > >> On Wed, 7 Aug 2024 00:19:20 + > >> Song Liu wrote: > >> > >>> Do you mean we do not want patch 3/3,

Re: [PATCH v2 2/3] kallsyms: Add APIs to match symbol without .XXXX suffix.

2024-08-08 Thread Petr Mladek
On Fri 2024-08-02 14:08:34, Song Liu wrote: > With CONFIG_LTO_CLANG=y, the compiler may add suffix to function names > to avoid duplication. This causes confusion with users of kallsyms. > On one hand, users like livepatch are required to match the symbols > exactly. On the other hand, users like k

Re: [PATCH v2 3/3] tracing/kprobes: Use APIs that matches symbols without .XXX suffix

2024-08-09 Thread Petr Mladek
On Thu 2024-08-08 15:20:26, Song Liu wrote: > > > > On Aug 8, 2024, at 2:59 AM, Petr Mladek wrote: > > > > On Wed 2024-08-07 20:48:48, Song Liu wrote: > >> > >> > >>> On Aug 7, 2024, at 8:33 AM, Sami Tolvanen wrote: > >>

Re: [PATCH v2 1/1] livepatch: Add using attribute to klp_func for using function show

2024-08-13 Thread Petr Mladek
On Mon 2024-08-05 14:46:56, zhangyongde.zyd wrote: > From: Wardenjohn > > One system may contains more than one livepatch module. We can see > which patch is enabled. If some patches applied to one system > modifing the same function, livepatch will use the function enabled > on top of the functi

Re: [PATCH v3 0/2] Fix kallsyms with CONFIG_LTO_CLANG

2024-08-14 Thread Petr Mladek
yms, such as livepatch, have to match > symbols exactly. > > Address this by sorting full symbols at build time, and let kallsyms > lookup APIs to match the symbols exactly. The changes look good from the livepatching POV. For both patches, feel free to use: Acked-by: Petr Mladek I

Re: [PATCH v2 1/1] livepatch: Add using attribute to klp_func for using function show

2024-08-15 Thread Petr Mladek
On Wed 2024-08-14 22:23:21, zhang warden wrote: > > > > On Aug 14, 2024, at 00:05, Petr Mladek wrote: > > > > Alternative solution would be to store the pointer of struct klp_ops > > *ops into struct klp_func. Then using_show() could just check if > > the

Re: [POC 0/7] livepatch: Make livepatch states, callbacks, and shadow variables work together

2024-08-15 Thread Petr Mladek
On Thu 2024-07-25 16:19:30, Miroslav Benes wrote: > On Fri, 10 Nov 2023, Josh Poimboeuf wrote: > > > On Fri, Nov 10, 2023 at 06:04:21PM +0100, Petr Mladek wrote: > > > This POC is a material for the discussion "Simplify Livepatch Callbacks, > > > Shadow Variable

Re: [POC 2/7] livepatch: Allow to handle lifetime of shadow variables using the livepatch state

2024-08-15 Thread Petr Mladek
On Thu 2024-07-25 13:31:40, Miroslav Benes wrote: > > diff --git a/kernel/livepatch/state.c b/kernel/livepatch/state.c > > index 6693d808106b..4ec65afe3a43 100644 > > --- a/kernel/livepatch/state.c > > +++ b/kernel/livepatch/state.c > > @@ -198,11 +198,17 @@ void klp_release_states(struct klp_patch

Re: [POC 7/7] livepatching: Remove per-state version

2024-08-15 Thread Petr Mladek
On Thu 2024-07-25 16:16:44, Miroslav Benes wrote: > On Fri, 10 Nov 2023, Petr Mladek wrote: > > > The livepatch state API was added to help with maintaining: > > > >+ changes done by livepatch callbasks > >+ lifetime of shadow variables > > > &

Re: [POC 3/7] livepatch: Use per-state callbacks in state API tests

2024-08-16 Thread Petr Mladek
On Thu 2024-07-25 13:48:06, Miroslav Benes wrote: > Hi, > > On Fri, 10 Nov 2023, Petr Mladek wrote: > > > Recent changes in the livepatch core have allowed to connect states, > > shadow variables, and callbacks. Use these new features in > > the state tests. > &

Re: [POC 0/7] livepatch: Make livepatch states, callbacks, and shadow variables work together

2024-08-21 Thread Petr Mladek
On Thu 2024-07-25 16:40:20, Nicolai Stange wrote: > Miroslav Benes writes: > > > > > Do we still need klp_state->data member? Now that it can be easily coupled > > with shadow variables, is there a reason to preserve it? Good point. I have actually forgot the pointer completely. > I would say

[GIT PULL] livepatching selftest fixup for 6.11-rc6

2024-08-27 Thread Petr Mladek
Hi Linus, please pull a regression fix in livepatching selftests from git://git.kernel.org/pub/scm/linux/kernel/git/livepatching/livepatching tags/livepatching-for-6.11-rc6 === - Fix a regression in a livepatching selftest. ---

Re: [PATCH v4 2/2] livepatch: Add using attribute to klp_func for using function show

2024-09-06 Thread Petr Mladek
On Thu 2024-09-05 12:23:20, Miroslav Benes wrote: > Hi, > > On Wed, 28 Aug 2024, Wardenjohn wrote: > > > One system may contains more than one livepatch module. We can see > > which patch is enabled. If some patches applied to one system > > modifing the same function, livepatch will use the func

Re: [PATCH v4 2/2] livepatch: Add using attribute to klp_func for using function show

2024-09-06 Thread Petr Mladek
On Fri 2024-09-06 17:39:46, zhang warden wrote: > Hi, John & Miroslav > > >> > >> Would it be possible to just use klp_transition_patch and implement the > >> logic just in using_show()? > > > > Yes, containing the logic to the sysfs file sounds a lot better. > > Maybe I can try to use the sta

Re: [PATCH v4 2/2] livepatch: Add using attribute to klp_func for using function show

2024-09-10 Thread Petr Mladek
On Sun 2024-09-08 10:51:14, zhang warden wrote: > > Hi, Petr > > > > The 1st patch adds the pointer to struct klp_ops into struct > > klp_func. We might check the state a similar way as klp_ftrace_handler(). > > > > I had something like this in mind when I suggested to move the pointer: > > > >

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

2024-09-11 Thread Petr Mladek
On Mon 2024-09-02 20:59:43, 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 work needed for detecting function changes. > > This is similar in concept to kpatch-build,

[GIT PULL] livepatching for 6.12

2024-09-16 Thread Petr Mladek
Hi Linus, please pull the latest changes for the kernel livepatching from git://git.kernel.org/pub/scm/linux/kernel/git/livepatching/livepatching.git tags/livepatching-for-6.12 === - Small documentation improvement. ---

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

2024-09-17 Thread Petr Mladek
On Wed 2024-09-11 09:20:05, Josh Poimboeuf wrote: > Hi Petr, > > Thank you for trying it out and doing the research to compare it with > kpatch-build. > > On Wed, Sep 11, 2024 at 03:27:27PM +0200, Petr Mladek wrote: > > Without -ffunction-sections -fdata-sections: >

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