* [PATCH] perf/build: Include linux/string.h by jitdump.c for strlcpy()
@ 2026-11-26 6:08 Dmitry Safonov via B4 Relay
2026-11-26 6:13 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Safonov via B4 Relay @ 2026-11-26 6:08 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, James Clark
Cc: Arnaldo Carvalho de Melo, linux-perf-users, linux-kernel,
Dmitry Safonov
From: Dmitry Safonov <dima@arista.com>
jit_open() now calls strlcpy(), but jitdump.c only includes the libc
<string.h>. With glibc older than 2.38, that header does not declare
strlcpy(), causing the build to fail:
util/jitdump.c:246:17: error: implicit declaration of function 'strlcpy'; did you mean 'strncpy'? [-Wimplicit-function-declaration]
246 | strlcpy(jd->dir, dname, sizeof(jd->dir));
| ^~~~~~~
| strncpy
Current mainline gets the declaration indirectly through symbol.h after
commit 5a9dd835894c ("perf symbols: skip livepatch symbols when loading
kallsyms"). Stable trees are affected, in my case it's v6.12.119 with
stable backport/commit 649bf062b91d ("perf jitdump: Use dirname()
return value in jit_open()")
Replace <string.h> with <linux/string.h>, which includes the libc header
and declares the tools strlcpy() implementation.
Fixes: 4eddf7d9e341 ("perf jitdump: Use dirname() return value in jit_open()")
Signed-off-by: Dmitry Safonov <dima@arista.com>
---
tools/perf/util/jitdump.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c
index 45a05316b3ca..626a12280ca3 100644
--- a/tools/perf/util/jitdump.c
+++ b/tools/perf/util/jitdump.c
@@ -5,7 +5,6 @@
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <inttypes.h>
@@ -16,6 +15,7 @@
#include <linux/stringify.h>
#include <linux/kernel.h>
#include <linux/unaligned.h>
+#include <linux/string.h>
#include "event.h"
#include "debug.h"
---
base-commit: 40212b29a6f718d4e7fb3275cede181cb8e137cf
change-id: 20261126-perf-string-h-0a61ba363e65
Best regards,
--
Dmitry Safonov <dima@arista.com>
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] perf/build: Include linux/string.h by jitdump.c for strlcpy()
2026-11-26 6:08 [PATCH] perf/build: Include linux/string.h by jitdump.c for strlcpy() Dmitry Safonov via B4 Relay
@ 2026-11-26 6:13 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-26 6:13 UTC (permalink / raw)
To: Dmitry Safonov; +Cc: linux-perf-users
> From: Dmitry Safonov <dima@arista.com>
>
> jit_open() now calls strlcpy(), but jitdump.c only includes the libc
> <string.h>. With glibc older than 2.38, that header does not declare
> strlcpy(), causing the build to fail:
>
> util/jitdump.c:246:17: error: implicit declaration of function 'strlcpy'; did you mean 'strncpy'? [-Wimplicit-function-declaration]
> 246 | strlcpy(jd->dir, dname, sizeof(jd->dir));
> | ^~~~~~~
> | strncpy
>
> Current mainline gets the declaration indirectly through symbol.h after
> commit 5a9dd835894c ("perf symbols: skip livepatch symbols when loading
> kallsyms"). Stable trees are affected, in my case it's v6.12.119 with
> stable backport/commit 649bf062b91d ("perf jitdump: Use dirname()
> return value in jit_open()")
>
> Replace <string.h> with <linux/string.h>, which includes the libc header
> and declares the tools strlcpy() implementation.
>
> Fixes: 4eddf7d9e341 ("perf jitdump: Use dirname() return value in jit_open()")
> Signed-off-by: Dmitry Safonov <dima@arista.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261126-perf-string-h-v1-1-8f5c39ff30f0@arista.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-26 6:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 6:08 [PATCH] perf/build: Include linux/string.h by jitdump.c for strlcpy() Dmitry Safonov via B4 Relay
2026-11-26 6:13 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox