Package: src:qemu
Severity: normal
Tags: patch

Hello,

This bug follows #763043, with some updates.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=763043

Summary: Firstly, the byte7 should be 0xfc to correctly match both
ELF_OSABI=0 and ELF_OSABI=3. In addition, this affects not only x86_64,
but some other ports, too.

I only tried powerpc, and here is an example:

$ file /usr/lib/gcc/powerpc-linux-gnu/4.9/cc1
/usr/lib/gcc/powerpc-linux-gnu/4.9/cc1: ELF 32-bit MSB executable, PowerPC or 
cisco 4500, version 1 (GNU/Linux), dynamically linked, interpreter 
/lib/ld.so.1, for GNU/Linux 2.6.32, 
BuildID[sha1]=af334aed1745fa3623a18e6fcf6826d029e77657, stripped
$ hd /usr/lib/gcc/powerpc-linux-gnu/4.9/cc1|head -1
00000000  7f 45 4c 46 01 02 01 03  00 00 00 00 00 00 00 00  |.ELF............|

Regards,
Yixuan


-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (500, 'stable'), (500, 'oldstable'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.7-ckt9 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: sysvinit (via /sbin/init)
>From ce40902160e67adeb58a3792321840f59a651b43 Mon Sep 17 00:00:00 2001
From: Guo Yixuan <[email protected]>
Date: Thu, 7 May 2015 00:58:30 -0400
Subject: [PATCH] fix some masks for ELF_OSABI(byte7)

---
 debian/binfmt-update-in | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/debian/binfmt-update-in b/debian/binfmt-update-in
index c678d74..f83595d 100644
--- a/debian/binfmt-update-in
+++ b/debian/binfmt-update-in
@@ -31,7 +31,7 @@ mips64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xf
 mips64el_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00'
 mips64el_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
 ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14'
-ppc_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
+ppc_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
 ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
 ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
 ppc64abi32_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
@@ -51,9 +51,9 @@ sparc64_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x
 x86_64_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00'
 # linux x86_64 ELF_OSABI(byte7) can be 0 (traditional,SYSV) or 3 (GNU/LINUX extensions)
 # binfmt registration does not allow a enum, only value&mask.  So we use broader mask
-# to allow both 0 and 3 here, this also lets 1 (HPUX) and 2 (NETBSD) - 0xfb not 0xff
+# to allow both 0 and 3 here, this also lets 1 (HPUX) and 2 (NETBSD) - 0xfc not 0xff
 # alternative is to create 2 magic/mask pairs instead of one
-x86_64_mask='\xff\xff\xff\xff\xff\xfe\xfe\xfb\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
+x86_64_mask='\xff\xff\xff\xff\xff\xfe\xfe\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
 ppc64le_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15\x00'
 ppc64le_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00'
 
-- 
2.1.4

Reply via email to