* [PATCH] perf test: probe_vfs_getname add do_getname() probing fallback
@ 2026-04-16 12:55 Thomas Richter
2026-04-21 11:09 ` [PATCH Ping] " Thomas Richter
2026-04-25 0:57 ` [PATCH] " sashiko-bot
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Richter @ 2026-04-16 12:55 UTC (permalink / raw)
To: linux-kernel, linux-s390, linux-perf-users, acme, namhyung
Cc: agordeev, gor, sumanthk, hca, japo, Thomas Richter
The following tests are skipped for some time now on platforms
s390 and x86_64:
# perf test vfs_getname
138: Add vfs_getname probe to get syscall args filenames : Skip
140: Use vfs_getname probe to get syscall args filenames : Skip
154: Check open filename arg using perf trace + vfs_getname : Skip
#
This is caused by a change in kernel code of function
getname_flags(), see
commit 9fa3ec84587c ("allow incomplete imports of filenames")
This commit changed the function getname_flags() implementation.
Now the perf probe 'vfs_getname parameter=xxx' does not match any
more. Extend the test logic to fall back to probing do_getname().
This reflects the updated kernel code.
Output after:
# perf test vfs_getname
138: Add vfs_getname probe to get syscall args filenames : Ok
140: Use vfs_getname probe to get syscall args filenames : Ok
154: Check open filename arg using perf trace + vfs_getname : Ok
#
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
---
tools/perf/tests/shell/lib/probe_vfs_getname.sh | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/tools/perf/tests/shell/lib/probe_vfs_getname.sh b/tools/perf/tests/shell/lib/probe_vfs_getname.sh
index 88cd0e26d5f6..9156a79212b9 100644
--- a/tools/perf/tests/shell/lib/probe_vfs_getname.sh
+++ b/tools/perf/tests/shell/lib/probe_vfs_getname.sh
@@ -12,6 +12,8 @@ cleanup_probe_vfs_getname() {
add_probe_vfs_getname() {
add_probe_verbose=$1
+ do_getname=0
+
if [ $had_vfs_getname -eq 1 ] ; then
result_initname_re="[[:space:]]+([[:digit:]]+)[[:space:]]+initname.*"
line=$(perf probe -L getname_flags 2>&1 | grep -E "$result_initname_re" | sed -r "s/$result_initname_re/\1/")
@@ -28,12 +30,24 @@ add_probe_vfs_getname() {
line=$(perf probe -L getname_flags 2>&1 | grep -E "$result_aname_re" | sed -r "s/$result_aname_re/\1/")
fi
+ if [ -z "$line" ] ; then
+ do_getname=1
+ result_iname_re="[[:space:]]+([[:digit:]]+)[[:space:]]+initname\(result\);"
+ line=$(perf probe -L do_getname 2>&1 | grep -E "$result_iname_re" | sed -r "s/$result_iname_re/\1/")
+ fi
+
if [ -z "$line" ] ; then
echo "Could not find probeable line"
return 2
fi
- perf probe -q "vfs_getname=getname_flags:${line} pathname=result->name:string" || \
+ if [ "$do_getname" -eq 1 ]
+ then
+ param="vfs_getname=do_getname:${line} pathname=result->iname:string"
+ perf probe -q "$param" || perf probe $add_probe_verbose "$param" || return 1
+ return 0
+ fi
+ perf probe -q "vfs_getname=getname_flags:${line} pathname=result->name:string" || \
perf probe $add_probe_verbose "vfs_getname=getname_flags:${line} pathname=filename:ustring" || return 1
fi
}
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH Ping] perf test: probe_vfs_getname add do_getname() probing fallback
2026-04-16 12:55 [PATCH] perf test: probe_vfs_getname add do_getname() probing fallback Thomas Richter
@ 2026-04-21 11:09 ` Thomas Richter
2026-04-25 0:57 ` [PATCH] " sashiko-bot
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Richter @ 2026-04-21 11:09 UTC (permalink / raw)
To: linux-kernel, linux-s390, linux-perf-users, acme, namhyung
Cc: agordeev, gor, sumanthk, hca, japo
Friendly ping...
On 4/16/26 14:55, Thomas Richter wrote:
> The following tests are skipped for some time now on platforms
> s390 and x86_64:
>
> # perf test vfs_getname
> 138: Add vfs_getname probe to get syscall args filenames : Skip
> 140: Use vfs_getname probe to get syscall args filenames : Skip
> 154: Check open filename arg using perf trace + vfs_getname : Skip
> #
>
> This is caused by a change in kernel code of function
> getname_flags(), see
> commit 9fa3ec84587c ("allow incomplete imports of filenames")
> This commit changed the function getname_flags() implementation.
>
> Now the perf probe 'vfs_getname parameter=xxx' does not match any
> more. Extend the test logic to fall back to probing do_getname().
> This reflects the updated kernel code.
>
> Output after:
> # perf test vfs_getname
> 138: Add vfs_getname probe to get syscall args filenames : Ok
> 140: Use vfs_getname probe to get syscall args filenames : Ok
> 154: Check open filename arg using perf trace + vfs_getname : Ok
> #
>
> Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
> Reviewed-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
> ---
> tools/perf/tests/shell/lib/probe_vfs_getname.sh | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/tests/shell/lib/probe_vfs_getname.sh b/tools/perf/tests/shell/lib/probe_vfs_getname.sh
> index 88cd0e26d5f6..9156a79212b9 100644
> --- a/tools/perf/tests/shell/lib/probe_vfs_getname.sh
> +++ b/tools/perf/tests/shell/lib/probe_vfs_getname.sh
> @@ -12,6 +12,8 @@ cleanup_probe_vfs_getname() {
>
> add_probe_vfs_getname() {
> add_probe_verbose=$1
> + do_getname=0
> +
> if [ $had_vfs_getname -eq 1 ] ; then
> result_initname_re="[[:space:]]+([[:digit:]]+)[[:space:]]+initname.*"
> line=$(perf probe -L getname_flags 2>&1 | grep -E "$result_initname_re" | sed -r "s/$result_initname_re/\1/")
> @@ -28,12 +30,24 @@ add_probe_vfs_getname() {
> line=$(perf probe -L getname_flags 2>&1 | grep -E "$result_aname_re" | sed -r "s/$result_aname_re/\1/")
> fi
>
> + if [ -z "$line" ] ; then
> + do_getname=1
> + result_iname_re="[[:space:]]+([[:digit:]]+)[[:space:]]+initname\(result\);"
> + line=$(perf probe -L do_getname 2>&1 | grep -E "$result_iname_re" | sed -r "s/$result_iname_re/\1/")
> + fi
> +
> if [ -z "$line" ] ; then
> echo "Could not find probeable line"
> return 2
> fi
>
> - perf probe -q "vfs_getname=getname_flags:${line} pathname=result->name:string" || \
> + if [ "$do_getname" -eq 1 ]
> + then
> + param="vfs_getname=do_getname:${line} pathname=result->iname:string"
> + perf probe -q "$param" || perf probe $add_probe_verbose "$param" || return 1
> + return 0
> + fi
> + perf probe -q "vfs_getname=getname_flags:${line} pathname=result->name:string" || \
> perf probe $add_probe_verbose "vfs_getname=getname_flags:${line} pathname=filename:ustring" || return 1
> fi
> }
--
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
--
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Wolfgang Wendt
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] perf test: probe_vfs_getname add do_getname() probing fallback
2026-04-16 12:55 [PATCH] perf test: probe_vfs_getname add do_getname() probing fallback Thomas Richter
2026-04-21 11:09 ` [PATCH Ping] " Thomas Richter
@ 2026-04-25 0:57 ` sashiko-bot
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-04-25 0:57 UTC (permalink / raw)
To: Thomas Richter; +Cc: linux-perf-users
Sashiko AI review found 2 potential issue(s):
- [Medium] Out-of-bounds kernel memory read in `do_getname` perf probe due to unterminated string.
- [Medium] Missing user-space pointer fallback logic reduces test robustness.
--
commit 44caa018a80d8e3283b4eda7b6e0f0690afbe123
Author: Thomas Richter <tmricht@linux.ibm.com>
perf test: probe_vfs_getname add do_getname() probing fallback
This commit extends the vfs_getname perf test logic to fall back to probing
do_getname() if getname_flags() does not match. This reflects updated kernel
code where the getname_flags() implementation was changed.
> diff --git a/tools/perf/tests/shell/lib/probe_vfs_getname.sh b/tools/perf/tests/shell/lib/probe_vfs_getname.sh
> --- a/tools/perf/tests/shell/lib/probe_vfs_getname.sh
> +++ b/tools/perf/tests/shell/lib/probe_vfs_getname.sh
[ ... ]
> @@ -28,12 +30,24 @@ add_probe_vfs_getname() {
> line=$(perf probe -L getname_flags 2>&1 | grep -E "$result_aname_re" | sed -r "s/$result_aname_re/\1/")
> fi
>
> + if [ -z "$line" ] ; then
> + do_getname=1
> + result_iname_re="[[:space:]]+([[:digit:]]+)[[:space:]]+initname\(result\);"
> + line=$(perf probe -L do_getname 2>&1 | grep -E "$result_iname_re" | sed -r "s/$result_iname_re/\1/")
> + fi
> +
> if [ -z "$line" ] ; then
> echo "Could not find probeable line"
> return 2
> fi
>
> - perf probe -q "vfs_getname=getname_flags:${line} pathname=result->name:string" || \
> + if [ "$do_getname" -eq 1 ]
> + then
> + param="vfs_getname=do_getname:${line} pathname=result->iname:string"
Does this probe cause an out-of-bounds kernel memory read when the path exceeds
EMBEDDED_NAME_MAX?
If a user provides a long file path, strncpy_from_user() completely fills the
fixed-size result->iname array without appending a NUL terminator, while the
actual NUL-terminated path is dynamically allocated and pointed to by
result->name.
Because the probe explicitly instructs the kernel to read result->iname as a
NUL-terminated string, could the kprobe fetcher read past the end of the iname
array into adjacent slab memory? Should this use result->name:string instead?
> + perf probe -q "$param" || perf probe $add_probe_verbose "$param" || return 1
Is the user-space pointer fallback missing here?
The original probe logic for getname_flags robustly handles compiler
optimizations by falling back to probing the user-space function argument
directly (pathname=filename:ustring) if reading the kernel result struct fails.
This new block for do_getname instead retries the exact same probe string, just
adding a verbose flag. Since filename remains the first argument to
do_getname(), would it be safer to include the filename:ustring fallback to
prevent the test from failing on certain toolchains?
> + return 0
> + fi
> + perf probe -q "vfs_getname=getname_flags:${line} pathname=result->name:string" || \
> perf probe $add_probe_verbose "vfs_getname=getname_flags:${line} pathname=filename:ustring" || return 1
> fi
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260416125515.3481495-1-tmricht@linux.ibm.com?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-25 0:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-16 12:55 [PATCH] perf test: probe_vfs_getname add do_getname() probing fallback Thomas Richter
2026-04-21 11:09 ` [PATCH Ping] " Thomas Richter
2026-04-25 0:57 ` [PATCH] " sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox