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.
Fixes: 4378a7d4be30 ("arm64: implement syscall wrappers") Reported-by: Naresh Kamboju naresh.kamboju@linaro.org Signed-off-by: Masami Hiramatsu mhiramat@kernel.org Cc: stable@vger.kernel.org --- arch/arm64/include/asm/ftrace.h | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h index caa955f10e19..a710f79db442 100644 --- a/arch/arm64/include/asm/ftrace.h +++ b/arch/arm64/include/asm/ftrace.h @@ -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 */
On Wed, 28 Nov 2018 01:29:45 +0900 Masami Hiramatsu mhiramat@kernel.org wrote:
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.
Acked-by: Steven Rostedt (VMware) rostedt@goodmis.org
-- Steve
Fixes: 4378a7d4be30 ("arm64: implement syscall wrappers") Reported-by: Naresh Kamboju naresh.kamboju@linaro.org Signed-off-by: Masami Hiramatsu mhiramat@kernel.org Cc: stable@vger.kernel.org
arch/arm64/include/asm/ftrace.h | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h index caa955f10e19..a710f79db442 100644 --- a/arch/arm64/include/asm/ftrace.h +++ b/arch/arm64/include/asm/ftrace.h @@ -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 */
Hi Masami,
On Wed, Nov 28, 2018 at 01:29:45AM +0900, Masami Hiramatsu wrote:
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.
Fixes: 4378a7d4be30 ("arm64: implement syscall wrappers") Reported-by: Naresh Kamboju naresh.kamboju@linaro.org Signed-off-by: Masami Hiramatsu mhiramat@kernel.org Cc: stable@vger.kernel.org
arch/arm64/include/asm/ftrace.h | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h index caa955f10e19..a710f79db442 100644 --- a/arch/arm64/include/asm/ftrace.h +++ b/arch/arm64/include/asm/ftrace.h @@ -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);
+}
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
On Tue, 27 Nov 2018 16:58:49 +0000 Will Deacon will.deacon@arm.com 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
Hi Will,
On Tue, 27 Nov 2018 13:18:59 -0500 Steven Rostedt rostedt@goodmis.org wrote:
On Tue, 27 Nov 2018 16:58:49 +0000 Will Deacon will.deacon@arm.com 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 ;-)
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,
Hi Masami,
On Wed, Nov 28, 2018 at 08:55:55AM +0900, Masami Hiramatsu wrote:
On Tue, 27 Nov 2018 13:18:59 -0500 Steven Rostedt rostedt@goodmis.org wrote:
On Tue, 27 Nov 2018 16:58:49 +0000 Will Deacon will.deacon@arm.com 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 ;-)
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:
Acked-by: Will Deacon will.deacon@arm.com
Thanks,
Will
On Wed, 28 Nov 2018 12:05:02 +0000 Will Deacon will.deacon@arm.com 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 will.deacon@arm.com
Shouldn't this go through your tree?
-- Steve
On Wed, Nov 28, 2018 at 09:22:23AM -0500, Steven Rostedt wrote:
On Wed, 28 Nov 2018 12:05:02 +0000 Will Deacon will.deacon@arm.com 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 will.deacon@arm.com
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
On Wed, 28 Nov 2018 19:59:22 +0000 Will Deacon will.deacon@arm.com wrote:
On Wed, Nov 28, 2018 at 09:22:23AM -0500, Steven Rostedt wrote:
On Wed, 28 Nov 2018 12:05:02 +0000 Will Deacon will.deacon@arm.com 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 will.deacon@arm.com
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,
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.
Fixes: 4378a7d4be30 ("arm64: implement syscall wrappers") Reported-by: Naresh Kamboju naresh.kamboju@linaro.org Signed-off-by: Masami Hiramatsu mhiramat@kernel.org Acked-by: Will Deacon will.deacon@arm.com Tested-by: Naresh Kamboju naresh.kamboju@linaro.org Cc: stable@vger.kernel.org --- arch/arm64/include/asm/ftrace.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h index caa955f10e19..fac54fb050d0 100644 --- a/arch/arm64/include/asm/ftrace.h +++ b/arch/arm64/include/asm/ftrace.h @@ -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 */
On Thu, Nov 29, 2018 at 02:39:33PM +0900, Masami Hiramatsu wrote:
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.
Fixes: 4378a7d4be30 ("arm64: implement syscall wrappers") Reported-by: Naresh Kamboju naresh.kamboju@linaro.org Signed-off-by: Masami Hiramatsu mhiramat@kernel.org Acked-by: Will Deacon will.deacon@arm.com Tested-by: Naresh Kamboju naresh.kamboju@linaro.org Cc: stable@vger.kernel.org
Queued for 4.20. Thanks.
On Thu, 29 Nov 2018 16:53:30 +0000 Catalin Marinas catalin.marinas@arm.com wrote:
On Thu, Nov 29, 2018 at 02:39:33PM +0900, Masami Hiramatsu wrote:
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.
Fixes: 4378a7d4be30 ("arm64: implement syscall wrappers") Reported-by: Naresh Kamboju naresh.kamboju@linaro.org Signed-off-by: Masami Hiramatsu mhiramat@kernel.org Acked-by: Will Deacon will.deacon@arm.com Tested-by: Naresh Kamboju naresh.kamboju@linaro.org Cc: stable@vger.kernel.org
Queued for 4.20. Thanks.
Thank you Catalin!
-- Catalin
linux-stable-mirror@lists.linaro.org