Skip to content

Commit 51ab33f

Browse files
committed
Merge tag 'livepatching-for-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/livepatching/livepatching
Pull livepatching updates from Petr Mladek: - Support both paths where tracefs is typically mounted in selftests - Make old_sympos 0 and 1 equal. They both are valid when there is only one symbol with the given name. * tag 'livepatching-for-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/livepatching/livepatching: selftests: livepatch: use canonical ftrace path livepatch: Match old_sympos 0 and 1 in klp_find_func()
2 parents 02baaa6 + 5cb5575 commit 51ab33f

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

kernel/livepatch/core.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,14 @@ static struct klp_func *klp_find_func(struct klp_object *obj,
8888
struct klp_func *func;
8989

9090
klp_for_each_func(obj, func) {
91+
/*
92+
* Besides identical old_sympos, also consider old_sympos
93+
* of 0 and 1 are identical.
94+
*/
9195
if ((strcmp(old_func->old_name, func->old_name) == 0) &&
92-
(old_func->old_sympos == func->old_sympos)) {
96+
((old_func->old_sympos == func->old_sympos) ||
97+
(old_func->old_sympos == 0 && func->old_sympos == 1) ||
98+
(old_func->old_sympos == 1 && func->old_sympos == 0))) {
9399
return func;
94100
}
95101
}

tools/testing/selftests/livepatch/functions.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ SYSFS_KERNEL_DIR="/sys/kernel"
1010
SYSFS_KLP_DIR="$SYSFS_KERNEL_DIR/livepatch"
1111
SYSFS_DEBUG_DIR="$SYSFS_KERNEL_DIR/debug"
1212
SYSFS_KPROBES_DIR="$SYSFS_DEBUG_DIR/kprobes"
13-
SYSFS_TRACING_DIR="$SYSFS_DEBUG_DIR/tracing"
13+
if [[ -e /sys/kernel/tracing/trace ]]; then
14+
SYSFS_TRACING_DIR="$SYSFS_KERNEL_DIR/tracing"
15+
else
16+
SYSFS_TRACING_DIR="$SYSFS_DEBUG_DIR/tracing"
17+
fi
1418

1519
# Kselftest framework requirement - SKIP code is 4
1620
ksft_skip=4

0 commit comments

Comments
 (0)