qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] qemu user mode could not support binfmt_misc config with fl


From: Luyou Peng
Subject: [Qemu-devel] qemu user mode could not support binfmt_misc config with flags include "P"
Date: Tue, 5 Mar 2019 11:40:24 +0000

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:
==========================
address@hidden:~/projects_lpeng/qemu/mips_2/sid$ sudo chroot .
[sudo] password for lpeng:
address@hidden:/# 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.
address@hidden:/#
===========================

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

I have submitted a ticket:https://bugs.launchpad.net/qemu/+bug/1818483, and I 
tried to 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?
Thanks so much!

Regards
Luyou


reply via email to

[Prev in Thread] Current Thread [Next in Thread]