Thread (14 messages) flat view 14 messages, 2 authors, 8d ago

Re: [PATCH v9 6/9] livepatch: Deprecate stack_order

From: sashiko-bot@kernel.org
Date: 2026-09-13 02:48:17

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The patch removes the 'stack_order' sysfs attribute from the kernel but does not remove the corresponding test code from the livepatch selftests, leaving a block of dead test code.
--

commit a8f748fc5d239275aee15cc15603ad2749191463
Author: Yafang Shao [off-list ref]

livepatch: Deprecate stack_order

The stack_order sysfs attribute was added to determine which active
livepatch is used for a given function. It is no longer needed because
recent changes refuse loading another livepatch which would modify
an already livepatched function unless the new livepatch would replace
the conflicting one.
quoted hunk ↗ jump to hunk
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index 8813f035087de..a5ff34a377a57 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -477,40 +476,17 @@ static ssize_t obsoletes_show(struct kobject *kobj,
 	return len;
 }
 
-static ssize_t stack_order_show(struct kobject *kobj,
-				struct kobj_attribute *attr, char *buf)
-{
[ ... ]
-}
-
 static struct kobj_attribute enabled_kobj_attr = __ATTR_RW(enabled);
 static struct kobj_attribute transition_kobj_attr = __ATTR_RO(transition);
 static struct kobj_attribute force_kobj_attr = __ATTR_WO(force);
 static struct kobj_attribute provides_kobj_attr = __ATTR_RO(provides);
 static struct kobj_attribute obsoletes_kobj_attr = __ATTR_RO(obsoletes);
-static struct kobj_attribute stack_order_kobj_attr = __ATTR_RO(stack_order);
 static struct attribute *klp_patch_attrs[] = {
 	&enabled_kobj_attr.attr,
 	&transition_kobj_attr.attr,
 	&force_kobj_attr.attr,
 	&provides_kobj_attr.attr,
 	&obsoletes_kobj_attr.attr,
-	&stack_order_kobj_attr.attr,
 	NULL
 };
[Severity: Low]
Since the stack_order sysfs attribute is being removed, should the
corresponding test code in tools/testing/selftests/livepatch/test-sysfs.sh
be removed as well?

Because the test script checks for the existence of the sysfs attribute
before testing it, the dead code will not cause the test to fail. However,
it leaves behind blocks that will never execute:

tools/testing/selftests/livepatch/test-sysfs.sh:sysfs test() {
    ...
    if does_sysfs_exist "$MOD_LIVEPATCH" "stack_order"; then
        check_sysfs_rights "$MOD_LIVEPATCH" "stack_order" "-r--r--r--"
        check_sysfs_value  "$MOD_LIVEPATCH" "stack_order" "1"
        HAS_STACK_ORDER_ATTR=1
    fi
    ...
}

Which leaves the following test block permanently dead:

tools/testing/selftests/livepatch/test-sysfs.sh:sysfs test stack_order value() {
    ...
    if [[ "$HAS_STACK_ORDER_ATTR" == "1" ]]; then
        start_test "sysfs test stack_order value"

        load_lp $MOD_LIVEPATCH

        check_sysfs_value  "$MOD_LIVEPATCH" "stack_order" "1"
    ...
}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260913024228.72317-1-laoar.shao@gmail.com?part=6
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help