From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <laurent@vivier.eu>,
YAMAMOTO Takashi <yamamoto@midokura.com>
Subject: [PULL 4/9] linux-user: Implement pivot_root
Date: Mon, 21 Jun 2021 13:04:40 +0200 [thread overview]
Message-ID: <20210621110445.231771-5-laurent@vivier.eu> (raw)
In-Reply-To: <20210621110445.231771-1-laurent@vivier.eu>
From: YAMAMOTO Takashi <yamamoto@midokura.com>
Used by runc.
Signed-off-by: YAMAMOTO Takashi <yamamoto@midokura.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20210531055019.10149-6-yamamoto@midokura.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/syscall.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 54037db8d66d..723cb02d2a00 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8257,6 +8257,10 @@ static int host_to_target_cpu_mask(const unsigned long *host_mask,
return 0;
}
+#if defined(TARGET_NR_pivot_root) && defined(__NR_pivot_root)
+_syscall2(int, pivot_root, const char *, new_root, const char *, put_old)
+#endif
+
/* This is an internal helper for do_syscall so that it is easier
* to have a single return point, so that actions, such as logging
* of syscall results, can be performed.
@@ -13220,6 +13224,23 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
return ret;
#endif
+#if defined(TARGET_NR_pivot_root)
+ case TARGET_NR_pivot_root:
+ {
+ void *p2;
+ p = lock_user_string(arg1); /* new_root */
+ p2 = lock_user_string(arg2); /* put_old */
+ if (!p || !p2) {
+ ret = -TARGET_EFAULT;
+ } else {
+ ret = get_errno(pivot_root(p, p2));
+ }
+ unlock_user(p2, arg2, 0);
+ unlock_user(p, arg1, 0);
+ }
+ return ret;
+#endif
+
default:
qemu_log_mask(LOG_UNIMP, "Unsupported syscall: %d\n", num);
return -TARGET_ENOSYS;
--
2.31.1
next prev parent reply other threads:[~2021-06-21 11:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-21 11:04 [PULL 0/9] Linux user for 6.1 patches Laurent Vivier
2021-06-21 11:04 ` [PULL 1/9] linux-user: Set CF_PARALLEL when mapping shared memory Laurent Vivier
2021-06-21 11:04 ` [PULL 2/9] linux-user: Disable static assert involving __SIGRTMAX if it is missing Laurent Vivier
2021-06-21 11:04 ` [PULL 3/9] linux-user/trace-events: fix minor typo in format string Laurent Vivier
2021-06-21 11:04 ` Laurent Vivier [this message]
2021-06-21 11:04 ` [PULL 5/9] linux-user: Let sigaction query SIGKILL/SIGSTOP Laurent Vivier
2021-06-21 11:04 ` [PULL 6/9] tests/tcg/linux-test: Check that sigaction can " Laurent Vivier
2021-06-21 11:04 ` [PULL 7/9] linux-user: Check for ieee128 fpbits in PPC64 HWCAP2 feature list Laurent Vivier
2021-06-21 11:04 ` [PULL 8/9] linux-user: Fix incorrect use of feature-test-macros Laurent Vivier
2021-06-21 11:04 ` [PULL 9/9] linux-user: Use public sigev_notify_thread_id member if available Laurent Vivier
2021-06-22 17:13 ` [PULL 0/9] Linux user for 6.1 patches Peter Maydell
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=20210621110445.231771-5-laurent@vivier.eu \
--to=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
--cc=yamamoto@midokura.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).