mbox

[PULL,00/24] Linux-user updates

Message ID cover.1408100160.git.riku.voipio@linaro.org
State Accepted
Headers show

Pull-request

git://git.linaro.org/people/riku.voipio/qemu.git linux-user-for-upstream

Message

Riku Voipio Aug. 15, 2014, 11:01 a.m. UTC
From: Riku Voipio <riku.voipio@linaro.org>

Hi,

A usual set of improvements and bugfixes. The binfmt flag addition is an
ABI break so endusers need to update their binfmt registering scripts.

The following changes since commit 2d591ce2aeebf9620ff527c7946844a3122afeec:

  Merge remote-tracking branch 'remotes/mdroth/qga-pull-2014-08-08' into staging (2014-08-08 14:16:05 +0100)

are available in the git repository at:

  git://git.linaro.org/people/riku.voipio/qemu.git linux-user-for-upstream

for you to fetch changes up to e93757cb483a945e88550e605fc59bb1a1e80ccc:

  linux-user: check return value of malloc() (2014-08-14 16:00:15 +0300)

----------------------------------------------------------------

Jincheng Miao (1):
  linux-user: Fix syscall instruction usermode emulation on X86_64

Joakim Tjernlund (1):
  linux-user: make binfmt flag O require P

Mike Frysinger (1):
  linux-user: fix readlink handling with magic exe symlink

Mikhail Ilyin (1):
  linux-user: /proc/self/maps content

Paul Burton (1):
  linux-user: support ioprio_{get, set} syscalls

Peter Maydell (1):
  linux-user: Fix conversion of sigevent argument to timer_create

Riku Voipio (4):
  linux-user: redirect openat calls
  linux-user: support timerfd_{create, gettime, settime} syscalls
  linux-user: support {name_to,open_by}_handle_at syscalls
  linux-user: add setns and unshare

Tom Musta (13):
  linux-user: PPC64 semid_ds Doesnt Include _unused1 and _unused2
  linux-user: Dereference Pointer Argument to ipc/semctl Sys Call
  linux-user: Properly Handle semun Structure In Cross-Endian Situations
  linux-user: Make ipc syscall's third argument an abi_long
  linux-user: Conditionally Pass Attribute Pointer to mq_open()
  linux-user: Detect Negative Message Sizes in msgsnd System Call
  linux-user: Handle NULL sched_param argument to sched_*
  linux-user: Detect fault in sched_rr_get_interval
  linux-user: Move get_ppc64_abi
  linux-user: Minimum Sig Handler Stack Size for PPC64 ELF V2
  linux-user: clock_nanosleep errno Handling on PPC
  linux-user: Support target-to-host translation of mlockall argument
  linux-user: writev Partial Writes

zhanghailiang (1):
  linux-user: check return value of malloc()

 configure                       |  37 +++++
 include/exec/cpu-all.h          |   2 +
 linux-user/aarch64/syscall.h    |   3 +
 linux-user/alpha/syscall.h      |   3 +
 linux-user/arm/syscall.h        |   4 +
 linux-user/cris/syscall.h       |   3 +
 linux-user/elfload.c            |   9 --
 linux-user/i386/syscall.h       |   3 +
 linux-user/m68k/syscall.h       |   4 +
 linux-user/main.c               |  20 ++-
 linux-user/microblaze/syscall.h |   3 +
 linux-user/mips/syscall.h       |   3 +
 linux-user/mips64/syscall.h     |   3 +
 linux-user/openrisc/syscall.h   |   4 +
 linux-user/ppc/syscall.h        |   4 +
 linux-user/ppc/target_cpu.h     |  10 ++
 linux-user/s390x/syscall.h      |   3 +
 linux-user/sh4/syscall.h        |   4 +
 linux-user/signal.c             |  12 +-
 linux-user/sparc/syscall.h      |   3 +
 linux-user/sparc64/syscall.h    |   3 +
 linux-user/strace.c             |  30 ++++
 linux-user/strace.list          |  18 +++
 linux-user/syscall.c            | 347 ++++++++++++++++++++++++++++++++++------
 linux-user/unicore32/syscall.h  |   4 +
 linux-user/x86_64/syscall.h     |   3 +
 scripts/qemu-binfmt-conf.sh     |  36 ++---
 target-i386/seg_helper.c        |   4 +-
 28 files changed, 495 insertions(+), 87 deletions(-)

Comments

Peter Maydell Aug. 15, 2014, 5:49 p.m. UTC | #1
On 15 August 2014 12:01,  <riku.voipio@linaro.org> wrote:
> A usual set of improvements and bugfixes. The binfmt flag addition is an
> ABI break so endusers need to update their binfmt registering scripts.

Ugh, really? I didn't realize that when I saw that patch
go past; I'd like to look at it in more detail before I
apply this, since "break everybody's working setup"
doesn't seem like a great idea...

thanks
-- PMM
Riku Voipio Aug. 18, 2014, 8:46 a.m. UTC | #2
On 15 August 2014 20:49, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 15 August 2014 12:01,  <riku.voipio@linaro.org> wrote:
>> A usual set of improvements and bugfixes. The binfmt flag addition is an
>> ABI break so endusers need to update their binfmt registering scripts.

> Ugh, really? I didn't realize that when I saw that patch
> go past; I'd like to look at it in more detail before I
> apply this, since "break everybody's working setup"
> doesn't seem like a great idea...

Ok, I think Joakim's patch can be adjusted so that it continues to
work as-is with
current binfmt registrations that don't have "P" set. Meanwhile, I'll
drop the patch from this round and re-submit the current linux-user
que without it.

Riku
Joakim Tjernlund Aug. 18, 2014, 10:49 a.m. UTC | #3
Riku Voipio <riku.voipio@linaro.org> wrote on 2014/08/18 10:46:36:
> 
> On 15 August 2014 20:49, Peter Maydell <peter.maydell@linaro.org> wrote:
> > On 15 August 2014 12:01,  <riku.voipio@linaro.org> wrote:
> >> A usual set of improvements and bugfixes. The binfmt flag addition is 
an
> >> ABI break so endusers need to update their binfmt registering 
scripts.
> 
> > Ugh, really? I didn't realize that when I saw that patch
> > go past; I'd like to look at it in more detail before I
> > apply this, since "break everybody's working setup"
> > doesn't seem like a great idea...
> 
> Ok, I think Joakim's patch can be adjusted so that it continues to
> work as-is with
> current binfmt registrations that don't have "P" set. Meanwhile, I'll
> drop the patch from this round and re-submit the current linux-user
> que without it.
> 

ouch, this was a surprise this late in the game. I don't see how you are
going to modify my patch to not need P flag, can you elaborate?

The current binfmt is semibroken as is, for some it works when adding O 
flag but
not all apps is happy with that. I think my patch is the best way solve 
this problem,
all one have to do is to update the binfmt registering(mostly a dist. 
problem) then it
will work for all uses.

 Jocke
Peter Maydell Aug. 18, 2014, 10:58 a.m. UTC | #4
On 18 August 2014 11:49, Joakim Tjernlund <joakim.tjernlund@transmode.se> wrote:
> The current binfmt is semibroken as is, for some it works when adding O
> flag but not all apps is happy with that. I think my patch is the best
> way solve this problem, all one have to do is to update the binfmt
> registering(mostly a dist. problem) then it will work for all uses.

Well, binfmt-misc works fine for me as it is and presumably
for most people or we'd have had more complaints. So
breaking all those existing working setups is really something
we should avoid as much as possible.

thanks
-- PMM
Joakim Tjernlund Aug. 18, 2014, 12:38 p.m. UTC | #5
Peter Maydell <peter.maydell@linaro.org> wrote on 2014/08/18 12:58:48:

> 
> On 18 August 2014 11:49, Joakim Tjernlund 
<joakim.tjernlund@transmode.se> wrote:
> > The current binfmt is semibroken as is, for some it works when adding 
O
> > flag but not all apps is happy with that. I think my patch is the best
> > way solve this problem, all one have to do is to update the binfmt
> > registering(mostly a dist. problem) then it will work for all uses.
> 
> Well, binfmt-misc works fine for me as it is and presumably
> for most people or we'd have had more complaints. So
> breaking all those existing working setups is really something
> we should avoid as much as possible.

How do you use it? With LXC booting a VM with traditional init?

There are complaints which dists had to solve because QEMU didn't. Usually
this is a separate static QEMU package/hack with a binfmt wrapper.
Gentoo used to have one but this got removed.

 Jocke
Peter Maydell Aug. 18, 2014, 12:45 p.m. UTC | #6
On 18 August 2014 13:38, Joakim Tjernlund <joakim.tjernlund@transmode.se> wrote:
> Peter Maydell <peter.maydell@linaro.org> wrote on 2014/08/18 12:58:48:
>> Well, binfmt-misc works fine for me as it is and presumably
>> for most people or we'd have had more complaints. So
>> breaking all those existing working setups is really something
>> we should avoid as much as possible.
>
> How do you use it? With LXC booting a VM with traditional init?

No. Just a straightforward chroot environment with a
statically linked qemu in it, and a binfmt_misc config like:

e104462:trusty:qemu$ cat /proc/sys/fs/binfmt_misc/qemu-arm
enabled
interpreter /usr/bin/qemu-arm-static
flags: OC
offset 0
magic 7f454c4601010100000000000000000002002800
mask ffffffffffffff00fffffffffffffffffeffffff

This works fine for the things I try to run in the chroot
(mostly test programs, also bash and basic command
line utilities).

> There are complaints which dists had to solve because QEMU didn't. Usually
> this is a separate static QEMU package/hack with a binfmt wrapper.
> Gentoo used to have one but this got removed.

I'm sure there are cases which don't work; but we should try
to find a way which allows us to make those work (with a
recommended change to binfmt misc registration) which
doesn't break the old configs in the process.

thanks
-- PMM
Joakim Tjernlund Aug. 18, 2014, 12:59 p.m. UTC | #7
Peter Maydell <peter.maydell@linaro.org> wrote on 2014/08/18 14:45:49:
> 
> On 18 August 2014 13:38, Joakim Tjernlund 
<joakim.tjernlund@transmode.se> wrote:
> > Peter Maydell <peter.maydell@linaro.org> wrote on 2014/08/18 12:58:48:
> >> Well, binfmt-misc works fine for me as it is and presumably
> >> for most people or we'd have had more complaints. So
> >> breaking all those existing working setups is really something
> >> we should avoid as much as possible.
> >
> > How do you use it? With LXC booting a VM with traditional init?
> 
> No. Just a straightforward chroot environment with a
> statically linked qemu in it, and a binfmt_misc config like:
> 
> e104462:trusty:qemu$ cat /proc/sys/fs/binfmt_misc/qemu-arm
> enabled
> interpreter /usr/bin/qemu-arm-static

Where does -static come from? Is that the standard name a static qemu-user 
build gets?

> flags: OC
> offset 0
> magic 7f454c4601010100000000000000000002002800
> mask ffffffffffffff00fffffffffffffffffeffffff
> 
> This works fine for the things I try to run in the chroot
> (mostly test programs, also bash and basic command
> line utilities).

Using bash as a login shell one need one of(from bash man page):
 A  login shell is one whose first character of argument zero is a -, or
 one started with the --login option.

> 
> > There are complaints which dists had to solve because QEMU didn't. 
Usually
> > this is a separate static QEMU package/hack with a binfmt wrapper.
> > Gentoo used to have one but this got removed.
> 
> I'm sure there are cases which don't work; but we should try
> to find a way which allows us to make those work (with a
> recommended change to binfmt misc registration) which
> doesn't break the old configs in the process.

This was considered/discussed to some point and no-one could come up
with a better approach.

 Jocke
Laurent Vivier Aug. 18, 2014, 1:02 p.m. UTC | #8
> Le 18 août 2014 à 14:45, Peter Maydell <peter.maydell@linaro.org> a écrit :
>
>
> On 18 August 2014 13:38, Joakim Tjernlund <joakim.tjernlund@transmode.se>
> wrote:
> > Peter Maydell <peter.maydell@linaro.org> wrote on 2014/08/18 12:58:48:
> >> Well, binfmt-misc works fine for me as it is and presumably
> >> for most people or we'd have had more complaints. So
> >> breaking all those existing working setups is really something
> >> we should avoid as much as possible.
> >
> > How do you use it? With LXC booting a VM with traditional init?
>
> No. Just a straightforward chroot environment with a
> statically linked qemu in it, and a binfmt_misc config like:
>
> e104462:trusty:qemu$ cat /proc/sys/fs/binfmt_misc/qemu-arm
> enabled
> interpreter /usr/bin/qemu-arm-static
> flags: OC
> offset 0
> magic 7f454c4601010100000000000000000002002800
> mask ffffffffffffff00fffffffffffffffffeffffff
>
> This works fine for the things I try to run in the chroot
> (mostly test programs, also bash and basic command
> line utilities).
>
> > There are complaints which dists had to solve because QEMU didn't. Usually
> > this is a separate static QEMU package/hack with a binfmt wrapper.
> > Gentoo used to have one but this got removed.
>
> I'm sure there are cases which don't work; but we should try
> to find a way which allows us to make those work (with a
> recommended change to binfmt misc registration) which
> doesn't break the old configs in the process.

If it can help:

I'm using qemu-linux-user in LXC containers for more than a year now without any
problem and with nor wrapper neither modifications in the distro I install (to
be honest, only debian etch-m68k and previous).
I like this approach because it avoids to have to maintain gcc cross-compiler
(and tools). It's 10 times slower than the cross compiler but works fine.

I've a script in my qemu-m68k repo that can create containers for several archs
(search in QEMU mailing list archives... or ask)

Regards,
Laurent
Peter Maydell Aug. 18, 2014, 1:04 p.m. UTC | #9
On 18 August 2014 13:59, Joakim Tjernlund <joakim.tjernlund@transmode.se> wrote:
> Peter Maydell <peter.maydell@linaro.org> wrote on 2014/08/18 14:45:49:
>>
>> On 18 August 2014 13:38, Joakim Tjernlund
> <joakim.tjernlund@transmode.se> wrote:
>> > Peter Maydell <peter.maydell@linaro.org> wrote on 2014/08/18 12:58:48:
>> >> Well, binfmt-misc works fine for me as it is and presumably
>> >> for most people or we'd have had more complaints. So
>> >> breaking all those existing working setups is really something
>> >> we should avoid as much as possible.
>> >
>> > How do you use it? With LXC booting a VM with traditional init?
>>
>> No. Just a straightforward chroot environment with a
>> statically linked qemu in it, and a binfmt_misc config like:
>>
>> e104462:trusty:qemu$ cat /proc/sys/fs/binfmt_misc/qemu-arm
>> enabled
>> interpreter /usr/bin/qemu-arm-static
>
> Where does -static come from? Is that the standard name a static qemu-user
> build gets?

No. It's just what Debian and Ubuntu call their statically
linked binaries.

>> flags: OC
>> offset 0
>> magic 7f454c4601010100000000000000000002002800
>> mask ffffffffffffff00fffffffffffffffffeffffff
>>
>> This works fine for the things I try to run in the chroot
>> (mostly test programs, also bash and basic command
>> line utilities).
>
> Using bash as a login shell one need one of(from bash man page):
>  A  login shell is one whose first character of argument zero is a -, or
>  one started with the --login option.

Who said anything about login shells? I just chroot into the
thing and run a shell.

-- PMM
Riku Voipio Aug. 18, 2014, 1:17 p.m. UTC | #10
On 18 August 2014 15:59, Joakim Tjernlund <joakim.tjernlund@transmode.se> wrote:
> Peter Maydell <peter.maydell@linaro.org> wrote on 2014/08/18 14:45:49:
>> I'm sure there are cases which don't work; but we should try
>> to find a way which allows us to make those work (with a
>> recommended change to binfmt misc registration) which
>> doesn't break the old configs in the process.

> This was considered/discussed to some point and no-one could come up
> with a better approach.

A lot of people are OK with the current approach. Really few
applications become unhappy if say,called "/bin/ls" instead of "ls".
So saying things are "broken" without switching to P flag is a bit
myopic view. In my experience, only some testsuites suffer failures.

The problem with updating the binfmt registration is that people may
have a mix of old and new qemu binaries. When we change the
registration, it means no old qemu anymore works. The "argc > 3" is
also a bit weak - it means that calling "ls -la ." would pass the test
even if "P" flag is not set, but qemu would pass wrong parameters to
the binary being run.

No doubt starting to use the P flag would be a improvement. But it
would be good to find a less breaky way manage the transition.

Riku
Joakim Tjernlund Aug. 18, 2014, 3:15 p.m. UTC | #11
Peter Maydell <peter.maydell@linaro.org> wrote on 2014/08/18 15:04:50:
> 
> On 18 August 2014 13:59, Joakim Tjernlund 
<joakim.tjernlund@transmode.se> wrote:
> > Peter Maydell <peter.maydell@linaro.org> wrote on 2014/08/18 14:45:49:
> >>
> >> On 18 August 2014 13:38, Joakim Tjernlund
> > <joakim.tjernlund@transmode.se> wrote:
> >> > Peter Maydell <peter.maydell@linaro.org> wrote on 2014/08/18 
12:58:48:
> >> >> Well, binfmt-misc works fine for me as it is and presumably
> >> >> for most people or we'd have had more complaints. So
> >> >> breaking all those existing working setups is really something
> >> >> we should avoid as much as possible.
> >> >
> >> > How do you use it? With LXC booting a VM with traditional init?
> >>
> >> No. Just a straightforward chroot environment with a
> >> statically linked qemu in it, and a binfmt_misc config like:
> >>
> >> e104462:trusty:qemu$ cat /proc/sys/fs/binfmt_misc/qemu-arm
> >> enabled
> >> interpreter /usr/bin/qemu-arm-static
> >
> > Where does -static come from? Is that the standard name a static 
qemu-user
> > build gets?
> 
> No. It's just what Debian and Ubuntu call their statically
> linked binaries.
> 
> >> flags: OC
> >> offset 0
> >> magic 7f454c4601010100000000000000000002002800
> >> mask ffffffffffffff00fffffffffffffffffeffffff
> >>
> >> This works fine for the things I try to run in the chroot
> >> (mostly test programs, also bash and basic command
> >> line utilities).
> >
> > Using bash as a login shell one need one of(from bash man page):
> >  A  login shell is one whose first character of argument zero is a -, 
or
> >  one started with the --login option.
> 
> Who said anything about login shells? I just chroot into the
> thing and run a shell.

Yes, that was a bit short. It was only meant as an example of what could 
break not using
P flag as bash behaves differently if invoked as login shell which could 
lead to breakage
further down the line.

 Jocke
Joakim Tjernlund Aug. 18, 2014, 3:35 p.m. UTC | #12
Riku Voipio <riku.voipio@linaro.org> wrote on 2014/08/18 15:17:06:
> 
> On 18 August 2014 15:59, Joakim Tjernlund 
<joakim.tjernlund@transmode.se> wrote:
> > Peter Maydell <peter.maydell@linaro.org> wrote on 2014/08/18 14:45:49:
> >> I'm sure there are cases which don't work; but we should try
> >> to find a way which allows us to make those work (with a
> >> recommended change to binfmt misc registration) which
> >> doesn't break the old configs in the process.
> 
> > This was considered/discussed to some point and no-one could come up
> > with a better approach.
> 
> A lot of people are OK with the current approach. Really few
> applications become unhappy if say,called "/bin/ls" instead of "ls".
> So saying things are "broken" without switching to P flag is a bit
> myopic view. In my experience, only some testsuites suffer failures.

semibroken but OK, that was a bit much too. 

> 
> The problem with updating the binfmt registration is that people may
> have a mix of old and new qemu binaries. When we change the
> registration, it means no old qemu anymore works. The "argc > 3" is
> also a bit weak - it means that calling "ls -la ." would pass the test
> even if "P" flag is not set, but qemu would pass wrong parameters to
> the binary being run.

Yes, it does not catch all error cases but I figured it was better than no
error check at all.

> 
> No doubt starting to use the P flag would be a improvement. But it
> would be good to find a less breaky way manage the transition.

Yes it would but none of us came up with a better way at the time and you 
were OK
with my patch in the end. Now I don't have time to dwell on this, sorry.

 Jocke

PS.
   Crazy idea, you could read /proc/sys/fs/binfmt_misc/$ARCH and parse the 
flags
   field if you can live with the performance hit.