File not found: /sys/kernel/debug/tracing/events/syscalls
Subsystems (3)
While debugging the selftests/bpf: get_cgroup_id_user test failure on arm64 where the test is expecting trace file /sys/kernel/debug/tracing/events/syscalls/sys_enter_nanosleep/id but this path not enabled after enabling required kernel configuration also. CONFIG_FTRACE_SYSCALLS=y
strace output:open(\"/sys/kernel/debug/tracing/events/syscalls/sys_enter_nanosleep/id\", O_RDONLY) = -1 ENOENT (No such file or directory)
This problem noticed on Linux mainline kernel version 4.20.0-rc3.
Best regards
Naresh Kamboju
Hi,
I found that the commit 4378a7d4be30 ("arm64: implement syscall wrappers") changed
the syscall wrapper function names by adding __arm64_ prefix. So arm64 kernel should
have its own arch_syscall_match_sym_name().
Thank you,
2018年11月28日(水) 0:22 Naresh Kamboju <[email protected]>:
Quoted 15 lines
While debugging the selftests/bpf:
get_cgroup_id_usertest failure on arm64 where the test is expecting trace file/sys/kernel/debug/tracing/events/syscalls/sys_enter_nanosleep/idbut this path not enabled after enabling required kernel configuration also.CONFIG_FTRACE_SYSCALLS=ystrace output:
open(\"/sys/kernel/debug/tracing/events/syscalls/sys_enter_nanosleep/id\", O_RDONLY)= -1 ENOENT (No such file or directory)This problem noticed on Linux mainline kernel version 4.20.0-rc3.
Best regards
Naresh Kamboju
Signature · 1 line
Masami Hiramatsu
Masami Hiramatsu
maintainerPATCH 1/1 arm64: ftrace: Fix to enable syscall events on arm64
Since commit 4378a7d4be30 ("arm64: implement syscall wrappers") introduced "__arm64_" prefix to all syscall wrapper symbols in sys_call_table, syscall tracer can not find corresponding metadata from syscall name. In the result, we have no syscall ftrace events on arm64 kernel, and some bpf testcases are failed on arm64.
To fix this issue, this introduces custom arch_syscall_match_sym_name() which skips first 8 bytes when comparing the syscall and symbol names.
--- arch/arm64/include/asm/ftrace.h | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm64/include/asm/ftrace.h +9 -0
@@ -56,6 +56,15 @@ static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs) {return is_compat_task (); } + +#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME + +static inline bool arch_syscall_match_sym_name (const char *sym, +const char *name) +{ +/* Since all syscall functions have __arm64_ prefix, we must skip it */ +return !strcmp (sym +8 , name); +}#endif /* ifndef __ASSEMBLY__ */ #endif /* __ASM_FTRACE_H */
Re: [PATCH] arm64: ftrace: Fix to enable syscall events on arm64
Quoted 11 lines · On Wed, 28 Nov 2018 01:29:45 +0900 Masami Hiramatsu <[email protected]> wrote:
Since commit
4378a7d4be30("arm64: implement syscall wrappers") introduced "__arm64_" prefix to all syscall wrapper symbols insys_call_table, syscall tracer can not find corresponding metadata from syscall name. In the result, we have no syscall ftrace events on arm64 kernel, and some bpf testcases are failed on arm64.To fix this issue, this introduces custom
arch_syscall_match_sym_name()which skips first 8 bytes when comparing the syscall and symbol names.
-- Steve
Quoted 28 lines
Fixes 4378a7d4be30 ("arm64: implement syscall wrappers")Reported-by Naresh Kamboju <[email protected]>Signed-off-by Masami Hiramatsu <[email protected]>--- arch/arm64/include/asm/ftrace.h | 9 +++++++++ 1 file changed, 9 insertions(+)arch/arm64/include/asm/ftrace.h +9
-0@@ -56,6 +56,15 @@ static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs) {return is_compat_task (); } + +#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME + +static inline bool arch_syscall_match_sym_name (const char *sym, +const char *name) +{ +/* Since all syscall functions have __arm64_ prefix, we must skip it */ +return !strcmp (sym +8 , name); +}#endif /* ifndef __ASSEMBLY__ */ #endif /* __ASM_FTRACE_H */
Re: [PATCH] arm64: ftrace: Fix to enable syscall events on arm64
In reply to Masami HiramatsuHi Masami,
Quoted 26 lines · Masami Hiramatsu
Since commit
4378a7d4be30("arm64: implement syscall wrappers") introduced "__arm64_" prefix to all syscall wrapper symbols insys_call_table, syscall tracer can not find corresponding metadata from syscall name. In the result, we have no syscall ftrace events on arm64 kernel, and some bpf testcases are failed on arm64.To fix this issue, this introduces custom
arch_syscall_match_sym_name()which skips first 8 bytes when comparing the syscall and symbol names.Fixes 4378a7d4be30 ("arm64: implement syscall wrappers")Reported-by Naresh Kamboju <[email protected]>Signed-off-by Masami Hiramatsu <[email protected]>--- arch/arm64/include/asm/ftrace.h | 9 +++++++++ 1 file changed, 9 insertions(+)arch/arm64/include/asm/ftrace.h +0
-0@@ -56,6 +56,15 @@ static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs) {return is_compat_task ();
arch/arm64/include/asm/ftrace.h static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs) · line 67
Quoted 10 lines
arch/arm64/include/asm/ftrace.h +9
-0} + +#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME + +static inline bool arch_syscall_match_sym_name (const char *sym, +const char *name) +{ +/* Since all syscall functions have __arm64_ prefix, we must skip it */ +return !strcmp (sym +8 , name); +}
This looks fine to me, but I'm curious about whether this is supposed to work with compat syscalls as well, where the prefix is "__arm64_compat_".
If we broadly follow the x86 lead, we'd have:
return (!strncmp(sym, "__arm64_", 8) && !strcmp(sym + 8, name)) || (!strncmp(sym, "__arm64_compat_", 15) && !strcmp(sym + 15, name));
Do we need to handle compat (i.e. 32-bit) tasks here?
Will
Steven Rostedt
maintainerRe: [PATCH] arm64: ftrace: Fix to enable syscall events on arm64
Quoted 9 lines · On Tue, 27 Nov 2018 16:58:49 +0000 Will Deacon <[email protected]> wrote:
This looks fine to me, but I'm curious about whether this is supposed to work with compat syscalls as well, where the prefix is "
__arm64_compat_".If we broadly follow the x86 lead, we'd have:
return (!strncmp(sym, "__arm64_", 8) && !strcmp(sym + 8, name)) || (!strncmp(sym, "__arm64_compat_", 15) && !strcmp(sym + 15, name));Do we need to handle compat (i.e. 32-bit) tasks here?
Only if you want to trace compat syscalls as well ;-)
-- Steve
Masami Hiramatsu
maintainerRe: [PATCH] arm64: ftrace: Fix to enable syscall events on arm64
Hi Will,
Quoted 6 lines · On Tue, 27 Nov 2018 13:18:59 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 3 lines · On Tue, 27 Nov 2018 16:58:49 +0000 Will Deacon <[email protected]> wrote:
This looks fine to me, but I'm curious about whether this is supposed to work with compat syscalls as well, where the prefix is "
__arm64_compat_".
Quoted 8 lines
Quoted 6 lines
If we broadly follow the x86 lead, we'd have:
return (!strncmp(sym, "__arm64_", 8) && !strcmp(sym + 8, name)) || (!strncmp(sym, "__arm64_compat_", 15) && !strcmp(sym + 15, name));Do we need to handle compat (i.e. 32-bit) tasks here?
Only if you want to trace compat syscalls as well ;-)
Actually I thought about that, but I found below comment in arch/arm64/include/asm/ftrace.h
* Because AArch32 mode does not share the same syscall table with AArch64,
* tracing compat syscalls may result in reporting bogus syscalls or even
* hang-up, so just do not trace them.
That's why I dropped compat syscall support.
Thank you,
Signature · 1 line
Masami Hiramatsu <[email protected]>
Will Deacon
Acked-byRe: [PATCH] arm64: ftrace: Fix to enable syscall events on arm64
Hi Masami,
Quoted 18 lines · Masami Hiramatsu
Quoted 6 lines · On Tue, 27 Nov 2018 13:18:59 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 3 lines · On Tue, 27 Nov 2018 16:58:49 +0000 Will Deacon <[email protected]> wrote:
This looks fine to me, but I'm curious about whether this is supposed to work with compat syscalls as well, where the prefix is "
__arm64_compat_".Quoted 8 lines
Quoted 6 lines
If we broadly follow the x86 lead, we'd have:
return (!strncmp(sym, "__arm64_", 8) && !strcmp(sym + 8, name)) || (!strncmp(sym, "__arm64_compat_", 15) && !strcmp(sym + 15, name));Do we need to handle compat (i.e. 32-bit) tasks here?
Only if you want to trace compat syscalls as well ;-)
Quoted 8 lines
Actually I thought about that, but I found below comment in
arch/arm64/include/asm/ftrace.h* Because AArch32 mode does not share the same syscall table with AArch64,
* tracing compat syscalls may result in reporting bogus syscalls or even
* hang-up, so just do not trace them.That's why I dropped compat syscall support.
Ok! Then please add a comment to arch_syscall_match_sym_name() along those lines, and you can add my ack:
Thanks,
Will
Steven Rostedt
maintainerRe: [PATCH] arm64: ftrace: Fix to enable syscall events on arm64
Quoted 4 lines · On Wed, 28 Nov 2018 12:05:02 +0000 Will Deacon <[email protected]> wrote:
Ok! Then please add a comment to
arch_syscall_match_sym_name()along those lines, and you can add my ack:Acked-by Will Deacon <[email protected]>
Shouldn't this go through your tree?
-- Steve
Re: [PATCH] arm64: ftrace: Fix to enable syscall events on arm64
Quoted 9 lines · Steven Rostedt
Quoted 4 lines · On Wed, 28 Nov 2018 12:05:02 +0000 Will Deacon <[email protected]> wrote:
Ok! Then please add a comment to
arch_syscall_match_sym_name()along those lines, and you can add my ack:Acked-by Will Deacon <[email protected]>Shouldn't this go through your tree?
Yup; I'm hoping Catalin will pick it up as a fix for 4.20 (we take it in turns, so I'm looking at stuff for 4.21 atm).
Will
Masami Hiramatsu
maintainerRe: [PATCH] arm64: ftrace: Fix to enable syscall events on arm64
Quoted 7 lines · On Wed, 28 Nov 2018 19:59:22 +0000 Will Deacon <[email protected]> wrote:
Quoted 6 lines · Steven Rostedt
Quoted 3 lines · On Wed, 28 Nov 2018 12:05:02 +0000 Will Deacon <[email protected]> wrote:
Ok! Then please add a comment to
arch_syscall_match_sym_name()along those lines, and you can add my ack:
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Acked-by Will Deacon <[email protected]>Shouldn't this go through your tree?
Yup; I'm hoping Catalin will pick it up as a fix for 4.20 (we take it in turns, so I'm looking at stuff for 4.21 atm).
OK, I'll add a comment about compat syscalls. BTW, this should be applied to 4.19 too, since without this, no one can use syscall events on arm64.
Thank you,
Signature · 1 line
Masami Hiramatsu <[email protected]>
Masami Hiramatsu
maintainerPATCH v2 1/1 arm64: ftrace: Fix to enable syscall events on arm64
In reply to Will DeaconSince commit 4378a7d4be30 ("arm64: implement syscall wrappers") introduced "__arm64_" prefix to all syscall wrapper symbols in sys_call_table, syscall tracer can not find corresponding metadata from syscall name. In the result, we have no syscall ftrace events on arm64 kernel, and some bpf testcases are failed on arm64.
To fix this issue, this introduces custom arch_syscall_match_sym_name() which skips first 8 bytes when comparing the syscall and symbol names.
--- arch/arm64/include/asm/ftrace.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/arm64/include/asm/ftrace.h +13 -0
@@ -56,6 +56,19 @@ static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs) {return is_compat_task (); } + +#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME + +static inline bool arch_syscall_match_sym_name (const char *sym, +const char *name) +{ +/* +* Since all syscall functions have __arm64_ prefix, we must skip it. +* However, as we described above, we decided to ignore compat +* syscalls, so we don't care about __arm64_compat_ prefix here. +*/ +return !strcmp (sym +8 , name); +}#endif /* ifndef __ASSEMBLY__ */ #endif /* __ASM_FTRACE_H */
Re: [PATCH v2] arm64: ftrace: Fix to enable syscall events on arm64
Quoted 11 lines · Masami Hiramatsu
Since commit
4378a7d4be30("arm64: implement syscall wrappers") introduced "__arm64_" prefix to all syscall wrapper symbols insys_call_table, syscall tracer can not find corresponding metadata from syscall name. In the result, we have no syscall ftrace events on arm64 kernel, and some bpf testcases are failed on arm64.To fix this issue, this introduces custom
arch_syscall_match_sym_name()which skips first 8 bytes when comparing the syscall and symbol names.
Quoted 6 lines
Fixes 4378a7d4be30 ("arm64: implement syscall wrappers")Reported-by Naresh Kamboju <[email protected]>Signed-off-by Masami Hiramatsu <[email protected]>Acked-by Will Deacon <[email protected]>Tested-by Naresh Kamboju <[email protected]>
Queued for 4.20. Thanks.
Signature · 1 line
Catalin
Masami Hiramatsu
maintainerRe: [PATCH v2] arm64: ftrace: Fix to enable syscall events on arm64
Quoted 12 lines · On Thu, 29 Nov 2018 16:53:30 +0000 Catalin Marinas <[email protected]>…
Quoted 11 lines · Masami Hiramatsu
Since commit
4378a7d4be30("arm64: implement syscall wrappers") introduced "__arm64_" prefix to all syscall wrapper symbols insys_call_table, syscall tracer can not find corresponding metadata from syscall name. In the result, we have no syscall ftrace events on arm64 kernel, and some bpf testcases are failed on arm64.To fix this issue, this introduces custom
arch_syscall_match_sym_name()which skips first 8 bytes when comparing the syscall and symbol names.
Quoted 8 lines
Quoted 6 lines
Fixes 4378a7d4be30 ("arm64: implement syscall wrappers")Reported-by Naresh Kamboju <[email protected]>Signed-off-by Masami Hiramatsu <[email protected]>Acked-by Will Deacon <[email protected]>Tested-by Naresh Kamboju <[email protected]>Queued for 4.20. Thanks.
Thank you Catalin!
Quoted 3 lines
Signature · 2 lines
-- Catalin
Signature · 1 line
Masami Hiramatsu <[email protected]>
Naresh Kamboju
Tested-byHi Masami San,
Thanks for the patch it solved the problem.
Quoted 8 lines · Masami Hiramatsu
Hi,
I found that the commit
4378a7d4be30("arm64: implement syscall wrappers") changed
the syscall wrapper function names by adding__arm64_prefix. So arm64 kernel should
have its ownarch_syscall_match_sym_name().
arm64: ftrace: Fix to enable syscall events on arm64
From: Masami Hiramatsu <[email protected]>
Since commit 4378a7d4be30 ("arm64: implement syscall wrappers") introduced "__arm64_" prefix to all syscall wrapper symbols in sys_call_table, syscall tracer can not find corresponding metadata from syscall name. In the result, we have no syscall ftrace events on arm64 kernel, and some bpf testcases are failed on arm64.
To fix this issue, this introduces custom arch_syscall_match_sym_name() which skips first 8 bytes when comparing the syscall and symbol names.
--- arch/arm64/include/asm/ftrace.h | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm64/include/asm/ftrace.h +0 -0
@@ -56,6 +56,15 @@ static inline bool
arch_trace_is_compat_syscall(struct pt_regs *regs)
{
return is_compat_task();
}
+
+#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
+
+static inline bool arch_syscall_match_sym_name(const char *sym,
+ const char *name)
+{
+ /* Since all syscall functions have __arm64_ prefix, we must skip it */
+ return !strcmp(sym + 8, name);
+}
#endif /* ifndef __ASSEMBLY__ */
#endif /* __ASM_FTRACE_H */
Quoted 24 lines
Thank you,
2018年11月28日(水) 0:22 Naresh Kamboju <[email protected]>:
Quoted 7 lines
While debugging the selftests/bpf:
get_cgroup_id_usertest failure on arm64 where the test is expecting trace file/sys/kernel/debug/tracing/events/syscalls/sys_enter_nanosleep/idbut this path not enabled after enabling required kernel configuration also.CONFIG_FTRACE_SYSCALLS=yQuoted 8 lines
strace output:
open(\"/sys/kernel/debug/tracing/events/syscalls/sys_enter_nanosleep/id\", O_RDONLY)= -1 ENOENT (No such file or directory)This problem noticed on Linux mainline kernel version 4.20.0-rc3.
Best regards
Naresh Kamboju--
Masami Hiramatsu