[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#776999: broken 32-bit userland on 64-bit kernel



On Wed, Feb 04, 2015 at 06:04:00PM -0600, D. Jared Dominguez wrote:
> In other words, 32-bit efivar/efibootmgr on 64-bit kernel is going
> to get the same value from the kernel as 64-bit efivar/efibootmgr on
> 64-bit. With the x32 ABI, you're going to see the same value on a
> 64-bit kernel (through the x32 ABI) as you would see on a 32-bit
> kernel. So we need some way to determine not just whether the kernel
> 32-bit or 64-bit but if 64-bit, whether we're using the x32 ABI.

No:
apt-get install busybox-static:amd64
file /bin/busybox
/bin/busybox: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.32, BuildID[sha1]=a27daca7e9e5371ce77039507c4e2bd47440fdcd, stripped
busybox cat raw_var|hd
00000410  76 00 00 00 00 00 00 00  01 00 00 00 62 00 64 00  |v...........b.d.|
apt-get install busybox-static:i386
file /bin/busybox
/bin/busybox: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, for GNU/Linux 2.6.32, BuildID[sha1]=aa0144e035e833cab6e746c55316451b7b2b1dc6, stripped
00000410  76 00 00 00 01 00 00 00  62 00 64 00 65 00 62 00  |v.......b.d.e.b.|
apt-get install busybox-static:x32
file /bin/busybox
/bin/busybox: ELF 32-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 3.4.0, BuildID[sha1]=41712644f83d7ef27e025f3c74482db6d50fe250, stripped
00000410  76 00 00 00 01 00 00 00  62 00 64 00 65 00 62 00  |v.......b.d.e.b.|

It's the same for i386 and x32, and what's more important (release arch) is
that it's not same for i386 and amd64.

The current version of efivar assumes that, if uname -m returns something
that includes a substring "64", the field is uint64_t.  That's ok on amd64,
wrong on both i386 and x32.

So at least on my test setup (kernel 3.16.0-4-amd64 in qemu invoked with:
"qemu-system-x86_64 -enable-kvm -m 2048 -bios /usr/share/qemu/OVMF.fd ...")
the field is uint32_t for 32-bit processes, and thus efivar returns junk.

-- 
// If you believe in so-called "intellectual property", please immediately
// cease using counterfeit alphabets.  Instead, contact the nearest temple
// of Amon, whose priests will provide you with scribal services for all
// your writing needs, for Reasonable and Non-Discriminatory prices.


Reply to: