[PATCH 2/8] selftests: livepatch: test-kprobe: Replace true/false mod param by 1/0

Marcos Paulo de Souza posted 8 patches 3 weeks, 3 days ago
[PATCH 2/8] selftests: livepatch: test-kprobe: Replace true/false mod param by 1/0
Posted by Marcos Paulo de Souza 3 weeks, 3 days ago
Older kernels don't support true/false for boolean module parameters
because they lack commit 0d6ea3ac94ca
("lib/kstrtox.c: add "false"/"true" support to kstrtobool()"). Replace
true/false by 1/0 so the test module can be loaded on older kernels.

No functional changes.

Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
---
 tools/testing/selftests/livepatch/test-kprobe.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/livepatch/test-kprobe.sh b/tools/testing/selftests/livepatch/test-kprobe.sh
index b67dfad03d97f..cdf31d0e51955 100755
--- a/tools/testing/selftests/livepatch/test-kprobe.sh
+++ b/tools/testing/selftests/livepatch/test-kprobe.sh
@@ -20,11 +20,11 @@ start_test "livepatch interaction with kprobed function with post_handler"
 
 echo 1 > "$SYSFS_KPROBES_DIR/enabled"
 
-load_mod $MOD_KPROBE has_post_handler=true
+load_mod $MOD_KPROBE has_post_handler=1
 load_failing_mod $MOD_LIVEPATCH
 unload_mod $MOD_KPROBE
 
-check_result "% insmod test_modules/test_klp_kprobe.ko has_post_handler=true
+check_result "% insmod test_modules/test_klp_kprobe.ko has_post_handler=1
 % insmod test_modules/$MOD_LIVEPATCH.ko
 livepatch: enabling patch '$MOD_LIVEPATCH'
 livepatch: '$MOD_LIVEPATCH': initializing patching transition
@@ -39,14 +39,14 @@ insmod: ERROR: could not insert module test_modules/$MOD_LIVEPATCH.ko: Device or
 
 start_test "livepatch interaction with kprobed function without post_handler"
 
-load_mod $MOD_KPROBE has_post_handler=false
+load_mod $MOD_KPROBE has_post_handler=0
 load_lp $MOD_LIVEPATCH
 
 unload_mod $MOD_KPROBE
 disable_lp $MOD_LIVEPATCH
 unload_lp $MOD_LIVEPATCH
 
-check_result "% insmod test_modules/test_klp_kprobe.ko has_post_handler=false
+check_result "% insmod test_modules/test_klp_kprobe.ko has_post_handler=0
 % insmod test_modules/$MOD_LIVEPATCH.ko
 livepatch: enabling patch '$MOD_LIVEPATCH'
 livepatch: '$MOD_LIVEPATCH': initializing patching transition

-- 
2.52.0
Re: [PATCH 2/8] selftests: livepatch: test-kprobe: Replace true/false mod param by 1/0
Posted by Miroslav Benes 2 weeks, 4 days ago
A nit but I think that "test-kprobe: " is unnecessary noise in the subject 
and can be dropped. It applies to all patches in the series.

On Fri, 13 Mar 2026, Marcos Paulo de Souza wrote:

> Older kernels don't support true/false for boolean module parameters
> because they lack commit 0d6ea3ac94ca
> ("lib/kstrtox.c: add "false"/"true" support to kstrtobool()"). Replace
> true/false by 1/0 so the test module can be loaded on older kernels.
> 
> No functional changes.

We also define a bool module parameter in 
test_modules/test_klp_callbacks_busy.c. Does it have a similar problem?

Miroslav
Re: [PATCH 2/8] selftests: livepatch: test-kprobe: Replace true/false mod param by 1/0
Posted by Marcos Paulo de Souza 2 weeks, 4 days ago
On Thu, 2026-03-19 at 14:03 +0100, Miroslav Benes wrote:
> A nit but I think that "test-kprobe: " is unnecessary noise in the
> subject 
> and can be dropped. It applies to all patches in the series.

Ok, I'll drop it in the v2.

> 
> On Fri, 13 Mar 2026, Marcos Paulo de Souza wrote:
> 
> > Older kernels don't support true/false for boolean module
> > parameters
> > because they lack commit 0d6ea3ac94ca
> > ("lib/kstrtox.c: add "false"/"true" support to kstrtobool()").
> > Replace
> > true/false by 1/0 so the test module can be loaded on older
> > kernels.
> > 
> > No functional changes.
> 
> We also define a bool module parameter in 
> test_modules/test_klp_callbacks_busy.c. Does it have a similar
> problem?

No, because n/N was accepted as false already on 4.12 (SLE12-SP5). I'm
not sure about older versions tough.

> 
> Miroslav
Re: [PATCH 2/8] selftests: livepatch: test-kprobe: Replace true/false mod param by 1/0
Posted by Miroslav Benes 2 weeks, 3 days ago
On Thu, 19 Mar 2026, Marcos Paulo de Souza wrote:

> On Thu, 2026-03-19 at 14:03 +0100, Miroslav Benes wrote:
> > A nit but I think that "test-kprobe: " is unnecessary noise in the
> > subject 
> > and can be dropped. It applies to all patches in the series.
> 
> Ok, I'll drop it in the v2.
> 
> > 
> > On Fri, 13 Mar 2026, Marcos Paulo de Souza wrote:
> > 
> > > Older kernels don't support true/false for boolean module
> > > parameters
> > > because they lack commit 0d6ea3ac94ca
> > > ("lib/kstrtox.c: add "false"/"true" support to kstrtobool()").
> > > Replace
> > > true/false by 1/0 so the test module can be loaded on older
> > > kernels.
> > > 
> > > No functional changes.
> > 
> > We also define a bool module parameter in 
> > test_modules/test_klp_callbacks_busy.c. Does it have a similar
> > problem?
> 
> No, because n/N was accepted as false already on 4.12 (SLE12-SP5). I'm
> not sure about older versions tough.

strtobool() (predecessor of kstrtobool()) has it from the beginning and 
that is ~2010 which predates the kernel live patching itself so I think we 
are good.

Miroslav