All of lore.kernel.org
 help / color / mirror / Atom feed
From: Francis Laniel <flaniel@linux.microsoft.com>
To: linux-arm-kernel@lists.infradead.org
Cc: linux-trace-devel@vger.kernel.org,
	Francis Laniel <flaniel@linux.microsoft.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Peter Collingbourne <pcc@google.com>,
	Mark Brown <broonie@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Daniel Kiss <daniel.kiss@arm.com>,
	Kees Cook <keescook@chromium.org>,
	linux-kernel@vger.kernel.org
Subject: [RFC PATCH v1 0/1] Call forget_syscall() if different than execve*()
Date: Mon,  9 May 2022 16:19:56 +0100	[thread overview]
Message-ID: <20220509151958.441240-1-flaniel@linux.microsoft.com> (raw)

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().

Now, forget_syscall() is called only if previous syscall number was different
than __NR_execve and __NR_execveat.
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 with this patch.
ls   264 [000]    66.226848:  syscalls:sys_exit_execve: 0x0
...

Nonetheless, this contribution is not perfect, hence I marked it as RFC.
First, I am not really sure if this is safe to not call forget_syscall() all the
time, even though I did not have problem while testing it.
Then, by including <asm-generic/unistd.h> to the modified file I ended with
some warnings at compile time:

So, if you see any way to improve this contribution, feel free to share!

Francis Laniel (1):
  arm64: Forget syscall if different from execve*()

 arch/arm64/include/asm/processor.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)


Best regards and thank you in advance.
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: Francis Laniel <flaniel@linux.microsoft.com>
To: linux-arm-kernel@lists.infradead.org
Cc: linux-trace-devel@vger.kernel.org,
	Francis Laniel <flaniel@linux.microsoft.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Peter Collingbourne <pcc@google.com>,
	Mark Brown <broonie@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Daniel Kiss <daniel.kiss@arm.com>,
	Kees Cook <keescook@chromium.org>,
	linux-kernel@vger.kernel.org
Subject: [RFC PATCH v1 0/1] Call forget_syscall() if different than execve*()
Date: Mon,  9 May 2022 16:19:56 +0100	[thread overview]
Message-ID: <20220509151958.441240-1-flaniel@linux.microsoft.com> (raw)

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().

Now, forget_syscall() is called only if previous syscall number was different
than __NR_execve and __NR_execveat.
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 with this patch.
ls   264 [000]    66.226848:  syscalls:sys_exit_execve: 0x0
...

Nonetheless, this contribution is not perfect, hence I marked it as RFC.
First, I am not really sure if this is safe to not call forget_syscall() all the
time, even though I did not have problem while testing it.
Then, by including <asm-generic/unistd.h> to the modified file I ended with
some warnings at compile time:

So, if you see any way to improve this contribution, feel free to share!

Francis Laniel (1):
  arm64: Forget syscall if different from execve*()

 arch/arm64/include/asm/processor.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)


Best regards and thank you in advance.
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2022-05-09 15:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09 15:19 Francis Laniel [this message]
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-09 15:19   ` Francis Laniel
2022-05-10 10:59   ` Will Deacon
2022-05-10 10:59     ` Will Deacon
2022-05-10 14:00     ` Francis Laniel
2022-05-10 14:00       ` Francis Laniel
2022-05-10 14:03       ` Will Deacon
2022-05-10 14:03         ` Will Deacon
2022-05-10 14:12         ` Francis Laniel
2022-05-10 14:12           ` Francis Laniel
2022-05-18 13:32         ` Catalin Marinas
2022-05-18 13:32           ` Catalin Marinas
2022-05-10 13:33   ` kernel test robot

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=20220509151958.441240-1-flaniel@linux.microsoft.com \
    --to=flaniel@linux.microsoft.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=daniel.kiss@arm.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 \
    --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.