linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Francis Laniel <flaniel@linux.microsoft.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-trace-devel@vger.kernel.org,
	Catalin Marinas <catalin.marinas@arm.com>,
	Mark Brown <broonie@kernel.org>,
	Peter Collingbourne <pcc@google.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Kees Cook <keescook@chromium.org>,
	Daniel Kiss <daniel.kiss@arm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v1 1/1] arm64: Forget syscall if different from execve*()
Date: Tue, 10 May 2022 11:59:48 +0100	[thread overview]
Message-ID: <20220510105948.GB27557@willie-the-truck> (raw)
In-Reply-To: <20220509151958.441240-2-flaniel@linux.microsoft.com>

On Mon, May 09, 2022 at 04:19:57PM +0100, Francis Laniel wrote:
> This patch enables exeve*() to be traced by syscalls:sys_exit_execve
> tracepoint.
> Previously, calling forget_syscall() would set syscall to -1, which impedes
> this tracepoint to prints its information.
> So, this patch makes call to forget_syscall() conditional by only calling
> it when syscall number is not execve() or execveat().
> 
> Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
> ---
>  arch/arm64/include/asm/processor.h | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
> index 73e38d9a540c..e12ceb363d6a 100644
> --- a/arch/arm64/include/asm/processor.h
> +++ b/arch/arm64/include/asm/processor.h
> @@ -34,6 +34,8 @@
>  
>  #include <vdso/processor.h>
>  
> +#include <asm-generic/unistd.h>
> +
>  #include <asm/alternative.h>
>  #include <asm/cpufeature.h>
>  #include <asm/hw_breakpoint.h>
> @@ -250,8 +252,12 @@ void tls_preserve_current_state(void);
>  
>  static inline void start_thread_common(struct pt_regs *regs, unsigned long pc)
>  {
> +	s32 previous_syscall = regs->syscallno;
>  	memset(regs, 0, sizeof(*regs));
> -	forget_syscall(regs);
> +	if (previous_syscall == __NR_execve || previous_syscall == __NR_execveat)
> +		regs->syscallno = previous_syscall;
> +	else
> +		forget_syscall(regs);

Hmm, this really looks like a bodge and it doesn't handle the compat case
either.

How do other architectures handle this?

Will

  reply	other threads:[~2022-05-10 11:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09 15:19 [RFC PATCH v1 0/1] Call forget_syscall() if different than execve*() Francis Laniel
2022-05-09 15:19 ` [RFC PATCH v1 1/1] arm64: Forget syscall if different from execve*() Francis Laniel
2022-05-10 10:59   ` Will Deacon [this message]
2022-05-10 14:00     ` Francis Laniel
2022-05-10 14:03       ` Will Deacon
2022-05-10 14:12         ` Francis Laniel
2022-05-18 13:32         ` Catalin Marinas

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=20220510105948.GB27557@willie-the-truck \
    --to=will@kernel.org \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=daniel.kiss@arm.com \
    --cc=flaniel@linux.microsoft.com \
    --cc=keescook@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pcc@google.com \
    /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 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).