From: Francis Laniel <flaniel@linux.microsoft.com>
To: linux-trace-devel@vger.kernel.org
Cc: James Morse <james.morse@arm.com>,
Daniel Kiss <daniel.kiss@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Mark Brown <broonie@kernel.org>,
Peter Collingbourne <pcc@google.com>,
Kees Cook <keescook@chromium.org>,
Mark Rutland <mark.rutland@arm.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org
Subject: Re: [PATCH v2 0/1] Remove forget_syscall() from start_thread_common()
Date: Thu, 23 Jun 2022 16:09:01 +0200 [thread overview]
Message-ID: <2635206.mvXUDI8C0e@pwmachine> (raw)
In-Reply-To: <20220608162447.666494-1-flaniel@linux.microsoft.com>
Hi.
Le mercredi 8 juin 2022, 18:24:45 CEST Francis Laniel a écrit :
> Hi.
>
>
> First, I hope you are fine and the same for your relatives.
>
> With this contribution, I enabled using syscalls:sys_exit_execve and
> syscalls:sys_exit_execveat as tracepoints on arm64.
> Indeed, before this contribution, the above tracepoint would not print their
> information as syscall number was set to -1 by calling forget_syscall().
>
> I tested it by compiling a kernel for arm64 and running it within a VM:
> # Perf was compiled with linux kernel source.
> root@vm-arm64:~# perf record -ag -e 'syscalls:sys_exit_execve' -e
> 'syscalls:sys_enter_execve' & [1] 263
> root@vm-arm64:~# ls
> perf.data share
> root@vm-arm64:~# fg
> perf record -ag -e 'syscalls:sys_exit_execve' -e 'syscalls:sys_enter_execve'
> ^C[ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.061 MB perf.data (2 samples) ]
> root@vm-arm64:~# perf script
> bash 264 [000] 66.220187: syscalls:sys_enter_execve: filename:
> 0xaaab05d9d ...
> # Below line does not appear without this patch.
> ls 264 [000] 66.226848: syscalls:sys_exit_execve: 0x0
> ...
>
> Forgetting the syscall number before starting a new thread was confirmed to
> be a bug [1].
> Particularly, the following architectures do not forget the syscall number
> before starting a new thread:
> * arm (32 bits) EABI: start_thread() sets r7 to previous r7 for ELF FDPIC
> and to 0 for other binfmts [2].
> * arm (32 bits) OABI: syscall number is set to -1 if
> ptrace_report_syscall_entry() failed [3].
> * mips: start_thread() does not modify current_thread_info->syscall which is
> taken directly from v0 [4, 5].
> * riscv: start_thread() does not modify a7 [6].
> * x86_64: start_thread_common() does not touch orig_ax which seems to
> contain the syscall number [7].
>
> If you see any way to improve this contribution, feel free to share!
>
> Change since:
> v1:
> * Remove call to forget_syscall() and store previous syscall number in
> regs->syscallno unconditionnaly.
>
> Francis Laniel (1):
> arm64: Do not forget syscall when starting a new thread.
>
> arch/arm64/include/asm/processor.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>
> Best regards and thank you in advance.
> ---
> [1] https://lore.kernel.org/linux-arm-kernel/YoT1iLPEbteRTQGZ@arm.com/
> [2] https://elixir.bootlin.com/linux/v5.18-rc6/source/arch/arm/include/asm/
> processor.h#L52
> [3] https://elixir.bootlin.com/linux/v5.18-rc6/source/arch/arm/kernel/
> ptrace.c#L847
> [4] https://elixir.bootlin.com/linux/v5.18-rc6/source/arch/mips/kernel/
> process.c#L52
> [5] https://elixir.bootlin.com/linux/v5.18-rc6/source/arch/mips/kernel/
> scall64-n64.S#L85
> [6] https://elixir.bootlin.com/linux/v5.18-rc6/source/arch/riscv/kernel/
> process.c#L87
> [7] https://elixir.bootlin.com/linux/v5.18-rc6/source/arch/x86/kernel/
> process_64.c#L505
Can someone please take a quick look at this patch?
Best regards and thank you in advance.
WARNING: multiple messages have this Message-ID (diff)
From: Francis Laniel <flaniel@linux.microsoft.com>
To: linux-trace-devel@vger.kernel.org
Cc: James Morse <james.morse@arm.com>,
Daniel Kiss <daniel.kiss@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Mark Brown <broonie@kernel.org>,
Peter Collingbourne <pcc@google.com>,
Kees Cook <keescook@chromium.org>,
Mark Rutland <mark.rutland@arm.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org
Subject: Re: [PATCH v2 0/1] Remove forget_syscall() from start_thread_common()
Date: Thu, 23 Jun 2022 16:09:01 +0200 [thread overview]
Message-ID: <2635206.mvXUDI8C0e@pwmachine> (raw)
In-Reply-To: <20220608162447.666494-1-flaniel@linux.microsoft.com>
Hi.
Le mercredi 8 juin 2022, 18:24:45 CEST Francis Laniel a écrit :
> Hi.
>
>
> First, I hope you are fine and the same for your relatives.
>
> With this contribution, I enabled using syscalls:sys_exit_execve and
> syscalls:sys_exit_execveat as tracepoints on arm64.
> Indeed, before this contribution, the above tracepoint would not print their
> information as syscall number was set to -1 by calling forget_syscall().
>
> I tested it by compiling a kernel for arm64 and running it within a VM:
> # Perf was compiled with linux kernel source.
> root@vm-arm64:~# perf record -ag -e 'syscalls:sys_exit_execve' -e
> 'syscalls:sys_enter_execve' & [1] 263
> root@vm-arm64:~# ls
> perf.data share
> root@vm-arm64:~# fg
> perf record -ag -e 'syscalls:sys_exit_execve' -e 'syscalls:sys_enter_execve'
> ^C[ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.061 MB perf.data (2 samples) ]
> root@vm-arm64:~# perf script
> bash 264 [000] 66.220187: syscalls:sys_enter_execve: filename:
> 0xaaab05d9d ...
> # Below line does not appear without this patch.
> ls 264 [000] 66.226848: syscalls:sys_exit_execve: 0x0
> ...
>
> Forgetting the syscall number before starting a new thread was confirmed to
> be a bug [1].
> Particularly, the following architectures do not forget the syscall number
> before starting a new thread:
> * arm (32 bits) EABI: start_thread() sets r7 to previous r7 for ELF FDPIC
> and to 0 for other binfmts [2].
> * arm (32 bits) OABI: syscall number is set to -1 if
> ptrace_report_syscall_entry() failed [3].
> * mips: start_thread() does not modify current_thread_info->syscall which is
> taken directly from v0 [4, 5].
> * riscv: start_thread() does not modify a7 [6].
> * x86_64: start_thread_common() does not touch orig_ax which seems to
> contain the syscall number [7].
>
> If you see any way to improve this contribution, feel free to share!
>
> Change since:
> v1:
> * Remove call to forget_syscall() and store previous syscall number in
> regs->syscallno unconditionnaly.
>
> Francis Laniel (1):
> arm64: Do not forget syscall when starting a new thread.
>
> arch/arm64/include/asm/processor.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>
> Best regards and thank you in advance.
> ---
> [1] https://lore.kernel.org/linux-arm-kernel/YoT1iLPEbteRTQGZ@arm.com/
> [2] https://elixir.bootlin.com/linux/v5.18-rc6/source/arch/arm/include/asm/
> processor.h#L52
> [3] https://elixir.bootlin.com/linux/v5.18-rc6/source/arch/arm/kernel/
> ptrace.c#L847
> [4] https://elixir.bootlin.com/linux/v5.18-rc6/source/arch/mips/kernel/
> process.c#L52
> [5] https://elixir.bootlin.com/linux/v5.18-rc6/source/arch/mips/kernel/
> scall64-n64.S#L85
> [6] https://elixir.bootlin.com/linux/v5.18-rc6/source/arch/riscv/kernel/
> process.c#L87
> [7] https://elixir.bootlin.com/linux/v5.18-rc6/source/arch/x86/kernel/
> process_64.c#L505
Can someone please take a quick look at this patch?
Best regards and thank you in advance.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Francis Laniel <flaniel@linux.microsoft.com>
To: linux-trace-devel@vger.kernel.org
Cc: James Morse <james.morse@arm.com>,
Daniel Kiss <daniel.kiss@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Mark Brown <broonie@kernel.org>,
Peter Collingbourne <pcc@google.com>,
Kees Cook <keescook@chromium.org>,
Mark Rutland <mark.rutland@arm.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org
Subject: Re: [PATCH v2 0/1] Remove forget_syscall() from start_thread_common()
Date: Thu, 23 Jun 2022 16:09:01 +0200 [thread overview]
Message-ID: <2635206.mvXUDI8C0e@pwmachine> (raw)
In-Reply-To: <20220608162447.666494-1-flaniel@linux.microsoft.com>
Hi.
Le mercredi 8 juin 2022, 18:24:45 CEST Francis Laniel a écrit :
> Hi.
>
>
> First, I hope you are fine and the same for your relatives.
>
> With this contribution, I enabled using syscalls:sys_exit_execve and
> syscalls:sys_exit_execveat as tracepoints on arm64.
> Indeed, before this contribution, the above tracepoint would not print their
> information as syscall number was set to -1 by calling forget_syscall().
>
> I tested it by compiling a kernel for arm64 and running it within a VM:
> # Perf was compiled with linux kernel source.
> root@vm-arm64:~# perf record -ag -e 'syscalls:sys_exit_execve' -e
> 'syscalls:sys_enter_execve' & [1] 263
> root@vm-arm64:~# ls
> perf.data share
> root@vm-arm64:~# fg
> perf record -ag -e 'syscalls:sys_exit_execve' -e 'syscalls:sys_enter_execve'
> ^C[ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.061 MB perf.data (2 samples) ]
> root@vm-arm64:~# perf script
> bash 264 [000] 66.220187: syscalls:sys_enter_execve: filename:
> 0xaaab05d9d ...
> # Below line does not appear without this patch.
> ls 264 [000] 66.226848: syscalls:sys_exit_execve: 0x0
> ...
>
> Forgetting the syscall number before starting a new thread was confirmed to
> be a bug [1].
> Particularly, the following architectures do not forget the syscall number
> before starting a new thread:
> * arm (32 bits) EABI: start_thread() sets r7 to previous r7 for ELF FDPIC
> and to 0 for other binfmts [2].
> * arm (32 bits) OABI: syscall number is set to -1 if
> ptrace_report_syscall_entry() failed [3].
> * mips: start_thread() does not modify current_thread_info->syscall which is
> taken directly from v0 [4, 5].
> * riscv: start_thread() does not modify a7 [6].
> * x86_64: start_thread_common() does not touch orig_ax which seems to
> contain the syscall number [7].
>
> If you see any way to improve this contribution, feel free to share!
>
> Change since:
> v1:
> * Remove call to forget_syscall() and store previous syscall number in
> regs->syscallno unconditionnaly.
>
> Francis Laniel (1):
> arm64: Do not forget syscall when starting a new thread.
>
> arch/arm64/include/asm/processor.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>
> Best regards and thank you in advance.
> ---
> [1] https://lore.kernel.org/linux-arm-kernel/YoT1iLPEbteRTQGZ@arm.com/
> [2] https://elixir.bootlin.com/linux/v5.18-rc6/source/arch/arm/include/asm/
> processor.h#L52
> [3] https://elixir.bootlin.com/linux/v5.18-rc6/source/arch/arm/kernel/
> ptrace.c#L847
> [4] https://elixir.bootlin.com/linux/v5.18-rc6/source/arch/mips/kernel/
> process.c#L52
> [5] https://elixir.bootlin.com/linux/v5.18-rc6/source/arch/mips/kernel/
> scall64-n64.S#L85
> [6] https://elixir.bootlin.com/linux/v5.18-rc6/source/arch/riscv/kernel/
> process.c#L87
> [7] https://elixir.bootlin.com/linux/v5.18-rc6/source/arch/x86/kernel/
> process_64.c#L505
Can someone please take a quick look at this patch?
Best regards and thank you in advance.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-06-23 14:09 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-08 16:24 [PATCH v2 0/1] Remove forget_syscall() from start_thread_common() Francis Laniel
2022-06-08 16:24 ` Francis Laniel
2022-06-08 16:24 ` Francis Laniel
2022-06-08 16:24 ` [PATCH v2 1/1] arm64: Do not forget syscall when starting a new thread Francis Laniel
2022-06-08 16:24 ` Francis Laniel
2022-06-28 13:58 ` Will Deacon
2022-06-28 13:58 ` Will Deacon
2022-06-28 19:26 ` Francis Laniel
2022-06-28 19:26 ` Francis Laniel
2022-06-30 17:16 ` Francis Laniel
2022-06-30 17:16 ` Francis Laniel
2022-07-01 11:36 ` Will Deacon
2022-07-01 11:36 ` Will Deacon
2022-07-01 12:10 ` Francis Laniel
2022-07-01 12:10 ` Francis Laniel
2022-06-23 14:09 ` Francis Laniel [this message]
2022-06-23 14:09 ` [PATCH v2 0/1] Remove forget_syscall() from start_thread_common() Francis Laniel
2022-06-23 14:09 ` Francis Laniel
2022-07-01 15:41 ` Will Deacon
2022-07-01 15:41 ` Will Deacon
2022-07-01 15:41 ` Will Deacon
2022-07-04 8:55 ` Francis Laniel
2022-07-04 8:55 ` Francis Laniel
2022-07-04 8:55 ` Francis Laniel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2635206.mvXUDI8C0e@pwmachine \
--to=flaniel@linux.microsoft.com \
--cc=aou@eecs.berkeley.edu \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=christophe.leroy@csgroup.eu \
--cc=daniel.kiss@arm.com \
--cc=james.morse@arm.com \
--cc=keescook@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=pcc@google.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.