Skip to contentSkip to conversation

selftests: livepatch: Support 4.12 kernels

PATCH In review Marcos Paulo de Souza 4 participants 18 messages May 24 – Jun 19

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover selftests: livepatch: Support 4.12 kernels

One issue that exists since the inception of the livepatch selftests is the capability of recovering from a failed test: the tested livepatch modules were kept loaded, interfering with the next tests. The first two commits introduce a simple mechanism that tracks all loaded modules, and if the test is aborted, the trap function will disable/unload the remaining modules. With these changes the test "livepatch interaction with kprobed function without post_handler" fails on 4.12 kernels (lacking the feature to have a kprobe a livepatches to be used alongside), but the loaded modules are unloaded, not affecting the next tests.

The other patches adapt the test_klp_mod_target.c file to use module_param_cb and kernel_param_ops structures to test livepatching of functions in modules. This was done to allow the test to be compiled on 4.12 kernels. Older kernels lacks proc_create_single function, and to adapt the code for older versions would require ifdefs, which are not desirable.

I tested these changes using the current upstream kernel and kernel from SLE 12-SP5 (kernel 4.12). The test-kprobe.sh test fails on 4.12 due to the missing capability of livepatch and kprobes to be used together. The result is that now selftests is able to unload the modules loaded, and continue with the next tests. For the livepatch target test, it works the same for 4.12 and current upstream.

Please test and review!

---
Marcos Paulo de Souza (4):
selftests: livepatch: Introduce _remove_mod function
selftests: livepatch: Remove leftover modules when a testcase fails
selftests: livepatch: Adapt mod_target module to pass on 4.12 kernels
selftests: livepatch: Add information about minimum kernel support

 tools/testing/selftests/livepatch/README           |  3 ++
 tools/testing/selftests/livepatch/functions.sh     | 35 ++++++++++++++++++++--
 .../testing/selftests/livepatch/test-livepatch.sh  | 23 +++++++-------
 .../livepatch/test_modules/test_klp_mod_patch.c    | 11 ++++---
 .../livepatch/test_modules/test_klp_mod_target.c   | 22 +++++++-------
 5 files changed, 62 insertions(+), 32 deletions(-)

---
base-commit: 8f7168335cb2e438668c5d94eea76621c9a10edd
change-id: 20260506-livepatch-unload-on-fail-56d30a4e45ca

Best regards,

Signature · 1 line
Marcos Paulo de Souza <[email protected]>
#1 lore raw

PATCH 1/4 selftests: livepatch: Introduce _remove_mod function

This new function will be used in the next patch to remove loaded modules when a testcase fails.

---
 tools/testing/selftests/livepatch/functions.sh | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
tools/testing/selftests/livepatch/functions.sh +11 -2
index 2bc50271729c..3ec0b7962fc5 100644
@@ -241,9 +241,10 @@ function load_failing_mod() {
 	log "$ret"
 }
 
-# unload_mod(modname) - unload a kernel module
+# _remove_mod(modname) - Internal function to remove a loaded module.
+#                        Use unload_mod() instead, which also updates TEST_MODS tracking.
 #	modname - module name to unload
-function unload_mod() {
+function _remove_mod() {
 	local mod="$1"
 
 	# Wait for module reference count to clear ...
@@ -261,6 +262,14 @@ function unload_mod() {
 		die "failed to unload module $mod (/sys/module)"
 }
 
+# unload_mod(modname) - unload a kernel module
+#	modname - module name to unload
+function unload_mod() {
+	local mod="$1"
+
+	_remove_mod "$mod"
+}
+
 # unload_lp(modname) - unload a kernel module with a livepatch
 #	modname - module name to unload
 function unload_lp() {
Signature · 1 line
2.54.0
#2 lore raw

Re: [PATCH 1/4] selftests: livepatch: Introduce _remove_mod function

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] `_remove_mod` uses `die()` which will terminate the script during cleanup operations. --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] _remove_mod uses die() which will terminate the script during cleanup operations. --

commit 7b1591f4e5c3b351136e7fe2821eb2e15ae59ad0
Author: Marcos Paulo de Souza <[email protected]>

selftests: livepatch: Introduce _remove_mod function

This commit introduces the _remove_mod internal function to remove a loaded module, intended to be used during cleanup when a testcase fails. It also refactors unload_mod to use this new helper function.

Quoted 4 lines
tools/testing/selftests/livepatch/functions.sh +0 -0
index 2bc50271729c6..3ec0b7962fc5c 100644

[ ... ]

Quoted 14 lines
tools/testing/selftests/livepatch/functions.sh +3 -2
@@ -241,9 +241,10 @@ function load_failing_mod() {
 	log "$ret"
 }
 
-# unload_mod(modname) - unload a kernel module
+# _remove_mod(modname) - Internal function to remove a loaded module.
+#                        Use unload_mod() instead, which also updates TEST_MODS tracking.
 #	modname - module name to unload
-function unload_mod() {
+function _remove_mod() {
 	local mod="$1"
 
 	# Wait for module reference count to clear ...

tools/testing/selftests/livepatch/functions.sh function unload_mod() { · line 262

Quoted 1 line
tools/testing/selftests/livepatch/functions.sh +0 -0
@@ -261,6 +262,14 @@ function unload_mod() {
 		die "failed to unload module $mod (/sys/module)"

[Severity: Medium]
The commit message notes this function will be used to remove loaded modules when a testcase fails. If used in a cleanup path (such as a bash EXIT trap), will calling die() here terminate the script prematurely?

If a module fails to unload (for example, if its refcount doesn't drop), die() executes exit 1. Inside a trap, this aborts the rest of the cleanup process. This could skip unloading any remaining modules and prevent final cleanup operations like pop_config() from running, potentially leaving kernel tracing persistently enabled and polluting the system state for subsequent tests.

Quoted 1 line
tools/testing/selftests/livepatch/functions.sh +0 -0
 }

[ ... ]

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw

Re: [PATCH 1/4] selftests: livepatch: Introduce _remove_mod function

Quoted 50 lines · On Sun, 2026-05-24 at 23:59 +0000, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] _remove_mod uses die() which will terminate the script during cleanup operations.
--

commit 7b1591f4e5c3b351136e7fe2821eb2e15ae59ad0
Author: Marcos Paulo de Souza <[email protected]>

selftests: livepatch: Introduce _remove_mod function

This commit introduces the _remove_mod internal function to remove a loaded
module, intended to be used during cleanup when a testcase fails. It also
refactors unload_mod to use this new helper function.

Quoted 5 lines
tools/testing/selftests/livepatch/functions.sh +0 -0
index 2bc50271729c6..3ec0b7962fc5c 100644

[ ... ]

Quoted 16 lines
tools/testing/selftests/livepatch/functions.sh +0 -0
@@ -241,9 +241,10 @@ function load_failing_mod() {

  log "$ret"
 }

tools/testing/selftests/livepatch/functions.sh +1 -1
-# unload_mod(modname) - unload a kernel module
+# _remove_mod(modname) - Internal function to remove a loaded

module.
+#                        Use unload_mod() instead, which also updates TEST_MODS tracking.
 # modname - module name to unload

tools/testing/selftests/livepatch/functions.sh +1 -1
-function unload_mod() {
+function _remove_mod() {

  local mod="$1"

  # Wait for module reference count to clear ...

tools/testing/selftests/livepatch/functions.sh +0 -0
@@ -261,6 +262,14 @@ function unload_mod() {
Quoted 1 line

  die "failed to unload module $mod (/sys/module)"

[Severity: Medium]
The commit message notes this function will be used to remove loaded modules
when a testcase fails. If used in a cleanup path (such as a bash EXIT trap),
will calling die() here terminate the script prematurely?

Quoted 9 lines

If a module fails to unload (for example, if its refcount doesn't drop),
die() executes exit 1. Inside a trap, this aborts the rest of the cleanup process. This could skip unloading any remaining modules and prevent final cleanup operations like pop_config() from running, potentially
leaving kernel tracing persistently enabled and polluting the system state
for subsequent tests.

The system is already polluted when a testcase fails nowadays, since a module is kept loaded either way, making the next tests to fail if they also try to lead the same modules.

The current approach is trying to make it more reliable.

Quoted 4 lines
Quoted 2 lines

 }

[ ... ]

maintainer
#4 lore raw

Re: [PATCH 1/4] selftests: livepatch: Introduce _remove_mod function

Quoted 61 lines · Marcos Paulo de Souza
Quoted 50 lines · On Sun, 2026-05-24 at 23:59 +0000, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] _remove_mod uses die() which will terminate the script during cleanup operations.
--

commit 7b1591f4e5c3b351136e7fe2821eb2e15ae59ad0
Author: Marcos Paulo de Souza <[email protected]>

selftests: livepatch: Introduce _remove_mod function

This commit introduces the _remove_mod internal function to remove a loaded
module, intended to be used during cleanup when a testcase fails. It also
refactors unload_mod to use this new helper function.

Quoted 5 lines
tools/testing/selftests/livepatch/functions.sh +0 -0
index 2bc50271729c6..3ec0b7962fc5c 100644

[ ... ]

Quoted 16 lines
tools/testing/selftests/livepatch/functions.sh +0 -0
@@ -241,9 +241,10 @@ function load_failing_mod() {

  log "$ret"
 }

tools/testing/selftests/livepatch/functions.sh +1 -1
-# unload_mod(modname) - unload a kernel module
+# _remove_mod(modname) - Internal function to remove a loaded

module.
+#                        Use unload_mod() instead, which also updates TEST_MODS tracking.
 # modname - module name to unload

tools/testing/selftests/livepatch/functions.sh +1 -1
-function unload_mod() {
+function _remove_mod() {

  local mod="$1"

  # Wait for module reference count to clear ...

tools/testing/selftests/livepatch/functions.sh +0 -0
@@ -261,6 +262,14 @@ function unload_mod() {
Quoted 1 line

  die "failed to unload module $mod (/sys/module)"

[Severity: Medium]
The commit message notes this function will be used to remove loaded modules
when a testcase fails. If used in a cleanup path (such as a bash EXIT trap),
will calling die() here terminate the script prematurely?

Quoted 9 lines

If a module fails to unload (for example, if its refcount doesn't drop),
die() executes exit 1. Inside a trap, this aborts the rest of the cleanup process. This could skip unloading any remaining modules and prevent final cleanup operations like pop_config() from running, potentially
leaving kernel tracing persistently enabled and polluting the system state
for subsequent tests.

Quoted 5 lines

The system is already polluted when a testcase fails nowadays, since a module is kept loaded either way, making the next tests to fail if they also try to lead the same modules.

The current approach is trying to make it more reliable.

I believe that Sashiko suggested that the clean up path should not use "die" or "exit" when something fails. It should try to continue with the next cleanup task.

I remember that we even used the following in rpm post install scripts:

    command || true

It is useful when the script does several independent actions and we would like to process as many of them as possible.

For example, in our case, if one module can't be unloaded then we might still try to remove other modules and call pop_config.

So, we should somehow distinguish when some code paths are called in the script and when in the clean up part.

I would export some variable in the cleanup() function and check it in the called code paths, for example:

tools/testing/selftests/livepatch/functions.sh +5 -1
index 9c98bbb8b725..eebc7f193d98 100644
@@ -62,7 +62,9 @@ function has_kdir() {
 function die() {
 	log "ERROR: $1"
 	echo "ERROR: $1" >&2
-	exit 1
+	if [ -z "$in_klp_cleanup" ] ; then
+	    exit 1
+	fi
 }
 
 function push_config() {
@@ -128,6 +130,8 @@ function set_ftrace_enabled() {
 }
 
 function cleanup() {
+	export in_klp_cleanup=1
+
 	# Remove leftover modules in reverse order to handle dependencies
 	for mod_item in "${TEST_MODS[@]}"; do
 		if is_livepatch_mod "$mod_item"; then

Finally, I think how to split the changes into patches.

I think that the above changes which add "in_klp_cleanup" might be a separate patch,

But the original 1st patch looked weird. It did split _remove_mod() and talked about TEST_MODS tracking but the tracking was added in 2nd patch. I would prefer to split the function and add the tracking in the same patch so that it is obvious why it is split and what is the difference.

Best Regards,
Petr

#5 lore raw

PATCH 2/4 selftests: livepatch: Remove leftover modules when a testcase fails

In reply to Marcos Paulo de Souza

The current livepatch selftest scripts load modules, run tests and unloads them. If the test fails, it can leave loaded modules behind, and in some cases making it impossible to run the next tests.

This approach tracks down the loaded modules, and in case of a test failure, or premature exit of the script, the cleanup function will be called by the trap installed on setup_config function.

The cleanup function iterates over the list of leftover loaded modules, unloading them. The function also checks if the given module is a livepatch, properly disabling it before unloading.

---
 tools/testing/selftests/livepatch/functions.sh | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
tools/testing/selftests/livepatch/functions.sh +22 -1
index 3ec0b7962fc5..25f137003865 100644
@@ -15,6 +15,8 @@ if [[ -e /sys/kernel/tracing/trace ]]; then
 else
 	SYSFS_TRACING_DIR="$SYSFS_DEBUG_DIR/tracing"
 fi
+# List of loaded modules used in tests
+TEST_MODS=()
 
 # Kselftest framework requirement - SKIP code is 4
 ksft_skip=4
@@ -125,6 +127,14 @@ function set_ftrace_enabled() {
 }
 
 function cleanup() {
+	# Remove leftover modules in reverse order to handle dependencies
+	for mod_item in "${TEST_MODS[@]}"; do
+		if is_livepatch_mod "$mod_item"; then
+			disable_lp "$mod_item"
+		fi
+		_remove_mod "$mod_item"
+	done
+
 	pop_config
 }
 
@@ -181,6 +191,9 @@ function __load_mod() {
 	# Wait for module in sysfs ...
 	loop_until '[[ -e "/sys/module/$mod" ]]' ||
 		die "failed to load module $mod"
+
+	# Store the module in the modules list
+	TEST_MODS+=("$mod")
 }
 
 
@@ -262,12 +275,20 @@ function _remove_mod() {
 		die "failed to unload module $mod (/sys/module)"
 }
 
-# unload_mod(modname) - unload a kernel module
+# unload_mod(modname) - unload a kernel module and remove it from TEST_MODS
 #	modname - module name to unload
 function unload_mod() {
 	local mod="$1"
 
 	_remove_mod "$mod"
+
+	# Remove from TEST_MODS array
+	for i in "${!TEST_MODS[@]}"; do
+		if [[ "${TEST_MODS[$i]}" == "$mod" ]]; then
+			unset 'TEST_MODS[$i]'
+			break
+		fi
+	done
 }
 
 # unload_lp(modname) - unload a kernel module with a livepatch
Signature · 1 line
2.54.0
#6 lore raw

Re: [PATCH 2/4] selftests: livepatch: Remove leftover modules when a testcase fails

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] The cleanup loop iterates over the TEST_MODS array in forward order, violating dependency…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The cleanup loop iterates over the TEST_MODS array in forward order, violating dependency requirements and causing rmmod to fail.
- [Medium] Functions invoked during cleanup call die() on failure, prematurely aborting the EXIT trap and skipping pop_config(). --

commit aafb48b2a54fe2209742378f31fb96583598557a
Author: Marcos Paulo de Souza <[email protected]>

selftests: livepatch: Remove leftover modules when a testcase fails

This commit introduces a cleanup mechanism for livepatch selftests that tracks loaded modules and attempts to remove them if a test fails or exits prematurely. It uses a TEST_MODS array to keep track of dependencies and unloads the remaining modules during an EXIT trap.

Quoted 4 lines
tools/testing/selftests/livepatch/functions.sh +0 -0
index 3ec0b7962fc5c..25f1370038654 100644

[ ... ]

tools/testing/selftests/livepatch/functions.sh function set_ftrace_enabled() { · line 131

Quoted 6 lines
tools/testing/selftests/livepatch/functions.sh +2 -0
@@ -125,6 +127,14 @@ function set_ftrace_enabled() {
 }
 
 function cleanup() {
+	# Remove leftover modules in reverse order to handle dependencies
+	for mod_item in "${TEST_MODS[@]}"; do

[Severity: Medium]
Does this loop actually iterate in reverse order?

The comment states the modules will be removed in reverse order to handle dependencies, but ${TEST_MODS[@]} expands the array in ascending index order.

Because dependent modules (like livepatches) are loaded after their base modules, iterating in forward order will attempt to unload the base modules first. This would likely cause rmmod to fail with a module in use error.

tools/testing/selftests/livepatch/functions.sh function set_ftrace_enabled() { · line 135

Quoted 4 lines
tools/testing/selftests/livepatch/functions.sh +4 -0
+		if is_livepatch_mod "$mod_item"; then
+			disable_lp "$mod_item"
+		fi
+		_remove_mod "$mod_item"

[Severity: Medium]
Can this call prematurely abort the cleanup process?

The cleanup() function is executed within an EXIT trap. If _remove_mod() fails to unload a module, it calls die() which executes an exit command:

tools/testing/selftests/livepatch/functions.sh:_remove_mod() {
...
die "failed to unload module $mod (/sys/module)"
}

Executing exit inside a bash EXIT trap immediately halts the execution of the trap itself. This would abruptly skip the remaining iterations of the module cleanup loop and skip the subsequent pop_config() call.

Failing to execute pop_config() leaves the global kernel debug and tracing configurations modified, which could pollute the state of the test system.

Quoted 4 lines
tools/testing/selftests/livepatch/functions.sh +2 -0
+	done
+
 	pop_config
 }
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
maintainer
#7 lore raw

Re: [PATCH 2/4] selftests: livepatch: Remove leftover modules when a testcase fails

Quoted 30 lines · On Mon 2026-05-25 00:06:21, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The cleanup loop iterates over the TEST_MODS array in forward order, violating dependency requirements and causing rmmod to fail.
- [Medium] Functions invoked during cleanup call die() on failure, prematurely aborting the EXIT trap and skipping pop_config(). --

commit aafb48b2a54fe2209742378f31fb96583598557a
Author: Marcos Paulo de Souza <[email protected]>

selftests: livepatch: Remove leftover modules when a testcase fails

This commit introduces a cleanup mechanism for livepatch selftests that tracks loaded modules and attempts to remove them if a test fails or exits prematurely. It uses a TEST_MODS array to keep track of dependencies and unloads the remaining modules during an EXIT trap.

Quoted 4 lines
tools/testing/selftests/livepatch/functions.sh +0 -0
index 3ec0b7962fc5c..25f1370038654 100644

[ ... ]

tools/testing/selftests/livepatch/functions.sh function set_ftrace_enabled() { · line 131

Quoted 6 lines
tools/testing/selftests/livepatch/functions.sh +2 -0
@@ -125,6 +127,14 @@ function set_ftrace_enabled() {
 }
 
 function cleanup() {
+	# Remove leftover modules in reverse order to handle dependencies
+	for mod_item in "${TEST_MODS[@]}"; do

[Severity: Medium]
Does this loop actually iterate in reverse order?

Quoted 7 lines

The comment states the modules will be removed in reverse order to handle dependencies, but ${TEST_MODS[@]} expands the array in ascending index order.

Because dependent modules (like livepatches) are loaded after their base modules, iterating in forward order will attempt to unload the base modules first. This would likely cause rmmod to fail with a module in use error.

The ordering should not be important. It does not matter whether the livepatch or livepatched module is removed first. And only one livepatch is enabled when atomic replace is used.

I believe that the ordering does not matter even when more livepatches are enabled and the atomic replace is not used. Anyway, there is an idea to make the no-replace livepatches trully independent, see
https://lore.kernel.org/r/[email protected]

I would personally ignore the ordering here.

Best Regards,
Petr

maintainer
#8 lore raw

Re: [PATCH 2/4] selftests: livepatch: Remove leftover modules when a testcase fails

In reply to Marcos Paulo de Souza
Quoted 31 lines · Marcos Paulo de Souza

The current livepatch selftest scripts load modules, run tests and unloads them. If the test fails, it can leave loaded modules behind, and in some cases making it impossible to run the next tests.

This approach tracks down the loaded modules, and in case of a test failure, or premature exit of the script, the cleanup function will be called by the trap installed on setup_config function.

The cleanup function iterates over the list of leftover loaded modules, unloading them. The function also checks if the given module is a livepatch, properly disabling it before unloading.

---
 tools/testing/selftests/livepatch/functions.sh | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
tools/testing/selftests/livepatch/functions.sh +2 -0
index 3ec0b7962fc5..25f137003865 100644
@@ -15,6 +15,8 @@ if [[ -e /sys/kernel/tracing/trace ]]; then
 else
 	SYSFS_TRACING_DIR="$SYSFS_DEBUG_DIR/tracing"
 fi
+# List of loaded modules used in tests
+TEST_MODS=()
 
 # Kselftest framework requirement - SKIP code is 4
 ksft_skip=4

tools/testing/selftests/livepatch/functions.sh function set_ftrace_enabled() { · line 131

Quoted 5 lines
tools/testing/selftests/livepatch/functions.sh +2 -0
@@ -125,6 +127,14 @@ function set_ftrace_enabled() {
 }
 
 function cleanup() {
+	# Remove leftover modules in reverse order to handle dependencies
+	for mod_item in "${TEST_MODS[@]}"; do

It would make sense to check here that the module is loaded. I would add a helper function is_mod_loaded which would check whether /sys/module/$mod exists.

tools/testing/selftests/livepatch/functions.sh function set_ftrace_enabled() { · line 132

Quoted 1 line
tools/testing/selftests/livepatch/functions.sh +1 -0
+		if is_livepatch_mod "$mod_item"; then

It might make sense to 1st check here whether the livepatch is enabled. Again, I would add a helper function for this.

tools/testing/selftests/livepatch/functions.sh function set_ftrace_enabled() { · line 136

Quoted 4 lines
tools/testing/selftests/livepatch/functions.sh +4 -0
+			disable_lp "$mod_item"
+		fi
+		_remove_mod "$mod_item"
+	done

I would put this into a helper function, for example, called remove_test_mods().

tools/testing/selftests/livepatch/functions.sh function __load_mod() { · line 196

Quoted 11 lines
tools/testing/selftests/livepatch/functions.sh +4 -0
+
 	pop_config
 }
 
@@ -181,6 +191,9 @@ function __load_mod() {
 	# Wait for module in sysfs ...
 	loop_until '[[ -e "/sys/module/$mod" ]]' ||
 		die "failed to load module $mod"
+
+	# Store the module in the modules list
+	TEST_MODS+=("$mod")

I would put this into a helper function, for example, called track_test_mod().

Quoted 12 lines
tools/testing/selftests/livepatch/functions.sh +1 -1
 }
 
 
@@ -262,12 +275,20 @@ function _remove_mod() {
 		die "failed to unload module $mod (/sys/module)"
 }
 
-# unload_mod(modname) - unload a kernel module
+# unload_mod(modname) - unload a kernel module and remove it from TEST_MODS
 #	modname - module name to unload
 function unload_mod() {
 	local mod="$1"

tools/testing/selftests/livepatch/functions.sh function _remove_mod() { · line 291

Quoted 10 lines
tools/testing/selftests/livepatch/functions.sh +8 -0
 
 	_remove_mod "$mod"
+
+	# Remove from TEST_MODS array
+	for i in "${!TEST_MODS[@]}"; do
+		if [[ "${TEST_MODS[$i]}" == "$mod" ]]; then
+			unset 'TEST_MODS[$i]'
+			break
+		fi
+	done

And this into a helper called, for example, untrack_test_mod().

tools/testing/selftests/livepatch/functions.sh function _remove_mod() { · line 294

Quoted 3 lines
tools/testing/selftests/livepatch/functions.sh +0 -0
 }
 
 # unload_lp(modname) - unload a kernel module with a livepatch

Best Regards,
Petr

#9 lore raw

PATCH 3/4 selftests: livepatch: Adapt mod_target module to pass on 4.12 kernels

In reply to Marcos Paulo de Souza

Use the stable module_param_cb API instead of proc_fs for exposing module state. This approach is compatible with kernel 4.12 and later. The end result is the same: the module has a function that shows a string, which is later livepatched to show a different string. The only difference is that the file being checked is now a module parameter instead of a procfs entry.

---
 tools/testing/selftests/livepatch/functions.sh     |  1 +
 .../testing/selftests/livepatch/test-livepatch.sh  | 23 +++++++++++-----------
 .../livepatch/test_modules/test_klp_mod_patch.c    | 11 +++++------
 .../livepatch/test_modules/test_klp_mod_target.c   | 22 ++++++++++-----------
 4 files changed, 27 insertions(+), 30 deletions(-)
tools/testing/selftests/livepatch/functions.sh +1 -0
index 25f137003865..c8c99851c3a2 100644
@@ -7,6 +7,7 @@
 MAX_RETRIES=600
 RETRY_INTERVAL=".1"	# seconds
 SYSFS_KERNEL_DIR="/sys/kernel"
+SYSFS_MODULE_DIR="/sys/module"
 SYSFS_KLP_DIR="$SYSFS_KERNEL_DIR/livepatch"
 SYSFS_DEBUG_DIR="$SYSFS_KERNEL_DIR/debug"
 SYSFS_KPROBES_DIR="$SYSFS_DEBUG_DIR/kprobes"
tools/testing/selftests/livepatch/test-livepatch.sh +11 -12
index c44c5341a2f1..06aacf0f4dc7 100755
@@ -198,26 +198,25 @@ livepatch: '$MOD_REPLACE': unpatching complete
 % rmmod $MOD_REPLACE"
 
 
-# - load a target module that provides /proc/test_klp_mod_target with
-#   original output
-# - load a livepatch that patches the target module's show function
-# - verify the proc entry returns livepatched output
+# - load a target module with module_param_cb get data with original output
+# - load a livepatch that patches the target module's get function
+# - verify the parameter get function returns the livepatched output
 # - disable and unload the livepatch
-# - verify the proc entry returns original output again
+# - verify the parameter get function returns the original output again
 # - unload the target module
 
 start_test "module function patching"
 
 load_mod $MOD_TARGET
 
-if [[ "$(cat /proc/$MOD_TARGET)" != "$MOD_TARGET: original output" ]] ; then
+if [[ "$(cat $SYSFS_MODULE_DIR/$MOD_TARGET/parameters/klp_mod_arg)" != "$MOD_TARGET: original output" ]] ; then
 	echo -e "FAIL\n\n"
 	die "livepatch kselftest(s) failed"
 fi
 
 load_lp $MOD_TARGET_PATCH
 
-if [[ "$(cat /proc/$MOD_TARGET)" != "$MOD_TARGET_PATCH: this has been live patched" ]] ; then
+if [[ "$(cat $SYSFS_MODULE_DIR/$MOD_TARGET/parameters/klp_mod_arg)" != "$MOD_TARGET_PATCH: this has been live patched" ]] ; then
 	echo -e "FAIL\n\n"
 	die "livepatch kselftest(s) failed"
 fi
@@ -225,7 +224,7 @@ fi
 disable_lp $MOD_TARGET_PATCH
 unload_lp $MOD_TARGET_PATCH
 
-if [[ "$(cat /proc/$MOD_TARGET)" != "$MOD_TARGET: original output" ]] ; then
+if [[ "$(cat $SYSFS_MODULE_DIR/$MOD_TARGET/parameters/klp_mod_arg)" != "$MOD_TARGET: original output" ]] ; then
 	echo -e "FAIL\n\n"
 	die "livepatch kselftest(s) failed"
 fi
@@ -252,9 +251,9 @@ $MOD_TARGET: test_klp_mod_target_exit"
 
 # - load a livepatch that targets a not-yet-loaded module
 # - load the target module: klp_module_coming patches it immediately
-# - verify the proc entry returns livepatched output
+# - verify the parameter get function returns the livepatched output
 # - disable and unload the livepatch
-# - verify the proc entry returns original output again
+# - verify the parameter get function returns the original output again
 # - unload the target module
 
 start_test "module function patching (livepatch first)"
@@ -262,7 +261,7 @@ start_test "module function patching (livepatch first)"
 load_lp $MOD_TARGET_PATCH
 load_mod $MOD_TARGET
 
-if [[ "$(cat /proc/$MOD_TARGET)" != "$MOD_TARGET_PATCH: this has been live patched" ]] ; then
+if [[ "$(cat $SYSFS_MODULE_DIR/$MOD_TARGET/parameters/klp_mod_arg)" != "$MOD_TARGET_PATCH: this has been live patched" ]] ; then
 	echo -e "FAIL\n\n"
 	die "livepatch kselftest(s) failed"
 fi
@@ -270,7 +269,7 @@ fi
 disable_lp $MOD_TARGET_PATCH
 unload_lp $MOD_TARGET_PATCH
 
-if [[ "$(cat /proc/$MOD_TARGET)" != "$MOD_TARGET: original output" ]] ; then
+if [[ "$(cat $SYSFS_MODULE_DIR/$MOD_TARGET/parameters/klp_mod_arg)" != "$MOD_TARGET: original output" ]] ; then
 	echo -e "FAIL\n\n"
 	die "livepatch kselftest(s) failed"
 fi
tools/testing/selftests/livepatch/test_modules/test_klp_mod_patch.c +5 -6
index 6725b4720365..ab56e57c02a8 100644
@@ -8,17 +8,16 @@
 #include <linux/livepatch.h>
 #include <linux/seq_file.h>
 
-static int livepatch_mod_target_show(struct seq_file *m, void *v)
+static int livepatch_mod_target_get(char *buffer, const struct kernel_param *kp)
 {
-	seq_printf(m, "%s: %s\n", THIS_MODULE->name,
-		   "this has been live patched");
-	return 0;
+	return sprintf(buffer, "%s: %s\n", THIS_MODULE->name,
+		       "this has been live patched");
 }
 
 static struct klp_func funcs[] = {
 	{
-		.old_name = "test_klp_mod_target_show",
-		.new_func = livepatch_mod_target_show,
+		.old_name = "test_klp_mod_target_get",
+		.new_func = livepatch_mod_target_get,
 	},
 	{},
 };
tools/testing/selftests/livepatch/test_modules/test_klp_mod_target.c +10 -12
index 9643984d2402..1382a266825f 100644
@@ -5,31 +5,29 @@
 
 #include <linux/module.h>
 #include <linux/kernel.h>
-#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
+#include <linux/moduleparam.h>
 
-static struct proc_dir_entry *pde;
-
-static noinline int test_klp_mod_target_show(struct seq_file *m, void *v)
+static noinline int test_klp_mod_target_get(char *buffer, const struct kernel_param *kp)
 {
-	seq_printf(m, "%s: %s\n", THIS_MODULE->name, "original output");
-	return 0;
+	return sprintf(buffer, "%s: %s\n", THIS_MODULE->name, "original output");
 }
 
+static const struct kernel_param_ops test_klp_mod_target_ops = {
+	.get = test_klp_mod_target_get,
+};
+
+module_param_cb(klp_mod_arg, &test_klp_mod_target_ops, NULL, 0444);
+MODULE_PARM_DESC(klp_mod_arg, "The value of this argument will be livepatched");
+
 static int test_klp_mod_target_init(void)
 {
 	pr_info("%s\n", __func__);
-	pde = proc_create_single("test_klp_mod_target", 0, NULL,
-				 test_klp_mod_target_show);
-	if (!pde)
-		return -ENOMEM;
 	return 0;
 }
 
 static void test_klp_mod_target_exit(void)
 {
 	pr_info("%s\n", __func__);
-	proc_remove(pde);
 }
 
 module_init(test_klp_mod_target_init);
Signature · 1 line
2.54.0
#10 lore raw

Re: [PATCH 3/4] selftests: livepatch: Adapt mod_target module to pass on 4.12 kernels

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The `test_klp_mod_target_ops` structure omits the logically required `.set` callback, exposing…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The test_klp_mod_target_ops structure omits the logically required .set callback, exposing the kernel to a NULL pointer dereference during module load. --

commit 532c1b8c7438f534fd4e3440716ede6cf83efe1c
Author: Marcos Paulo de Souza <[email protected]>

selftests: livepatch: Adapt mod_target module to pass on 4.12 kernels

Use the stable module_param_cb API instead of proc_fs for exposing module state. This approach is compatible with kernel 4.12 and later.

Quoted 5 lines
tools/testing/selftests/livepatch/test_modules/test_klp_mod_target.c +0 -0
index 9643984d24022..1382a266825fb 100644
@@ -5,31 +5,29 @@

[ ... ]

tools/testing/selftests/livepatch/test_modules/test_klp_mod_target.c line 19

Quoted 5 lines
tools/testing/selftests/livepatch/test_modules/test_klp_mod_target.c +5 -0
+static const struct kernel_param_ops test_klp_mod_target_ops = {
+	.get = test_klp_mod_target_get,
+};
+
+module_param_cb(klp_mod_arg, &test_klp_mod_target_ops, NULL, 0444);

[Severity: Medium]
Does this code need a .set callback in the kernel_param_ops structure?

When a module parameter is passed during module load, the kernel parses the arguments using parse_args(), which invokes parse_one() in kernel/params.c. Because parse_one() unconditionally executes the .set callback without verifying if it is actually defined, omitting it here leaves the callback implicitly initialized to NULL.

Could this lead to a NULL pointer dereference and a kernel panic if someone attempts to set this parameter during module load?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
#11 lore raw

Re: [PATCH 3/4] selftests: livepatch: Adapt mod_target module to pass on 4.12 kernels

Quoted 51 lines · On Mon, 2026-05-25 at 00:24 +0000, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The test_klp_mod_target_ops structure omits the logically required .set callback, exposing the kernel to a NULL pointer dereference during module load.
--

commit 532c1b8c7438f534fd4e3440716ede6cf83efe1c
Author: Marcos Paulo de Souza <[email protected]>

selftests: livepatch: Adapt mod_target module to pass on 4.12 kernels

Use the stable module_param_cb API instead of proc_fs for exposing module
state. This approach is compatible with kernel 4.12 and later.

Quoted 13 lines

diff --git a/tools/testing/selftests/livepatch/test_modules/test_klp_mod_targe t.c b/tools/testing/selftests/livepatch/test_modules/test_klp_mod_targe t.c
index 9643984d24022..1382a266825fb 100644
---
a/tools/testing/selftests/livepatch/test_modules/test_klp_mod_targe t.c
+++
b/tools/testing/selftests/livepatch/test_modules/test_klp_mod_targe t.c

(quoted diff) +0 -0
@@ -5,31 +5,29 @@

[ ... ]

Quoted 6 lines
tools/testing/selftests/livepatch/test_modules/test_klp_mod_target.c +5 -0
+static const struct kernel_param_ops test_klp_mod_target_ops = {
+	.get = test_klp_mod_target_get,
+};
+
+module_param_cb(klp_mod_arg, &test_klp_mod_target_ops, NULL,

0444);

[Severity: Medium]
Does this code need a .set callback in the kernel_param_ops structure?

When a module parameter is passed during module load, the kernel parses the
arguments using parse_args(), which invokes parse_one() in kernel/params.c.
Because parse_one() unconditionally executes the .set callback without
verifying if it is actually defined, omitting it here leaves the callback
implicitly initialized to NULL.

Quoted 3 lines

Could this lead to a NULL pointer dereference and a kernel panic if someone
attempts to set this parameter during module load?

Indeed! I'll send a v2 addressing the missing argument. Thanks Sachiko for spotting it :)

maintainer
#12 lore raw

Re: [PATCH 3/4] selftests: livepatch: Adapt mod_target module to pass on 4.12 kernels

Quoted 52 lines · Marcos Paulo de Souza
Quoted 51 lines · On Mon, 2026-05-25 at 00:24 +0000, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The test_klp_mod_target_ops structure omits the logically required .set callback, exposing the kernel to a NULL pointer dereference during module load.
--

commit 532c1b8c7438f534fd4e3440716ede6cf83efe1c
Author: Marcos Paulo de Souza <[email protected]>

selftests: livepatch: Adapt mod_target module to pass on 4.12 kernels

Use the stable module_param_cb API instead of proc_fs for exposing module
state. This approach is compatible with kernel 4.12 and later.

Quoted 13 lines

diff --git a/tools/testing/selftests/livepatch/test_modules/test_klp_mod_targe t.c b/tools/testing/selftests/livepatch/test_modules/test_klp_mod_targe t.c
index 9643984d24022..1382a266825fb 100644
---
a/tools/testing/selftests/livepatch/test_modules/test_klp_mod_targe t.c
+++
b/tools/testing/selftests/livepatch/test_modules/test_klp_mod_targe t.c

(quoted diff) +0 -0
@@ -5,31 +5,29 @@

[ ... ]

Quoted 6 lines
tools/testing/selftests/livepatch/test_modules/test_klp_mod_target.c +5 -0
+static const struct kernel_param_ops test_klp_mod_target_ops = {
+	.get = test_klp_mod_target_get,
+};
+
+module_param_cb(klp_mod_arg, &test_klp_mod_target_ops, NULL,

0444);

[Severity: Medium]
Does this code need a .set callback in the kernel_param_ops structure?

When a module parameter is passed during module load, the kernel parses the
arguments using parse_args(), which invokes parse_one() in kernel/params.c.
Because parse_one() unconditionally executes the .set callback without
verifying if it is actually defined, omitting it here leaves the callback
implicitly initialized to NULL.

Quoted 6 lines
Quoted 3 lines

Could this lead to a NULL pointer dereference and a kernel panic if someone
attempts to set this parameter during module load?

Indeed! I'll send a v2 addressing the missing argument. Thanks Sachiko for spotting it :)

It should be perfectly fine to use NULL for the .set() callback. It can't be called because of the given permissions 0444.

We should teach Sashiko about this ;-)

Best Regards,
Petr

maintainer
#13 lore raw

Re: [PATCH 3/4] selftests: livepatch: Adapt mod_target module to pass on 4.12 kernels

In reply to Marcos Paulo de Souza
Quoted 21 lines · Marcos Paulo de Souza

Use the stable module_param_cb API instead of proc_fs for exposing module state. This approach is compatible with kernel 4.12 and later. The end result is the same: the module has a function that shows a string, which is later livepatched to show a different string. The only difference is that the file being checked is now a module parameter instead of a procfs entry.

tools/testing/selftests/livepatch/test-livepatch.sh +3 -4
@@ -198,26 +198,25 @@ livepatch: '$MOD_REPLACE': unpatching complete
 % rmmod $MOD_REPLACE"
 
 
-# - load a target module that provides /proc/test_klp_mod_target with
-#   original output
-# - load a livepatch that patches the target module's show function
-# - verify the proc entry returns livepatched output
+# - load a target module with module_param_cb get data with original output
+# - load a livepatch that patches the target module's get function
+# - verify the parameter get function returns the livepatched output
 # - disable and unload the livepatch

tools/testing/selftests/livepatch/test-livepatch.sh livepatch: '$MOD_REPLACE': unpatching complete · line 212

Quoted 10 lines
tools/testing/selftests/livepatch/test-livepatch.sh +2 -2
-# - verify the proc entry returns original output again
+# - verify the parameter get function returns the original output again
 # - unload the target module
 
 start_test "module function patching"
 
 load_mod $MOD_TARGET
 
-if [[ "$(cat /proc/$MOD_TARGET)" != "$MOD_TARGET: original output" ]] ; then
+if [[ "$(cat $SYSFS_MODULE_DIR/$MOD_TARGET/parameters/klp_mod_arg)" != "$MOD_TARGET: original output" ]] ; then

I would personally call the parameter "test" or something simple.

A better descriptive name was needed in the top-level /proc directory to prevent conflicts. But the module-specific parameter is checked module-specific directory...

Quoted 8 lines
tools/testing/selftests/livepatch/test-livepatch.sh +0 -0
 	echo -e "FAIL\n\n"
 	die "livepatch kselftest(s) failed"
 fi
 
tools/testing/selftests/livepatch/test_modules/test_klp_mod_patch.c +0 -0
@@ -8,17 +8,16 @@
 #include <linux/livepatch.h>

tools/testing/selftests/livepatch/test_modules/test_klp_mod_patch.c line 14

Quoted 10 lines
tools/testing/selftests/livepatch/test_modules/test_klp_mod_patch.c +3 -4
 #include <linux/seq_file.h>
 
-static int livepatch_mod_target_show(struct seq_file *m, void *v)
+static int livepatch_mod_target_get(char *buffer, const struct kernel_param *kp)
 {
-	seq_printf(m, "%s: %s\n", THIS_MODULE->name,
-		   "this has been live patched");
-	return 0;
+	return sprintf(buffer, "%s: %s\n", THIS_MODULE->name,
+		       "this has been live patched");

Please, use sysfs_emit() instead of sprintf(). It is a specifically designed API for sysfs output. It prevents a potential buffer overflow.

It is less important here. But we should show good examples...

tools/testing/selftests/livepatch/test_modules/test_klp_mod_patch.c line 23

Quoted 11 lines
tools/testing/selftests/livepatch/test_modules/test_klp_mod_patch.c +2 -2
 }
 
 static struct klp_func funcs[] = {
 	{
-		.old_name = "test_klp_mod_target_show",
-		.new_func = livepatch_mod_target_show,
+		.old_name = "test_klp_mod_target_get",
+		.new_func = livepatch_mod_target_get,
 	},
 	{},
 };

Otherwise the change looks good to me.

Best Regards,
Petr

#14 lore raw

PATCH 4/4 selftests: livepatch: Add information about minimum kernel support

In reply to Marcos Paulo de Souza

The current livepatch selftests are compatible with kernel 4.12, so add a note about it for future developers willing to contribute with new tests.

---
 tools/testing/selftests/livepatch/README | 3 +++
 1 file changed, 3 insertions(+)
tools/testing/selftests/livepatch/README +3 -0
index d2035dd64a2b..293f4730b927 100644
@@ -54,3 +54,6 @@ check_result().  The latter function greps the kernel's ring buffer for
 those strings for result comparison.  Other utility functions include
 general module loading and livepatch loading helpers (waiting for patch
 transitions, sysfs entries, etc.)
+
+All new tests and test modules MUST be compatible with kernel version 4.12 and
+later, including current upstream kernels.
Signature · 1 line
2.54.0
#15 lore raw

Re: [PATCH 4/4] selftests: livepatch: Add information about minimum kernel support

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Mandating backward compatibility with an ancient kernel version (4.12) for all new in-tree…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Mandating backward compatibility with an ancient kernel version (4.12) for all new in-tree selftests violates established upstream kernel principles. --

commit 005a4d6b98d5e0ddf7ab7d595575364d010c4d3f
Author: Marcos Paulo de Souza <[email protected]>

selftests: livepatch: Add information about minimum kernel support

This commit adds a note to the livepatch selftests README. It documents that the current tests are compatible with kernel 4.12 and mandates that all new tests must maintain this backward compatibility.

tools/testing/selftests/livepatch/README check_result(). The latter function greps the kernel's ring buffer for · line 59

Quoted 11 lines
tools/testing/selftests/livepatch/README +3 -0
index d2035dd64a2be..293f4730b9277 100644
@@ -54,3 +54,6 @@ check_result().  The latter function greps the kernel's ring buffer for
 those strings for result comparison.  Other utility functions include
 general module loading and livepatch loading helpers (waiting for patch
 transitions, sysfs entries, etc.)
+
+All new tests and test modules MUST be compatible with kernel version 4.12 and
+later, including current upstream kernels.

[Severity: Medium]
Does mandating backward compatibility with kernel 4.12 for all new tests conflict with upstream kernel principles?

Requiring tests to support an older kernel could block the introduction of tests for any livepatch features developed after 4.12, as the required internal APIs would not exist. This might also force developers to clutter the test module codebase with version checks for old kernels.

Should the burden of backporting tests to older enterprise kernels be left to downstream distributions rather than enforced on upstream contributors?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
maintainer
#16 lore raw

Re: [PATCH 4/4] selftests: livepatch: Add information about minimum kernel support

In reply to Marcos Paulo de Souza
Quoted 14 lines · Marcos Paulo de Souza

The current livepatch selftests are compatible with kernel 4.12, so add a note about it for future developers willing to contribute with new tests.

---
 tools/testing/selftests/livepatch/README | 3 +++
 1 file changed, 3 insertions(+)
tools/testing/selftests/livepatch/README +0 -0
index d2035dd64a2b..293f4730b927 100644

tools/testing/selftests/livepatch/README check_result(). The latter function greps the kernel's ring buffer for · line 59

Quoted 6 lines
tools/testing/selftests/livepatch/README +3 -0
@@ -54,3 +54,6 @@ check_result().  The latter function greps the kernel's ring buffer for
 those strings for result comparison.  Other utility functions include
 general module loading and livepatch loading helpers (waiting for patch
 transitions, sysfs entries, etc.)
+
+All new tests and test modules MUST be compatible with kernel version 4.12 and
+later, including current upstream kernels.

I do not have a good feeling about this. One thing is to accept fixes/workarounds for the backward compatibility. But forcing contributors to keep the compatibility might be too demanding.

I might be wrong. But I think that you would need a pretty old userspace to run 4.12 kernel. And most people could not get it easily.

Honestly, I though more about this effort and I am not sure how complicated it would be in the long term.

I know about two pending patchsets which are breaking the backward compatibility:

+ Better integration of callbacks and shadow variables with the states API [1]
+ Introduce replace set support [2]

Especially the 1st one is a pain. It is 19th patches and most of them are fixing/reworking the selftests. I think that it was the reason why nobody reviewed it yet. And it might be even worse if we wanted to make it backward compatible.

[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/

Best Regards,
Petr

maintainer
#17 lore raw

Re: [PATCH 4/4] selftests: livepatch: Add information about minimum kernel support

Quoted 11 lines · Petr Mladek
Quoted 9 lines · Marcos Paulo de Souza

The current livepatch selftests are compatible with kernel 4.12, so add a note about it for future developers willing to contribute with new tests.

---
 tools/testing/selftests/livepatch/README | 3 +++
 1 file changed, 3 insertions(+)
Quoted 15 lines

tools/testing/selftests/livepatch/README check_result(). The latter function greps the kernel's ring buffer for · line 59

Quoted 11 lines
tools/testing/selftests/livepatch/README +3 -0
index d2035dd64a2b..293f4730b927 100644
@@ -54,3 +54,6 @@ check_result().  The latter function greps the kernel's ring buffer for
 those strings for result comparison.  Other utility functions include
 general module loading and livepatch loading helpers (waiting for patch
 transitions, sysfs entries, etc.)
+
+All new tests and test modules MUST be compatible with kernel version 4.12 and
+later, including current upstream kernels.

I do not have a good feeling about this. One thing is to accept fixes/workarounds for the backward compatibility. But forcing contributors to keep the compatibility might be too demanding.

I agree. This patch should be dropped. I think that the first two of the series make sense on their own since the cleanup is a reasonable thing to do in general. The third one is in "why not" area. But this one is wrong. Sashiko summed it up well.

Quoted 9 lines

I might be wrong. But I think that you would need a pretty old userspace to run 4.12 kernel. And most people could not get it easily.

Honestly, I though more about this effort and I am not sure how complicated it would be in the long term.

I know about two pending patchsets which are breaking the backward compatibility:

Quoted 7 lines

+ Better integration of callbacks and shadow variables with the states API [1]
+ Introduce replace set support [2]

Especially the 1st one is a pain. It is 19th patches and most of them are fixing/reworking the selftests. I think that it was the reason why nobody reviewed it yet. And it might be even worse if we wanted to make it backward compatible.

I would not be too bothered about it. If keeping the backward compatibility is difficult, it could be put aside. This patch set is not that complicated and I think that it can be sold like reasonable changes on their own.