diff options
author | YAMAMOTO Takashi <yamamoto@midokura.com> | 2021-05-31 14:50:12 +0900 |
---|---|---|
committer | Laurent Vivier <laurent@vivier.eu> | 2021-06-20 16:04:01 +0200 |
commit | e10fbe8f34843891b18f68f76320b43606f4df69 (patch) | |
tree | ef96ff97977b6a49bbe49993d1006a847a0b928d /linux-user | |
parent | 0e8876970401dee2055c1eb1c23f92f2e57d73ad (diff) |
linux-user: Implement pivot_root
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>
Diffstat (limited to 'linux-user')
-rw-r--r-- | linux-user/syscall.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 54037db8d6..723cb02d2a 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; |