linux-user: enabling binfmt P flag
Hi,
After weekend, I think the solution to using the P flag is to go back to Joakim's original patch:
http://lists.gnu.org/archive/html/qemu-devel/2014-07/msg02269.html
With this, we get:
If you continue to use qemu-x-static in your binfmt_misc registration, nothing changes - both old and new qemu work using the old binfmt registration.
If you rename the binary qemu-x-binfmt, you need to update the binfmt_misc register to have P flag and new binary - you get correct argv with new qemu. Any old qemu you still have around, will stop working. But with "file not found" error rather than obscurely eating one of the arguments and running regardless.
This leaves us with one case - people who are used to running qemu-x-static ./binary to test single binaries. Distro's will need leave a symlink from qemu-x-binfmt qemu-x-static. The "-binfmt" string check doesn't trigger, and qemu works as before.
The key point: this way nobody's working setup will break, unless they update binfmt registration. As long as the change is done by users them self (I need correct argv0 -> I will update binfmt), there is very little surprise for anyone.
There will be some fallout once *distributions* change the binfmt - users will notice their existing qemu chroots stop working with a "file not found" error for any binary they try to run.
If we find even this breakage too much, I'm not sure this can be fixed.
Riku
Quoted 29 lines · Riku Voipio
Hi,
After weekend, I think the solution to using the P flag is to go back to Joakim's original patch:
http://lists.gnu.org/archive/html/qemu-devel/2014-07/msg02269.html
With this, we get:
If you continue to use qemu-x-static in your
binfmt_miscregistration, nothing changes - both old and new qemu work using the old binfmt registration.If you rename the binary qemu-x-binfmt, you need to update the
binfmt_miscregister to have P flag and new binary - you get correct argv with new qemu. Any old qemu you still have around, will stop working. But with "file not found" error rather than obscurely eating one of the arguments and running regardless.This leaves us with one case - people who are used to running qemu-x-static ./binary to test single binaries. Distro's will need leave a symlink from qemu-x-binfmt qemu-x-static. The "-binfmt" string check doesn't trigger, and qemu works as before.
The key point: this way nobody's working setup will break, unless they update binfmt registration. As long as the change is done by users them self (I need correct argv0 -> I will update binfmt), there is very little surprise for anyone.
Quoted 5 lines
There will be some fallout once *distributions* change the binfmt - users will notice their existing qemu chroots stop working with a "file not found" error for any binary they try to run.
If we find even this breakage too much, I'm not sure this can be fixed.
I would very much prefer if we could stick with only a single binary. And yes, switching semantics when you use binfmt wrappers will hurt for a short while, but after that everyone will have their setups changed and we're safe for the future.
Alex
Alexander Graf <[email protected]> wrote on 2014/08/25 11:14:58:
Quoted 21 lines · Riku Voipio
Quoted 19 lines
Hi,
After weekend, I think the solution to using the P flag is to go back to Joakim's original patch:
http://lists.gnu.org/archive/html/qemu-devel/2014-07/msg02269.html
With this, we get:
If you continue to use qemu-x-static in your
binfmt_miscregistration, nothing changes - both old and new qemu work using the old binfmt registration.If you rename the binary qemu-x-binfmt, you need to update the
binfmt_miscregister to have P flag and new binary - you get correct argv with new qemu. Any old qemu you still have around, will stop working. But with "file not found" error rather than obscurely eating one of the arguments and running regardless.
Quoted 8 lines
Quoted 8 lines
This leaves us with one case - people who are used to running qemu-x-static ./binary to test single binaries. Distro's will need leave a symlink from qemu-x-binfmt qemu-x-static. The "-binfmt" string check doesn't trigger, and qemu works as before.
The key point: this way nobody's working setup will break, unless they update binfmt registration. As long as the change is done by users them self (I need correct argv0 -> I will update binfmt), there is
very
Quoted 3 lines
Quoted 3 lines
little surprise for anyone.
There will be some fallout once *distributions* change the binfmt -
users
Quoted 4 lines
Quoted 4 lines
will notice their existing qemu chroots stop working with a "file not found" error for any binary they try to run.
If we find even this breakage too much, I'm not sure this can be
fixed.
Quoted 5 lines
I would very much prefer if we could stick with only a single binary. And yes, switching semantics when you use binfmt wrappers will hurt for a short while, but after that everyone will have their setups changed and we're safe for the future.
Yes, but as this is going to break something whatever we do I feel it is better
move towards always requiring P flag as this how binfmt should have been impl.
from the beginning and have users switch over now.
Then ask the kernel folks for a way to explicitly see what flags are used from within linux-user so you can adapt automatically.
Jocke
Quoted 36 lines · Alexander Graf
Quoted 33 lines · Riku Voipio
Hi,
After weekend, I think the solution to using the P flag is to go back to Joakim's original patch:
http://lists.gnu.org/archive/html/qemu-devel/2014-07/msg02269.html
With this, we get:
If you continue to use qemu-x-static in your
binfmt_miscregistration, nothing changes - both old and new qemu work using the old binfmt registration.If you rename the binary qemu-x-binfmt, you need to update the
binfmt_miscregister to have P flag and new binary - you get correct argv with new qemu. Any old qemu you still have around, will stop working. But with "file not found" error rather than obscurely eating one of the arguments and running regardless.This leaves us with one case - people who are used to running qemu-x-static ./binary to test single binaries. Distro's will need leave a symlink from qemu-x-binfmt qemu-x-static. The "-binfmt" string check doesn't trigger, and qemu works as before.
The key point: this way nobody's working setup will break, unless they update binfmt registration. As long as the change is done by users them self (I need correct argv0 -> I will update binfmt), there is very little surprise for anyone.
There will be some fallout once *distributions* change the binfmt - users will notice their existing qemu chroots stop working with a "file not found" error for any binary they try to run.
Quoted 6 lines
Quoted 1 line
If we find even this breakage too much, I'm not sure this can be fixed.
I would very much prefer if we could stick with only a single binary. And yes, switching semantics when you use binfmt wrappers will hurt for a short while, but after that everyone will have their setups changed and we're safe for the future.
I don't really the unpredictable nature of the breakage. Take
$ rm a b c
With P flag: /bin/rm rm a b c Without P flag: /bin/rm a b c
If we use old qemu with P flag: qemu will run /bin/rm with argv: "/bin/rm rm a b c"
-> tries to delete "rm"
If we use new qemu without P flag, qemu will run /bin/rm with argv: "a b c"
-> fails to delete "a"
This is the black magic errors that drive users nuts when they try to debug what is happening... "File not found" when the qemu binary is not in the right place is confusing enough.
Riku
Quoted 50 lines · Riku Voipio
Quoted 36 lines · Alexander Graf
Quoted 33 lines · Riku Voipio
Hi,
After weekend, I think the solution to using the P flag is to go back to Joakim's original patch:
http://lists.gnu.org/archive/html/qemu-devel/2014-07/msg02269.html
With this, we get:
If you continue to use qemu-x-static in your
binfmt_miscregistration, nothing changes - both old and new qemu work using the old binfmt registration.If you rename the binary qemu-x-binfmt, you need to update the
binfmt_miscregister to have P flag and new binary - you get correct argv with new qemu. Any old qemu you still have around, will stop working. But with "file not found" error rather than obscurely eating one of the arguments and running regardless.This leaves us with one case - people who are used to running qemu-x-static ./binary to test single binaries. Distro's will need leave a symlink from qemu-x-binfmt qemu-x-static. The "-binfmt" string check doesn't trigger, and qemu works as before.
The key point: this way nobody's working setup will break, unless they update binfmt registration. As long as the change is done by users them self (I need correct argv0 -> I will update binfmt), there is very little surprise for anyone.
There will be some fallout once *distributions* change the binfmt - users will notice their existing qemu chroots stop working with a "file not found" error for any binary they try to run.
Quoted 6 lines
Quoted 1 line
If we find even this breakage too much, I'm not sure this can be fixed.
I would very much prefer if we could stick with only a single binary. And yes, switching semantics when you use binfmt wrappers will hurt for a short while, but after that everyone will have their setups changed and we're safe for the future.
I don't really the unpredictable nature of the breakage. Take
$ rm a b cWith P flag: /bin/rm rm a b c Without P flag: /bin/rm a b c
Quoted 8 lines
If we use old qemu with P flag: qemu will run
/bin/rmwith argv: "/bin/rmrm a b c"
-> tries to delete "rm"
If we use new qemu without P flag, qemu will run/bin/rmwith argv: "a b c"
-> fails to delete "a"This is the black magic errors that drive users nuts when they try to debug what is happening... "File not found" when the qemu binary is not in the right place is confusing enough.
Yes, but is anyone actually using the "P" flag? We've never advertised anywhere that QEMU supports it.
Maybe we should just make the next version be 3.0 and declare it a major ABI breakage ;).
Alex
Quoted 58 lines · Alexander Graf
Quoted 55 lines · Riku Voipio
Quoted 36 lines · Alexander Graf
Quoted 33 lines · Riku Voipio
Hi,
After weekend, I think the solution to using the P flag is to go back to Joakim's original patch:
http://lists.gnu.org/archive/html/qemu-devel/2014-07/msg02269.html
With this, we get:
If you continue to use qemu-x-static in your
binfmt_miscregistration, nothing changes - both old and new qemu work using the old binfmt registration.If you rename the binary qemu-x-binfmt, you need to update the
binfmt_miscregister to have P flag and new binary - you get correct argv with new qemu. Any old qemu you still have around, will stop working. But with "file not found" error rather than obscurely eating one of the arguments and running regardless.This leaves us with one case - people who are used to running qemu-x-static ./binary to test single binaries. Distro's will need leave a symlink from qemu-x-binfmt qemu-x-static. The "-binfmt" string check doesn't trigger, and qemu works as before.
The key point: this way nobody's working setup will break, unless they update binfmt registration. As long as the change is done by users them self (I need correct argv0 -> I will update binfmt), there is very little surprise for anyone.
There will be some fallout once *distributions* change the binfmt - users will notice their existing qemu chroots stop working with a "file not found" error for any binary they try to run.
Quoted 6 lines
Quoted 1 line
If we find even this breakage too much, I'm not sure this can be fixed.
I would very much prefer if we could stick with only a single binary. And yes, switching semantics when you use binfmt wrappers will hurt for a short while, but after that everyone will have their setups changed and we're safe for the future.
I don't really the unpredictable nature of the breakage. Take
$ rm a b cWith P flag: /bin/rm rm a b c Without P flag: /bin/rm a b cIf we use old qemu with P flag: qemu will run
/bin/rmwith argv: "/bin/rmrm a b c"
-> tries to delete "rm"
If we use new qemu without P flag, qemu will run/bin/rmwith argv: "a b c"
-> fails to delete "a"
Quoted 6 lines
Quoted 3 lines
This is the black magic errors that drive users nuts when they try to debug what is happening... "File not found" when the qemu binary is not in the right place is confusing enough.
Yes, but is anyone actually using the "P" flag? We've never advertised anywhere that QEMU supports it.
No, we don't use the P flag now. The changeset has not been merged in. With "new Qemu" I meant Joakims "if O assume P" patch.
Quoted 5 lines
Maybe we should just make the next version be 3.0 and declare it a major ABI breakage ;).
Alex
Quoted 68 lines · Alexander Graf
Quoted 56 lines · Riku Voipio
Quoted 36 lines · Alexander Graf
Quoted 33 lines · Riku Voipio
Hi,
After weekend, I think the solution to using the P flag is to go back to Joakim's original patch:
http://lists.gnu.org/archive/html/qemu-devel/2014-07/msg02269.html
With this, we get:
If you continue to use qemu-x-static in your
binfmt_miscregistration, nothing changes - both old and new qemu work using the old binfmt registration.If you rename the binary qemu-x-binfmt, you need to update the
binfmt_miscregister to have P flag and new binary - you get correct argv with new qemu. Any old qemu you still have around, will stop working. But with "file not found" error rather than obscurely eating one of the arguments and running regardless.This leaves us with one case - people who are used to running qemu-x-static ./binary to test single binaries. Distro's will need leave a symlink from qemu-x-binfmt qemu-x-static. The "-binfmt" string check doesn't trigger, and qemu works as before.
The key point: this way nobody's working setup will break, unless they update binfmt registration. As long as the change is done by users them self (I need correct argv0 -> I will update binfmt), there is very little surprise for anyone.
There will be some fallout once *distributions* change the binfmt - users will notice their existing qemu chroots stop working with a "file not found" error for any binary they try to run.
Quoted 6 lines
Quoted 1 line
If we find even this breakage too much, I'm not sure this can be fixed.
I would very much prefer if we could stick with only a single binary. And yes, switching semantics when you use binfmt wrappers will hurt for a short while, but after that everyone will have their setups changed and we're safe for the future.
I don't really the unpredictable nature of the breakage. Take
$ rm a b cWith P flag:
/bin/rmrm a b c
Without P flag:/bin/rma b cIf we use old qemu with P flag: qemu will run
/bin/rmwith argv: "/bin/rmrm a b c"
-> tries to delete "rm"
If we use new qemu without P flag, qemu will run/bin/rmwith argv: "a b c" -> fails to delete "a"Quoted 4 lines
This is the black magic errors that drive users nuts when they try to debug what
is happening... "File not found" when the qemu binary is not in the right place is confusing enough.
Quoted 5 lines
Yes, but is anyone actually using the "P" flag? We've never advertised anywhere that QEMU supports it.
Maybe we should just make the next version be 3.0 and declare it a major ABI breakage ;).
You can also add the feature and let's the configure manages if it must be enabled or not.
Regards,
Laurent
Riku Voipio <[email protected]> wrote on 2014/08/25 14:42:57:
Quoted 7 lines · Alexander Graf
Quoted 5 lines · Riku Voipio
Quoted 2 lines
Hi,
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
After weekend, I think the solution to using the P flag is to go back to Joakim's original patch:
http://lists.gnu.org/archive/html/qemu-devel/2014-07/msg02269.html
With this, we get:
If you continue to use qemu-x-static in your
binfmt_misc
registration,
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
nothing changes - both old and new qemu work using the old binfmt registration.
If you rename the binary qemu-x-binfmt, you need to update the
binfmt_miscregister to have P flag and new binary - you get
correct
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
argv with new qemu. Any old qemu you still have around, will stop working. But with "file not found" error rather than obscurely
eating
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
one of the arguments and running regardless.
This leaves us with one case - people who are used to running qemu-x-static ./binary to test single binaries. Distro's will need leave a symlink from qemu-x-binfmt qemu-x-static. The "-binfmt"
string
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
check doesn't trigger, and qemu works as before.
The key point: this way nobody's working setup will break, unless
they
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
update binfmt registration. As long as the change is done by users them self (I need correct argv0 -> I will update binfmt), there is
very
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
little surprise for anyone.
There will be some fallout once *distributions* change the binfmt -
users
Quoted 1 line
Quoted 1 line
Quoted 1 line
will notice their existing qemu chroots stop working with a "file
not
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
found" error for any binary they try to run.
If we find even this breakage too much, I'm not sure this can be
fixed.
Quoted 3 lines
Quoted 3 lines
I would very much prefer if we could stick with only a single binary. And yes, switching semantics when you use binfmt wrappers will hurt
for
Quoted 10 lines
Quoted 2 lines
a short while, but after that everyone will have their setups changed and we're safe for the future.
I don't really the unpredictable nature of the breakage. Take
$ rm a b cWith P flag: /bin/rm rm a b c Without P flag: /bin/rm a b cIf we use old qemu with P flag: qemu will run
/bin/rmwith argv:
"/bin/rm rm a b c"
Quoted 2 lines
-> tries to delete "rm"
If we use new qemu without P flag, qemu will run/bin/rmwith argv: "a b
c"
Quoted 3 lines
-> fails to delete "a"
This is the black magic errors that drive users nuts when they try to
debug what
Quoted 2 lines
is happening... "File not found" when the qemu binary is not in the right place is confusing enough.
Then consider when you run a LXC without P flag. bash expects argv0=-bash to be a
login shell and source "profile" files. This can result in even worse "black magic errors"
Either way stuff may break :(
Oh well, perhaps the binfmt wrapper is the best although then you will be stuck with the -binfmt magic handling in QEMU for a long time.
Jocke
Hi,
Quoted 1 line · Joakim Tjernlund
Then consider when you run a LXC without P flag.
Please remember that your usecase of running Qemu in LXC is a new feature, never before supported. Adding new features is always nice. However, it must not happen with expense of regressing already working features (traditional chroot).
Riku
Riku Voipio <[email protected]> wrote on 2014/08/25 15:55:55:
Quoted 7 lines
Hi,
Quoted 1 line · Joakim Tjernlund
Then consider when you run a LXC without P flag.
Please remember that your usecase of running Qemu in LXC is a new
feature,
Quoted 1 line
never before supported. Adding new features is always nice. However, it
must
Quoted 2 lines
not happen with expense of regressing already working features (traditional chroot).
OK, but traditional chroot is unaffected with my patch. Only binfmt users which uses the binfmt flag O will have to change to PO. How many is that?
Jocke
Quoted 9 lines · Joakim Tjernlund
Riku Voipio <[email protected]> wrote on 2014/08/25 15:55:55:
Quoted 7 lines
Hi,
Quoted 1 line · Joakim Tjernlund
Then consider when you run a LXC without P flag.
Please remember that your usecase of running Qemu in LXC is a new
feature,
Quoted 8 lines
Quoted 1 line
never before supported. Adding new features is always nice. However, it
must
Quoted 2 lines
not happen with expense of regressing already working features (traditional chroot).
OK, but traditional chroot is unaffected with my patch. Only binfmt users which uses the binfmt flag O will have to change to PO. How many is that?
Traditional chroot is with binfmt_misc. Debian and ubuntu packages of Qemu enable OC flags, so at least all debian/ubuntu users who use qemu linux-user in chroots are affected.
Using OC seems quite typical:
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/app-emulation/qemu/files/qemu-binfmt.initd-r1?view=markup
http://rwmj.wordpress.com/2013/12/22/how-to-run-aarch64-binaries-on-an-x86-64-host-using-qemu-userspace-emulation/#content
Others, like Suse, scratchbox use the P flag and wrapper binary.
Riku Voipio <[email protected]> wrote on 2014/08/25 16:49:17:
Quoted 12 lines · Joakim Tjernlund
Quoted 10 lines
Riku Voipio <[email protected]> wrote on 2014/08/25 15:55:55:
Quoted 7 lines
Hi,
Quoted 1 line · Joakim Tjernlund
Then consider when you run a LXC without P flag.
Please remember that your usecase of running Qemu in LXC is a new
feature,
Quoted 1 line
never before supported. Adding new features is always nice. However,
it
Quoted 9 lines
Quoted 7 lines
must
Quoted 2 lines
not happen with expense of regressing already working features (traditional chroot).
OK, but traditional chroot is unaffected with my patch. Only binfmt users which uses the binfmt flag O will have to change to PO. How many is that?
Traditional chroot is with
binfmt_misc. Debian and ubuntu packages of
Sorry, I figured you meant plain chroot
Quoted 6 lines
Qemu enable OC flags, so at least all debian/ubuntu users who use qemu linux-user in chroots are affected.
Using OC seems quite typical:
Quoted 1 line
Quoted 2 lines
Others, like Suse, scratchbox use the P flag and wrapper binary.
Yes, but I meant those not using the dist. default as dists will update their binfmt scripts when upgrading QEMU.
Basically this will only be a potential problem for DIYs QEMU users.
Jocke
A message that is not in the archive (sent off-list or not yet received): OF93B0417A.866825C3-ONC1257D3F.005235F4-C1257D3F.0052A534@LocalDomain
Any resolution for how to handle P flag yet?
Jocke
Joakim Tjernlund/Transmode wrote on 2014/08/25 17:02:42:
Quoted 14 lines
Riku Voipio <[email protected]> wrote on 2014/08/25 16:49:17:
Quoted 12 lines · Joakim Tjernlund
Quoted 10 lines
Riku Voipio <[email protected]> wrote on 2014/08/25 15:55:55:
Quoted 7 lines
Hi,
Quoted 1 line · Joakim Tjernlund
Then consider when you run a LXC without P flag.
Please remember that your usecase of running Qemu in LXC is a new
feature,
Quoted 1 line
never before supported. Adding new features is always nice.
However, it
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
must
Quoted 2 lines
not happen with expense of regressing already working features (traditional chroot).
Quoted 14 lines
Quoted 5 lines
Quoted 3 lines
OK, but traditional chroot is unaffected with my patch. Only binfmt users which uses the binfmt flag O will have to change to PO. How many is that?
Traditional chroot is with
binfmt_misc. Debian and ubuntu packages ofSorry, I figured you meant plain chroot
Quoted 6 lines
Qemu enable OC flags, so at least all debian/ubuntu users who use qemu linux-user in chroots are affected.
Using OC seems quite typical:
Quoted 1 line
Quoted 1 line
Quoted 9 lines
Quoted 2 lines
Others, like Suse, scratchbox use the P flag and wrapper binary.
Yes, but I meant those not using the dist. default as dists will update their binfmt scripts when upgrading QEMU.
Basically this will only be a potential problem for DIYs QEMU users.
Jocke
[cc'ing MJT for more distro opinion since I think fundamentally the choice we ought to make upstream is "what's not going to screw over distros"... Paolo, is there a RedHat QEMU maintainer who would have an opinion here?]
Quoted 27 lines · Riku Voipio
After weekend, I think the solution to using the P flag is to go back to Joakim's original patch:
http://lists.gnu.org/archive/html/qemu-devel/2014-07/msg02269.html
With this, we get:
If you continue to use qemu-x-static in your
binfmt_miscregistration, nothing changes - both old and new qemu work using the old binfmt registration.If you rename the binary qemu-x-binfmt, you need to update the
binfmt_miscregister to have P flag and new binary - you get correct argv with new qemu. Any old qemu you still have around, will stop working. But with "file not found" error rather than obscurely eating one of the arguments and running regardless.This leaves us with one case - people who are used to running qemu-x-static ./binary to test single binaries. Distro's will need leave a symlink from qemu-x-binfmt qemu-x-static. The "-binfmt" string check doesn't trigger, and qemu works as before.
The key point: this way nobody's working setup will break, unless they update binfmt registration. As long as the change is done by users them self (I need correct argv0 -> I will update binfmt), there is very little surprise for anyone.
Quoted 5 lines
There will be some fallout once *distributions* change the binfmt - users will notice their existing qemu chroots stop working with a "file not found" error for any binary they try to run.
If we find even this breakage too much, I'm not sure this can be fixed.
My take on this:
* I agree we can't break existing working setups with binfmt
registered with "O"
* It would be nice to have a forward path to binfmt registered
with "OP"
* The best we can do is provide a QEMU which can work in
both "O" and "OP" configurations, and clearly advertise to distros and individual users that (a) we recommend the "OP" config and binary name (b) updating the binfmt config will break any old QEMU binaries they have lying around in chroots (c) they should probably provide both binary names for back-compatibility
ie essentially leave it up to distros whether they want to move forward to the bright new "correct argv0" future at the cost of some transition pain, or if they'll just sit with their current config.
What I really would like is a way for the kernel to tell the interpreter binary what particular mangling it's chosen to do of the command line arguments. Then we could have one binary that coped in both situations and when run via the command line, and it would just come down to "recommend OP and tell people/distros to make sure to update the QEMU binaries in any chroots they have when they make that change". Unfortunately the kernel doesn't
do that and it would need a kernel change to fix it :-(
-- PMM
Peter Maydell <[email protected]> wrote on 2014/08/29 20:01:12:
.....
Quoted 10 lines
What I really would like is a way for the kernel to tell the interpreter binary what particular mangling it's chosen to do of the command line arguments. Then we could have one binary that coped in both situations and when run via the command line, and it would just come down to "recommend OP and tell people/distros to make sure to update the QEMU binaries in any chroots they have when they make that change". Unfortunately the kernel doesn't
do that and it would need a kernel change to fix it :-(
I think QEMU should request such a change, you have a good reason for it. There will be more flags in the future which will make it impossible to do the right thing automatically. I would like to see a flag which strips away the qemu-ARCH from argv, much like the other interpreters do.
Perhaps similar to AT_EXECFD? An AT_BINFMTFLAGS which holds the flags(or an empty string when no flags)
Jocke
Il 29/08/2014 20:01, Peter Maydell ha scritto:
Quoted 4 lines
[cc'ing MJT for more distro opinion since I think fundamentally the choice we ought to make upstream is "what's not going to screw over distros"... Paolo, is there a RedHat QEMU maintainer who would have an opinion here?]
There's Cole Robinson.
BTW, Fedora doesn't use the binfmt scripts from QEMU, but does reuse the binfmt lines. We'd just add Ps and we'd be fine.
However, the problem is not really for distros. Packagers just read the release notes and adjust whatever needs to be adjusted. The problem is for people who compile from source and are bit by conflicting binfmt formats from their distro.
The solution could be to extend binfmt_misc so that it sets two environment variables BINFMT_MISC_PID and BINFMT_MISC_ORIG_ARGV0. The former is set to the pid of the binfmt "interpreter" program, the latter to the argv[0] value. Then QEMU can check if BINFMT_MISC_PID matches getpid() and, if so, trust the BINFMT_MISC_ORIG_ARGV0 value.
Paolo
Quoted 9 lines · Paolo Bonzini
Il 29/08/2014 20:01, Peter Maydell ha scritto:
Quoted 4 lines
[cc'ing MJT for more distro opinion since I think fundamentally the choice we ought to make upstream is "what's not going to screw over distros"... Paolo, is there a RedHat QEMU maintainer who would have an opinion here?]
There's Cole Robinson.
BTW, Fedora doesn't use the binfmt scripts from QEMU
That's ok, nobody with any sense doesn't.
Quoted 2 lines
, but does reuse the
binfmt lines. We'd just add Ps and we'd be fine.
But this would break all your existing users' existing chroot setups. That's the question I'm after an answer to:
what do you (as a distro) think would be acceptable as transitional breakage, if anything?
Quoted 4 lines
However, the problem is not really for distros. Packagers just read the release notes and adjust whatever needs to be adjusted. The problem is for people who compile from source and are bit by conflicting binfmt formats from their distro.
This is one reason I like the "one binary name for O and one for P" approach.
Quoted 5 lines
The solution could be to extend
binfmt_miscso that it sets two environment variablesBINFMT_MISC_PIDandBINFMT_MISC_ORIG_ARGV0. The former is set to the pid of the binfmt "interpreter" program, the latter to the argv[0] value. Then QEMU can check ifBINFMT_MISC_PIDmatchesgetpid()and, if so, trust theBINFMT_MISC_ORIG_ARGV0value.
Certainly if we're in a position to get the kernel to be more informative about how it invoked us that would be the ideal.
thanks
-- PMM
Il 01/09/2014 11:12, Peter Maydell ha scritto:
Quoted 6 lines
Quoted 1 line
We'd just add Ps and we'd be fine.
But this would break all your existing users' existing chroot setups. That's the question I'm after an answer to:
what do you (as a distro) think would be acceptable as transitional breakage, if anything?
Yes, but it's not like Fedora'd have choice. Distros have to follow what upstream does, even if it breaks something else (or they could revert the "P" patch and get an entirely specular set of bug reports).
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
The solution could be to extend
binfmt_miscso that it sets two environment variablesBINFMT_MISC_PIDandBINFMT_MISC_ORIG_ARGV0. The former is set to the pid of the binfmt "interpreter" program, the latter to the argv[0] value. Then QEMU can check ifBINFMT_MISC_PIDmatchesgetpid()and, if so, trust theBINFMT_MISC_ORIG_ARGV0value.Certainly if we're in a position to get the kernel to be more informative about how it invoked us that would be the ideal.
I think it's simply that "P" was ill-designed (possibly because implementing the above is not trivial).
Paolo
Quoted 11 lines · Paolo Bonzini
Il 01/09/2014 11:12, Peter Maydell ha scritto:
Quoted 6 lines
Quoted 1 line
We'd just add Ps and we'd be fine.
But this would break all your existing users' existing chroot setups. That's the question I'm after an answer to:
what do you (as a distro) think would be acceptable as transitional breakage, if anything?Yes, but it's not like Fedora'd have choice. Distros have to follow what upstream does, even if it breaks something else (or they could revert the "P" patch and get an entirely specular set of bug reports).
Yes, that's why I'm asking what you'd prefer before we change upstream QEMU rather than just picking something randomly and letting you deal with the consequences :-)
-- PMM
Quoted 13 lines · Peter Maydell
Quoted 9 lines · Paolo Bonzini
Il 29/08/2014 20:01, Peter Maydell ha scritto:
Quoted 4 lines
[cc'ing MJT for more distro opinion since I think fundamentally the choice we ought to make upstream is "what's not going to screw over distros"... Paolo, is there a RedHat QEMU maintainer who would have an opinion here?]
There's Cole Robinson.
BTW, Fedora doesn't use the binfmt scripts from QEMU
That's ok, nobody with any sense doesn't.
Quoted 12 lines
Quoted 2 lines
, but does reuse the
binfmt lines. We'd just add Ps and we'd be fine.But this would break all your existing users' existing chroot setups. That's the question I'm after an answer to:
what do you (as a distro) think would be acceptable as transitional breakage, if anything?Quoted 4 lines
However, the problem is not really for distros. Packagers just read the release notes and adjust whatever needs to be adjusted. The problem is for people who compile from source and are bit by conflicting binfmt formats from their distro.
Or people with chroots from older/different distros, already having a qemu-static inside.
Quoted 2 lines
This is one reason I like the "one binary name for O and one for P" approach.
Maybe the new binary name could be something more generic than qemu-x-binfmt. Say qemu-x-user. Then distributions and users can drop the old binary name over time, and we are back to one binary again eventually.
Quoted 8 lines
Quoted 5 lines
The solution could be to extend
binfmt_miscso that it sets two environment variablesBINFMT_MISC_PIDandBINFMT_MISC_ORIG_ARGV0. The former is set to the pid of the binfmt "interpreter" program, the latter to the argv[0] value. Then QEMU can check ifBINFMT_MISC_PIDmatchesgetpid()and, if so, trust theBINFMT_MISC_ORIG_ARGV0value.Certainly if we're in a position to get the kernel to be more informative about how it invoked us that would be the ideal.
There is AT_FLAGS, that seems unused atm (only ever set to 0).
http://lxr.free-electrons.com/source/fs/binfmt_elf.c#L240
As indeed I afree with Paolo that (in hindsight) it was misdesign for the kernel to tell the application how it invoked us..
Riku
Riku
Riku Voipio <[email protected]> wrote on 2014/09/01 11:51:15:
Quoted 18 lines · Peter Maydell
Quoted 16 lines · Paolo Bonzini
Quoted 9 lines
Il 29/08/2014 20:01, Peter Maydell ha scritto:
Quoted 4 lines
[cc'ing MJT for more distro opinion since I think fundamentally the choice we ought to make upstream is "what's not going to screw over distros"... Paolo, is there a RedHat QEMU maintainer who would have an opinion here?]
There's Cole Robinson.
BTW, Fedora doesn't use the binfmt scripts from QEMU
That's ok, nobody with any sense doesn't.
Quoted 2 lines
, but does reuse the
binfmt lines. We'd just add Ps and we'd be fine.
Quoted 6 lines
Quoted 6 lines
But this would break all your existing users' existing chroot setups. That's the question I'm after an answer to:
what do you (as a distro) think would be acceptable as transitional breakage, if anything?Quoted 1 line
However, the problem is not really for distros. Packagers just read
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
release notes and adjust whatever needs to be adjusted. The problem
is
Quoted 10 lines
Quoted 2 lines
Quoted 2 lines
for people who compile from source and are bit by conflicting binfmt formats from their distro.
Or people with chroots from older/different distros, already having a qemu-static inside.
Quoted 2 lines
This is one reason I like the "one binary name for O and one for P" approach.
Maybe the new binary name could be something more generic than
qemu-x-binfmt.
Quoted 5 lines
Say qemu-x-user. Then distributions and users can drop the old binary name over time, and we are back to one binary again eventually.
Quoted 2 lines
Quoted 2 lines
The solution could be to extend
binfmt_miscso that it sets two environment variablesBINFMT_MISC_PIDandBINFMT_MISC_ORIG_ARGV0.
The
Quoted 1 line
Quoted 1 line
Quoted 1 line
former is set to the pid of the binfmt "interpreter" program, the
latter
Quoted 1 line
Quoted 1 line
Quoted 1 line
to the argv[0] value. Then QEMU can check if
BINFMT_MISC_PID
matches
Quoted 10 lines
Quoted 4 lines
Quoted 1 line
getpid()and, if so, trust theBINFMT_MISC_ORIG_ARGV0value.Certainly if we're in a position to get the kernel to be more informative about how it invoked us that would be the ideal.
There is
AT_FLAGS, that seems unused atm (only ever set to 0).http://lxr.free-electrons.com/source/fs/binfmt_elf.c#L240
As indeed I afree with Paolo that (in hindsight) it was misdesign for
the
Quoted 1 line
kernel to tell the application how it invoked us..
Did this go anywhere ? Is there a solution in sight?
Jocke
Quoted 1 line · Joakim Tjernlund
Did this go anywhere ? Is there a solution in sight?
I was hoping for more distro input, but absent that:
Does anybody care to try to float the idea of an API extension to the binfmt stuff to pass us the argv0 out-of-band (eg via an elf auxv vector entry if some new binfmt flag is passed)? That would I think be the best approach, though obviously it's a kernel change.
Failing that I'm not sure we can change upstream QEMU's behaviour because it will just break too much to do that. This sucks but the kernel as it stands just gives us no manoeuvering room :-(
thanks
-- PMM
Il 17/09/2014 18:12, Peter Maydell ha scritto:
Quoted 12 lines
Quoted 1 line · Joakim Tjernlund
Did this go anywhere ? Is there a solution in sight?
I was hoping for more distro input, but absent that:
Does anybody care to try to float the idea of an API extension to the binfmt stuff to pass us the argv0 out-of-band (eg via an elf auxv vector entry if some new binfmt flag is passed)? That would I think be the best approach, though obviously it's a kernel change.
Quoted 4 lines
Failing that I'm not sure we can change upstream QEMU's behaviour because it will just break too much to do that. This sucks but the kernel as it stands just gives us no manoeuvering room :-(
Another idea is to add a configure option that defaults to yes.
Paolo
Quoted 7 lines · Paolo Bonzini
Il 17/09/2014 18:12, Peter Maydell ha scritto:
Quoted 6 lines
Does anybody care to try to float the idea of an API extension to the binfmt stuff to pass us the argv0 out-of-band (eg via an elf auxv vector entry if some new binfmt flag is passed)? That would I think be the best approach, though obviously it's a kernel change.
Quoted 6 lines
Quoted 4 lines
Failing that I'm not sure we can change upstream QEMU's behaviour because it will just break too much to do that. This sucks but the kernel as it stands just gives us no manoeuvering room :-(
Another idea is to add a configure option that defaults to yes.
I think that still ends up breaking a bunch of people at some point in the future.
I spoke to a kernel guy this morning and he seemed vaguely positive about the idea of an API extension, so I'll see if I can find time to write and send out a patch for that.
-- PMM