[PATCH v2 11/11] linux-user: always assume preserve_argv0 for now [!MERGE]

2021-05-30 Thread YAMAMOTO Takashi
Just because the kernel I'm using is not new enough. [!MERGE] because this is specific to my environment and would break others. Signed-off-by: YAMAMOTO Takashi --- linux-user/main.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/linux-user/main.c b/

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

2021-05-30 Thread YAMAMOTO Takashi
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 --- linux-user/syscall.c | 2 ++ 1 file chang

[PATCH v2 09/11] linux-user: Make the qemu detection for /proc/$pid/exe a bit conservative

2021-05-30 Thread YAMAMOTO Takashi
Perform the qemu special case only when the binary seems the same as our own executable. This is enough for my use case (docker and runc) where the involved qemu binaries are always for the same arch. Signed-off-by: YAMAMOTO Takashi --- linux-user/syscall.c | 38

[PATCH v2 07/11] linux-user: simplify is_proc_myself

2021-05-30 Thread YAMAMOTO Takashi
Signed-off-by: YAMAMOTO Takashi --- linux-user/syscall.c | 23 +++ 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 999760448d..86b12cc8b4 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8027,26

[PATCH v2 08/11] linux-user: Implement exec of /proc/$pid/exe of qemu process

2021-05-30 Thread YAMAMOTO Takashi
interpreting dockerd. Signed-off-by: YAMAMOTO Takashi --- linux-user/syscall.c | 59 1 file changed, 59 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 86b12cc8b4..6f9161dbe4 100644 --- a/linux-user/syscall.c +++ b/linux-user

[PATCH v2 06/11] linux-user: add get_exe_path

2021-05-30 Thread YAMAMOTO Takashi
Refactor to prepare the special cases for /proc/$pid/exe where pid is not the calling process. Signed-off-by: YAMAMOTO Takashi --- linux-user/syscall.c | 48 ++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux

[PATCH v2 05/11] linux-user: Implement pivot_root

2021-05-30 Thread YAMAMOTO Takashi
Used by runc. Signed-off-by: YAMAMOTO Takashi --- 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

[PATCH v2 00/11] linux-user changes to run docker

2021-05-30 Thread YAMAMOTO Takashi
/garbage/tree/master/binfmt-aarch64-install YAMAMOTO Takashi (11): linux-user: handle /proc/self/exe for execve linux-user: Fix the execfd case of /proc/self/exe open linux-user: dup the execfd on start up linux-user: make exec_path realpath linux-user: Implement pivot_root linux-user: add

[PATCH v2 04/11] linux-user: make exec_path realpath

2021-05-30 Thread YAMAMOTO Takashi
Otherwise, it can be easily fooled by the user app using chdir(). Signed-off-by: YAMAMOTO Takashi --- linux-user/main.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/linux-user/main.c b/linux-user/main.c index a9d02f9583..be604a84f9 100644 --- a/linux-user

[PATCH v2 02/11] linux-user: Fix the execfd case of /proc/self/exe open

2021-05-30 Thread YAMAMOTO Takashi
It's problematic to return AT_EXECFD as it is because the user app would close it. This patch opens it via /proc/self/fd instead. Signed-off-by: YAMAMOTO Takashi --- linux-user/syscall.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/linux-user/syscal

[PATCH v2 01/11] linux-user: handle /proc/self/exe for execve

2021-05-30 Thread YAMAMOTO Takashi
It seems somehow common to execve /proc/self/exe in docker or golang community these days. At least, moby "reexec" and runc "libcontainer" do that. Signed-off-by: YAMAMOTO Takashi --- linux-user/syscall.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) dif

[PATCH v2 03/11] linux-user: dup the execfd on start up

2021-05-30 Thread YAMAMOTO Takashi
So that it can be used for other purposes (e.g. syscall.c) after the elf loader closed it. Signed-off-by: YAMAMOTO Takashi --- linux-user/main.c| 10 +- linux-user/qemu.h| 2 ++ linux-user/syscall.c | 5 ++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a

[PATCH 5/5] linux-user: Implement pivot_root

2021-05-23 Thread YAMAMOTO Takashi
Used by runc. Signed-off-by: YAMAMOTO Takashi --- linux-user/syscall.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 2947e79dc0..e739921e86 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -35,6

[PATCH 3/5] linux-user: Fix the execfd case of /proc/self/exe open

2021-05-23 Thread YAMAMOTO Takashi
It's problematic to return AT_EXECFD as it is because the user app would close it. This patch opens it via /proc/self/fd instead. Signed-off-by: YAMAMOTO Takashi --- linux-user/syscall.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/linux-user/syscal

[PATCH 2/5] linux-uesr: make exec_path realpath

2021-05-23 Thread YAMAMOTO Takashi
Otherwise, it can be easily fooled by the user app using chdir(). Signed-off-by: YAMAMOTO Takashi --- linux-user/main.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/linux-user/main.c b/linux-user/main.c index 4dfc47ad3b..1f9f4e3820 100644 --- a/linux-user/main.c

[PATCH 4/5] linux-user: dup the execfd on start up

2021-05-23 Thread YAMAMOTO Takashi
So that it can be used for other purposes (e.g. syscall.c) after the elf loader closed it. Signed-off-by: YAMAMOTO Takashi --- linux-user/main.c| 8 linux-user/qemu.h| 2 ++ linux-user/syscall.c | 5 ++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/linux

[PATCH 1/5] linux-user: handle /proc/self/exe for execve

2021-05-23 Thread YAMAMOTO Takashi
It seems somehow common to execve /proc/self/exe in docker or golang community these days. At least, moby "reexec" and runc "libcontainer" do that. Signed-off-by: YAMAMOTO Takashi --- linux-user/syscall.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) dif

[PATCH 0/5] linux-user changes to run docker

2021-05-23 Thread YAMAMOTO Takashi
infmt-aarch64-install YAMAMOTO Takashi (5): linux-user: handle /proc/self/exe for execve linux-uesr: make exec_path realpath linux-user: Fix the execfd case of /proc/self/exe open linux-user: dup the execfd on start up linux-user: Implement pivot_root linux-user/main.c