[PATCH v2 10/11] linux-user: a crude hack for libcontainer (CLONE_PARENT) [!MERGE]

YAMAMOTO Takashi posted 11 patches 3 years, 5 months ago
Maintainers: Laurent Vivier <laurent@vivier.eu>
[PATCH v2 10/11] linux-user: a crude hack for libcontainer (CLONE_PARENT) [!MERGE]
Posted by YAMAMOTO Takashi 3 years, 5 months ago
runc uses clone() with a combination of flags which we don't
support. This commit works it around by ignoring CLONE_PARENT.

[!MERGE] because this is just a crude hack for the very specific
application.

Signed-off-by: YAMAMOTO Takashi <yamamoto@midokura.com>
---
 linux-user/syscall.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 56a3c37d83..7645ed36e4 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6553,6 +6553,8 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
         pthread_mutex_destroy(&info.mutex);
         pthread_mutex_unlock(&clone_lock);
     } else {
+        flags &= ~CLONE_PARENT; /* XXX crude hack for libcontainer. */
+
         /* if no CLONE_VM, we consider it is a fork */
         if (flags & CLONE_INVALID_FORK_FLAGS) {
             return -TARGET_EINVAL;
-- 
2.21.1 (Apple Git-122.3)