qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Wind Li <1926246@bugs.launchpad.net>
To: qemu-devel@nongnu.org
Subject: [Bug 1926246] Re: chrome based apps can not be run under qemu user mode
Date: Tue, 27 Apr 2021 12:09:39 -0000	[thread overview]
Message-ID: <161952537979.11780.16767764265509351823.malone@wampee.canonical.com> (raw)
In-Reply-To: 161950107824.17271.5936509317690090363.malonedeb@chaenomeles.canonical.com

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


  parent reply	other threads:[~2021-04-27 12:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=161952537979.11780.16767764265509351823.malone@wampee.canonical.com \
    --to=1926246@bugs.launchpad.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).