[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250115082431.5550-6-pmladek@suse.com>
Date: Wed, 15 Jan 2025 09:24:17 +0100
From: Petr Mladek <pmladek@...e.com>
To: Josh Poimboeuf <jpoimboe@...nel.org>,
Miroslav Benes <mbenes@...e.cz>
Cc: Joe Lawrence <joe.lawrence@...hat.com>,
Nicolai Stange <nstange@...e.de>,
live-patching@...r.kernel.org,
linux-kernel@...r.kernel.org,
Petr Mladek <pmladek@...e.com>
Subject: [PATCH v1 05/19] livepatch: Remove "data" from struct klp_state
The "data" pointer in "struct klp_state" is associated with the lifetime of
the livepatch module, not the livepatch state. This means it's lost when a
livepatch is replaced, even if the new livepatch supports the same state.
Shadow variables provide a more reliable way to attach data to a livepatch
state. Their lifetime can be tied to the state's lifetime by:
- Sharing the same "id"
- Setting "is_shadow" in "struct klp_state"
Removing the "data" pointer prevents potential issues once per-object
callbacks are removed, as it cannot be used securely in that context.
Signed-off-by: Petr Mladek <pmladek@...e.com>
---
include/linux/livepatch.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h
index 56e71d488e71..d02d7a616338 100644
--- a/include/linux/livepatch.h
+++ b/include/linux/livepatch.h
@@ -175,14 +175,12 @@ struct klp_state_callbacks {
* @block_disable: the state disablement is not supported
* @is_shadow: the state handles lifetime of a shadow variable with
* the same @id
- * @data: custom data
*/
struct klp_state {
unsigned long id;
struct klp_state_callbacks callbacks;
bool block_disable;
bool is_shadow;
- void *data;
};
/**
--
2.47.1
Powered by blists - more mailing lists