* [Qemu-devel] [PATCH] linux-user, s390x: ignore OS ABI value in ELF header
@ 2017-11-10 19:49 Laurent Vivier
2017-11-10 19:52 ` no-reply
2017-11-12 6:56 ` Thomas Huth
0 siblings, 2 replies; 5+ messages in thread
From: Laurent Vivier @ 2017-11-10 19:49 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, Peter Maydell, Thomas Huth, Laurent Vivier
I have this error:
bash: /sbin/ldconfig: cannot execute binary file: Exec format error
because /sbin/ldconfig is:
ELF 64-bit MSB executable, IBM S/390, version 1 (GNU/Linux),
statically linked, for GNU/Linux 3.2.0,
BuildID[sha1]=90b64604014aafac9c1a0623b1cf447281d1a382, stripped
OS ABI is GNU/linux
"/bin/ls" works well:
ELF 64-bit MSB shared object, IBM S/390, version 1 (SYSV), dynamically linked,
interpreter /lib/ld64.so.1, for GNU/Linux 3.2.0,
BuildID[sha1]=be9b19143d4657678846f6e5277383071fc1059a, stripped
OS ABI is SYSV
To be able to execute ldconfig, this patch modifies s390x binfmt mask
to ignore the OS ABI value (EI_OSABI, byte 7).
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
scripts/qemu-binfmt-conf.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
index 8afc3eb5bb..e2e1b7544d 100755
--- a/scripts/qemu-binfmt-conf.sh
+++ b/scripts/qemu-binfmt-conf.sh
@@ -85,7 +85,7 @@ sh4eb_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
sh4eb_family=sh4
s390x_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16'
-s390x_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
+s390x_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
s390x_family=s390x
aarch64_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00'
--
2.13.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user, s390x: ignore OS ABI value in ELF header
2017-11-10 19:49 [Qemu-devel] [PATCH] linux-user, s390x: ignore OS ABI value in ELF header Laurent Vivier
@ 2017-11-10 19:52 ` no-reply
2017-11-12 6:56 ` Thomas Huth
1 sibling, 0 replies; 5+ messages in thread
From: no-reply @ 2017-11-10 19:52 UTC (permalink / raw)
To: laurent; +Cc: famz, qemu-devel, huth, peter.maydell, rth
Hi,
This series seems to have some coding style problems. See output below for
more information:
Subject: [Qemu-devel] [PATCH] linux-user, s390x: ignore OS ABI value in ELF header
Type: series
Message-id: 20171110194935.17541-1-laurent@vivier.eu
=== TEST SCRIPT BEGIN ===
#!/bin/bash
BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0
git config --local diff.renamelimit 0
git config --local diff.renames True
commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))
done
exit $failed
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/20171110194935.17541-1-laurent@vivier.eu -> patchew/20171110194935.17541-1-laurent@vivier.eu
Switched to a new branch 'test'
07d00cea5e linux-user, s390x: ignore OS ABI value in ELF header
=== OUTPUT BEGIN ===
Checking PATCH 1/1: linux-user, s390x: ignore OS ABI value in ELF header...
ERROR: line over 90 characters
#39: FILE: scripts/qemu-binfmt-conf.sh:88:
+s390x_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
total: 1 errors, 0 warnings, 8 lines checked
Your patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user, s390x: ignore OS ABI value in ELF header
2017-11-10 19:49 [Qemu-devel] [PATCH] linux-user, s390x: ignore OS ABI value in ELF header Laurent Vivier
2017-11-10 19:52 ` no-reply
@ 2017-11-12 6:56 ` Thomas Huth
2017-11-12 9:23 ` Laurent Vivier
1 sibling, 1 reply; 5+ messages in thread
From: Thomas Huth @ 2017-11-12 6:56 UTC (permalink / raw)
To: Laurent Vivier; +Cc: qemu-devel, Richard Henderson, Peter Maydell
Am Fri, 10 Nov 2017 20:49:35 +0100
schrieb Laurent Vivier <laurent@vivier.eu>:
> I have this error:
> bash: /sbin/ldconfig: cannot execute binary file: Exec format error
>
> because /sbin/ldconfig is:
> ELF 64-bit MSB executable, IBM S/390, version 1 (GNU/Linux),
> statically linked, for GNU/Linux 3.2.0,
> BuildID[sha1]=90b64604014aafac9c1a0623b1cf447281d1a382, stripped
>
> OS ABI is GNU/linux
>
> "/bin/ls" works well:
>
> ELF 64-bit MSB shared object, IBM S/390, version 1 (SYSV),
> dynamically linked, interpreter /lib/ld64.so.1, for GNU/Linux 3.2.0,
> BuildID[sha1]=be9b19143d4657678846f6e5277383071fc1059a, stripped
>
> OS ABI is SYSV
>
> To be able to execute ldconfig, this patch modifies s390x binfmt mask
> to ignore the OS ABI value (EI_OSABI, byte 7).
>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
> scripts/qemu-binfmt-conf.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
> index 8afc3eb5bb..e2e1b7544d 100755
> --- a/scripts/qemu-binfmt-conf.sh
> +++ b/scripts/qemu-binfmt-conf.sh
> @@ -85,7 +85,7 @@
> sh4eb_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
> sh4eb_family=sh4
> s390x_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16'
> -s390x_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
> +s390x_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
If I've got that right, the OSABI field should either be 0 for
"No extensions or unspecified" (which is then printed by "file"
as SYSV) or 3 for "GNU/Linux".
Thus wouldn't it be better to use a mask of 0xfc here instead, so
that we refuse at least everything with a value > 3 here?
Also I wonder whether i386 has the same problem, too?
Thomas
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user, s390x: ignore OS ABI value in ELF header
2017-11-12 6:56 ` Thomas Huth
@ 2017-11-12 9:23 ` Laurent Vivier
2017-11-12 17:24 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 5+ messages in thread
From: Laurent Vivier @ 2017-11-12 9:23 UTC (permalink / raw)
To: Thomas Huth; +Cc: qemu-devel, Richard Henderson, Peter Maydell
Le 12/11/2017 à 07:56, Thomas Huth a écrit :
> Am Fri, 10 Nov 2017 20:49:35 +0100
> schrieb Laurent Vivier <laurent@vivier.eu>:
>
>> I have this error:
>> bash: /sbin/ldconfig: cannot execute binary file: Exec format error
>>
>> because /sbin/ldconfig is:
>> ELF 64-bit MSB executable, IBM S/390, version 1 (GNU/Linux),
>> statically linked, for GNU/Linux 3.2.0,
>> BuildID[sha1]=90b64604014aafac9c1a0623b1cf447281d1a382, stripped
>>
>> OS ABI is GNU/linux
>>
>> "/bin/ls" works well:
>>
>> ELF 64-bit MSB shared object, IBM S/390, version 1 (SYSV),
>> dynamically linked, interpreter /lib/ld64.so.1, for GNU/Linux 3.2.0,
>> BuildID[sha1]=be9b19143d4657678846f6e5277383071fc1059a, stripped
>>
>> OS ABI is SYSV
>>
>> To be able to execute ldconfig, this patch modifies s390x binfmt mask
>> to ignore the OS ABI value (EI_OSABI, byte 7).
>>
>> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
>> ---
>> scripts/qemu-binfmt-conf.sh | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
>> index 8afc3eb5bb..e2e1b7544d 100755
>> --- a/scripts/qemu-binfmt-conf.sh
>> +++ b/scripts/qemu-binfmt-conf.sh
>> @@ -85,7 +85,7 @@
>> sh4eb_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
>> sh4eb_family=sh4
>> s390x_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16'
>> -s390x_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
>> +s390x_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
>
> If I've got that right, the OSABI field should either be 0 for
> "No extensions or unspecified" (which is then printed by "file"
> as SYSV) or 3 for "GNU/Linux".
> Thus wouldn't it be better to use a mask of 0xfc here instead, so
> that we refuse at least everything with a value > 3 here?
No, because with this mask you allow HPUX and NetBSD (See
/usr/include/elf.h), I don't think it's really better. The simplest way
to manage this is to ignore the field. A better way should be to have
two binfmt entries, one for SYSV and one for GNU/Linux, but as our goal
is to run linux binaries on linux system, is it worth it?
Most of the other archs use already 0.
>
> Also I wonder whether i386 has the same problem, too?
>
Yes, I think all targets can have the same problem (I have with m68k,
but with the gcc-7/cc1 binary).
Thanks,
Laurent
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user, s390x: ignore OS ABI value in ELF header
2017-11-12 9:23 ` Laurent Vivier
@ 2017-11-12 17:24 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-11-12 17:24 UTC (permalink / raw)
To: Laurent Vivier, Thomas Huth; +Cc: Peter Maydell, qemu-devel, Richard Henderson
On 11/12/2017 06:23 AM, Laurent Vivier wrote:
> Le 12/11/2017 à 07:56, Thomas Huth a écrit :
>> Am Fri, 10 Nov 2017 20:49:35 +0100
>> schrieb Laurent Vivier <laurent@vivier.eu>:
>>
>>> I have this error:
>>> bash: /sbin/ldconfig: cannot execute binary file: Exec format error
>>>
>>> because /sbin/ldconfig is:
>>> ELF 64-bit MSB executable, IBM S/390, version 1 (GNU/Linux),
>>> statically linked, for GNU/Linux 3.2.0,
>>> BuildID[sha1]=90b64604014aafac9c1a0623b1cf447281d1a382, stripped
>>>
>>> OS ABI is GNU/linux
>>>
>>> "/bin/ls" works well:
>>>
>>> ELF 64-bit MSB shared object, IBM S/390, version 1 (SYSV),
>>> dynamically linked, interpreter /lib/ld64.so.1, for GNU/Linux 3.2.0,
>>> BuildID[sha1]=be9b19143d4657678846f6e5277383071fc1059a, stripped
>>>
>>> OS ABI is SYSV
>>>
>>> To be able to execute ldconfig, this patch modifies s390x binfmt mask
>>> to ignore the OS ABI value (EI_OSABI, byte 7).
>>>
>>> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
>>> ---
>>> scripts/qemu-binfmt-conf.sh | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
>>> index 8afc3eb5bb..e2e1b7544d 100755
>>> --- a/scripts/qemu-binfmt-conf.sh
>>> +++ b/scripts/qemu-binfmt-conf.sh
>>> @@ -85,7 +85,7 @@
>>> sh4eb_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
>>> sh4eb_family=sh4
>>> s390x_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16'
>>> -s390x_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
>>> +s390x_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
>>
>> If I've got that right, the OSABI field should either be 0 for
>> "No extensions or unspecified" (which is then printed by "file"
>> as SYSV) or 3 for "GNU/Linux".
>> Thus wouldn't it be better to use a mask of 0xfc here instead, so
>> that we refuse at least everything with a value > 3 here?
> No, because with this mask you allow HPUX and NetBSD (See
> /usr/include/elf.h), I don't think it's really better. The simplest way
> to manage this is to ignore the field. A better way should be to have
> two binfmt entries, one for SYSV and one for GNU/Linux, but as our goal
> is to run linux binaries on linux system, is it worth it?
This was my first thought when I reviewed your patch, this indeed looks
cleaner and would be self-explanatory.
Regards,
Phil.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-11-12 17:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-10 19:49 [Qemu-devel] [PATCH] linux-user, s390x: ignore OS ABI value in ELF header Laurent Vivier
2017-11-10 19:52 ` no-reply
2017-11-12 6:56 ` Thomas Huth
2017-11-12 9:23 ` Laurent Vivier
2017-11-12 17:24 ` Philippe Mathieu-Daudé
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.