Thread (9 messages) flat view 9 messages, 2 authors, 4d ago

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

From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Date: 2026-08-07 10:29:18
Also in: linux-kselftest, lkml

On Fri,  7 Aug 2026 16:15:10 +0800
"Rui Qi" [off-list ref] wrote:
Hi,

This series fixes two ways add_remove_uprobe can construct an invalid
uprobe offset.
Please send the series in the new thread (not reply) next time.
Instead, you can make a permalink to the previous discussion from your
mail's message-id and write it in the mail body so that we can follow
the discussion in the previous version.

e.g. 

 https://lore.kernel.org/all/20260806083101.2651025-1-qirui.001@bytedance.com/ (local)

You can get this using below script.
-----
#!/bin/sh
#
if [ -f "$1" ]; then
  MID=`grep -i ^"Message-Id:" $1 | cut -f2 -d: | tr -d ' <>'`
else
  MID=$1
fi

URL=`curl -Ls -o /dev/null -w %{url_effective} http://lkml.kernel.org/r/$MID`
echo ${URL%T/#u}
-----

Thank you,
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

-- 
Masami Hiramatsu (Google) [off-list ref]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help