[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 05/11] linux-user: Implement pivot_root
From: |
YAMAMOTO Takashi |
Subject: |
[PATCH v2 05/11] linux-user: Implement pivot_root |
Date: |
Mon, 31 May 2021 14:50:12 +0900 |
Used by runc.
Signed-off-by: YAMAMOTO Takashi <yamamoto@midokura.com>
---
linux-user/syscall.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 2947e79dc0..51144c6d29 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8254,6 +8254,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.
@@ -13222,6 +13226,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.21.1 (Apple Git-122.3)
- [PATCH v2 00/11] linux-user changes to run docker, YAMAMOTO Takashi, 2021/05/31
- [PATCH v2 01/11] linux-user: handle /proc/self/exe for execve, YAMAMOTO Takashi, 2021/05/31
- [PATCH v2 02/11] linux-user: Fix the execfd case of /proc/self/exe open, YAMAMOTO Takashi, 2021/05/31
- [PATCH v2 03/11] linux-user: dup the execfd on start up, YAMAMOTO Takashi, 2021/05/31
- [PATCH v2 04/11] linux-user: make exec_path realpath, YAMAMOTO Takashi, 2021/05/31
- [PATCH v2 05/11] linux-user: Implement pivot_root,
YAMAMOTO Takashi <=
- [PATCH v2 06/11] linux-user: add get_exe_path, YAMAMOTO Takashi, 2021/05/31
- [PATCH v2 07/11] linux-user: simplify is_proc_myself, YAMAMOTO Takashi, 2021/05/31
- [PATCH v2 08/11] linux-user: Implement exec of /proc/$pid/exe of qemu process, YAMAMOTO Takashi, 2021/05/31
- [PATCH v2 09/11] linux-user: Make the qemu detection for /proc/$pid/exe a bit conservative, YAMAMOTO Takashi, 2021/05/31
- [PATCH v2 10/11] linux-user: a crude hack for libcontainer (CLONE_PARENT) [!MERGE], YAMAMOTO Takashi, 2021/05/31
- [PATCH v2 11/11] linux-user: always assume preserve_argv0 for now [!MERGE], YAMAMOTO Takashi, 2021/05/31
- Re: [PATCH v2 00/11] linux-user changes to run docker, no-reply, 2021/05/31