From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Laurent Vivier" <laurent@vivier.eu>,
"Helge Deller" <deller@gmx.de>, "Drew DeVault" <sir@cmpwn.com>,
"Daniel P . Berrangé" <berrange@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH v5 3/5] linux-user/strace: Add output for execveat() syscall
Date: Fri, 4 Nov 2022 18:36:30 +0100 [thread overview]
Message-ID: <20221104173632.1052-4-philmd@linaro.org> (raw)
In-Reply-To: <20221104173632.1052-1-philmd@linaro.org>
From: Drew DeVault <sir@cmpwn.com>
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Message-Id: <20221104081015.706009-1-sir@cmpwn.com>
Suggested-by: Helge Deller <deller@gmx.de>
[PMD: Split of bigger patch]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
linux-user/strace.c | 23 +++++++++++++++++++++++
linux-user/strace.list | 2 +-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/linux-user/strace.c b/linux-user/strace.c
index 3d11d2f759..7bccb4f0c0 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -1104,6 +1104,16 @@ UNUSED static const struct flags clone_flags[] = {
FLAG_END,
};
+UNUSED static const struct flags execveat_flags[] = {
+#ifdef AT_EMPTY_PATH
+ FLAG_GENERIC(AT_EMPTY_PATH),
+#endif
+#ifdef AT_SYMLINK_NOFOLLOW
+ FLAG_GENERIC(AT_SYMLINK_NOFOLLOW),
+#endif
+ FLAG_END,
+};
+
UNUSED static const struct flags msg_flags[] = {
/* send */
FLAG_GENERIC(MSG_CONFIRM),
@@ -1976,6 +1986,19 @@ print_execve(CPUArchState *cpu_env, const struct syscallname *name,
print_syscall_epilogue(name);
}
+static void
+print_execveat(CPUArchState *cpu_env, const struct syscallname *name,
+ abi_long arg1, abi_long arg2, abi_long arg3,
+ abi_long arg4, abi_long arg5, abi_long arg6)
+{
+ print_syscall_prologue(name);
+ print_at_dirfd(arg1, 0);
+ print_string(arg2, 0);
+ print_execve_argv(arg3, 0);
+ print_flags(execveat_flags, arg5, 1);
+ print_syscall_epilogue(name);
+}
+
#if defined(TARGET_NR_faccessat) || defined(TARGET_NR_faccessat2)
static void
print_faccessat(CPUArchState *cpu_env, const struct syscallname *name,
diff --git a/linux-user/strace.list b/linux-user/strace.list
index 3a898e2532..bb21c05414 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -164,7 +164,7 @@
{ TARGET_NR_execve, "execve" , NULL, print_execve, NULL },
#endif
#ifdef TARGET_NR_execveat
-{ TARGET_NR_execveat, "execveat" , NULL, NULL, NULL },
+{ TARGET_NR_execveat, "execveat" , NULL, print_execveat, NULL },
#endif
#ifdef TARGET_NR_exec_with_loader
{ TARGET_NR_exec_with_loader, "exec_with_loader" , NULL, NULL, NULL },
--
2.38.1
next prev parent reply other threads:[~2022-11-04 17:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-04 17:36 [PATCH v5 0/5] linux-user: implement execveat Philippe Mathieu-Daudé
2022-11-04 17:36 ` [PATCH v5 1/5] linux-user/strace: Constify struct flags Philippe Mathieu-Daudé
2023-01-25 9:20 ` Laurent Vivier
2022-11-04 17:36 ` [PATCH v5 2/5] linux-user/strace: Extract print_execve_argv() from print_execve() Philippe Mathieu-Daudé
2023-01-25 9:28 ` Laurent Vivier
2022-11-04 17:36 ` Philippe Mathieu-Daudé [this message]
2023-01-25 9:33 ` [PATCH v5 3/5] linux-user/strace: Add output for execveat() syscall Laurent Vivier
2022-11-04 17:36 ` [PATCH v5 4/5] linux-user/syscall: Extract do_execve() from do_syscall1() Philippe Mathieu-Daudé
2023-01-25 9:36 ` Laurent Vivier
2022-11-04 17:36 ` [PATCH v5 5/5] linux-user/syscall: Implement execveat() Philippe Mathieu-Daudé
2023-01-25 9:46 ` [PATCH v5 0/5] linux-user: implement execveat Laurent Vivier
2023-01-25 9:47 ` Drew DeVault
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=20221104173632.1052-4-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=berrange@redhat.com \
--cc=deller@gmx.de \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
--cc=sir@cmpwn.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).