Linux Trace Kernel
 help / color / mirror / Atom feed
From: "Rui Qi" <qirui.001@bytedance.com>
To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: "Steven Rostedt" <rostedt@goodmis.org>,
	 "Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
	 "Shuah Khan" <shuah@kernel.org>,
	"Heiko Carstens" <hca@linux.ibm.com>,
	 <linux-trace-kernel@vger.kernel.org>,
	<linux-kselftest@vger.kernel.org>,
	 <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] selftests/ftrace: Force C locale for readelf in uprobe test
Date: Fri, 7 Aug 2026 16:01:05 +0800	[thread overview]
Message-ID: <a1f16b86-89ca-4286-841b-da9a081c8d33@bytedance.com> (raw)
In-Reply-To: <20260807104709.0626fd20ed7618273dcbead2@kernel.org>

On 8/7/26 9:47 AM, Masami Hiramatsu (Google) wrote:
> On Thu,  6 Aug 2026 16:31:00 +0800
> "Rui Qi" <qirui.001@bytedance.com> wrote:
> 
>> The add_remove_uprobe test parses the entry point from readelf -h output
>> by looking for the English "Entry" field. readelf output is localized
>> via gettext, while the ftracetest runner does not force LC_ALL=C and the
>> top-level Makefile leaves LANG effective for child processes.
> 
> Hmm, to make it safer, I think we should force LC_ALL=C in the top level
> of ftracetest, instead of setting it in each test case.
> 
> Thank you,
> 

Thank you for the suggestion.

Agreed, setting LC_ALL=C in the ftracetest runner is better than fixing
this one readelf invocation. I will update ftracetest to export LC_ALL=C
so all test cases inherit the C locale, and send a v2.

Thanks,
Rui


>>
>> If readelf prints a translated field name, ENTRYPOINT becomes empty and
>> the uprobe_events write is rejected because the offset after PATH: is
>> missing.
>>
>> Run readelf with LC_ALL=C so the parsed header field remains stable
>> across locales.
>>
>> Signed-off-by: Rui Qi <qirui.001@bytedance.com>
>> ---
>>  .../selftests/ftrace/test.d/dynevent/add_remove_uprobe.tc       | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_uprobe.tc b/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_uprobe.tc
>> index f2048c244526..f33a863be68b 100644
>> --- a/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_uprobe.tc
>> +++ b/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_uprobe.tc
>> @@ -12,7 +12,7 @@ echo 0 > events/enable
>>  echo > dynamic_events
>>  
>>  REALBIN=`readlink -f /bin/sh`
>> -ENTRYPOINT=`readelf -h ${REALBIN} | grep Entry | sed -e 's/[^0]*//'`
>> +ENTRYPOINT=`LC_ALL=C readelf -h ${REALBIN} | grep Entry | sed -e 's/[^0]*//'`
>>  
>>  echo "p:myevent ${REALBIN}:${ENTRYPOINT}" >> uprobe_events
>>  
>> -- 
>> 2.20.1
> 

  reply	other threads:[~2026-08-07  8:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06  8:31 [PATCH 1/2] selftests/ftrace: Force C locale for readelf in uprobe test Rui Qi
2026-08-06  8:31 ` [PATCH 2/2] selftests/ftrace: Convert ELF entry point to file offset " Rui Qi
2026-08-07  1:47 ` [PATCH 1/2] selftests/ftrace: Force C locale for readelf " Masami Hiramatsu
2026-08-07  8:01   ` Rui Qi [this message]
2026-08-07  8:15 ` [PATCH v2 0/2] selftests/ftrace: Fix add_remove_uprobe robustness Rui Qi
2026-08-07  8:15   ` [PATCH v2 1/2] selftests/ftrace: Force C locale in ftracetest Rui Qi
2026-08-07  8:15   ` [PATCH v2 2/2] selftests/ftrace: Convert ELF entry point to file offset in uprobe test Rui Qi
2026-08-07 10:30     ` Masami Hiramatsu
2026-08-07 10:29   ` [PATCH v2 0/2] selftests/ftrace: Fix add_remove_uprobe robustness Masami Hiramatsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a1f16b86-89ca-4286-841b-da9a081c8d33@bytedance.com \
    --to=qirui.001@bytedance.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox