[PATCH v2 0/2] selftests/ftrace: Fix add_remove_uprobe robustness

From: Rui Qi

Date: Fri Aug 07 2026 - 04:17:15 EST


Hi,

This series fixes two ways add_remove_uprobe can construct an invalid
uprobe offset.

Patch 1 follows Masami's feedback on v1 and forces the C locale in the
top-level ftracetest runner, rather than setting LC_ALL=C around each
readelf invocation.

Patch 2 fixes the remaining offset issue. readelf reports the ELF entry
point as a virtual address, while uprobe_events expects a file offset.
Convert the entry point through the LOAD program headers so the test also
works for non-PIE executables.

Changes in v2:
- Move LC_ALL=C to the top-level ftracetest runner, as suggested by
Masami.
- Keep the entry-point-to-file-offset conversion as the second patch and
rely on the runner-provided locale for readelf output.

Testing:
- ./scripts/checkpatch.pl --strict -g HEAD~2..HEAD
- sh -n tools/testing/selftests/ftrace/ftracetest
- sh -n tools/testing/selftests/ftrace/test.d/dynevent/add_remove_uprobe.tc

Rui Qi (2):
selftests/ftrace: Force C locale in ftracetest
selftests/ftrace: Convert ELF entry point to file offset in uprobe
test

tools/testing/selftests/ftrace/ftracetest | 3 +++
.../test.d/dynevent/add_remove_uprobe.tc | 27 +++++++++++++++++--
2 files changed, 28 insertions(+), 2 deletions(-)

--
2.20.1