From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:41043) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBqks-0000T0-7w for qemu-devel@nongnu.org; Wed, 03 Apr 2019 21:01:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBqkq-0006ls-KD for qemu-devel@nongnu.org; Wed, 03 Apr 2019 21:01:22 -0400 Received: from indium.canonical.com ([91.189.90.7]:52974) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hBqkm-0006Y2-UZ for qemu-devel@nongnu.org; Wed, 03 Apr 2019 21:01:20 -0400 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.86_2 #2 (Debian)) id 1hBqkl-0000dj-2v for ; Thu, 04 Apr 2019 01:01:15 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id D82C32E80C9 for ; Thu, 4 Apr 2019 01:01:14 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Thu, 04 Apr 2019 00:47:38 -0000 From: YunQiang Su Reply-To: Bug 1818483 <1818483@bugs.launchpad.net> Sender: bounces@canonical.com References: <155168800961.29550.2360664198558693792.malonedeb@chaenomeles.canonical.com> Message-Id: <155433885817.13466.6330910596232249449.malone@gac.canonical.com> Errors-To: bounces@canonical.com Subject: [Qemu-devel] [Bug 1818483] Re: qemu user mode does not support binfmt_misc config with flags include "P" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This patch is for qemu itself. It test AT_FLAGS and determine whether it is start by binfmt_misc and whether P flag is used. ** Patch added: "preserve-argv0.patch" https://bugs.launchpad.net/qemu/+bug/1818483/+attachment/5252630/+files/= preserve-argv0.patch -- = You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1818483 Title: qemu user mode does not support binfmt_misc config with flags include "P" Status in QEMU: New Bug description: Hi Sir: During our test in chroot environment with qemu-user-static, we got some = test cases failed because of program output warning with unexpected full pa= th name. For example in test module "Devscripts" the test item for broken tarball expected the warning info: but the output was: the cause is the config file of binfmt_misc was set not to send argv0, fo= r example: type command "tar" after chroot: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D lpeng@lpeng-VirtualBox:~/projects_lpeng/qemu/mips_2/sid$ sudo chroot . [sudo] password for lpeng: = root@lpeng-VirtualBox:/# tar /bin/tar: You must specify one of the '-Acdtrux', '--delete' or '--test-l= abel' options Try '/bin/tar --help' or '/bin/tar --usage' for more information. root@lpeng-VirtualBox:/# = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D by adding output log in main()@qemu/Linux-user/main.c we found the original input command was changed, and qemu do not know tha= t, we got the input args: argv_0----/usr/bin/qemu-mips64el-static--- argv_1----/bin/tar--- argv_2----NULL--- Next step we modified the flags=3DP in the corresponding config under fol= der /proc/sys/fs/binfmt_misc, then binfmt_misc sent argv[0] to qemu. But chroot could not start bash because in current qemu dose not consider= about this unexpected one more"argv[0]" = After modified qemu code temporary to handle the new argv list we got the= input args, and from argv[2] is the original input command argv_0----/usr/bin/qemu-mips64el-static--- argv_1----/bin/tar--- argv_2----tar--- We need the original input from command line, so is it possible that let = binfmt_misc to pass one more additional args or env to qemu as a token of t= he binfmt_misc flag, then qemu can judge how to parse the input args by it? looking forward your suggestions. Thanks luyou To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1818483/+subscriptions