qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <huth@tuxfamily.org>
To: Laurent Vivier <laurent@vivier.eu>
Cc: qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>,
	Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [Qemu-devel] [PATCH] linux-user, s390x: ignore OS ABI value in ELF header
Date: Sun, 12 Nov 2017 07:56:27 +0100	[thread overview]
Message-ID: <20171112075627.5798b8b9@thl530.multi.box> (raw)
In-Reply-To: <20171110194935.17541-1-laurent@vivier.eu>

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

  parent reply	other threads:[~2017-11-12  6:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2017-11-12  9:23   ` Laurent Vivier
2017-11-12 17:24     ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171112075627.5798b8b9@thl530.multi.box \
    --to=huth@tuxfamily.org \
    --cc=laurent@vivier.eu \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).