qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Bug 1926246] [NEW] chrome based apps can not be run under qemu user mode
@ 2021-04-27  5:24 Wind Li
  2021-04-27  8:45 ` [Bug 1926246] " Wind Li
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Wind Li @ 2021-04-27  5:24 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

chrome uses /proc/self/exe to fork render process.
Here a simple code to reproduce the issue. It's output parent then child but failed with qemu: unknown option 'type=renderer'.

Maybe we can modify exec syscall to replace /proc/self/exe to the real
path.

//gcc -o self self.c 
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main(int argc, char** argv) {
  if(argc==1){
    printf ("parent\n");
	if ( fork() == 0 )
    {
        return execl("/proc/self/exe","/proc/self/exe", "--type=renderer",NULL);
    }
  } else {
    printf ("child\n");
  }
  return 0;
}

similar reports:
https://github.com/AppImage/AppImageKit/issues/965  
https://github.com/golang/go/issues/42080  

Workardound:
compile chrome or your chrome based app with a patch to content/common/child_process_host_impl.cc:GetChildPath, get the realpath of /proc/self/exe:  

diff --git a/content/common/child_process_host_impl.cc b/content/common/child_process_host_impl.cc
index bc78aba80ac8..9fab74d3bae8 100644
--- a/content/common/child_process_host_impl.cc
+++ b/content/common/child_process_host_impl.cc
@@ -60,8 +60,12 @@ base::FilePath ChildProcessHost::GetChildPath(int flags) {
 #if defined(OS_LINUX)
   // Use /proc/self/exe rather than our known binary path so updates
   // can't swap out the binary from underneath us.
-  if (child_path.empty() && flags & CHILD_ALLOW_SELF)
-    child_path = base::FilePath(base::kProcSelfExe);
+  if (child_path.empty() && flags & CHILD_ALLOW_SELF) {
+    if (!ReadSymbolicLink(base::FilePath(base::kProcSelfExe), &child_path)) {
+      NOTREACHED() << "Unable to resolve " << base::kProcSelfExe << ".";
+      child_path = base::FilePath(base::kProcSelfExe);
+    }
+  }
 #endif

   // On most platforms, the child executable is the same as the current

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1926246

Title:
  chrome based apps can not be run under qemu user mode

Status in QEMU:
  New

Bug description:
  chrome uses /proc/self/exe to fork render process.
  Here a simple code to reproduce the issue. It's output parent then child but failed with qemu: unknown option 'type=renderer'.

  Maybe we can modify exec syscall to replace /proc/self/exe to the real
  path.

  //gcc -o self self.c 
  #include <stdio.h>
  #include <sys/types.h>
  #include <unistd.h>
  int main(int argc, char** argv) {
    if(argc==1){
      printf ("parent\n");
  	if ( fork() == 0 )
      {
          return execl("/proc/self/exe","/proc/self/exe", "--type=renderer",NULL);
      }
    } else {
      printf ("child\n");
    }
    return 0;
  }

  similar reports:
  https://github.com/AppImage/AppImageKit/issues/965  
  https://github.com/golang/go/issues/42080  

  Workardound:
  compile chrome or your chrome based app with a patch to content/common/child_process_host_impl.cc:GetChildPath, get the realpath of /proc/self/exe:  

  diff --git a/content/common/child_process_host_impl.cc b/content/common/child_process_host_impl.cc
  index bc78aba80ac8..9fab74d3bae8 100644
  --- a/content/common/child_process_host_impl.cc
  +++ b/content/common/child_process_host_impl.cc
  @@ -60,8 +60,12 @@ base::FilePath ChildProcessHost::GetChildPath(int flags) {
   #if defined(OS_LINUX)
     // Use /proc/self/exe rather than our known binary path so updates
     // can't swap out the binary from underneath us.
  -  if (child_path.empty() && flags & CHILD_ALLOW_SELF)
  -    child_path = base::FilePath(base::kProcSelfExe);
  +  if (child_path.empty() && flags & CHILD_ALLOW_SELF) {
  +    if (!ReadSymbolicLink(base::FilePath(base::kProcSelfExe), &child_path)) {
  +      NOTREACHED() << "Unable to resolve " << base::kProcSelfExe << ".";
  +      child_path = base::FilePath(base::kProcSelfExe);
  +    }
  +  }
   #endif

     // On most platforms, the child executable is the same as the
  current

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1926246/+subscriptions


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Bug 1926246] Re: chrome based apps can not be run under qemu user mode
  2021-04-27  5:24 [Bug 1926246] [NEW] chrome based apps can not be run under qemu user mode Wind Li
@ 2021-04-27  8:45 ` Wind Li
  2021-04-27  9:03   ` no-reply
  2021-04-27  9:53   ` Laurent Vivier
  2021-04-27  9:54 ` Laurent Vivier
                   ` (6 subsequent siblings)
  7 siblings, 2 replies; 13+ messages in thread
From: Wind Li @ 2021-04-27  8:45 UTC (permalink / raw)
  To: qemu-devel

qemu patch:  
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 95d79ddc43..227d9b1b0e 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8537,7 +8537,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
              * before the execve completes and makes it the other
              * program's problem.
              */
-            ret = get_errno(safe_execve(p, argp, envp));
+            ret = get_errno(safe_execve(is_proc_myself(p, "exe") ? exec_path : p, argp, envp));
             unlock_user(p, arg1, 0);
 
             goto execve_end;

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1926246

Title:
  chrome based apps can not be run under qemu user mode

Status in QEMU:
  New

Bug description:
  chrome uses /proc/self/exe to fork render process.
  Here a simple code to reproduce the issue. It's output parent then child but failed with qemu: unknown option 'type=renderer'.

  Maybe we can modify exec syscall to replace /proc/self/exe to the real
  path.

  //gcc -o self self.c 
  #include <stdio.h>
  #include <sys/types.h>
  #include <unistd.h>
  int main(int argc, char** argv) {
    if(argc==1){
      printf ("parent\n");
  	if ( fork() == 0 )
      {
          return execl("/proc/self/exe","/proc/self/exe", "--type=renderer",NULL);
      }
    } else {
      printf ("child\n");
    }
    return 0;
  }

  similar reports:
  https://github.com/AppImage/AppImageKit/issues/965  
  https://github.com/golang/go/issues/42080  

  Workardound:
  compile chrome or your chrome based app with a patch to content/common/child_process_host_impl.cc:GetChildPath, get the realpath of /proc/self/exe:  

  diff --git a/content/common/child_process_host_impl.cc b/content/common/child_process_host_impl.cc
  index bc78aba80ac8..9fab74d3bae8 100644
  --- a/content/common/child_process_host_impl.cc
  +++ b/content/common/child_process_host_impl.cc
  @@ -60,8 +60,12 @@ base::FilePath ChildProcessHost::GetChildPath(int flags) {
   #if defined(OS_LINUX)
     // Use /proc/self/exe rather than our known binary path so updates
     // can't swap out the binary from underneath us.
  -  if (child_path.empty() && flags & CHILD_ALLOW_SELF)
  -    child_path = base::FilePath(base::kProcSelfExe);
  +  if (child_path.empty() && flags & CHILD_ALLOW_SELF) {
  +    if (!ReadSymbolicLink(base::FilePath(base::kProcSelfExe), &child_path)) {
  +      NOTREACHED() << "Unable to resolve " << base::kProcSelfExe << ".";
  +      child_path = base::FilePath(base::kProcSelfExe);
  +    }
  +  }
   #endif

     // On most platforms, the child executable is the same as the
  current

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1926246/+subscriptions


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [Bug 1926246] Re: chrome based apps can not be run under qemu user mode
  2021-04-27  8:45 ` [Bug 1926246] " Wind Li
@ 2021-04-27  9:03   ` no-reply
  2021-04-27  9:53   ` Laurent Vivier
  1 sibling, 0 replies; 13+ messages in thread
From: no-reply @ 2021-04-27  9:03 UTC (permalink / raw)
  To: 1926246; +Cc: qemu-devel

Patchew URL: https://patchew.org/QEMU/161951314717.4719.489219171575884785.malone@gac.canonical.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 161951314717.4719.489219171575884785.malone@gac.canonical.com
Subject: [Bug 1926246] Re: chrome based apps can not be run under qemu user mode

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]         patchew/161951314717.4719.489219171575884785.malone@gac.canonical.com -> patchew/161951314717.4719.489219171575884785.malone@gac.canonical.com
 - [tag update]      patchew/20210423044713.3403-1-dongli.zhang@oracle.com -> patchew/20210423044713.3403-1-dongli.zhang@oracle.com
 - [tag update]      patchew/20210423083351.2096734-1-kraxel@redhat.com -> patchew/20210423083351.2096734-1-kraxel@redhat.com
 - [tag update]      patchew/cover.1617281290.git.haibo.xu@linaro.org -> patchew/cover.1617281290.git.haibo.xu@linaro.org
Switched to a new branch 'test'
7defae3 chrome based apps can not be run under qemu user mode

=== OUTPUT BEGIN ===
ERROR: line over 90 characters
#22: FILE: linux-user/syscall.c:8540:
+            ret = get_errno(safe_execve(is_proc_myself(p, "exe") ? exec_path : p, argp, envp));

ERROR: Missing Signed-off-by: line(s)

total: 2 errors, 0 warnings, 8 lines checked

Commit 7defae3f3169 (chrome based apps can not be run under qemu user mode) has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/161951314717.4719.489219171575884785.malone@gac.canonical.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Bug 1926246] Re: chrome based apps can not be run under qemu user mode
  2021-04-27  8:45 ` [Bug 1926246] " Wind Li
  2021-04-27  9:03   ` no-reply
@ 2021-04-27  9:53   ` Laurent Vivier
  1 sibling, 0 replies; 13+ messages in thread
From: Laurent Vivier @ 2021-04-27  9:53 UTC (permalink / raw)
  To: qemu-devel

Le 27/04/2021 à 10:45, Wind Li a écrit :
> qemu patch:  
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 95d79ddc43..227d9b1b0e 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -8537,7 +8537,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
>               * before the execve completes and makes it the other
>               * program's problem.
>               */
> -            ret = get_errno(safe_execve(p, argp, envp));
> +            ret = get_errno(safe_execve(is_proc_myself(p, "exe") ? exec_path : p, argp, envp));
>              unlock_user(p, arg1, 0);
>  
>              goto execve_end;
> 

I think this is the good approach to fix the problem, but exec_path can be not set in the case of
AT_EXECFD (binfmt_misc with credential flag) because we use execfd instead. You should use
do_openat() to get the file descriptor and execveat() to start the process.

Thanks,
Laurent


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 1926246] Re: chrome based apps can not be run under qemu user mode
  2021-04-27  5:24 [Bug 1926246] [NEW] chrome based apps can not be run under qemu user mode Wind Li
  2021-04-27  8:45 ` [Bug 1926246] " Wind Li
@ 2021-04-27  9:54 ` Laurent Vivier
  2021-04-27 10:58 ` Wind Li
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Laurent Vivier @ 2021-04-27  9:54 UTC (permalink / raw)
  To: qemu-devel

I think this is the good approach to fix the problem, but exec_path can be not set in the case of
AT_EXECFD (binfmt_misc with credential flag) because we use execfd instead. You should use
do_openat() to get the file descriptor and execveat() to start the process.

Thanks,
Laurent

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1926246

Title:
  chrome based apps can not be run under qemu user mode

Status in QEMU:
  New

Bug description:
  chrome uses /proc/self/exe to fork render process.
  Here a simple code to reproduce the issue. It's output parent then child but failed with qemu: unknown option 'type=renderer'.

  Maybe we can modify exec syscall to replace /proc/self/exe to the real
  path.

  //gcc -o self self.c 
  #include <stdio.h>
  #include <sys/types.h>
  #include <unistd.h>
  int main(int argc, char** argv) {
    if(argc==1){
      printf ("parent\n");
  	if ( fork() == 0 )
      {
          return execl("/proc/self/exe","/proc/self/exe", "--type=renderer",NULL);
      }
    } else {
      printf ("child\n");
    }
    return 0;
  }

  similar reports:
  https://github.com/AppImage/AppImageKit/issues/965  
  https://github.com/golang/go/issues/42080  

  Workardound:
  compile chrome or your chrome based app with a patch to content/common/child_process_host_impl.cc:GetChildPath, get the realpath of /proc/self/exe:  

  diff --git a/content/common/child_process_host_impl.cc b/content/common/child_process_host_impl.cc
  index bc78aba80ac8..9fab74d3bae8 100644
  --- a/content/common/child_process_host_impl.cc
  +++ b/content/common/child_process_host_impl.cc
  @@ -60,8 +60,12 @@ base::FilePath ChildProcessHost::GetChildPath(int flags) {
   #if defined(OS_LINUX)
     // Use /proc/self/exe rather than our known binary path so updates
     // can't swap out the binary from underneath us.
  -  if (child_path.empty() && flags & CHILD_ALLOW_SELF)
  -    child_path = base::FilePath(base::kProcSelfExe);
  +  if (child_path.empty() && flags & CHILD_ALLOW_SELF) {
  +    if (!ReadSymbolicLink(base::FilePath(base::kProcSelfExe), &child_path)) {
  +      NOTREACHED() << "Unable to resolve " << base::kProcSelfExe << ".";
  +      child_path = base::FilePath(base::kProcSelfExe);
  +    }
  +  }
   #endif

     // On most platforms, the child executable is the same as the
  current

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1926246/+subscriptions


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 1926246] Re: chrome based apps can not be run under qemu user mode
  2021-04-27  5:24 [Bug 1926246] [NEW] chrome based apps can not be run under qemu user mode Wind Li
  2021-04-27  8:45 ` [Bug 1926246] " Wind Li
  2021-04-27  9:54 ` Laurent Vivier
@ 2021-04-27 10:58 ` Wind Li
  2021-04-27 11:12   ` Laurent Vivier
  2021-04-27 12:09 ` Wind Li
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: Wind Li @ 2021-04-27 10:58 UTC (permalink / raw)
  To: qemu-devel

Just found there's already a patch for this:
https://lists.sr.ht/~philmd/qemu/patches/8196

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1926246

Title:
  chrome based apps can not be run under qemu user mode

Status in QEMU:
  New

Bug description:
  chrome uses /proc/self/exe to fork render process.
  Here a simple code to reproduce the issue. It's output parent then child but failed with qemu: unknown option 'type=renderer'.

  Maybe we can modify exec syscall to replace /proc/self/exe to the real
  path.

  //gcc -o self self.c 
  #include <stdio.h>
  #include <sys/types.h>
  #include <unistd.h>
  int main(int argc, char** argv) {
    if(argc==1){
      printf ("parent\n");
  	if ( fork() == 0 )
      {
          return execl("/proc/self/exe","/proc/self/exe", "--type=renderer",NULL);
      }
    } else {
      printf ("child\n");
    }
    return 0;
  }

  similar reports:
  https://github.com/AppImage/AppImageKit/issues/965  
  https://github.com/golang/go/issues/42080  

  Workardound:
  compile chrome or your chrome based app with a patch to content/common/child_process_host_impl.cc:GetChildPath, get the realpath of /proc/self/exe:  

  diff --git a/content/common/child_process_host_impl.cc b/content/common/child_process_host_impl.cc
  index bc78aba80ac8..9fab74d3bae8 100644
  --- a/content/common/child_process_host_impl.cc
  +++ b/content/common/child_process_host_impl.cc
  @@ -60,8 +60,12 @@ base::FilePath ChildProcessHost::GetChildPath(int flags) {
   #if defined(OS_LINUX)
     // Use /proc/self/exe rather than our known binary path so updates
     // can't swap out the binary from underneath us.
  -  if (child_path.empty() && flags & CHILD_ALLOW_SELF)
  -    child_path = base::FilePath(base::kProcSelfExe);
  +  if (child_path.empty() && flags & CHILD_ALLOW_SELF) {
  +    if (!ReadSymbolicLink(base::FilePath(base::kProcSelfExe), &child_path)) {
  +      NOTREACHED() << "Unable to resolve " << base::kProcSelfExe << ".";
  +      child_path = base::FilePath(base::kProcSelfExe);
  +    }
  +  }
   #endif

     // On most platforms, the child executable is the same as the
  current

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1926246/+subscriptions


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Bug 1926246] Re: chrome based apps can not be run under qemu user mode
  2021-04-27 10:58 ` Wind Li
@ 2021-04-27 11:12   ` Laurent Vivier
  2021-04-27 11:12     ` Laurent Vivier
  0 siblings, 1 reply; 13+ messages in thread
From: Laurent Vivier @ 2021-04-27 11:12 UTC (permalink / raw)
  To: Bug 1926246, qemu-devel

Le 27/04/2021 à 12:58, Wind Li a écrit :
> Just found there's already a patch for this:
> https://lists.sr.ht/~philmd/qemu/patches/8196
> 

Yes, you are right.

I didn't see this patch because he didn't cc: me and he removed the "linux-user" tag from the subject...

Could you verify it actually fixes the problem?


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Bug 1926246] Re: chrome based apps can not be run under qemu user mode
  2021-04-27 11:12   ` Laurent Vivier
@ 2021-04-27 11:12     ` Laurent Vivier
  0 siblings, 0 replies; 13+ messages in thread
From: Laurent Vivier @ 2021-04-27 11:12 UTC (permalink / raw)
  To: qemu-devel

Le 27/04/2021 à 12:58, Wind Li a écrit :
> Just found there's already a patch for this:
> https://lists.sr.ht/~philmd/qemu/patches/8196
> 

Yes, you are right.

I didn't see this patch because he didn't cc: me and he removed the
"linux-user" tag from the subject...

Could you verify it actually fixes the problem?

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1926246

Title:
  chrome based apps can not be run under qemu user mode

Status in QEMU:
  New

Bug description:
  chrome uses /proc/self/exe to fork render process.
  Here a simple code to reproduce the issue. It's output parent then child but failed with qemu: unknown option 'type=renderer'.

  Maybe we can modify exec syscall to replace /proc/self/exe to the real
  path.

  //gcc -o self self.c 
  #include <stdio.h>
  #include <sys/types.h>
  #include <unistd.h>
  int main(int argc, char** argv) {
    if(argc==1){
      printf ("parent\n");
  	if ( fork() == 0 )
      {
          return execl("/proc/self/exe","/proc/self/exe", "--type=renderer",NULL);
      }
    } else {
      printf ("child\n");
    }
    return 0;
  }

  similar reports:
  https://github.com/AppImage/AppImageKit/issues/965  
  https://github.com/golang/go/issues/42080  

  Workardound:
  compile chrome or your chrome based app with a patch to content/common/child_process_host_impl.cc:GetChildPath, get the realpath of /proc/self/exe:  

  diff --git a/content/common/child_process_host_impl.cc b/content/common/child_process_host_impl.cc
  index bc78aba80ac8..9fab74d3bae8 100644
  --- a/content/common/child_process_host_impl.cc
  +++ b/content/common/child_process_host_impl.cc
  @@ -60,8 +60,12 @@ base::FilePath ChildProcessHost::GetChildPath(int flags) {
   #if defined(OS_LINUX)
     // Use /proc/self/exe rather than our known binary path so updates
     // can't swap out the binary from underneath us.
  -  if (child_path.empty() && flags & CHILD_ALLOW_SELF)
  -    child_path = base::FilePath(base::kProcSelfExe);
  +  if (child_path.empty() && flags & CHILD_ALLOW_SELF) {
  +    if (!ReadSymbolicLink(base::FilePath(base::kProcSelfExe), &child_path)) {
  +      NOTREACHED() << "Unable to resolve " << base::kProcSelfExe << ".";
  +      child_path = base::FilePath(base::kProcSelfExe);
  +    }
  +  }
   #endif

     // On most platforms, the child executable is the same as the
  current

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1926246/+subscriptions


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 1926246] Re: chrome based apps can not be run under qemu user mode
  2021-04-27  5:24 [Bug 1926246] [NEW] chrome based apps can not be run under qemu user mode Wind Li
                   ` (2 preceding siblings ...)
  2021-04-27 10:58 ` Wind Li
@ 2021-04-27 12:09 ` Wind Li
  2021-04-27 12:34 ` Wind Li
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Wind Li @ 2021-04-27 12:09 UTC (permalink / raw)
  To: qemu-devel

Yes. It fixes the execve issue.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1926246

Title:
  chrome based apps can not be run under qemu user mode

Status in QEMU:
  New

Bug description:
  chrome uses /proc/self/exe to fork render process.
  Here a simple code to reproduce the issue. It's output parent then child but failed with qemu: unknown option 'type=renderer'.

  Maybe we can modify exec syscall to replace /proc/self/exe to the real
  path.

  //gcc -o self self.c 
  #include <stdio.h>
  #include <sys/types.h>
  #include <unistd.h>
  int main(int argc, char** argv) {
    if(argc==1){
      printf ("parent\n");
  	if ( fork() == 0 )
      {
          return execl("/proc/self/exe","/proc/self/exe", "--type=renderer",NULL);
      }
    } else {
      printf ("child\n");
    }
    return 0;
  }

  similar reports:
  https://github.com/AppImage/AppImageKit/issues/965  
  https://github.com/golang/go/issues/42080  

  Workardound:
  compile chrome or your chrome based app with a patch to content/common/child_process_host_impl.cc:GetChildPath, get the realpath of /proc/self/exe:  

  diff --git a/content/common/child_process_host_impl.cc b/content/common/child_process_host_impl.cc
  index bc78aba80ac8..9fab74d3bae8 100644
  --- a/content/common/child_process_host_impl.cc
  +++ b/content/common/child_process_host_impl.cc
  @@ -60,8 +60,12 @@ base::FilePath ChildProcessHost::GetChildPath(int flags) {
   #if defined(OS_LINUX)
     // Use /proc/self/exe rather than our known binary path so updates
     // can't swap out the binary from underneath us.
  -  if (child_path.empty() && flags & CHILD_ALLOW_SELF)
  -    child_path = base::FilePath(base::kProcSelfExe);
  +  if (child_path.empty() && flags & CHILD_ALLOW_SELF) {
  +    if (!ReadSymbolicLink(base::FilePath(base::kProcSelfExe), &child_path)) {
  +      NOTREACHED() << "Unable to resolve " << base::kProcSelfExe << ".";
  +      child_path = base::FilePath(base::kProcSelfExe);
  +    }
  +  }
   #endif

     // On most platforms, the child executable is the same as the
  current

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1926246/+subscriptions


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 1926246] Re: chrome based apps can not be run under qemu user mode
  2021-04-27  5:24 [Bug 1926246] [NEW] chrome based apps can not be run under qemu user mode Wind Li
                   ` (3 preceding siblings ...)
  2021-04-27 12:09 ` Wind Li
@ 2021-04-27 12:34 ` Wind Li
  2021-05-15 11:17 ` Thomas Huth
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Wind Li @ 2021-04-27 12:34 UTC (permalink / raw)
  To: qemu-devel

Here is the command line to start chromium, --no-zygote is needed to
avoid the gpu releated crash:

qemu-aarch64 /usr/lib/chromium/chrome --no-sandbox --no-zygote

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1926246

Title:
  chrome based apps can not be run under qemu user mode

Status in QEMU:
  New

Bug description:
  chrome uses /proc/self/exe to fork render process.
  Here a simple code to reproduce the issue. It's output parent then child but failed with qemu: unknown option 'type=renderer'.

  Maybe we can modify exec syscall to replace /proc/self/exe to the real
  path.

  //gcc -o self self.c 
  #include <stdio.h>
  #include <sys/types.h>
  #include <unistd.h>
  int main(int argc, char** argv) {
    if(argc==1){
      printf ("parent\n");
  	if ( fork() == 0 )
      {
          return execl("/proc/self/exe","/proc/self/exe", "--type=renderer",NULL);
      }
    } else {
      printf ("child\n");
    }
    return 0;
  }

  similar reports:
  https://github.com/AppImage/AppImageKit/issues/965  
  https://github.com/golang/go/issues/42080  

  Workardound:
  compile chrome or your chrome based app with a patch to content/common/child_process_host_impl.cc:GetChildPath, get the realpath of /proc/self/exe:  

  diff --git a/content/common/child_process_host_impl.cc b/content/common/child_process_host_impl.cc
  index bc78aba80ac8..9fab74d3bae8 100644
  --- a/content/common/child_process_host_impl.cc
  +++ b/content/common/child_process_host_impl.cc
  @@ -60,8 +60,12 @@ base::FilePath ChildProcessHost::GetChildPath(int flags) {
   #if defined(OS_LINUX)
     // Use /proc/self/exe rather than our known binary path so updates
     // can't swap out the binary from underneath us.
  -  if (child_path.empty() && flags & CHILD_ALLOW_SELF)
  -    child_path = base::FilePath(base::kProcSelfExe);
  +  if (child_path.empty() && flags & CHILD_ALLOW_SELF) {
  +    if (!ReadSymbolicLink(base::FilePath(base::kProcSelfExe), &child_path)) {
  +      NOTREACHED() << "Unable to resolve " << base::kProcSelfExe << ".";
  +      child_path = base::FilePath(base::kProcSelfExe);
  +    }
  +  }
   #endif

     // On most platforms, the child executable is the same as the
  current

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1926246/+subscriptions


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 1926246] Re: chrome based apps can not be run under qemu user mode
  2021-04-27  5:24 [Bug 1926246] [NEW] chrome based apps can not be run under qemu user mode Wind Li
                   ` (4 preceding siblings ...)
  2021-04-27 12:34 ` Wind Li
@ 2021-05-15 11:17 ` Thomas Huth
  2021-05-15 12:56 ` Wind Li
  2021-05-15 14:34 ` Thomas Huth
  7 siblings, 0 replies; 13+ messages in thread
From: Thomas Huth @ 2021-05-15 11:17 UTC (permalink / raw)
  To: qemu-devel

The QEMU project is currently moving its bug tracking to another system.
For this we need to know which bugs are still valid and which could be
closed already. Thus we are setting the bug state to "Incomplete" now.

If the bug has already been fixed in the latest upstream version of QEMU,
then please close this ticket as "Fix released".

If it is not fixed yet and you think that this bug report here is still
valid, then you have two options:

1) If you already have an account on gitlab.com, please open a new ticket
for this problem in our new tracker here:

    https://gitlab.com/qemu-project/qemu/-/issues

and then close this ticket here on Launchpad (or let it expire auto-
matically after 60 days). Please mention the URL of this bug ticket on
Launchpad in the new ticket on GitLab.

2) If you don't have an account on gitlab.com and don't intend to get
one, but still would like to keep this ticket opened, then please switch
the state back to "New" or "Confirmed" within the next 60 days (other-
wise it will get closed as "Expired"). We will then eventually migrate
the ticket automatically to the new system (but you won't be the reporter
of the bug in the new system and thus you won't get notified on changes
anymore).

Thank you and sorry for the inconvenience.


** Changed in: qemu
       Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1926246

Title:
  chrome based apps can not be run under qemu user mode

Status in QEMU:
  Incomplete

Bug description:
  chrome uses /proc/self/exe to fork render process.
  Here a simple code to reproduce the issue. It's output parent then child but failed with qemu: unknown option 'type=renderer'.

  Maybe we can modify exec syscall to replace /proc/self/exe to the real
  path.

  //gcc -o self self.c 
  #include <stdio.h>
  #include <sys/types.h>
  #include <unistd.h>
  int main(int argc, char** argv) {
    if(argc==1){
      printf ("parent\n");
  	if ( fork() == 0 )
      {
          return execl("/proc/self/exe","/proc/self/exe", "--type=renderer",NULL);
      }
    } else {
      printf ("child\n");
    }
    return 0;
  }

  similar reports:
  https://github.com/AppImage/AppImageKit/issues/965  
  https://github.com/golang/go/issues/42080  

  Workardound:
  compile chrome or your chrome based app with a patch to content/common/child_process_host_impl.cc:GetChildPath, get the realpath of /proc/self/exe:  

  diff --git a/content/common/child_process_host_impl.cc b/content/common/child_process_host_impl.cc
  index bc78aba80ac8..9fab74d3bae8 100644
  --- a/content/common/child_process_host_impl.cc
  +++ b/content/common/child_process_host_impl.cc
  @@ -60,8 +60,12 @@ base::FilePath ChildProcessHost::GetChildPath(int flags) {
   #if defined(OS_LINUX)
     // Use /proc/self/exe rather than our known binary path so updates
     // can't swap out the binary from underneath us.
  -  if (child_path.empty() && flags & CHILD_ALLOW_SELF)
  -    child_path = base::FilePath(base::kProcSelfExe);
  +  if (child_path.empty() && flags & CHILD_ALLOW_SELF) {
  +    if (!ReadSymbolicLink(base::FilePath(base::kProcSelfExe), &child_path)) {
  +      NOTREACHED() << "Unable to resolve " << base::kProcSelfExe << ".";
  +      child_path = base::FilePath(base::kProcSelfExe);
  +    }
  +  }
   #endif

     // On most platforms, the child executable is the same as the
  current

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1926246/+subscriptions


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 1926246] Re: chrome based apps can not be run under qemu user mode
  2021-04-27  5:24 [Bug 1926246] [NEW] chrome based apps can not be run under qemu user mode Wind Li
                   ` (5 preceding siblings ...)
  2021-05-15 11:17 ` Thomas Huth
@ 2021-05-15 12:56 ` Wind Li
  2021-05-15 14:34 ` Thomas Huth
  7 siblings, 0 replies; 13+ messages in thread
From: Wind Li @ 2021-05-15 12:56 UTC (permalink / raw)
  To: qemu-devel

** Changed in: qemu
       Status: Incomplete => New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1926246

Title:
  chrome based apps can not be run under qemu user mode

Status in QEMU:
  New

Bug description:
  chrome uses /proc/self/exe to fork render process.
  Here a simple code to reproduce the issue. It's output parent then child but failed with qemu: unknown option 'type=renderer'.

  Maybe we can modify exec syscall to replace /proc/self/exe to the real
  path.

  //gcc -o self self.c 
  #include <stdio.h>
  #include <sys/types.h>
  #include <unistd.h>
  int main(int argc, char** argv) {
    if(argc==1){
      printf ("parent\n");
  	if ( fork() == 0 )
      {
          return execl("/proc/self/exe","/proc/self/exe", "--type=renderer",NULL);
      }
    } else {
      printf ("child\n");
    }
    return 0;
  }

  similar reports:
  https://github.com/AppImage/AppImageKit/issues/965  
  https://github.com/golang/go/issues/42080  

  Workardound:
  compile chrome or your chrome based app with a patch to content/common/child_process_host_impl.cc:GetChildPath, get the realpath of /proc/self/exe:  

  diff --git a/content/common/child_process_host_impl.cc b/content/common/child_process_host_impl.cc
  index bc78aba80ac8..9fab74d3bae8 100644
  --- a/content/common/child_process_host_impl.cc
  +++ b/content/common/child_process_host_impl.cc
  @@ -60,8 +60,12 @@ base::FilePath ChildProcessHost::GetChildPath(int flags) {
   #if defined(OS_LINUX)
     // Use /proc/self/exe rather than our known binary path so updates
     // can't swap out the binary from underneath us.
  -  if (child_path.empty() && flags & CHILD_ALLOW_SELF)
  -    child_path = base::FilePath(base::kProcSelfExe);
  +  if (child_path.empty() && flags & CHILD_ALLOW_SELF) {
  +    if (!ReadSymbolicLink(base::FilePath(base::kProcSelfExe), &child_path)) {
  +      NOTREACHED() << "Unable to resolve " << base::kProcSelfExe << ".";
  +      child_path = base::FilePath(base::kProcSelfExe);
  +    }
  +  }
   #endif

     // On most platforms, the child executable is the same as the
  current

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1926246/+subscriptions


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 1926246] Re: chrome based apps can not be run under qemu user mode
  2021-04-27  5:24 [Bug 1926246] [NEW] chrome based apps can not be run under qemu user mode Wind Li
                   ` (6 preceding siblings ...)
  2021-05-15 12:56 ` Wind Li
@ 2021-05-15 14:34 ` Thomas Huth
  7 siblings, 0 replies; 13+ messages in thread
From: Thomas Huth @ 2021-05-15 14:34 UTC (permalink / raw)
  To: qemu-devel

This is an automated cleanup. This bug report has been moved to QEMU's
new bug tracker on gitlab.com and thus gets marked as 'expired' now.
Please continue with the discussion here:

 https://gitlab.com/qemu-project/qemu/-/issues/324


** Changed in: qemu
       Status: New => Expired

** Bug watch added: gitlab.com/qemu-project/qemu/-/issues #324
   https://gitlab.com/qemu-project/qemu/-/issues/324

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1926246

Title:
  chrome based apps can not be run under qemu user mode

Status in QEMU:
  Expired

Bug description:
  chrome uses /proc/self/exe to fork render process.
  Here a simple code to reproduce the issue. It's output parent then child but failed with qemu: unknown option 'type=renderer'.

  Maybe we can modify exec syscall to replace /proc/self/exe to the real
  path.

  //gcc -o self self.c 
  #include <stdio.h>
  #include <sys/types.h>
  #include <unistd.h>
  int main(int argc, char** argv) {
    if(argc==1){
      printf ("parent\n");
  	if ( fork() == 0 )
      {
          return execl("/proc/self/exe","/proc/self/exe", "--type=renderer",NULL);
      }
    } else {
      printf ("child\n");
    }
    return 0;
  }

  similar reports:
  https://github.com/AppImage/AppImageKit/issues/965  
  https://github.com/golang/go/issues/42080  

  Workardound:
  compile chrome or your chrome based app with a patch to content/common/child_process_host_impl.cc:GetChildPath, get the realpath of /proc/self/exe:  

  diff --git a/content/common/child_process_host_impl.cc b/content/common/child_process_host_impl.cc
  index bc78aba80ac8..9fab74d3bae8 100644
  --- a/content/common/child_process_host_impl.cc
  +++ b/content/common/child_process_host_impl.cc
  @@ -60,8 +60,12 @@ base::FilePath ChildProcessHost::GetChildPath(int flags) {
   #if defined(OS_LINUX)
     // Use /proc/self/exe rather than our known binary path so updates
     // can't swap out the binary from underneath us.
  -  if (child_path.empty() && flags & CHILD_ALLOW_SELF)
  -    child_path = base::FilePath(base::kProcSelfExe);
  +  if (child_path.empty() && flags & CHILD_ALLOW_SELF) {
  +    if (!ReadSymbolicLink(base::FilePath(base::kProcSelfExe), &child_path)) {
  +      NOTREACHED() << "Unable to resolve " << base::kProcSelfExe << ".";
  +      child_path = base::FilePath(base::kProcSelfExe);
  +    }
  +  }
   #endif

     // On most platforms, the child executable is the same as the
  current

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1926246/+subscriptions


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-05-15 14:42 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-27  5:24 [Bug 1926246] [NEW] chrome based apps can not be run under qemu user mode Wind Li
2021-04-27  8:45 ` [Bug 1926246] " Wind Li
2021-04-27  9:03   ` no-reply
2021-04-27  9:53   ` Laurent Vivier
2021-04-27  9:54 ` Laurent Vivier
2021-04-27 10:58 ` Wind Li
2021-04-27 11:12   ` Laurent Vivier
2021-04-27 11:12     ` Laurent Vivier
2021-04-27 12:09 ` Wind Li
2021-04-27 12:34 ` Wind Li
2021-05-15 11:17 ` Thomas Huth
2021-05-15 12:56 ` Wind Li
2021-05-15 14:34 ` Thomas Huth

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).