From: Petr Mladek <pmladek@suse.com>
To: Nicolai Stange <nstange@suse.de>
Cc: Miroslav Benes <mbenes@suse.cz>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Joe Lawrence <joe.lawrence@redhat.com>,
live-patching@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [POC 0/7] livepatch: Make livepatch states, callbacks, and shadow variables work together
Date: Wed, 21 Aug 2024 17:28:31 +0200 [thread overview]
Message-ID: <ZsYHn3XoJu3npb0E@pathway.suse.cz> (raw)
In-Reply-To: <66a263d5.170a0220.b2c84.1870SMTPIN_ADDED_BROKEN@mx.google.com>
On Thu 2024-07-25 16:40:20, Nicolai Stange wrote:
> Miroslav Benes <mbenes@suse.cz> 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 yes, it could point to e.g. some lock protecting an
> associated shadow variable's usage. Or be used to conveniently pass on
> any kind of data between subsequent livepatches.
Honestly, I would prefer to remove the klp_state->data member. I can't
find a safe way how to maintain it.
The pointer is in struct klp_state. It means that any livepatch
supporting the state has its own copy of the pointer. We could copy
the value in __klp_enable_patch() but where?
Before calling klp_states_pre_patch() or after?
It might somehow work when the value is set only once (in a pre_patch
callback). But what if anyone tries to modify the pointer.
What if there are more livepatches using the state at the same time
(not using the atomic replace) and each livepatch has different
value.
From my POV, the klp_state->data pointer is a potentially dangerous
thing with not well defined semantic. IMHO, it is not worth it.
It the livepatches need a new synchronization mechanism, they
might allocate the lock in yet another shadow variable.
Do I miss anything, please?
Could you come up with a reasonable semantic, please?
Best Regards,
Petr
prev parent reply other threads:[~2024-08-21 15:28 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-10 17:04 Petr Mladek
2023-11-10 17:04 ` [POC 1/7] livepatch: Add callbacks for introducing and removing states Petr Mladek
2023-11-11 0:54 ` kernel test robot
2023-11-11 3:19 ` kernel test robot
2023-11-10 17:04 ` [POC 2/7] livepatch: Allow to handle lifetime of shadow variables using the livepatch state Petr Mladek
2024-07-25 11:31 ` Miroslav Benes
2024-08-15 13:43 ` Petr Mladek
2023-11-10 17:04 ` [POC 3/7] livepatch: Use per-state callbacks in state API tests Petr Mladek
2024-07-25 11:48 ` Miroslav Benes
2024-08-16 16:02 ` Petr Mladek
2023-11-10 17:04 ` [POC 4/7] livepatch: Do not use callbacks when testing sysfs interface Petr Mladek
2023-11-10 17:04 ` [POC 5/7] livepatch: Convert klp module callbacks tests into livepatch module tests Petr Mladek
2023-11-11 1:15 ` kernel test robot
2024-07-25 12:22 ` Miroslav Benes
2023-11-10 17:04 ` [POC 6/7] livepatch: Remove the obsolete per-object callbacks Petr Mladek
2023-11-10 17:04 ` [POC 7/7] livepatching: Remove per-state version Petr Mladek
2024-07-25 14:16 ` Miroslav Benes
2024-08-15 14:00 ` Petr Mladek
2023-11-10 21:33 ` [POC 0/7] livepatch: Make livepatch states, callbacks, and shadow variables work together Josh Poimboeuf
2024-07-25 14:19 ` Miroslav Benes
2024-08-15 10:08 ` Petr Mladek
2024-07-25 14:22 ` Miroslav Benes
2024-07-25 14:40 ` Nicolai Stange
[not found] ` <66a263d5.170a0220.b2c84.1870SMTPIN_ADDED_BROKEN@mx.google.com>
2024-08-21 15:28 ` Petr Mladek [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZsYHn3XoJu3npb0E@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=nstange@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®