linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* File not found: /sys/kernel/debug/tracing/events/syscalls
@ 2018-11-27 15:22 Naresh Kamboju
  2018-11-27 16:11 ` Masami Hiramatsu
  0 siblings, 1 reply; 15+ messages in thread
From: Naresh Kamboju @ 2018-11-27 15:22 UTC (permalink / raw)
  To: open list; +Cc: Masami Hiramatsu, rostedt, mingo

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: File not found: /sys/kernel/debug/tracing/events/syscalls
  2018-11-27 15:22 File not found: /sys/kernel/debug/tracing/events/syscalls Naresh Kamboju
@ 2018-11-27 16:11 ` Masami Hiramatsu
  2018-11-27 16:29   ` [PATCH] arm64: ftrace: Fix to enable syscall events on arm64 Masami Hiramatsu
  2018-11-28  2:19   ` File not found: /sys/kernel/debug/tracing/events/syscalls Naresh Kamboju
  0 siblings, 2 replies; 15+ messages in thread
From: Masami Hiramatsu @ 2018-11-27 16:11 UTC (permalink / raw)
  To: Naresh Kamboju
  Cc: Linux kernel mailing list, Steven Rostedt (Red Hat),
	Ingo Molnar, 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 own arch_syscall_match_sym_name().

Thank you,

2018年11月28日(水) 0:22 Naresh Kamboju <naresh.kamboju@linaro.org>:
>
> 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



-- 
Masami Hiramatsu

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH] arm64: ftrace: Fix to enable syscall events on arm64
  2018-11-27 16:11 ` Masami Hiramatsu
@ 2018-11-27 16:29   ` Masami Hiramatsu
  2018-11-27 16:32     ` Steven Rostedt
  2018-11-27 16:58     ` Will Deacon
  2018-11-28  2:19   ` File not found: /sys/kernel/debug/tracing/events/syscalls Naresh Kamboju
  1 sibling, 2 replies; 15+ messages in thread
From: Masami Hiramatsu @ 2018-11-27 16:29 UTC (permalink / raw)
  To: Steven Rostedt, Catalin Marinas
  Cc: Naresh Kamboju, Will Deacon, Mark Rutland, Ingo Molnar,
	Masami Hiramatsu, Masami Hiramatsu, linux-kernel, stable

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 */


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH] arm64: ftrace: Fix to enable syscall events on arm64
  2018-11-27 16:29   ` [PATCH] arm64: ftrace: Fix to enable syscall events on arm64 Masami Hiramatsu
@ 2018-11-27 16:32     ` Steven Rostedt
  2018-11-27 16:58     ` Will Deacon
  1 sibling, 0 replies; 15+ messages in thread
From: Steven Rostedt @ 2018-11-27 16:32 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: Catalin Marinas, Naresh Kamboju, Will Deacon, Mark Rutland,
	Ingo Molnar, Masami Hiramatsu, linux-kernel, stable

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 */


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] arm64: ftrace: Fix to enable syscall events on arm64
  2018-11-27 16:29   ` [PATCH] arm64: ftrace: Fix to enable syscall events on arm64 Masami Hiramatsu
  2018-11-27 16:32     ` Steven Rostedt
@ 2018-11-27 16:58     ` Will Deacon
  2018-11-27 18:18       ` Steven Rostedt
  1 sibling, 1 reply; 15+ messages in thread
From: Will Deacon @ 2018-11-27 16:58 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: Steven Rostedt, Catalin Marinas, Naresh Kamboju, Mark Rutland,
	Ingo Molnar, Masami Hiramatsu, linux-kernel, stable

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] arm64: ftrace: Fix to enable syscall events on arm64
  2018-11-27 16:58     ` Will Deacon
@ 2018-11-27 18:18       ` Steven Rostedt
  2018-11-27 23:55         ` Masami Hiramatsu
  0 siblings, 1 reply; 15+ messages in thread
From: Steven Rostedt @ 2018-11-27 18:18 UTC (permalink / raw)
  To: Will Deacon
  Cc: Masami Hiramatsu, Catalin Marinas, Naresh Kamboju, Mark Rutland,
	Ingo Molnar, Masami Hiramatsu, linux-kernel, stable

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] arm64: ftrace: Fix to enable syscall events on arm64
  2018-11-27 18:18       ` Steven Rostedt
@ 2018-11-27 23:55         ` Masami Hiramatsu
  2018-11-28 12:05           ` Will Deacon
  0 siblings, 1 reply; 15+ messages in thread
From: Masami Hiramatsu @ 2018-11-27 23:55 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Will Deacon, Masami Hiramatsu, Catalin Marinas, Naresh Kamboju,
	Mark Rutland, Ingo Molnar, Masami Hiramatsu, linux-kernel,
	stable, AKASHI Takahiro

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,

-- 
Masami Hiramatsu <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: File not found: /sys/kernel/debug/tracing/events/syscalls
  2018-11-27 16:11 ` Masami Hiramatsu
  2018-11-27 16:29   ` [PATCH] arm64: ftrace: Fix to enable syscall events on arm64 Masami Hiramatsu
@ 2018-11-28  2:19   ` Naresh Kamboju
  1 sibling, 0 replies; 15+ messages in thread
From: Naresh Kamboju @ 2018-11-28  2:19 UTC (permalink / raw)
  To: Masami Hiramatsu; +Cc: open list, rostedt, mingo, mhiramat

Hi Masami San,

Thanks for the patch it solved the problem.

On Tue, 27 Nov 2018 at 21:41, Masami Hiramatsu
<masami.hiramatsu@linaro.org> wrote:
>
> 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().

arm64: ftrace: Fix to enable syscall events on arm64

From: Masami Hiramatsu <mhiramat@kernel.org>

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")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Tested-by: Naresh Kamboju <naresh.kamboju@linaro.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 */


>
> Thank you,
>
> 2018年11月28日(水) 0:22 Naresh Kamboju <naresh.kamboju@linaro.org>:
> >
> > 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
>
>
>
> --
> Masami Hiramatsu

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH] arm64: ftrace: Fix to enable syscall events on arm64
  2018-11-27 23:55         ` Masami Hiramatsu
@ 2018-11-28 12:05           ` Will Deacon
  2018-11-28 14:22             ` Steven Rostedt
  0 siblings, 1 reply; 15+ messages in thread
From: Will Deacon @ 2018-11-28 12:05 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: Steven Rostedt, Catalin Marinas, Naresh Kamboju, Mark Rutland,
	Ingo Molnar, Masami Hiramatsu, linux-kernel, stable,
	AKASHI Takahiro

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] arm64: ftrace: Fix to enable syscall events on arm64
  2018-11-28 12:05           ` Will Deacon
@ 2018-11-28 14:22             ` Steven Rostedt
  2018-11-28 19:59               ` Will Deacon
  0 siblings, 1 reply; 15+ messages in thread
From: Steven Rostedt @ 2018-11-28 14:22 UTC (permalink / raw)
  To: Will Deacon
  Cc: Masami Hiramatsu, Catalin Marinas, Naresh Kamboju, Mark Rutland,
	Ingo Molnar, Masami Hiramatsu, linux-kernel, stable,
	AKASHI Takahiro

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] arm64: ftrace: Fix to enable syscall events on arm64
  2018-11-28 14:22             ` Steven Rostedt
@ 2018-11-28 19:59               ` Will Deacon
  2018-11-29  5:38                 ` Masami Hiramatsu
  2018-11-29  5:39                 ` [PATCH v2] " Masami Hiramatsu
  0 siblings, 2 replies; 15+ messages in thread
From: Will Deacon @ 2018-11-28 19:59 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Masami Hiramatsu, Catalin Marinas, Naresh Kamboju, Mark Rutland,
	Ingo Molnar, Masami Hiramatsu, linux-kernel, stable,
	AKASHI Takahiro

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] arm64: ftrace: Fix to enable syscall events on arm64
  2018-11-28 19:59               ` Will Deacon
@ 2018-11-29  5:38                 ` Masami Hiramatsu
  2018-11-29  5:39                 ` [PATCH v2] " Masami Hiramatsu
  1 sibling, 0 replies; 15+ messages in thread
From: Masami Hiramatsu @ 2018-11-29  5:38 UTC (permalink / raw)
  To: Will Deacon
  Cc: Steven Rostedt, Masami Hiramatsu, Catalin Marinas,
	Naresh Kamboju, Mark Rutland, Ingo Molnar, Masami Hiramatsu,
	linux-kernel, stable, AKASHI Takahiro

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,


-- 
Masami Hiramatsu <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v2] arm64: ftrace: Fix to enable syscall events on arm64
  2018-11-28 19:59               ` Will Deacon
  2018-11-29  5:38                 ` Masami Hiramatsu
@ 2018-11-29  5:39                 ` Masami Hiramatsu
  2018-11-29 16:53                   ` Catalin Marinas
  1 sibling, 1 reply; 15+ messages in thread
From: Masami Hiramatsu @ 2018-11-29  5:39 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Steven Rostedt, Naresh Kamboju, Will Deacon, Mark Rutland,
	Ingo Molnar, Masami Hiramatsu, Masami Hiramatsu, linux-kernel,
	stable

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 */


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v2] arm64: ftrace: Fix to enable syscall events on arm64
  2018-11-29  5:39                 ` [PATCH v2] " Masami Hiramatsu
@ 2018-11-29 16:53                   ` Catalin Marinas
  2018-11-29 22:13                     ` Masami Hiramatsu
  0 siblings, 1 reply; 15+ messages in thread
From: Catalin Marinas @ 2018-11-29 16:53 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: Steven Rostedt, Naresh Kamboju, Will Deacon, Mark Rutland,
	Ingo Molnar, Masami Hiramatsu, linux-kernel, stable

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.

-- 
Catalin

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2] arm64: ftrace: Fix to enable syscall events on arm64
  2018-11-29 16:53                   ` Catalin Marinas
@ 2018-11-29 22:13                     ` Masami Hiramatsu
  0 siblings, 0 replies; 15+ messages in thread
From: Masami Hiramatsu @ 2018-11-29 22:13 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Steven Rostedt, Naresh Kamboju, Will Deacon, Mark Rutland,
	Ingo Molnar, Masami Hiramatsu, linux-kernel, stable

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


-- 
Masami Hiramatsu <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2018-11-29 22:13 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-27 15:22 File not found: /sys/kernel/debug/tracing/events/syscalls Naresh Kamboju
2018-11-27 16:11 ` Masami Hiramatsu
2018-11-27 16:29   ` [PATCH] arm64: ftrace: Fix to enable syscall events on arm64 Masami Hiramatsu
2018-11-27 16:32     ` Steven Rostedt
2018-11-27 16:58     ` Will Deacon
2018-11-27 18:18       ` Steven Rostedt
2018-11-27 23:55         ` Masami Hiramatsu
2018-11-28 12:05           ` Will Deacon
2018-11-28 14:22             ` Steven Rostedt
2018-11-28 19:59               ` Will Deacon
2018-11-29  5:38                 ` Masami Hiramatsu
2018-11-29  5:39                 ` [PATCH v2] " Masami Hiramatsu
2018-11-29 16:53                   ` Catalin Marinas
2018-11-29 22:13                     ` Masami Hiramatsu
2018-11-28  2:19   ` File not found: /sys/kernel/debug/tracing/events/syscalls Naresh Kamboju

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).