All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [Bug 1818483] [NEW] qemu user mode does not support binfmt_misc config with flags=P
@ 2019-03-04  8:26 Luyou Peng
  2019-03-05 11:30 ` [Qemu-devel] [Bug 1818483] " Luyou Peng
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Luyou Peng @ 2019-03-04  8:26 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

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 path name.
For example in test module "Devscripts"
the test item for broken tarball expected the warning info:
<tar: This does not look like a tar archive
tar: ******* >
but the output was:
</bin/tar: This does not look like a tar archive
/bin/tar: ******>
the cause is the config file of binfmt_misc was set not to send argv0, for example:
type command "tar" after chroot:
==========================
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-label' options
Try '/bin/tar --help' or '/bin/tar --usage' for more information.
root@lpeng-VirtualBox:/# 
===========================

by adding output log in main()@qemu/Linux-user/main.c
we found the original input command was changed, and qemu do not know that, 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=P in the corresponding config under folder /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 the binfmt_misc flag, then qemu can judge how to parse the input args by it?
looking forward your suggestions.

Thanks
luyou

** 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/1818483

Title:
  qemu user mode does not support binfmt_misc config with flags=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 path name.
  For example in test module "Devscripts"
  the test item for broken tarball expected the warning info:
  <tar: This does not look like a tar archive
  tar: ******* >
  but the output was:
  </bin/tar: This does not look like a tar archive
  /bin/tar: ******>
  the cause is the config file of binfmt_misc was set not to send argv0, for example:
  type command "tar" after chroot:
  ==========================
  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-label' options
  Try '/bin/tar --help' or '/bin/tar --usage' for more information.
  root@lpeng-VirtualBox:/# 
  ===========================

  by adding output log in main()@qemu/Linux-user/main.c
  we found the original input command was changed, and qemu do not know that, 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=P in the corresponding config under folder /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 the 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

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

* [Qemu-devel] [Bug 1818483] Re: qemu user mode does not support binfmt_misc config with flags=P
  2019-03-04  8:26 [Qemu-devel] [Bug 1818483] [NEW] qemu user mode does not support binfmt_misc config with flags=P Luyou Peng
@ 2019-03-05 11:30 ` Luyou Peng
  2019-03-05 11:56 ` [Qemu-devel] [Bug 1818483] Re: qemu user mode does not support binfmt_misc config with flags include "P" Peter Maydell
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Luyou Peng @ 2019-03-05 11:30 UTC (permalink / raw)
  To: qemu-devel

I modified binfmt_misc.c to let it send one more args if the corresponding binfmt_misc flags include "P", also I modified main.c in qemu as attached patch_qemu_main.patch to check if the input args include such string. Then qemu user could support both scenarios.
Is this modification feasible?

** Patch added: "patch_qemu_main.patch"
   https://bugs.launchpad.net/qemu/+bug/1818483/+attachment/5243644/+files/patch_qemu_main.patch

** Summary changed:

- qemu user mode does not support binfmt_misc config with flags=P
+ qemu user mode does not support binfmt_misc config with flags include "P"

-- 
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 path name.
  For example in test module "Devscripts"
  the test item for broken tarball expected the warning info:
  <tar: This does not look like a tar archive
  tar: ******* >
  but the output was:
  </bin/tar: This does not look like a tar archive
  /bin/tar: ******>
  the cause is the config file of binfmt_misc was set not to send argv0, for example:
  type command "tar" after chroot:
  ==========================
  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-label' options
  Try '/bin/tar --help' or '/bin/tar --usage' for more information.
  root@lpeng-VirtualBox:/# 
  ===========================

  by adding output log in main()@qemu/Linux-user/main.c
  we found the original input command was changed, and qemu do not know that, 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=P in the corresponding config under folder /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 the 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

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

* [Qemu-devel] [Bug 1818483] Re: qemu user mode does not support binfmt_misc config with flags include "P"
  2019-03-04  8:26 [Qemu-devel] [Bug 1818483] [NEW] qemu user mode does not support binfmt_misc config with flags=P Luyou Peng
  2019-03-05 11:30 ` [Qemu-devel] [Bug 1818483] " Luyou Peng
@ 2019-03-05 11:56 ` Peter Maydell
  2019-03-07  6:08 ` Luyou Peng
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Peter Maydell @ 2019-03-05 11:56 UTC (permalink / raw)
  To: qemu-devel

Doesn't doing the check like that break execution of a command like
"echo 'MISC_FMT_PRESERVE_ARGV0'" in a chroot environment that isn't
using -P ?

-- 
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 path name.
  For example in test module "Devscripts"
  the test item for broken tarball expected the warning info:
  <tar: This does not look like a tar archive
  tar: ******* >
  but the output was:
  </bin/tar: This does not look like a tar archive
  /bin/tar: ******>
  the cause is the config file of binfmt_misc was set not to send argv0, for example:
  type command "tar" after chroot:
  ==========================
  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-label' options
  Try '/bin/tar --help' or '/bin/tar --usage' for more information.
  root@lpeng-VirtualBox:/# 
  ===========================

  by adding output log in main()@qemu/Linux-user/main.c
  we found the original input command was changed, and qemu do not know that, 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=P in the corresponding config under folder /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 the 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

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

* [Qemu-devel] [Bug 1818483] Re: qemu user mode does not support binfmt_misc config with flags include "P"
  2019-03-04  8:26 [Qemu-devel] [Bug 1818483] [NEW] qemu user mode does not support binfmt_misc config with flags=P Luyou Peng
  2019-03-05 11:30 ` [Qemu-devel] [Bug 1818483] " Luyou Peng
  2019-03-05 11:56 ` [Qemu-devel] [Bug 1818483] Re: qemu user mode does not support binfmt_misc config with flags include "P" Peter Maydell
@ 2019-03-07  6:08 ` Luyou Peng
  2019-03-07  9:52 ` Peter Maydell
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Luyou Peng @ 2019-03-07  6:08 UTC (permalink / raw)
  To: qemu-devel

hi Peter:
Thanks for your suggestion.
but anyway we have to modify qemu code when binfmt_misc passes argv[0] in, right?

-- 
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 path name.
  For example in test module "Devscripts"
  the test item for broken tarball expected the warning info:
  <tar: This does not look like a tar archive
  tar: ******* >
  but the output was:
  </bin/tar: This does not look like a tar archive
  /bin/tar: ******>
  the cause is the config file of binfmt_misc was set not to send argv0, for example:
  type command "tar" after chroot:
  ==========================
  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-label' options
  Try '/bin/tar --help' or '/bin/tar --usage' for more information.
  root@lpeng-VirtualBox:/# 
  ===========================

  by adding output log in main()@qemu/Linux-user/main.c
  we found the original input command was changed, and qemu do not know that, 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=P in the corresponding config under folder /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 the 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

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

* [Qemu-devel] [Bug 1818483] Re: qemu user mode does not support binfmt_misc config with flags include "P"
  2019-03-04  8:26 [Qemu-devel] [Bug 1818483] [NEW] qemu user mode does not support binfmt_misc config with flags=P Luyou Peng
                   ` (2 preceding siblings ...)
  2019-03-07  6:08 ` Luyou Peng
@ 2019-03-07  9:52 ` Peter Maydell
  2019-03-07 10:19 ` Luyou Peng
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Peter Maydell @ 2019-03-07  9:52 UTC (permalink / raw)
  To: qemu-devel

The question is: can we have one set of QEMU code that copes correctly
with both 'binfmt_misc with P flag' and 'binfmt_misc without P flag' ?

Your patch makes -P work but breaks some cases without it. That means
it's not backwards compatible with all the existing QEMU installations
and use cases in the world, which means it's awkward to move to. It
would be better if there were a mechanism which would allow us to make
them both work.

-- 
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 path name.
  For example in test module "Devscripts"
  the test item for broken tarball expected the warning info:
  <tar: This does not look like a tar archive
  tar: ******* >
  but the output was:
  </bin/tar: This does not look like a tar archive
  /bin/tar: ******>
  the cause is the config file of binfmt_misc was set not to send argv0, for example:
  type command "tar" after chroot:
  ==========================
  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-label' options
  Try '/bin/tar --help' or '/bin/tar --usage' for more information.
  root@lpeng-VirtualBox:/# 
  ===========================

  by adding output log in main()@qemu/Linux-user/main.c
  we found the original input command was changed, and qemu do not know that, 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=P in the corresponding config under folder /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 the 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

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

* [Qemu-devel] [Bug 1818483] Re: qemu user mode does not support binfmt_misc config with flags include "P"
  2019-03-04  8:26 [Qemu-devel] [Bug 1818483] [NEW] qemu user mode does not support binfmt_misc config with flags=P Luyou Peng
                   ` (3 preceding siblings ...)
  2019-03-07  9:52 ` Peter Maydell
@ 2019-03-07 10:19 ` Luyou Peng
  2019-03-10 13:50 ` YunQiang Su
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Luyou Peng @ 2019-03-07 10:19 UTC (permalink / raw)
  To: qemu-devel

hi Peter:
You are right, any additional modification should not affect the previous.
We expect that if this issue could be resolved without code change it's the best.
it may need to modify both binfmt_misc side to pass more information for flag P and qemu side to handle it.

-- 
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 path name.
  For example in test module "Devscripts"
  the test item for broken tarball expected the warning info:
  <tar: This does not look like a tar archive
  tar: ******* >
  but the output was:
  </bin/tar: This does not look like a tar archive
  /bin/tar: ******>
  the cause is the config file of binfmt_misc was set not to send argv0, for example:
  type command "tar" after chroot:
  ==========================
  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-label' options
  Try '/bin/tar --help' or '/bin/tar --usage' for more information.
  root@lpeng-VirtualBox:/# 
  ===========================

  by adding output log in main()@qemu/Linux-user/main.c
  we found the original input command was changed, and qemu do not know that, 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=P in the corresponding config under folder /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 the 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

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

* [Qemu-devel] [Bug 1818483] Re: qemu user mode does not support binfmt_misc config with flags include "P"
  2019-03-04  8:26 [Qemu-devel] [Bug 1818483] [NEW] qemu user mode does not support binfmt_misc config with flags=P Luyou Peng
                   ` (4 preceding siblings ...)
  2019-03-07 10:19 ` Luyou Peng
@ 2019-03-10 13:50 ` YunQiang Su
  2019-04-03 14:45 ` YunQiang Su
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: YunQiang Su @ 2019-03-10 13:50 UTC (permalink / raw)
  To: qemu-devel

@Peter Luyou and me are working on try to pass the info about whether P
flag is enabled or not by enviroment var or auxval. While we have not
found the right method to do it from binfmt_misc.

In fact, currently qemu trys to process the O flag, and it cannot work at all.
When you install qemu-user-static package from Debian/Ubuntu, the O flag is enabled,
while 
   execfd = qemu_getauxval(AT_EXECFD);
always return 0.

-- 
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 path name.
  For example in test module "Devscripts"
  the test item for broken tarball expected the warning info:
  <tar: This does not look like a tar archive
  tar: ******* >
  but the output was:
  </bin/tar: This does not look like a tar archive
  /bin/tar: ******>
  the cause is the config file of binfmt_misc was set not to send argv0, for example:
  type command "tar" after chroot:
  ==========================
  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-label' options
  Try '/bin/tar --help' or '/bin/tar --usage' for more information.
  root@lpeng-VirtualBox:/# 
  ===========================

  by adding output log in main()@qemu/Linux-user/main.c
  we found the original input command was changed, and qemu do not know that, 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=P in the corresponding config under folder /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 the 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

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

* [Qemu-devel] [Bug 1818483] Re: qemu user mode does not support binfmt_misc config with flags include "P"
  2019-03-04  8:26 [Qemu-devel] [Bug 1818483] [NEW] qemu user mode does not support binfmt_misc config with flags=P Luyou Peng
                   ` (5 preceding siblings ...)
  2019-03-10 13:50 ` YunQiang Su
@ 2019-04-03 14:45 ` YunQiang Su
  2019-04-04  0:47 ` YunQiang Su
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: YunQiang Su @ 2019-04-03 14:45 UTC (permalink / raw)
  To: qemu-devel

This patch is for linux kernel.

It will set the 3rd bit of AT_FLAGS, if P is set for binfmt_misc.

The major concern is that AT_FLAGS is never used, then, should we use it
here?

** Patch added: "binfmt_preserve_argv0.patch"
   https://bugs.launchpad.net/qemu/+bug/1818483/+attachment/5252516/+files/binfmt_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 path name.
  For example in test module "Devscripts"
  the test item for broken tarball expected the warning info:
  <tar: This does not look like a tar archive
  tar: ******* >
  but the output was:
  </bin/tar: This does not look like a tar archive
  /bin/tar: ******>
  the cause is the config file of binfmt_misc was set not to send argv0, for example:
  type command "tar" after chroot:
  ==========================
  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-label' options
  Try '/bin/tar --help' or '/bin/tar --usage' for more information.
  root@lpeng-VirtualBox:/# 
  ===========================

  by adding output log in main()@qemu/Linux-user/main.c
  we found the original input command was changed, and qemu do not know that, 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=P in the corresponding config under folder /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 the 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

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

* [Qemu-devel] [Bug 1818483] Re: qemu user mode does not support binfmt_misc config with flags include "P"
  2019-03-04  8:26 [Qemu-devel] [Bug 1818483] [NEW] qemu user mode does not support binfmt_misc config with flags=P Luyou Peng
                   ` (6 preceding siblings ...)
  2019-04-03 14:45 ` YunQiang Su
@ 2019-04-04  0:47 ` YunQiang Su
  2021-05-05 17:42 ` Thomas Huth
  2021-07-05  4:17 ` Launchpad Bug Tracker
  9 siblings, 0 replies; 11+ messages in thread
From: YunQiang Su @ 2019-04-04  0:47 UTC (permalink / raw)
  To: qemu-devel

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 path name.
  For example in test module "Devscripts"
  the test item for broken tarball expected the warning info:
  <tar: This does not look like a tar archive
  tar: ******* >
  but the output was:
  </bin/tar: This does not look like a tar archive
  /bin/tar: ******>
  the cause is the config file of binfmt_misc was set not to send argv0, for example:
  type command "tar" after chroot:
  ==========================
  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-label' options
  Try '/bin/tar --help' or '/bin/tar --usage' for more information.
  root@lpeng-VirtualBox:/# 
  ===========================

  by adding output log in main()@qemu/Linux-user/main.c
  we found the original input command was changed, and qemu do not know that, 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=P in the corresponding config under folder /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 the 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

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

* [Bug 1818483] Re: qemu user mode does not support binfmt_misc config with flags include "P"
  2019-03-04  8:26 [Qemu-devel] [Bug 1818483] [NEW] qemu user mode does not support binfmt_misc config with flags=P Luyou Peng
                   ` (7 preceding siblings ...)
  2019-04-04  0:47 ` YunQiang Su
@ 2021-05-05 17:42 ` Thomas Huth
  2021-07-05  4:17 ` Launchpad Bug Tracker
  9 siblings, 0 replies; 11+ messages in thread
From: Thomas Huth @ 2021-05-05 17:42 UTC (permalink / raw)
  To: qemu-devel

The QEMU project is currently considering to move 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 older bugs to
"Incomplete" now.

If you still think this bug report here is valid, then please switch
the state back to "New" within the next 60 days, otherwise this report
will be marked as "Expired". Or please mark it as "Fix Released" if
the problem has been solved with a newer version of QEMU already.

Thank you and sorry for the inconvenience.


** Tags added: linux-user

** 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/1818483

Title:
  qemu user mode does not support binfmt_misc config with flags include
  "P"

Status in QEMU:
  Incomplete

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 path name.
  For example in test module "Devscripts"
  the test item for broken tarball expected the warning info:
  <tar: This does not look like a tar archive
  tar: ******* >
  but the output was:
  </bin/tar: This does not look like a tar archive
  /bin/tar: ******>
  the cause is the config file of binfmt_misc was set not to send argv0, for example:
  type command "tar" after chroot:
  ==========================
  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-label' options
  Try '/bin/tar --help' or '/bin/tar --usage' for more information.
  root@lpeng-VirtualBox:/# 
  ===========================

  by adding output log in main()@qemu/Linux-user/main.c
  we found the original input command was changed, and qemu do not know that, 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=P in the corresponding config under folder /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 the 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


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

* [Bug 1818483] Re: qemu user mode does not support binfmt_misc config with flags include "P"
  2019-03-04  8:26 [Qemu-devel] [Bug 1818483] [NEW] qemu user mode does not support binfmt_misc config with flags=P Luyou Peng
                   ` (8 preceding siblings ...)
  2021-05-05 17:42 ` Thomas Huth
@ 2021-07-05  4:17 ` Launchpad Bug Tracker
  9 siblings, 0 replies; 11+ messages in thread
From: Launchpad Bug Tracker @ 2021-07-05  4:17 UTC (permalink / raw)
  To: qemu-devel

[Expired for QEMU because there has been no activity for 60 days.]

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

-- 
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:
  Expired

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 path name.
  For example in test module "Devscripts"
  the test item for broken tarball expected the warning info:
  <tar: This does not look like a tar archive
  tar: ******* >
  but the output was:
  </bin/tar: This does not look like a tar archive
  /bin/tar: ******>
  the cause is the config file of binfmt_misc was set not to send argv0, for example:
  type command "tar" after chroot:
  ==========================
  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-label' options
  Try '/bin/tar --help' or '/bin/tar --usage' for more information.
  root@lpeng-VirtualBox:/# 
  ===========================

  by adding output log in main()@qemu/Linux-user/main.c
  we found the original input command was changed, and qemu do not know that, 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=P in the corresponding config under folder /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 the 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


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

end of thread, other threads:[~2021-07-05  4:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-04  8:26 [Qemu-devel] [Bug 1818483] [NEW] qemu user mode does not support binfmt_misc config with flags=P Luyou Peng
2019-03-05 11:30 ` [Qemu-devel] [Bug 1818483] " Luyou Peng
2019-03-05 11:56 ` [Qemu-devel] [Bug 1818483] Re: qemu user mode does not support binfmt_misc config with flags include "P" Peter Maydell
2019-03-07  6:08 ` Luyou Peng
2019-03-07  9:52 ` Peter Maydell
2019-03-07 10:19 ` Luyou Peng
2019-03-10 13:50 ` YunQiang Su
2019-04-03 14:45 ` YunQiang Su
2019-04-04  0:47 ` YunQiang Su
2021-05-05 17:42 ` Thomas Huth
2021-07-05  4:17 ` Launchpad Bug Tracker

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.