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

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



On Tue, Feb 03, 2015 at 04:40:16PM -0600, Adam Borowski wrote:
Package: efivar
Version: 0.15-3
Severity: serious

I'm afraid the patch 07-num_bits.patch breaks the case of 32-bit userland
on a 64-bit kernel.  As far as I know, this is how i386 would get installed
on any non-ancient machine if d-i could get that far (it doesn't for me in
qemu-kvm.x86-64, though).

The bad assumption is that an 64-bit kernel would give the same data to any
process.  This seems to be obvious, but it's not the case:

Here's a set of sample dumps of
/sys/firmware/efi/vars/Boot0005-8be4df61-93ca-11d2-aa0d-00e098032b8c/raw_var
-- all done on the same virtual machine, same kernel, same boot-up, all that
differs is the ABI of the cat process:

cat is amd64:
00000000  42 00 6f 00 6f 00 74 00  30 00 30 00 30 00 35 00  |B.o.o.t.0.0.0.5.|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000400  61 df e4 8b ca 93 d2 11  aa 0d 00 e0 98 03 2b 8c  |a.............+.|
00000410  76 00 00 00 00 00 00 00  01 00 00 00 62 00 64 00  |v...........b.d.|
         ^^^^^^^^^^^^^^^^^^^^^^^
00000420  65 00 62 00 69 00 61 00  6e 00 00 00 04 01 2a 00  |e.b.i.a.n.....*.|
00000430  01 00 00 00 00 08 00 00  00 00 00 00 00 00 10 00  |................|
00000440  00 00 00 00 14 ab c8 38  14 e4 68 40 89 28 2a 27  |.......8..h@.(*'|
00000450  8b 45 06 d2 02 02 04 04  34 00 5c 00 45 00 46 00  |.E......4.\.E.F.|
00000460  49 00 5c 00 64 00 65 00  62 00 69 00 61 00 6e 00  |I.\.d.e.b.i.a.n.|
00000470  5c 00 67 00 72 00 75 00  62 00 78 00 36 00 34 00  |\.g.r.u.b.x.6.4.|
00000480  2e 00 65 00 66 00 69 00  00 00 7f ff 04 00 00 00  |..e.f.i.........|
00000490  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000820  07 00 00 00                                       |....|
00000824
cat is x32:
00000000  42 00 6f 00 6f 00 74 00  30 00 30 00 30 00 35 00  |B.o.o.t.0.0.0.5.|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000400  61 df e4 8b ca 93 d2 11  aa 0d 00 e0 98 03 2b 8c  |a.............+.|
00000410  76 00 00 00 01 00 00 00  62 00 64 00 65 00 62 00  |v.......b.d.e.b.|
         ^^^^^^^^^^^
00000420  69 00 61 00 6e 00 00 00  04 01 2a 00 01 00 00 00  |i.a.n.....*.....|
00000430  00 08 00 00 00 00 00 00  00 00 10 00 00 00 00 00  |................|
00000440  14 ab c8 38 14 e4 68 40  89 28 2a 27 8b 45 06 d2  |...8..h@.(*'.E..|
00000450  02 02 04 04 34 00 5c 00  45 00 46 00 49 00 5c 00  |....4.\.E.F.I.\.|
00000460  64 00 65 00 62 00 69 00  61 00 6e 00 5c 00 67 00  |d.e.b.i.a.n.\.g.|
00000470  72 00 75 00 62 00 78 00  36 00 34 00 2e 00 65 00  |r.u.b.x.6.4...e.|
00000480  66 00 69 00 00 00 7f ff  04 00 00 00 00 00 00 00  |f.i.............|
00000490  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000810  00 00 00 00 00 00 00 00  07 00 00 00              |............|
0000081c
cat is i386:
00000000  42 00 6f 00 6f 00 74 00  30 00 30 00 30 00 35 00  |B.o.o.t.0.0.0.5.|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000400  61 df e4 8b ca 93 d2 11  aa 0d 00 e0 98 03 2b 8c  |a.............+.|
00000410  76 00 00 00 01 00 00 00  62 00 64 00 65 00 62 00  |v.......b.d.e.b.|
         ^^^^^^^^^^^
00000420  69 00 61 00 6e 00 00 00  04 01 2a 00 01 00 00 00  |i.a.n.....*.....|
00000430  00 08 00 00 00 00 00 00  00 00 10 00 00 00 00 00  |................|
00000440  14 ab c8 38 14 e4 68 40  89 28 2a 27 8b 45 06 d2  |...8..h@.(*'.E..|
00000450  02 02 04 04 34 00 5c 00  45 00 46 00 49 00 5c 00  |....4.\.E.F.I.\.|
00000460  64 00 65 00 62 00 69 00  61 00 6e 00 5c 00 67 00  |d.e.b.i.a.n.\.g.|
00000470  72 00 75 00 62 00 78 00  36 00 34 00 2e 00 65 00  |r.u.b.x.6.4...e.|
00000480  66 00 69 00 00 00 7f ff  04 00 00 00 00 00 00 00  |f.i.............|
00000490  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000810  00 00 00 00 00 00 00 00  07 00 00 00              |............|
0000081c

Note that, surprisingly, the kernel detects the ABI of the running process
and presents different contents of that file on the sys fs.  This means,
runtime detection is bad as any 32-bit process will get 32-bit fields
(actually, just one, the rest is arch-independent).

Thus, to fix the issue, it seems you can drop 07-num_bits.patch and install
the patch I attached instead.  I'm afraid I can't test it save for qemu and
virtualbox at this time, though.

I'm not convinced that this doesn't break the use case in #773412 [1] since you're looking to define the type at compile-time[2], and that's precisely why #773412 came about. We'll end up replacing a bug in an unofficial port for a bug in an official port.

And while we're here... could you please add x32 to the list of architectures
in debian/control?  This would fix a FTBFS on an unofficial arch.

Yes, I can do that assuming it's not otherwise an issue.


[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=773412
[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=10;filename=efivar.patch;att=1;bug=776999

--Jared


--
Jared Domínguez
Infrastructure Software Engineering
Dell | Enterprise Solutions Group


Reply to: