public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
* Boot with EFI stub fails on VMWare during decompression
@ 2015-01-16 10:03 Bruno Prémont
       [not found] ` <20150116110344.715cc887-I2t2yFIzmohO7ya8xxV06g@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Bruno Prémont @ 2015-01-16 10:03 UTC (permalink / raw)
  To: Matt Fleming, linux-efi

I have a few systems that don't boot on some VMWare nodes using EFI stub.

Kernel boots on VMWare ESXi 5.1 but has trouble on ESXi 5.5.

>From behavior it seems very much related to memory layout as just
adding a few efi_printk() into EFI stub gets the otherwise same kernel
to boot. Also the kernel does boot on another VMWare node.

Kernel I'm using: 3.18.2

I've take a snapshot that i converted to core dump. Poking at it with
gdb it looks like kernel gets stuck in misc.o somewhere during zlib
decompression.


Register dump:
rax            0x1000   4096
rbx            0x23f78cb        37714123
rcx            0x0      0
rdx            0x0      0
rsi            0x0      0
rdi            0x23f7863        37714019
rbp            0x1a363b4        0x1a363b4
rsp            0x2404b20        0x2404b20
r8             0x2404ee0        37768928
r9             0x4      4
r10            0x3      3
r11            0x9      9
r12            0x13dcbbc        20827068
r13            0x1e000000       503316480      (this seems to point to decompressed kernel)
r14            0x9b8ea7 10194599
r15            0x23f8bc0        37718976
rip            0x23f21f9        0x23f21f9
eflags         0x46     [ PF ZF ]
cs             0x18     24
ss             0x0      0
ds             0x0      0
es             0x0      0
fs             0x0      0
gs             0x0      0


Code disassembly:
Dump of assembler code from 0x23f21d0 to 0x23f22f8:
   0x00000000023f21d0:  53      push   %rbx
   0x00000000023f21d1:  48 89 fb        mov    %rdi,%rbx
   0x00000000023f21d4:  48 8d 3d 85 56 00 00    lea    0x5685(%rip),%rdi        # 0x23f7860
   0x00000000023f21db:  e8 50 fe ff ff  callq  0x23f2030
   0x00000000023f21e0:  48 89 df        mov    %rbx,%rdi
   0x00000000023f21e3:  e8 48 fe ff ff  callq  0x23f2030
   0x00000000023f21e8:  48 8d 3d 74 56 00 00    lea    0x5674(%rip),%rdi        # 0x23f7863
   0x00000000023f21ef:  e8 3c fe ff ff  callq  0x23f2030
   0x00000000023f21f4:  0f 1f 40 00     nopl   0x0(%rax)
   0x00000000023f21f8:  f4      hlt    
=> 0x00000000023f21f9:  eb fd   jmp    0x23f21f8
   0x00000000023f21fb:  0f 1f 44 00 00  nopl   0x0(%rax,%rax,1)
   0x00000000023f2200:  41 57   push   %r15
   0x00000000023f2202:  4d 89 c7        mov    %r8,%r15
   0x00000000023f2205:  41 56   push   %r14
   0x00000000023f2207:  49 89 ce        mov    %rcx,%r14
   0x00000000023f220a:  41 55   push   %r13
   0x00000000023f220c:  49 89 fd        mov    %rdi,%r13
   0x00000000023f220f:  41 54   push   %r12
   0x00000000023f2211:  4d 89 cc        mov    %r9,%r12
   0x00000000023f2214:  55      push   %rbp
   0x00000000023f2215:  48 89 d5        mov    %rdx,%rbp
   0x00000000023f2218:  53      push   %rbx
   0x00000000023f2219:  48 89 f3        mov    %rsi,%rbx
   0x00000000023f221c:  48 83 ec 48     sub    $0x48,%rsp
   0x00000000023f2220:  80 bf ef 01 00 00 00    cmpb   $0x0,0x1ef(%rdi)
   0x00000000023f2227:  48 8b 05 8a 68 00 00    mov    0x688a(%rip),%rax        # 0x23f8ab8
   0x00000000023f222e:  48 89 38        mov    %rdi,(%rax)
   0x00000000023f2231:  74 69   je     0x23f229c
   0x00000000023f2233:  48 8d bf c0 00 00 00    lea    0xc0(%rdi),%rdi
   0x00000000023f223a:  ba 00 01 00 00  mov    $0x100,%edx
   0x00000000023f223f:  31 f6   xor    %esi,%esi
   0x00000000023f2241:  e8 0a 08 00 00  callq  0x23f2a50
   0x00000000023f2246:  49 8d bd eb 01 00 00    lea    0x1eb(%r13),%rdi
   0x00000000023f224d:  ba 06 00 00 00  mov    $0x6,%edx
   0x00000000023f2252:  31 f6   xor    %esi,%esi
   0x00000000023f2254:  e8 f7 07 00 00  callq  0x23f2a50
   0x00000000023f2259:  49 8d bd 68 02 00 00    lea    0x268(%r13),%rdi
   0x00000000023f2260:  ba 28 00 00 00  mov    $0x28,%edx
   0x00000000023f2265:  31 f6   xor    %esi,%esi
   0x00000000023f2267:  e8 e4 07 00 00  callq  0x23f2a50
   0x00000000023f226c:  49 8d bd d0 0c 00 00    lea    0xcd0(%r13),%rdi
   0x00000000023f2273:  ba 30 00 00 00  mov    $0x30,%edx
   0x00000000023f2278:  31 f6   xor    %esi,%esi
   0x00000000023f227a:  e8 d1 07 00 00  callq  0x23f2a50
   0x00000000023f227f:  49 8d bd ec 0e 00 00    lea    0xeec(%r13),%rdi
   0x00000000023f2286:  ba 14 01 00 00  mov    $0x114,%edx
   0x00000000023f228b:  31 f6   xor    %esi,%esi
   0x00000000023f228d:  e8 be 07 00 00  callq  0x23f2a50
   0x00000000023f2292:  48 8b 05 1f 68 00 00    mov    0x681f(%rip),%rax        # 0x23f8ab8
   0x00000000023f2299:  4c 8b 28        mov    (%rax),%r13
   0x00000000023f229c:  41 80 7d 06 07  cmpb   $0x7,0x6(%r13)
   0x00000000023f22a1:  0f 84 69 01 00 00       je     0x23f2410
   0x00000000023f22a7:  48 c7 05 2e 29 01 00 00 80 0b 00        movq   $0xb8000,0x1292e(%rip)        # 0x2404be0
   0x00000000023f22b2:  c7 05 1c 29 01 00 d4 03 00 00   movl   $0x3d4,0x1291c(%rip)        # 0x2404bd8
   0x00000000023f22bc:  41 0f b6 45 0e  movzbl 0xe(%r13),%eax
   0x00000000023f22c1:  89 05 0d 29 01 00       mov    %eax,0x1290d(%rip)        # 0x2404bd4
   0x00000000023f22c7:  41 0f b6 45 07  movzbl 0x7(%r13),%eax
   0x00000000023f22cc:  89 05 fe 28 01 00       mov    %eax,0x128fe(%rip)        # 0x2404bd0
   0x00000000023f22d2:  e8 b9 0b 00 00  callq  0x23f2e90
   0x00000000023f22d7:  48 8d 3d 9a 56 00 00    lea    0x569a(%rip),%rdi        # 0x23f7978
   0x00000000023f22de:  e8 4d fd ff ff  callq  0x23f2030
   0x00000000023f22e3:  48 8b 05 de 67 00 00    mov    0x67de(%rip),%rax        # 0x23f8ac8
   0x00000000023f22ea:  4c 39 a4 24 80 00 00 00 cmp    %r12,0x80(%rsp)
   0x00000000023f22f2:  4c 89 e1        mov    %r12,%rcx
   0x00000000023f22f5:  48 0f 43 8c 24 80 00 00 00      cmovae 0x80(%rsp),%rcx

Objdump of arch/x86/boot/compressed/misc.o:
0000000000002de0 <error>:
    2de0:       53                      push   %rbx
    2de1:       48 89 fb                mov    %rdi,%rbx
    2de4:       48 8d 3d 00 00 00 00    lea    0x0(%rip),%rdi        # 2deb <zlib_updatewindow+0x2d7b>
    2deb:       e8 00 00 00 00          callq  2df0 <zlib_updatewindow+0x2d80>
    2df0:       48 89 df                mov    %rbx,%rdi
    2df3:       e8 00 00 00 00          callq  2df8 <zlib_updatewindow+0x2d88>
    2df8:       48 8d 3d 00 00 00 00    lea    0x0(%rip),%rdi        # 2dff <zlib_updatewindow+0x2d8f>
    2dff:       e8 00 00 00 00          callq  2e04 <zlib_updatewindow+0x2d94>
    2e04:       0f 1f 40 00             nopl   0x0(%rax)
    2e08:       f4                      hlt    
=>  2e09:       eb fd                   jmp    2e08 <zlib_updatewindow+0x2d98>
    2e0b:       0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)

0000000000002e10 <decompress_kernel>:
    2e10:       41 57                   push   %r15
    2e12:       4d 89 c7                mov    %r8,%r15
    2e15:       41 56                   push   %r14
    2e17:       49 89 ce                mov    %rcx,%r14
    2e1a:       41 55                   push   %r13
    2e1c:       49 89 fd                mov    %rdi,%r13
    2e1f:       41 54                   push   %r12
    2e21:       4d 89 cc                mov    %r9,%r12
    2e24:       55                      push   %rbp
    2e25:       48 89 d5                mov    %rdx,%rbp
    2e28:       53                      push   %rbx
    2e29:       48 89 f3                mov    %rsi,%rbx
    2e2c:       48 83 ec 48             sub    $0x48,%rsp
    2e30:       80 bf ef 01 00 00 00    cmpb   $0x0,0x1ef(%rdi)
    2e37:       48 8b 05 00 00 00 00    mov    0x0(%rip),%rax        # 2e3e <zlib_updatewindow+0x2dce>


Possibly of interest, on the VMWare node where the kernel boots I get this memory mapping:
[    0.000000] efi: EFI v2.30 by VMware, Inc.
[    0.000000] efi:  SMBIOS=0x1ffa8000  ACPI 2.0=0x1ff99000 
[    0.000000] efi: mem00: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000000000-0x0000000000001000) (0MB)
[    0.000000] efi: mem01: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000001000-0x0000000000007000) (0MB)
[    0.000000] efi: mem02: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000007000-0x00000000000a0000) (0MB)
[    0.000000] efi: mem03: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000100000-0x0000000001000000) (15MB)
[    0.000000] efi: mem04: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000001000000-0x000000000240b000) (20MB)
[    0.000000] efi: mem05: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000000240b000-0x000000001b1bc000) (397MB)
[    0.000000] efi: mem06: [Loader Code        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001b1bc000-0x000000001d5c7000) (36MB)
[    0.000000] efi: mem07: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001d5c7000-0x000000001df83000) (9MB)
[    0.000000] efi: mem08: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001df83000-0x000000001df8e000) (0MB)
[    0.000000] efi: mem09: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001df8e000-0x000000001dfaf000) (0MB)
[    0.000000] efi: mem10: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dfaf000-0x000000001dfb2000) (0MB)
[    0.000000] efi: mem11: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dfb2000-0x000000001dfc4000) (0MB)
[    0.000000] efi: mem12: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dfc4000-0x000000001dfc5000) (0MB)
[    0.000000] efi: mem13: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dfc5000-0x000000001e61a000) (6MB)
[    0.000000] efi: mem14: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e61a000-0x000000001e6d8000) (0MB)
[    0.000000] efi: mem15: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e6d8000-0x000000001e6e7000) (0MB)
[    0.000000] efi: mem16: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e6e7000-0x000000001e6ed000) (0MB)
[    0.000000] efi: mem17: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e6ed000-0x000000001e6ee000) (0MB)
[    0.000000] efi: mem18: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e6ee000-0x000000001e71b000) (0MB)
[    0.000000] efi: mem19: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e71b000-0x000000001e71e000) (0MB)
[    0.000000] efi: mem20: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e71e000-0x000000001e724000) (0MB)
[    0.000000] efi: mem21: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e724000-0x000000001e725000) (0MB)
[    0.000000] efi: mem22: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e725000-0x000000001e729000) (0MB)
[    0.000000] efi: mem23: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e729000-0x000000001e72a000) (0MB)
[    0.000000] efi: mem24: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e72a000-0x000000001e751000) (0MB)
[    0.000000] efi: mem25: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e751000-0x000000001e754000) (0MB)
[    0.000000] efi: mem26: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e754000-0x000000001e755000) (0MB)
[    0.000000] efi: mem27: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e755000-0x000000001e756000) (0MB)
[    0.000000] efi: mem28: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e756000-0x000000001e75e000) (0MB)
[    0.000000] efi: mem29: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e75e000-0x000000001e760000) (0MB)
[    0.000000] efi: mem30: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e760000-0x000000001e76f000) (0MB)
[    0.000000] efi: mem31: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e76f000-0x000000001ee83000) (7MB)
[    0.000000] efi: mem32: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ee83000-0x000000001ee8c000) (0MB)
[    0.000000] efi: mem33: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ee8c000-0x000000001fe30000) (15MB)
[    0.000000] efi: mem34: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001fe30000-0x000000001fe43000) (0MB)
[    0.000000] efi: mem35: [Runtime Code       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001fe43000-0x000000001fe48000) (0MB)
[    0.000000] efi: mem36: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001fe48000-0x000000001ff20000) (0MB)
[    0.000000] efi: mem37: [Runtime Code       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff20000-0x000000001ff40000) (0MB)
[    0.000000] efi: mem38: [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff40000-0x000000001ff8a000) (0MB)
[    0.000000] efi: mem39: [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff8a000-0x000000001ff90000) (0MB)
[    0.000000] efi: mem40: [ACPI Reclaim Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff90000-0x000000001ff99000) (0MB)
[    0.000000] efi: mem41: [ACPI Reclaim Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff99000-0x000000001ffa8000) (0MB)
[    0.000000] efi: mem42: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ffa8000-0x000000001ffaa000) (0MB)
[    0.000000] efi: mem43: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ffaa000-0x000000001ffaf000) (0MB)
[    0.000000] efi: mem44: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ffaf000-0x000000001ffb0000) (0MB)
[    0.000000] efi: mem45: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ffb0000-0x0000000020000000) (0MB)
[    0.000000] efi: mem46: [Memory Mapped I/O  |RUN|  |  |  |   |  |  |  |  ] range=[0x00000000ffc00000-0x00000000ffc18000) (0MB)
[    0.000000] SMBIOS 2.6 present.
[    0.000000] DMI: VMware, Inc. VMware7,1/440BX Desktop Reference Platform, BIOS VMW71.00V.0.B64.1309111724 09/11/2013

while on the failing one I get (just enough efi_printk to cause kernel to boot):
[    0.000000] efi: EFI v2.30 by VMware, Inc.
[    0.000000] efi:  SMBIOS=0x1ffaf000  ACPI 2.0=0x1ff9f000 
[    0.000000] efi: mem00: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000000000-0x0000000000001000) (0MB)
[    0.000000] efi: mem01: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000001000-0x0000000000007000) (0MB)
[    0.000000] efi: mem02: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000007000-0x00000000000a0000) (0MB)
[    0.000000] efi: mem03: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000100000-0x0000000001000000) (15MB)
[    0.000000] efi: mem04: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000001000000-0x000000000240b000) (20MB)
[    0.000000] efi: mem05: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000000240b000-0x000000001ae96000) (394MB)
[    0.000000] efi: mem06: [Loader Code        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ae96000-0x000000001d2a1000) (36MB)
[    0.000000] efi: mem07: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001d2a1000-0x000000001dc68000) (9MB)
[    0.000000] efi: mem08: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dc68000-0x000000001dcb3000) (0MB)
[    0.000000] efi: mem09: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcb3000-0x000000001dcdb000) (0MB)
[    0.000000] efi: mem10: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcdb000-0x000000001dce9000) (0MB)
[    0.000000] efi: mem11: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dce9000-0x000000001dcea000) (0MB)
[    0.000000] efi: mem12: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcea000-0x000000001dcec000) (0MB)
[    0.000000] efi: mem13: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcec000-0x000000001dcfb000) (0MB)
[    0.000000] efi: mem14: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcfb000-0x000000001dcfc000) (0MB)
[    0.000000] efi: mem15: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcfc000-0x000000001dcfd000) (0MB)
[    0.000000] efi: mem16: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcfd000-0x000000001dcfe000) (0MB)
[    0.000000] efi: mem17: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcfe000-0x000000001ddd8000) (0MB)
[    0.000000] efi: mem18: [Loader Code        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ddd8000-0x000000001deb0000) (0MB)
[    0.000000] efi: mem19: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001deb0000-0x000000001decf000) (0MB)
[    0.000000] efi: mem20: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001decf000-0x000000001dee0000) (0MB)
[    0.000000] efi: mem21: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dee0000-0x000000001dee6000) (0MB)
[    0.000000] efi: mem22: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dee6000-0x000000001dee8000) (0MB)
[    0.000000] efi: mem23: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dee8000-0x000000001e547000) (6MB)
[    0.000000] efi: mem24: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e547000-0x000000001e58b000) (0MB)
[    0.000000] efi: mem25: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e58b000-0x000000001e58c000) (0MB)
[    0.000000] efi: mem26: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e58c000-0x000000001e590000) (0MB)
[    0.000000] efi: mem27: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e590000-0x000000001e591000) (0MB)
[    0.000000] efi: mem28: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e591000-0x000000001e5a0000) (0MB)
[    0.000000] efi: mem29: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e5a0000-0x000000001e5a2000) (0MB)
[    0.000000] efi: mem30: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e5a2000-0x000000001e602000) (0MB)
[    0.000000] efi: mem31: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e602000-0x000000001e604000) (0MB)
[    0.000000] efi: mem32: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e604000-0x000000001e613000) (0MB)
[    0.000000] efi: mem33: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e613000-0x000000001e614000) (0MB)
[    0.000000] efi: mem34: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e614000-0x000000001e645000) (0MB)
[    0.000000] efi: mem35: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e645000-0x000000001e648000) (0MB)
[    0.000000] efi: mem36: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e648000-0x000000001e64f000) (0MB)
[    0.000000] efi: mem37: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e64f000-0x000000001e651000) (0MB)
[    0.000000] efi: mem38: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e651000-0x000000001e656000) (0MB)
[    0.000000] efi: mem39: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e656000-0x000000001e657000) (0MB)
[    0.000000] efi: mem40: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e657000-0x000000001e66c000) (0MB)
[    0.000000] efi: mem41: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e66c000-0x000000001e66d000) (0MB)
[    0.000000] efi: mem42: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e66d000-0x000000001e69c000) (0MB)
[    0.000000] efi: mem43: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e69c000-0x000000001e6a2000) (0MB)
[    0.000000] efi: mem44: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e6a2000-0x000000001e6ad000) (0MB)
[    0.000000] efi: mem45: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e6ad000-0x000000001e9b3000) (3MB)
[    0.000000] efi: mem46: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e9b3000-0x000000001e9c2000) (0MB)
[    0.000000] efi: mem47: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e9c2000-0x000000001edd3000) (4MB)
[    0.000000] efi: mem48: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001edd3000-0x000000001eddc000) (0MB)
[    0.000000] efi: mem49: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001eddc000-0x000000001fe31000) (16MB)
[    0.000000] efi: mem50: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001fe31000-0x000000001fe33000) (0MB)
[    0.000000] efi: mem51: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001fe33000-0x000000001fe3c000) (0MB)
[    0.000000] efi: mem52: [Runtime Code       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001fe3c000-0x000000001fe44000) (0MB)
[    0.000000] efi: mem53: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001fe44000-0x000000001ff21000) (0MB)
[    0.000000] efi: mem54: [Runtime Code       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff21000-0x000000001ff41000) (0MB)
[    0.000000] efi: mem55: [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff41000-0x000000001ff8b000) (0MB)
[    0.000000] efi: mem56: [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff8b000-0x000000001ff91000) (0MB)
[    0.000000] efi: mem57: [ACPI Reclaim Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff91000-0x000000001ff9f000) (0MB)
[    0.000000] efi: mem58: [ACPI Reclaim Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff9f000-0x000000001ffad000) (0MB)
[    0.000000] efi: mem59: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ffad000-0x000000001ffae000) (0MB)
[    0.000000] efi: mem60: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ffae000-0x000000001ffb1000) (0MB)
[    0.000000] efi: mem61: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ffb1000-0x0000000020000000) (0MB)
[    0.000000] efi: mem62: [Memory Mapped I/O  |RUN|  |  |  |   |  |  |  |  ] range=[0x00000000ffc00000-0x00000000ffc18000) (0MB)
[    0.000000] SMBIOS 2.6 present.
[    0.000000] DMI: VMware, Inc. VMware7,1/440BX Desktop Reference Platform, BIOS VMW71.00V.0.B64.1404140612 04/14/2014

Size of bzImage: 10250672
Size of vmlinus: 28188076
Big size is due to included initrd.

Any idea where to search further or how to gather some more useful data with GDB?

Thanks,
Bruno

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Boot with EFI stub fails on VMWare during decompression
       [not found] ` <20150116110344.715cc887-I2t2yFIzmohO7ya8xxV06g@public.gmane.org>
@ 2015-01-16 11:15   ` Bruno Prémont
       [not found]     ` <20150116121545.56e4454b-I2t2yFIzmohO7ya8xxV06g@public.gmane.org>
  2015-01-20 19:02   ` Matt Fleming
  1 sibling, 1 reply; 7+ messages in thread
From: Bruno Prémont @ 2015-01-16 11:15 UTC (permalink / raw)
  To: Matt Fleming, linux-efi

On Fri, 16 Jan 2015 11:03:44 +0100 Bruno Prémont wrote:
> I have a few systems that don't boot on some VMWare nodes using EFI stub.
> 
> Kernel boots on VMWare ESXi 5.1 but has trouble on ESXi 5.5.
> 
> From behavior it seems very much related to memory layout as just
> adding a few efi_printk() into EFI stub gets the otherwise same kernel
> to boot. Also the kernel does boot on another VMWare node.
> 
> Kernel I'm using: 3.18.2
> 
> I've take a snapshot that i converted to core dump. Poking at it with
> gdb it looks like kernel gets stuck in misc.o somewhere during zlib
> decompression.
> 
> 
> Register dump:
> rax            0x1000   4096
> rbx            0x23f78cb        37714123
> rcx            0x0      0
> rdx            0x0      0
> rsi            0x0      0
> rdi            0x23f7863        37714019
> rbp            0x1a363b4        0x1a363b4
> rsp            0x2404b20        0x2404b20
> r8             0x2404ee0        37768928
> r9             0x4      4
> r10            0x3      3
> r11            0x9      9
> r12            0x13dcbbc        20827068
> r13            0x1e000000       503316480      (this seems to point to decompressed kernel)
> r14            0x9b8ea7 10194599
> r15            0x23f8bc0        37718976
> rip            0x23f21f9        0x23f21f9
> eflags         0x46     [ PF ZF ]
> cs             0x18     24
> ss             0x0      0
> ds             0x0      0
> es             0x0      0
> fs             0x0      0
> gs             0x0      0
> 
> 
> Code disassembly:
> Dump of assembler code from 0x23f21d0 to 0x23f22f8:
>    0x00000000023f21d0:  53      push   %rbx
>    0x00000000023f21d1:  48 89 fb        mov    %rdi,%rbx
>    0x00000000023f21d4:  48 8d 3d 85 56 00 00    lea    0x5685(%rip),%rdi        # 0x23f7860
>    0x00000000023f21db:  e8 50 fe ff ff  callq  0x23f2030
>    0x00000000023f21e0:  48 89 df        mov    %rbx,%rdi
>    0x00000000023f21e3:  e8 48 fe ff ff  callq  0x23f2030
>    0x00000000023f21e8:  48 8d 3d 74 56 00 00    lea    0x5674(%rip),%rdi        # 0x23f7863
>    0x00000000023f21ef:  e8 3c fe ff ff  callq  0x23f2030
>    0x00000000023f21f4:  0f 1f 40 00     nopl   0x0(%rax)
>    0x00000000023f21f8:  f4      hlt    
> => 0x00000000023f21f9:  eb fd   jmp    0x23f21f8
>    0x00000000023f21fb:  0f 1f 44 00 00  nopl   0x0(%rax,%rax,1)
>    0x00000000023f2200:  41 57   push   %r15
>    0x00000000023f2202:  4d 89 c7        mov    %r8,%r15
>    0x00000000023f2205:  41 56   push   %r14
>    0x00000000023f2207:  49 89 ce        mov    %rcx,%r14
>    0x00000000023f220a:  41 55   push   %r13
>    0x00000000023f220c:  49 89 fd        mov    %rdi,%r13
>    0x00000000023f220f:  41 54   push   %r12
>    0x00000000023f2211:  4d 89 cc        mov    %r9,%r12
>    0x00000000023f2214:  55      push   %rbp
>    0x00000000023f2215:  48 89 d5        mov    %rdx,%rbp
>    0x00000000023f2218:  53      push   %rbx
>    0x00000000023f2219:  48 89 f3        mov    %rsi,%rbx
>    0x00000000023f221c:  48 83 ec 48     sub    $0x48,%rsp
>    0x00000000023f2220:  80 bf ef 01 00 00 00    cmpb   $0x0,0x1ef(%rdi)
>    0x00000000023f2227:  48 8b 05 8a 68 00 00    mov    0x688a(%rip),%rax        # 0x23f8ab8
>    0x00000000023f222e:  48 89 38        mov    %rdi,(%rax)
>    0x00000000023f2231:  74 69   je     0x23f229c
>    0x00000000023f2233:  48 8d bf c0 00 00 00    lea    0xc0(%rdi),%rdi
>    0x00000000023f223a:  ba 00 01 00 00  mov    $0x100,%edx
>    0x00000000023f223f:  31 f6   xor    %esi,%esi
>    0x00000000023f2241:  e8 0a 08 00 00  callq  0x23f2a50
>    0x00000000023f2246:  49 8d bd eb 01 00 00    lea    0x1eb(%r13),%rdi
>    0x00000000023f224d:  ba 06 00 00 00  mov    $0x6,%edx
>    0x00000000023f2252:  31 f6   xor    %esi,%esi
>    0x00000000023f2254:  e8 f7 07 00 00  callq  0x23f2a50
>    0x00000000023f2259:  49 8d bd 68 02 00 00    lea    0x268(%r13),%rdi
>    0x00000000023f2260:  ba 28 00 00 00  mov    $0x28,%edx
>    0x00000000023f2265:  31 f6   xor    %esi,%esi
>    0x00000000023f2267:  e8 e4 07 00 00  callq  0x23f2a50
>    0x00000000023f226c:  49 8d bd d0 0c 00 00    lea    0xcd0(%r13),%rdi
>    0x00000000023f2273:  ba 30 00 00 00  mov    $0x30,%edx
>    0x00000000023f2278:  31 f6   xor    %esi,%esi
>    0x00000000023f227a:  e8 d1 07 00 00  callq  0x23f2a50
>    0x00000000023f227f:  49 8d bd ec 0e 00 00    lea    0xeec(%r13),%rdi
>    0x00000000023f2286:  ba 14 01 00 00  mov    $0x114,%edx
>    0x00000000023f228b:  31 f6   xor    %esi,%esi
>    0x00000000023f228d:  e8 be 07 00 00  callq  0x23f2a50
>    0x00000000023f2292:  48 8b 05 1f 68 00 00    mov    0x681f(%rip),%rax        # 0x23f8ab8
>    0x00000000023f2299:  4c 8b 28        mov    (%rax),%r13
>    0x00000000023f229c:  41 80 7d 06 07  cmpb   $0x7,0x6(%r13)
>    0x00000000023f22a1:  0f 84 69 01 00 00       je     0x23f2410
>    0x00000000023f22a7:  48 c7 05 2e 29 01 00 00 80 0b 00        movq   $0xb8000,0x1292e(%rip)        # 0x2404be0
>    0x00000000023f22b2:  c7 05 1c 29 01 00 d4 03 00 00   movl   $0x3d4,0x1291c(%rip)        # 0x2404bd8
>    0x00000000023f22bc:  41 0f b6 45 0e  movzbl 0xe(%r13),%eax
>    0x00000000023f22c1:  89 05 0d 29 01 00       mov    %eax,0x1290d(%rip)        # 0x2404bd4
>    0x00000000023f22c7:  41 0f b6 45 07  movzbl 0x7(%r13),%eax
>    0x00000000023f22cc:  89 05 fe 28 01 00       mov    %eax,0x128fe(%rip)        # 0x2404bd0
>    0x00000000023f22d2:  e8 b9 0b 00 00  callq  0x23f2e90
>    0x00000000023f22d7:  48 8d 3d 9a 56 00 00    lea    0x569a(%rip),%rdi        # 0x23f7978
>    0x00000000023f22de:  e8 4d fd ff ff  callq  0x23f2030
>    0x00000000023f22e3:  48 8b 05 de 67 00 00    mov    0x67de(%rip),%rax        # 0x23f8ac8
>    0x00000000023f22ea:  4c 39 a4 24 80 00 00 00 cmp    %r12,0x80(%rsp)
>    0x00000000023f22f2:  4c 89 e1        mov    %r12,%rcx
>    0x00000000023f22f5:  48 0f 43 8c 24 80 00 00 00      cmovae 0x80(%rsp),%rcx
> 
> Objdump of arch/x86/boot/compressed/misc.o:
> 0000000000002de0 <error>:
>     2de0:       53                      push   %rbx
>     2de1:       48 89 fb                mov    %rdi,%rbx
>     2de4:       48 8d 3d 00 00 00 00    lea    0x0(%rip),%rdi        # 2deb <zlib_updatewindow+0x2d7b>
>     2deb:       e8 00 00 00 00          callq  2df0 <zlib_updatewindow+0x2d80>
>     2df0:       48 89 df                mov    %rbx,%rdi
>     2df3:       e8 00 00 00 00          callq  2df8 <zlib_updatewindow+0x2d88>
>     2df8:       48 8d 3d 00 00 00 00    lea    0x0(%rip),%rdi        # 2dff <zlib_updatewindow+0x2d8f>
>     2dff:       e8 00 00 00 00          callq  2e04 <zlib_updatewindow+0x2d94>
>     2e04:       0f 1f 40 00             nopl   0x0(%rax)
>     2e08:       f4                      hlt    
> =>  2e09:       eb fd                   jmp    2e08 <zlib_updatewindow+0x2d98>
>     2e0b:       0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)
> 
> 0000000000002e10 <decompress_kernel>:
>     2e10:       41 57                   push   %r15
>     2e12:       4d 89 c7                mov    %r8,%r15
>     2e15:       41 56                   push   %r14
>     2e17:       49 89 ce                mov    %rcx,%r14
>     2e1a:       41 55                   push   %r13
>     2e1c:       49 89 fd                mov    %rdi,%r13
>     2e1f:       41 54                   push   %r12
>     2e21:       4d 89 cc                mov    %r9,%r12
>     2e24:       55                      push   %rbp
>     2e25:       48 89 d5                mov    %rdx,%rbp
>     2e28:       53                      push   %rbx
>     2e29:       48 89 f3                mov    %rsi,%rbx
>     2e2c:       48 83 ec 48             sub    $0x48,%rsp
>     2e30:       80 bf ef 01 00 00 00    cmpb   $0x0,0x1ef(%rdi)
>     2e37:       48 8b 05 00 00 00 00    mov    0x0(%rip),%rax        # 2e3e <zlib_updatewindow+0x2dce>

Analyzing this some more it seems to be:
  error_putstr("\n\n");
  error_putstr(x);         // x, if rbx, is "read error"
  error_putstr("\n\n -- System halted");
  while (1)
    asm("hlt");


Such an error("read error") call is present in lib/decompress_inflate.c
on line 135

        while (rc == Z_OK) {
                if (strm->avail_in == 0) {
                        /* TODO: handle case where both pos and fill are set */
                        len = fill(zbuf, GZIP_IOBUF_SIZE);
                        if (len < 0) {
                                rc = -1;
 =>                             error("read error");
                                break;
                        }
                        strm->next_in = zbuf;
                        strm->avail_in = len;
                }
                rc = zlib_inflate(strm, 0);

                /* Write any data generated */
                if (flush && strm->next_out > out_buf) {
                        long l = strm->next_out - out_buf;
                        if (l != flush(out_buf, l)) {
                                rc = -1;
                                error("write error");
                                break;
                        }
                        strm->next_out = out_buf;
                        strm->avail_out = out_len;
                }

                /* after Z_FINISH, only Z_STREAM_END is "we unpacked it all" */
                if (rc == Z_STREAM_END) {
                        rc = 0;
                        break;
                } else if (rc != Z_OK) {
                        error("uncompression error");
                        rc = -1;
                }
        }


From my understanding of the ASM&C code I get for misc.o len should be stored in
RAX (which has a value of 0x1000 which for a long should not be negative?) unless
RAX go overwritten during callq instruction (or one of the later callq).

> Possibly of interest, on the VMWare node where the kernel boots I get this memory mapping:
> [    0.000000] efi: EFI v2.30 by VMware, Inc.
> [    0.000000] efi:  SMBIOS=0x1ffa8000  ACPI 2.0=0x1ff99000 
> [    0.000000] efi: mem00: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000000000-0x0000000000001000) (0MB)
> [    0.000000] efi: mem01: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000001000-0x0000000000007000) (0MB)
> [    0.000000] efi: mem02: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000007000-0x00000000000a0000) (0MB)
> [    0.000000] efi: mem03: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000100000-0x0000000001000000) (15MB)
> [    0.000000] efi: mem04: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000001000000-0x000000000240b000) (20MB)
> [    0.000000] efi: mem05: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000000240b000-0x000000001b1bc000) (397MB)
> [    0.000000] efi: mem06: [Loader Code        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001b1bc000-0x000000001d5c7000) (36MB)
> [    0.000000] efi: mem07: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001d5c7000-0x000000001df83000) (9MB)
> [    0.000000] efi: mem08: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001df83000-0x000000001df8e000) (0MB)
> [    0.000000] efi: mem09: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001df8e000-0x000000001dfaf000) (0MB)
> [    0.000000] efi: mem10: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dfaf000-0x000000001dfb2000) (0MB)
> [    0.000000] efi: mem11: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dfb2000-0x000000001dfc4000) (0MB)
> [    0.000000] efi: mem12: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dfc4000-0x000000001dfc5000) (0MB)
> [    0.000000] efi: mem13: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dfc5000-0x000000001e61a000) (6MB)
> [    0.000000] efi: mem14: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e61a000-0x000000001e6d8000) (0MB)
> [    0.000000] efi: mem15: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e6d8000-0x000000001e6e7000) (0MB)
> [    0.000000] efi: mem16: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e6e7000-0x000000001e6ed000) (0MB)
> [    0.000000] efi: mem17: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e6ed000-0x000000001e6ee000) (0MB)
> [    0.000000] efi: mem18: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e6ee000-0x000000001e71b000) (0MB)
> [    0.000000] efi: mem19: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e71b000-0x000000001e71e000) (0MB)
> [    0.000000] efi: mem20: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e71e000-0x000000001e724000) (0MB)
> [    0.000000] efi: mem21: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e724000-0x000000001e725000) (0MB)
> [    0.000000] efi: mem22: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e725000-0x000000001e729000) (0MB)
> [    0.000000] efi: mem23: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e729000-0x000000001e72a000) (0MB)
> [    0.000000] efi: mem24: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e72a000-0x000000001e751000) (0MB)
> [    0.000000] efi: mem25: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e751000-0x000000001e754000) (0MB)
> [    0.000000] efi: mem26: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e754000-0x000000001e755000) (0MB)
> [    0.000000] efi: mem27: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e755000-0x000000001e756000) (0MB)
> [    0.000000] efi: mem28: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e756000-0x000000001e75e000) (0MB)
> [    0.000000] efi: mem29: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e75e000-0x000000001e760000) (0MB)
> [    0.000000] efi: mem30: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e760000-0x000000001e76f000) (0MB)
> [    0.000000] efi: mem31: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e76f000-0x000000001ee83000) (7MB)
> [    0.000000] efi: mem32: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ee83000-0x000000001ee8c000) (0MB)
> [    0.000000] efi: mem33: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ee8c000-0x000000001fe30000) (15MB)
> [    0.000000] efi: mem34: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001fe30000-0x000000001fe43000) (0MB)
> [    0.000000] efi: mem35: [Runtime Code       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001fe43000-0x000000001fe48000) (0MB)
> [    0.000000] efi: mem36: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001fe48000-0x000000001ff20000) (0MB)
> [    0.000000] efi: mem37: [Runtime Code       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff20000-0x000000001ff40000) (0MB)
> [    0.000000] efi: mem38: [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff40000-0x000000001ff8a000) (0MB)
> [    0.000000] efi: mem39: [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff8a000-0x000000001ff90000) (0MB)
> [    0.000000] efi: mem40: [ACPI Reclaim Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff90000-0x000000001ff99000) (0MB)
> [    0.000000] efi: mem41: [ACPI Reclaim Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff99000-0x000000001ffa8000) (0MB)
> [    0.000000] efi: mem42: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ffa8000-0x000000001ffaa000) (0MB)
> [    0.000000] efi: mem43: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ffaa000-0x000000001ffaf000) (0MB)
> [    0.000000] efi: mem44: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ffaf000-0x000000001ffb0000) (0MB)
> [    0.000000] efi: mem45: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ffb0000-0x0000000020000000) (0MB)
> [    0.000000] efi: mem46: [Memory Mapped I/O  |RUN|  |  |  |   |  |  |  |  ] range=[0x00000000ffc00000-0x00000000ffc18000) (0MB)
> [    0.000000] SMBIOS 2.6 present.
> [    0.000000] DMI: VMware, Inc. VMware7,1/440BX Desktop Reference Platform, BIOS VMW71.00V.0.B64.1309111724 09/11/2013
> 
> while on the failing one I get (just enough efi_printk to cause kernel to boot):
> [    0.000000] efi: EFI v2.30 by VMware, Inc.
> [    0.000000] efi:  SMBIOS=0x1ffaf000  ACPI 2.0=0x1ff9f000 
> [    0.000000] efi: mem00: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000000000-0x0000000000001000) (0MB)
> [    0.000000] efi: mem01: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000001000-0x0000000000007000) (0MB)
> [    0.000000] efi: mem02: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000007000-0x00000000000a0000) (0MB)
> [    0.000000] efi: mem03: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000100000-0x0000000001000000) (15MB)
> [    0.000000] efi: mem04: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000001000000-0x000000000240b000) (20MB)
> [    0.000000] efi: mem05: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000000240b000-0x000000001ae96000) (394MB)
> [    0.000000] efi: mem06: [Loader Code        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ae96000-0x000000001d2a1000) (36MB)
> [    0.000000] efi: mem07: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001d2a1000-0x000000001dc68000) (9MB)
> [    0.000000] efi: mem08: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dc68000-0x000000001dcb3000) (0MB)
> [    0.000000] efi: mem09: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcb3000-0x000000001dcdb000) (0MB)
> [    0.000000] efi: mem10: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcdb000-0x000000001dce9000) (0MB)
> [    0.000000] efi: mem11: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dce9000-0x000000001dcea000) (0MB)
> [    0.000000] efi: mem12: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcea000-0x000000001dcec000) (0MB)
> [    0.000000] efi: mem13: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcec000-0x000000001dcfb000) (0MB)
> [    0.000000] efi: mem14: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcfb000-0x000000001dcfc000) (0MB)
> [    0.000000] efi: mem15: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcfc000-0x000000001dcfd000) (0MB)
> [    0.000000] efi: mem16: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcfd000-0x000000001dcfe000) (0MB)
> [    0.000000] efi: mem17: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcfe000-0x000000001ddd8000) (0MB)
> [    0.000000] efi: mem18: [Loader Code        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ddd8000-0x000000001deb0000) (0MB)
> [    0.000000] efi: mem19: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001deb0000-0x000000001decf000) (0MB)
> [    0.000000] efi: mem20: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001decf000-0x000000001dee0000) (0MB)
> [    0.000000] efi: mem21: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dee0000-0x000000001dee6000) (0MB)
> [    0.000000] efi: mem22: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dee6000-0x000000001dee8000) (0MB)
> [    0.000000] efi: mem23: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dee8000-0x000000001e547000) (6MB)
> [    0.000000] efi: mem24: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e547000-0x000000001e58b000) (0MB)
> [    0.000000] efi: mem25: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e58b000-0x000000001e58c000) (0MB)
> [    0.000000] efi: mem26: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e58c000-0x000000001e590000) (0MB)
> [    0.000000] efi: mem27: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e590000-0x000000001e591000) (0MB)
> [    0.000000] efi: mem28: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e591000-0x000000001e5a0000) (0MB)
> [    0.000000] efi: mem29: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e5a0000-0x000000001e5a2000) (0MB)
> [    0.000000] efi: mem30: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e5a2000-0x000000001e602000) (0MB)
> [    0.000000] efi: mem31: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e602000-0x000000001e604000) (0MB)
> [    0.000000] efi: mem32: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e604000-0x000000001e613000) (0MB)
> [    0.000000] efi: mem33: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e613000-0x000000001e614000) (0MB)
> [    0.000000] efi: mem34: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e614000-0x000000001e645000) (0MB)
> [    0.000000] efi: mem35: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e645000-0x000000001e648000) (0MB)
> [    0.000000] efi: mem36: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e648000-0x000000001e64f000) (0MB)
> [    0.000000] efi: mem37: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e64f000-0x000000001e651000) (0MB)
> [    0.000000] efi: mem38: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e651000-0x000000001e656000) (0MB)
> [    0.000000] efi: mem39: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e656000-0x000000001e657000) (0MB)
> [    0.000000] efi: mem40: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e657000-0x000000001e66c000) (0MB)
> [    0.000000] efi: mem41: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e66c000-0x000000001e66d000) (0MB)
> [    0.000000] efi: mem42: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e66d000-0x000000001e69c000) (0MB)
> [    0.000000] efi: mem43: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e69c000-0x000000001e6a2000) (0MB)
> [    0.000000] efi: mem44: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e6a2000-0x000000001e6ad000) (0MB)
> [    0.000000] efi: mem45: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e6ad000-0x000000001e9b3000) (3MB)
> [    0.000000] efi: mem46: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e9b3000-0x000000001e9c2000) (0MB)
> [    0.000000] efi: mem47: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e9c2000-0x000000001edd3000) (4MB)
> [    0.000000] efi: mem48: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001edd3000-0x000000001eddc000) (0MB)
> [    0.000000] efi: mem49: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001eddc000-0x000000001fe31000) (16MB)
> [    0.000000] efi: mem50: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001fe31000-0x000000001fe33000) (0MB)
> [    0.000000] efi: mem51: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001fe33000-0x000000001fe3c000) (0MB)
> [    0.000000] efi: mem52: [Runtime Code       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001fe3c000-0x000000001fe44000) (0MB)
> [    0.000000] efi: mem53: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001fe44000-0x000000001ff21000) (0MB)
> [    0.000000] efi: mem54: [Runtime Code       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff21000-0x000000001ff41000) (0MB)
> [    0.000000] efi: mem55: [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff41000-0x000000001ff8b000) (0MB)
> [    0.000000] efi: mem56: [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff8b000-0x000000001ff91000) (0MB)
> [    0.000000] efi: mem57: [ACPI Reclaim Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff91000-0x000000001ff9f000) (0MB)
> [    0.000000] efi: mem58: [ACPI Reclaim Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff9f000-0x000000001ffad000) (0MB)
> [    0.000000] efi: mem59: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ffad000-0x000000001ffae000) (0MB)
> [    0.000000] efi: mem60: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ffae000-0x000000001ffb1000) (0MB)
> [    0.000000] efi: mem61: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ffb1000-0x0000000020000000) (0MB)
> [    0.000000] efi: mem62: [Memory Mapped I/O  |RUN|  |  |  |   |  |  |  |  ] range=[0x00000000ffc00000-0x00000000ffc18000) (0MB)
> [    0.000000] SMBIOS 2.6 present.
> [    0.000000] DMI: VMware, Inc. VMware7,1/440BX Desktop Reference Platform, BIOS VMW71.00V.0.B64.1404140612 04/14/2014
> 
> Size of bzImage: 10250672
> Size of vmlinus: 28188076
> Big size is due to included initrd.
> 
> Any idea where to search further or how to gather some more useful data with GDB?
> 
> Thanks,
> Bruno

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Boot with EFI stub fails on VMWare during decompression
       [not found]     ` <20150116121545.56e4454b-I2t2yFIzmohO7ya8xxV06g@public.gmane.org>
@ 2015-01-16 14:42       ` Bruno Prémont
  0 siblings, 0 replies; 7+ messages in thread
From: Bruno Prémont @ 2015-01-16 14:42 UTC (permalink / raw)
  To: Matt Fleming, linux-efi

On Fri, 16 Jan 2015 12:15:45 +0100 Bruno Prémont wrote:
> On Fri, 16 Jan 2015 11:03:44 +0100 Bruno Prémont wrote:
> > I have a few systems that don't boot on some VMWare nodes using EFI stub.
> > 
> > Kernel boots on VMWare ESXi 5.1 but has trouble on ESXi 5.5.
> > 
> > From behavior it seems very much related to memory layout as just
> > adding a few efi_printk() into EFI stub gets the otherwise same kernel
> > to boot. Also the kernel does boot on another VMWare node.
> > 
> > Kernel I'm using: 3.18.2
> > 
> > I've take a snapshot that i converted to core dump. Poking at it with
> > gdb it looks like kernel gets stuck in misc.o somewhere during zlib
> > decompression.
> > 
> > 
> > Register dump:
> > rax            0x1000   4096
> > rbx            0x23f78cb        37714123
> > rcx            0x0      0
> > rdx            0x0      0
> > rsi            0x0      0
> > rdi            0x23f7863        37714019
> > rbp            0x1a363b4        0x1a363b4
> > rsp            0x2404b20        0x2404b20
> > r8             0x2404ee0        37768928
> > r9             0x4      4
> > r10            0x3      3
> > r11            0x9      9
> > r12            0x13dcbbc        20827068
> > r13            0x1e000000       503316480      (this seems to point to decompressed kernel)
> > r14            0x9b8ea7 10194599
> > r15            0x23f8bc0        37718976
> > rip            0x23f21f9        0x23f21f9
> > eflags         0x46     [ PF ZF ]
> > cs             0x18     24
> > ss             0x0      0
> > ds             0x0      0
> > es             0x0      0
> > fs             0x0      0
> > gs             0x0      0
> > 
> > 
> > Code disassembly:
> > Dump of assembler code from 0x23f21d0 to 0x23f22f8:
> >    0x00000000023f21d0:  53      push   %rbx
> >    0x00000000023f21d1:  48 89 fb        mov    %rdi,%rbx
> >    0x00000000023f21d4:  48 8d 3d 85 56 00 00    lea    0x5685(%rip),%rdi        # 0x23f7860
> >    0x00000000023f21db:  e8 50 fe ff ff  callq  0x23f2030
> >    0x00000000023f21e0:  48 89 df        mov    %rbx,%rdi
> >    0x00000000023f21e3:  e8 48 fe ff ff  callq  0x23f2030
> >    0x00000000023f21e8:  48 8d 3d 74 56 00 00    lea    0x5674(%rip),%rdi        # 0x23f7863
> >    0x00000000023f21ef:  e8 3c fe ff ff  callq  0x23f2030
> >    0x00000000023f21f4:  0f 1f 40 00     nopl   0x0(%rax)
> >    0x00000000023f21f8:  f4      hlt    
> > => 0x00000000023f21f9:  eb fd   jmp    0x23f21f8
> >    0x00000000023f21fb:  0f 1f 44 00 00  nopl   0x0(%rax,%rax,1)
> >    0x00000000023f2200:  41 57   push   %r15
> >    0x00000000023f2202:  4d 89 c7        mov    %r8,%r15
> >    0x00000000023f2205:  41 56   push   %r14
> >    0x00000000023f2207:  49 89 ce        mov    %rcx,%r14
> >    0x00000000023f220a:  41 55   push   %r13
> >    0x00000000023f220c:  49 89 fd        mov    %rdi,%r13
> >    0x00000000023f220f:  41 54   push   %r12
> >    0x00000000023f2211:  4d 89 cc        mov    %r9,%r12
> >    0x00000000023f2214:  55      push   %rbp
> >    0x00000000023f2215:  48 89 d5        mov    %rdx,%rbp
> >    0x00000000023f2218:  53      push   %rbx
> >    0x00000000023f2219:  48 89 f3        mov    %rsi,%rbx
> >    0x00000000023f221c:  48 83 ec 48     sub    $0x48,%rsp
> >    0x00000000023f2220:  80 bf ef 01 00 00 00    cmpb   $0x0,0x1ef(%rdi)
> >    0x00000000023f2227:  48 8b 05 8a 68 00 00    mov    0x688a(%rip),%rax        # 0x23f8ab8
> >    0x00000000023f222e:  48 89 38        mov    %rdi,(%rax)
> >    0x00000000023f2231:  74 69   je     0x23f229c
> >    0x00000000023f2233:  48 8d bf c0 00 00 00    lea    0xc0(%rdi),%rdi
> >    0x00000000023f223a:  ba 00 01 00 00  mov    $0x100,%edx
> >    0x00000000023f223f:  31 f6   xor    %esi,%esi
> >    0x00000000023f2241:  e8 0a 08 00 00  callq  0x23f2a50
> >    0x00000000023f2246:  49 8d bd eb 01 00 00    lea    0x1eb(%r13),%rdi
> >    0x00000000023f224d:  ba 06 00 00 00  mov    $0x6,%edx
> >    0x00000000023f2252:  31 f6   xor    %esi,%esi
> >    0x00000000023f2254:  e8 f7 07 00 00  callq  0x23f2a50
> >    0x00000000023f2259:  49 8d bd 68 02 00 00    lea    0x268(%r13),%rdi
> >    0x00000000023f2260:  ba 28 00 00 00  mov    $0x28,%edx
> >    0x00000000023f2265:  31 f6   xor    %esi,%esi
> >    0x00000000023f2267:  e8 e4 07 00 00  callq  0x23f2a50
> >    0x00000000023f226c:  49 8d bd d0 0c 00 00    lea    0xcd0(%r13),%rdi
> >    0x00000000023f2273:  ba 30 00 00 00  mov    $0x30,%edx
> >    0x00000000023f2278:  31 f6   xor    %esi,%esi
> >    0x00000000023f227a:  e8 d1 07 00 00  callq  0x23f2a50
> >    0x00000000023f227f:  49 8d bd ec 0e 00 00    lea    0xeec(%r13),%rdi
> >    0x00000000023f2286:  ba 14 01 00 00  mov    $0x114,%edx
> >    0x00000000023f228b:  31 f6   xor    %esi,%esi
> >    0x00000000023f228d:  e8 be 07 00 00  callq  0x23f2a50
> >    0x00000000023f2292:  48 8b 05 1f 68 00 00    mov    0x681f(%rip),%rax        # 0x23f8ab8
> >    0x00000000023f2299:  4c 8b 28        mov    (%rax),%r13
> >    0x00000000023f229c:  41 80 7d 06 07  cmpb   $0x7,0x6(%r13)
> >    0x00000000023f22a1:  0f 84 69 01 00 00       je     0x23f2410
> >    0x00000000023f22a7:  48 c7 05 2e 29 01 00 00 80 0b 00        movq   $0xb8000,0x1292e(%rip)        # 0x2404be0
> >    0x00000000023f22b2:  c7 05 1c 29 01 00 d4 03 00 00   movl   $0x3d4,0x1291c(%rip)        # 0x2404bd8
> >    0x00000000023f22bc:  41 0f b6 45 0e  movzbl 0xe(%r13),%eax
> >    0x00000000023f22c1:  89 05 0d 29 01 00       mov    %eax,0x1290d(%rip)        # 0x2404bd4
> >    0x00000000023f22c7:  41 0f b6 45 07  movzbl 0x7(%r13),%eax
> >    0x00000000023f22cc:  89 05 fe 28 01 00       mov    %eax,0x128fe(%rip)        # 0x2404bd0
> >    0x00000000023f22d2:  e8 b9 0b 00 00  callq  0x23f2e90
> >    0x00000000023f22d7:  48 8d 3d 9a 56 00 00    lea    0x569a(%rip),%rdi        # 0x23f7978
> >    0x00000000023f22de:  e8 4d fd ff ff  callq  0x23f2030
> >    0x00000000023f22e3:  48 8b 05 de 67 00 00    mov    0x67de(%rip),%rax        # 0x23f8ac8
> >    0x00000000023f22ea:  4c 39 a4 24 80 00 00 00 cmp    %r12,0x80(%rsp)
> >    0x00000000023f22f2:  4c 89 e1        mov    %r12,%rcx
> >    0x00000000023f22f5:  48 0f 43 8c 24 80 00 00 00      cmovae 0x80(%rsp),%rcx
> > 
> > Objdump of arch/x86/boot/compressed/misc.o:
> > 0000000000002de0 <error>:
> >     2de0:       53                      push   %rbx
> >     2de1:       48 89 fb                mov    %rdi,%rbx
> >     2de4:       48 8d 3d 00 00 00 00    lea    0x0(%rip),%rdi        # 2deb <zlib_updatewindow+0x2d7b>
> >     2deb:       e8 00 00 00 00          callq  2df0 <zlib_updatewindow+0x2d80>
> >     2df0:       48 89 df                mov    %rbx,%rdi
> >     2df3:       e8 00 00 00 00          callq  2df8 <zlib_updatewindow+0x2d88>
> >     2df8:       48 8d 3d 00 00 00 00    lea    0x0(%rip),%rdi        # 2dff <zlib_updatewindow+0x2d8f>
> >     2dff:       e8 00 00 00 00          callq  2e04 <zlib_updatewindow+0x2d94>
> >     2e04:       0f 1f 40 00             nopl   0x0(%rax)
> >     2e08:       f4                      hlt    
> > =>  2e09:       eb fd                   jmp    2e08 <zlib_updatewindow+0x2d98>
> >     2e0b:       0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)
> > 
> > 0000000000002e10 <decompress_kernel>:
> >     2e10:       41 57                   push   %r15
> >     2e12:       4d 89 c7                mov    %r8,%r15
> >     2e15:       41 56                   push   %r14
> >     2e17:       49 89 ce                mov    %rcx,%r14
> >     2e1a:       41 55                   push   %r13
> >     2e1c:       49 89 fd                mov    %rdi,%r13
> >     2e1f:       41 54                   push   %r12
> >     2e21:       4d 89 cc                mov    %r9,%r12
> >     2e24:       55                      push   %rbp
> >     2e25:       48 89 d5                mov    %rdx,%rbp
> >     2e28:       53                      push   %rbx
> >     2e29:       48 89 f3                mov    %rsi,%rbx
> >     2e2c:       48 83 ec 48             sub    $0x48,%rsp
> >     2e30:       80 bf ef 01 00 00 00    cmpb   $0x0,0x1ef(%rdi)
> >     2e37:       48 8b 05 00 00 00 00    mov    0x0(%rip),%rax        # 2e3e <zlib_updatewindow+0x2dce>
> 
> Analyzing this some more it seems to be:
>   error_putstr("\n\n");
>   error_putstr(x);         // x, if rbx, is "read error"
>   error_putstr("\n\n -- System halted");
>   while (1)
>     asm("hlt");
> 
> 
> Such an error("read error") call is present in lib/decompress_inflate.c
> on line 135
> 
>         while (rc == Z_OK) {
>                 if (strm->avail_in == 0) {
>                         /* TODO: handle case where both pos and fill are set */
>                         len = fill(zbuf, GZIP_IOBUF_SIZE);
>                         if (len < 0) {
>                                 rc = -1;
>  =>                             error("read error");
>                                 break;
>                         }
>                         strm->next_in = zbuf;
>                         strm->avail_in = len;
>                 }
>                 rc = zlib_inflate(strm, 0);
> 
>                 /* Write any data generated */
>                 if (flush && strm->next_out > out_buf) {
>                         long l = strm->next_out - out_buf;
>                         if (l != flush(out_buf, l)) {
>                                 rc = -1;
>                                 error("write error");
>                                 break;
>                         }
>                         strm->next_out = out_buf;
>                         strm->avail_out = out_len;
>                 }
> 
>                 /* after Z_FINISH, only Z_STREAM_END is "we unpacked it all" */
>                 if (rc == Z_STREAM_END) {
>                         rc = 0;
>                         break;
>                 } else if (rc != Z_OK) {
>                         error("uncompression error");
>                         rc = -1;
>                 }
>         }
> 
> 
> From my understanding of the ASM&C code I get for misc.o len should be stored in
> RAX (which has a value of 0x1000 which for a long should not be negative?) unless
> RAX go overwritten during callq instruction (or one of the later callq).

I've been digging some more through the memory and determined the following:
- bzImage loaded at 0x1a32200 though first 0x3e00 are zeroed

Dumping sizeof(bzImage) bytes starting at 0x1a32200 and comparing it
with original bzImage I get (offset relative to bzImage start):

 0x00003e00 .. 0x0016cfff    matches
 0x0016d000 .. 0x009bcfff    mis-match
 0x009bd000 .. 0x009c687f    matches
            .. 0x009c69af    partial mis-match

memory mis-match (bzImage has data in there):
0016d000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
... (zeroed bytes)
009b4fe0  00 00 00 00 00 00 00 00  70 68 64 30 20 80 00 00  |........phd0 ...|
009b4ff0  04 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
009b5000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
... (zeroed bytes)
009bcff0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|


partial mis-match data:
            ================= m e m o r y  =================                                           ================ b z I m a g e =================
  009c6820  0e 20 41 c6 0e 18 42 cc  0e 10 42 cd 0e 08 47 0b  |. A...B...B...G.|    ==    |  009c6820  0e 20 41 c6 0e 18 42 cc  0e 10 42 cd 0e 08 47 0b  |. A...B...B...G.|
  009c6830  54 00 00 00 b4 0a 00 00  38 d2 ff ff 0b 0e 00 00  |T.......8.......|    ==    |  009c6830  54 00 00 00 b4 0a 00 00  38 d2 ff ff 0b 0e 00 00  |T.......8.......|
  009c6840  00 42 0e 10 8f 02 4c 0e  18 8e 03 42 0e 20 8d 04  |.B....L....B. ..|    ==    |  009c6840  00 42 0e 10 8f 02 4c 0e  18 8e 03 42 0e 20 8d 04  |.B....L....B. ..|
  009c6850  42 0e 28 8c 05 41 0e 30  86 06 41 0e 38 83 07 47  |B.(..A.0..A.8..G|    ==    |  009c6850  42 0e 28 8c 05 41 0e 30  86 06 41 0e 38 83 07 47  |B.(..A.0..A.8..G|
  009c6860  0e e0 01 03 0c 06 0a 0e  38 41 c3 0e 30 41 c6 0e  |........8A..0A..|    ==    |  009c6860  0e e0 01 03 0c 06 0a 0e  38 41 c3 0e 30 41 c6 0e  |........8A..0A..|
  009c6870  28 42 cc 0e 20 42 cd 0e  18 42 ce 0e 10 42 cf 0e  |(B.. B...B...B..|    ==    |  009c6870  28 42 cc 0e 20 42 cd 0e  18 42 ce 0e 10 42 cf 0e  |(B.. B...B...B..|
  009c6880  08 47 0b 00 00 00 00 00  00 60 a3 01 00 00 00 00  |.G.......`......|    !=    |  009c6880  08 47 0b 00 00 00 00 00  00 00 00 00 00 00 00 00  |.G..............|
  009c6890  00 60 a3 01 00 00 00 00  00 60 a3 01 00 00 00 00  |.`.......`......|    !=    |  009c6890  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
  009c68a0  e0 4e 40 02 00 00 00 00  a0 4e 40 02 00 00 00 00  |.N@......N@.....|    !=    |  009c68a0  e0 ee 9c 00 00 00 00 00  a0 ee 9c 00 00 00 00 00  |................|
  009c68b0  d4 4e 40 02 00 00 00 00  80 4e 40 02 00 00 00 00  |.N@......N@.....|    !=    |  009c68b0  d4 ee 9c 00 00 00 00 00  80 ee 9c 00 00 00 00 00  |................|
  009c68c0  88 4e 40 02 00 00 00 00  90 4e 40 02 00 00 00 00  |.N@......N@.....|    !=    |  009c68c0  88 ee 9c 00 00 00 00 00  90 ee 9c 00 00 00 00 00  |................|
  009c68d0  30 00 d0 2a 9c 00 00 00  00 00 00 00 00 00 00 00  |0..*............|    ==    |  009c68d0  30 00 d0 2a 9c 00 00 00  00 00 00 00 00 00 00 00  |0..*............|
  009c68e0  ff ff 00 00 00 9a af 00  ff ff 00 00 00 92 cf 00  |................|    ==    |  009c68e0  ff ff 00 00 00 9a af 00  ff ff 00 00 00 92 cf 00  |................|
  009c68f0  00 00 00 00 00 89 80 00  00 00 00 00 00 00 00 00  |................|    ==    |  009c68f0  00 00 00 00 00 89 80 00  00 00 00 00 00 00 00 00  |................|
  009c6900  08 69 9c 1c 00 00 00 00  98 88 ee 1d 00 00 00 00  |.i..............|    !=    |  009c6900  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
  009c6910  18 0f f9 1f 00 00 00 00  15 7c fe 1f 00 00 00 00  |.........|......|    !=    |  *
  009c6920  fd 73 fe 1f 00 00 00 00  c8 70 fe 1f 00 00 00 00  |.s.......p......|    !=    |  *
  009c6930  31 7a fe 1f 00 00 00 00  73 73 fe 1f 00 00 00 00  |1z......ss......|    !=    |  *
  009c6940  fe f7 fd 1f 00 00 00 00  f9 ed fd 1f 00 00 00 00  |................|    !=    |  *
  009c6950  68 84 fd 1f 00 00 00 00  50 a8 dd 1e 00 00 00 00  |h.......P.......|    !=    |  *
  009c6960  80 48 9c 1c 00 00 00 00  01 00 00 00 00 00 00 00  |.H..............|    !=    |  009c6960  80 0a 9c 00 00 00 00 00  01 00 00 00 00 00 00 00  |................|
  009c6970  00 00 10 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|    ==    |  009c6970  00 00 10 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
  009c6980  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|    ==    |  009c6980  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
  *                                                                                 ==    |  *
  009c69a0  00 00 00 00 00 00 00 00  00 00 00 00 76 32 8b ed  |............v2..|    ==    |  009c69a0  00 00 00 00 00 00 00 00  00 00 00 00 76 32 8b ed  |............v2..|
  009c69b0


Now my question is, what does the zeroed area correspond to?

The start of zeroed area in memory would be:
  0x1b9f200 .. 0x23ef1ff

For both starting kernels this fully fits into mem04.
So I'm wondering why the data does not match!


Just to get this kind of issues detected at a time it's possible to render some error
message, could the stub check its payload (CRC or better hash) before calling exit_boot
so a efi_printk() would still be possible?


> > Possibly of interest, on the VMWare node where the kernel boots I get this memory mapping:
> > [    0.000000] efi: EFI v2.30 by VMware, Inc.
> > [    0.000000] efi:  SMBIOS=0x1ffa8000  ACPI 2.0=0x1ff99000 
> > [    0.000000] efi: mem00: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000000000-0x0000000000001000) (0MB)
> > [    0.000000] efi: mem01: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000001000-0x0000000000007000) (0MB)
> > [    0.000000] efi: mem02: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000007000-0x00000000000a0000) (0MB)
> > [    0.000000] efi: mem03: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000100000-0x0000000001000000) (15MB)
> > [    0.000000] efi: mem04: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000001000000-0x000000000240b000) (20MB)
> > [    0.000000] efi: mem05: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000000240b000-0x000000001b1bc000) (397MB)
> > [    0.000000] efi: mem06: [Loader Code        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001b1bc000-0x000000001d5c7000) (36MB)
> > [    0.000000] efi: mem07: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001d5c7000-0x000000001df83000) (9MB)
> > [    0.000000] efi: mem08: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001df83000-0x000000001df8e000) (0MB)
> > [    0.000000] efi: mem09: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001df8e000-0x000000001dfaf000) (0MB)
> > [    0.000000] efi: mem10: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dfaf000-0x000000001dfb2000) (0MB)
> > [    0.000000] efi: mem11: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dfb2000-0x000000001dfc4000) (0MB)
> > [    0.000000] efi: mem12: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dfc4000-0x000000001dfc5000) (0MB)
> > [    0.000000] efi: mem13: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dfc5000-0x000000001e61a000) (6MB)
> > [    0.000000] efi: mem14: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e61a000-0x000000001e6d8000) (0MB)
> > [    0.000000] efi: mem15: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e6d8000-0x000000001e6e7000) (0MB)
> > [    0.000000] efi: mem16: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e6e7000-0x000000001e6ed000) (0MB)
> > [    0.000000] efi: mem17: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e6ed000-0x000000001e6ee000) (0MB)
> > [    0.000000] efi: mem18: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e6ee000-0x000000001e71b000) (0MB)
> > [    0.000000] efi: mem19: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e71b000-0x000000001e71e000) (0MB)
> > [    0.000000] efi: mem20: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e71e000-0x000000001e724000) (0MB)
> > [    0.000000] efi: mem21: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e724000-0x000000001e725000) (0MB)
> > [    0.000000] efi: mem22: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e725000-0x000000001e729000) (0MB)
> > [    0.000000] efi: mem23: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e729000-0x000000001e72a000) (0MB)
> > [    0.000000] efi: mem24: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e72a000-0x000000001e751000) (0MB)
> > [    0.000000] efi: mem25: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e751000-0x000000001e754000) (0MB)
> > [    0.000000] efi: mem26: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e754000-0x000000001e755000) (0MB)
> > [    0.000000] efi: mem27: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e755000-0x000000001e756000) (0MB)
> > [    0.000000] efi: mem28: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e756000-0x000000001e75e000) (0MB)
> > [    0.000000] efi: mem29: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e75e000-0x000000001e760000) (0MB)
> > [    0.000000] efi: mem30: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e760000-0x000000001e76f000) (0MB)
> > [    0.000000] efi: mem31: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e76f000-0x000000001ee83000) (7MB)
> > [    0.000000] efi: mem32: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ee83000-0x000000001ee8c000) (0MB)
> > [    0.000000] efi: mem33: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ee8c000-0x000000001fe30000) (15MB)
> > [    0.000000] efi: mem34: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001fe30000-0x000000001fe43000) (0MB)
> > [    0.000000] efi: mem35: [Runtime Code       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001fe43000-0x000000001fe48000) (0MB)
> > [    0.000000] efi: mem36: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001fe48000-0x000000001ff20000) (0MB)
> > [    0.000000] efi: mem37: [Runtime Code       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff20000-0x000000001ff40000) (0MB)
> > [    0.000000] efi: mem38: [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff40000-0x000000001ff8a000) (0MB)
> > [    0.000000] efi: mem39: [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff8a000-0x000000001ff90000) (0MB)
> > [    0.000000] efi: mem40: [ACPI Reclaim Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff90000-0x000000001ff99000) (0MB)
> > [    0.000000] efi: mem41: [ACPI Reclaim Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff99000-0x000000001ffa8000) (0MB)
> > [    0.000000] efi: mem42: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ffa8000-0x000000001ffaa000) (0MB)
> > [    0.000000] efi: mem43: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ffaa000-0x000000001ffaf000) (0MB)
> > [    0.000000] efi: mem44: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ffaf000-0x000000001ffb0000) (0MB)
> > [    0.000000] efi: mem45: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ffb0000-0x0000000020000000) (0MB)
> > [    0.000000] efi: mem46: [Memory Mapped I/O  |RUN|  |  |  |   |  |  |  |  ] range=[0x00000000ffc00000-0x00000000ffc18000) (0MB)
> > [    0.000000] SMBIOS 2.6 present.
> > [    0.000000] DMI: VMware, Inc. VMware7,1/440BX Desktop Reference Platform, BIOS VMW71.00V.0.B64.1309111724 09/11/2013
> > 
> > while on the failing one I get (just enough efi_printk to cause kernel to boot):
> > [    0.000000] efi: EFI v2.30 by VMware, Inc.
> > [    0.000000] efi:  SMBIOS=0x1ffaf000  ACPI 2.0=0x1ff9f000 
> > [    0.000000] efi: mem00: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000000000-0x0000000000001000) (0MB)
> > [    0.000000] efi: mem01: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000001000-0x0000000000007000) (0MB)
> > [    0.000000] efi: mem02: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000007000-0x00000000000a0000) (0MB)
> > [    0.000000] efi: mem03: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000100000-0x0000000001000000) (15MB)
> > [    0.000000] efi: mem04: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000001000000-0x000000000240b000) (20MB)
> > [    0.000000] efi: mem05: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000000240b000-0x000000001ae96000) (394MB)
> > [    0.000000] efi: mem06: [Loader Code        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ae96000-0x000000001d2a1000) (36MB)
> > [    0.000000] efi: mem07: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001d2a1000-0x000000001dc68000) (9MB)
> > [    0.000000] efi: mem08: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dc68000-0x000000001dcb3000) (0MB)
> > [    0.000000] efi: mem09: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcb3000-0x000000001dcdb000) (0MB)
> > [    0.000000] efi: mem10: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcdb000-0x000000001dce9000) (0MB)
> > [    0.000000] efi: mem11: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dce9000-0x000000001dcea000) (0MB)
> > [    0.000000] efi: mem12: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcea000-0x000000001dcec000) (0MB)
> > [    0.000000] efi: mem13: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcec000-0x000000001dcfb000) (0MB)
> > [    0.000000] efi: mem14: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcfb000-0x000000001dcfc000) (0MB)
> > [    0.000000] efi: mem15: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcfc000-0x000000001dcfd000) (0MB)
> > [    0.000000] efi: mem16: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcfd000-0x000000001dcfe000) (0MB)
> > [    0.000000] efi: mem17: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dcfe000-0x000000001ddd8000) (0MB)
> > [    0.000000] efi: mem18: [Loader Code        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ddd8000-0x000000001deb0000) (0MB)
> > [    0.000000] efi: mem19: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001deb0000-0x000000001decf000) (0MB)
> > [    0.000000] efi: mem20: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001decf000-0x000000001dee0000) (0MB)
> > [    0.000000] efi: mem21: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dee0000-0x000000001dee6000) (0MB)
> > [    0.000000] efi: mem22: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dee6000-0x000000001dee8000) (0MB)
> > [    0.000000] efi: mem23: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dee8000-0x000000001e547000) (6MB)
> > [    0.000000] efi: mem24: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e547000-0x000000001e58b000) (0MB)
> > [    0.000000] efi: mem25: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e58b000-0x000000001e58c000) (0MB)
> > [    0.000000] efi: mem26: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e58c000-0x000000001e590000) (0MB)
> > [    0.000000] efi: mem27: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e590000-0x000000001e591000) (0MB)
> > [    0.000000] efi: mem28: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e591000-0x000000001e5a0000) (0MB)
> > [    0.000000] efi: mem29: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e5a0000-0x000000001e5a2000) (0MB)
> > [    0.000000] efi: mem30: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e5a2000-0x000000001e602000) (0MB)
> > [    0.000000] efi: mem31: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e602000-0x000000001e604000) (0MB)
> > [    0.000000] efi: mem32: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e604000-0x000000001e613000) (0MB)
> > [    0.000000] efi: mem33: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e613000-0x000000001e614000) (0MB)
> > [    0.000000] efi: mem34: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e614000-0x000000001e645000) (0MB)
> > [    0.000000] efi: mem35: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e645000-0x000000001e648000) (0MB)
> > [    0.000000] efi: mem36: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e648000-0x000000001e64f000) (0MB)
> > [    0.000000] efi: mem37: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e64f000-0x000000001e651000) (0MB)
> > [    0.000000] efi: mem38: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e651000-0x000000001e656000) (0MB)
> > [    0.000000] efi: mem39: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e656000-0x000000001e657000) (0MB)
> > [    0.000000] efi: mem40: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e657000-0x000000001e66c000) (0MB)
> > [    0.000000] efi: mem41: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e66c000-0x000000001e66d000) (0MB)
> > [    0.000000] efi: mem42: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e66d000-0x000000001e69c000) (0MB)
> > [    0.000000] efi: mem43: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e69c000-0x000000001e6a2000) (0MB)
> > [    0.000000] efi: mem44: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e6a2000-0x000000001e6ad000) (0MB)
> > [    0.000000] efi: mem45: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e6ad000-0x000000001e9b3000) (3MB)
> > [    0.000000] efi: mem46: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e9b3000-0x000000001e9c2000) (0MB)
> > [    0.000000] efi: mem47: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001e9c2000-0x000000001edd3000) (4MB)
> > [    0.000000] efi: mem48: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001edd3000-0x000000001eddc000) (0MB)
> > [    0.000000] efi: mem49: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001eddc000-0x000000001fe31000) (16MB)
> > [    0.000000] efi: mem50: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001fe31000-0x000000001fe33000) (0MB)
> > [    0.000000] efi: mem51: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001fe33000-0x000000001fe3c000) (0MB)
> > [    0.000000] efi: mem52: [Runtime Code       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001fe3c000-0x000000001fe44000) (0MB)
> > [    0.000000] efi: mem53: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001fe44000-0x000000001ff21000) (0MB)
> > [    0.000000] efi: mem54: [Runtime Code       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff21000-0x000000001ff41000) (0MB)
> > [    0.000000] efi: mem55: [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff41000-0x000000001ff8b000) (0MB)
> > [    0.000000] efi: mem56: [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff8b000-0x000000001ff91000) (0MB)
> > [    0.000000] efi: mem57: [ACPI Reclaim Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff91000-0x000000001ff9f000) (0MB)
> > [    0.000000] efi: mem58: [ACPI Reclaim Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ff9f000-0x000000001ffad000) (0MB)
> > [    0.000000] efi: mem59: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ffad000-0x000000001ffae000) (0MB)
> > [    0.000000] efi: mem60: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ffae000-0x000000001ffb1000) (0MB)
> > [    0.000000] efi: mem61: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001ffb1000-0x0000000020000000) (0MB)
> > [    0.000000] efi: mem62: [Memory Mapped I/O  |RUN|  |  |  |   |  |  |  |  ] range=[0x00000000ffc00000-0x00000000ffc18000) (0MB)
> > [    0.000000] SMBIOS 2.6 present.
> > [    0.000000] DMI: VMware, Inc. VMware7,1/440BX Desktop Reference Platform, BIOS VMW71.00V.0.B64.1404140612 04/14/2014
> > 
> > Size of bzImage: 10250672
> > Size of vmlinus: 28188076
> > Big size is due to included initrd.
> > 
> > Any idea where to search further or how to gather some more useful data with GDB?
> > 
> > Thanks,
> > Bruno

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Boot with EFI stub fails on VMWare during decompression
       [not found] ` <20150116110344.715cc887-I2t2yFIzmohO7ya8xxV06g@public.gmane.org>
  2015-01-16 11:15   ` Bruno Prémont
@ 2015-01-20 19:02   ` Matt Fleming
       [not found]     ` <20150120190238.GB12079-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
  1 sibling, 1 reply; 7+ messages in thread
From: Matt Fleming @ 2015-01-20 19:02 UTC (permalink / raw)
  To: Bruno Prémont; +Cc: linux-efi

On Fri, 16 Jan, at 11:03:44AM, Bruno Prémont wrote:
> Register dump:
> rax            0x1000   4096
> rbx            0x23f78cb        37714123
> rcx            0x0      0
> rdx            0x0      0
> rsi            0x0      0
> rdi            0x23f7863        37714019
> rbp            0x1a363b4        0x1a363b4
> rsp            0x2404b20        0x2404b20
> r8             0x2404ee0        37768928
> r9             0x4      4
> r10            0x3      3
> r11            0x9      9
> r12            0x13dcbbc        20827068
> r13            0x1e000000       503316480      (this seems to point to decompressed kernel)

[...]
 
> while on the failing one I get (just enough efi_printk to cause kernel to boot):
> [    0.000000] efi: EFI v2.30 by VMware, Inc.
> [    0.000000] efi:  SMBIOS=0x1ffaf000  ACPI 2.0=0x1ff9f000 
> [    0.000000] efi: mem00: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000000000-0x0000000000001000) (0MB)

[..]

> [    0.000000] efi: mem23: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dee8000-0x000000001e547000) (6MB)

Oops. It sure looks like the EFI boot stub is trashing an EFI boot data
region. That would certainly explain the memory corruption you're seeing
(since the firmware assumes no one else is touch its data areas).

By any chance have you modified CONFIG_PHYSICAL_START in your .config?

The suspect code is probably this from
arch/x86/boot/compressed/head_64.S:

---

	/*
	 * Compute the decompressed kernel start address.  It is where
	 * we were loaded at aligned to a 2M boundary. %rbp contains the
	 * decompressed kernel start address.
	 *
	 * If it is a relocatable kernel then decompress and run the kernel
	 * from load address aligned to 2MB addr, otherwise decompress and
	 * run the kernel from LOAD_PHYSICAL_ADDR
	 *
	 * We cannot rely on the calculation done in 32-bit mode, since we
	 * may have been invoked via the 64-bit entry point.
	 */

	/* Start with the delta to where the kernel will run at. */
#ifdef CONFIG_RELOCATABLE
	leaq	startup_32(%rip) /* - $startup_32 */, %rbp
	movl	BP_kernel_alignment(%rsi), %eax
	decl	%eax
	addq	%rax, %rbp
	notq	%rax
	andq	%rax, %rbp
	cmpq	$LOAD_PHYSICAL_ADDR, %rbp
	jge	1f
#endif
	movq	$LOAD_PHYSICAL_ADDR, %rbp
1:

You may want to snoop around this code to make sure that we're not
making some crazy calculation mistakes wrt where we decompress the
kernel.

-- 
Matt Fleming, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Boot with EFI stub fails on VMWare during decompression
       [not found]     ` <20150120190238.GB12079-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
@ 2015-01-21  7:09       ` Bruno Prémont
  2015-01-21 13:54       ` Bruno Prémont
  1 sibling, 0 replies; 7+ messages in thread
From: Bruno Prémont @ 2015-01-21  7:09 UTC (permalink / raw)
  To: Matt Fleming; +Cc: linux-efi

Hi Matt,

On Tue, 20 Jan 2015 19:02:38 +0000 Matt Fleming wrote:
> On Fri, 16 Jan, at 11:03:44AM, Bruno Prémont wrote:
> > Register dump:
> > rax            0x1000   4096
> > rbx            0x23f78cb        37714123
> > rcx            0x0      0
> > rdx            0x0      0
> > rsi            0x0      0
> > rdi            0x23f7863        37714019
> > rbp            0x1a363b4        0x1a363b4
> > rsp            0x2404b20        0x2404b20
> > r8             0x2404ee0        37768928
> > r9             0x4      4
> > r10            0x3      3
> > r11            0x9      9
> > r12            0x13dcbbc        20827068
> > r13            0x1e000000       503316480      (this seems to point to decompressed kernel)
> 
> [...]
>  
> > while on the failing one I get (just enough efi_printk to cause kernel to boot):
> > [    0.000000] efi: EFI v2.30 by VMware, Inc.
> > [    0.000000] efi:  SMBIOS=0x1ffaf000  ACPI 2.0=0x1ff9f000 
> > [    0.000000] efi: mem00: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000000000-0x0000000000001000) (0MB)
> 
> [..]
> 
> > [    0.000000] efi: mem23: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dee8000-0x000000001e547000) (6MB)
> 
> Oops. It sure looks like the EFI boot stub is trashing an EFI boot data
> region. That would certainly explain the memory corruption you're seeing
> (since the firmware assumes no one else is touch its data areas).

Interestingly that part of the memory map has not changed though.

Though I'm wondering why bzImage is (also) being corrupted in mem04.
I've not checked yet how far decompression got (nor if it matches the
start of corruption in bzImage).

> By any chance have you modified CONFIG_PHYSICAL_START in your .config?

I've not touched it, so it has default value:
  CONFIG_PHYSICAL_START=0x1000000

> The suspect code is probably this from
> arch/x86/boot/compressed/head_64.S:
> 
> ---
> 
> 	/*
> 	 * Compute the decompressed kernel start address.  It is where
> 	 * we were loaded at aligned to a 2M boundary. %rbp contains the
> 	 * decompressed kernel start address.
> 	 *
> 	 * If it is a relocatable kernel then decompress and run the kernel
> 	 * from load address aligned to 2MB addr, otherwise decompress and
> 	 * run the kernel from LOAD_PHYSICAL_ADDR
> 	 *
> 	 * We cannot rely on the calculation done in 32-bit mode, since we
> 	 * may have been invoked via the 64-bit entry point.
> 	 */
> 
> 	/* Start with the delta to where the kernel will run at. */
> #ifdef CONFIG_RELOCATABLE
> 	leaq	startup_32(%rip) /* - $startup_32 */, %rbp
> 	movl	BP_kernel_alignment(%rsi), %eax
> 	decl	%eax
> 	addq	%rax, %rbp
> 	notq	%rax
> 	andq	%rax, %rbp
> 	cmpq	$LOAD_PHYSICAL_ADDR, %rbp
> 	jge	1f
> #endif
> 	movq	$LOAD_PHYSICAL_ADDR, %rbp
> 1:
> 
> You may want to snoop around this code to make sure that we're not
> making some crazy calculation mistakes wrt where we decompress the
> kernel.

What's the best way to check this?

I could at en endless loop just before that block and replay in gdb
with coredump.

Thanks,
Bruno

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Boot with EFI stub fails on VMWare during decompression
       [not found]     ` <20150120190238.GB12079-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
  2015-01-21  7:09       ` Bruno Prémont
@ 2015-01-21 13:54       ` Bruno Prémont
       [not found]         ` <20150121145420.76511d61-I2t2yFIzmohO7ya8xxV06g@public.gmane.org>
  1 sibling, 1 reply; 7+ messages in thread
From: Bruno Prémont @ 2015-01-21 13:54 UTC (permalink / raw)
  To: Matt Fleming; +Cc: linux-efi

On Tue, 20 Jan 2015 19:02:38 +0000 Matt Fleming wrote:
> On Fri, 16 Jan, at 11:03:44AM, Bruno Prémont wrote:
> > Register dump:
> > rax            0x1000   4096
> > rbx            0x23f78cb        37714123
> > rcx            0x0      0
> > rdx            0x0      0
> > rsi            0x0      0
> > rdi            0x23f7863        37714019
> > rbp            0x1a363b4        0x1a363b4
> > rsp            0x2404b20        0x2404b20
> > r8             0x2404ee0        37768928
> > r9             0x4      4
> > r10            0x3      3
> > r11            0x9      9
> > r12            0x13dcbbc        20827068
> > r13            0x1e000000       503316480      (this seems to point to decompressed kernel)
> 
> [...]
>  
> > while on the failing one I get (just enough efi_printk to cause kernel to boot):
> > [    0.000000] efi: EFI v2.30 by VMware, Inc.
> > [    0.000000] efi:  SMBIOS=0x1ffaf000  ACPI 2.0=0x1ff9f000 
> > [    0.000000] efi: mem00: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000000000-0x0000000000001000) (0MB)
> 
> [..]
> 
> > [    0.000000] efi: mem23: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000001dee8000-0x000000001e547000) (6MB)
> 
> Oops. It sure looks like the EFI boot stub is trashing an EFI boot data
> region. That would certainly explain the memory corruption you're seeing
> (since the firmware assumes no one else is touch its data areas).
> 
> By any chance have you modified CONFIG_PHYSICAL_START in your .config?

As mentioned in the other mail, it's left at default value:
  CONFIG_PHYSICAL_START=0x1000000

> The suspect code is probably this from
> arch/x86/boot/compressed/head_64.S:
> 
> ---
> 
> 	/*
> 	 * Compute the decompressed kernel start address.  It is where
> 	 * we were loaded at aligned to a 2M boundary. %rbp contains the
> 	 * decompressed kernel start address.
> 	 *
> 	 * If it is a relocatable kernel then decompress and run the kernel
> 	 * from load address aligned to 2MB addr, otherwise decompress and
> 	 * run the kernel from LOAD_PHYSICAL_ADDR
> 	 *
> 	 * We cannot rely on the calculation done in 32-bit mode, since we
> 	 * may have been invoked via the 64-bit entry point.
> 	 */
> 
> 	/* Start with the delta to where the kernel will run at. */
> #ifdef CONFIG_RELOCATABLE

I've put a breakpoint here (hlt-loop) and have following details:

(gdb) info registers
rax            0x0      0
rbx            0x1e53ae18       508800536
rcx            0xffffffff       4294967295
rdx            0x1ded8f98       502108056
rsi            0x1000   4096
rdi            0xffffffff       4294967295
rbp            0x1c003e00       0x1c003e00
rsp            0x1ffd7b68       0x1ffd7b68
r8             0x0      0
r9             0x0      0
r10            0x0      0
r11            0x0      0
r12            0x1ffd7dc8       536706504
r13            0x1ffd7dc0       536706496
r14            0x0      0
r15            0x1ffd7dc0       536706496
rip            0x10002ad        0x10002ad
eflags         0x46     [ PF ZF ]
cs             0x18     24
ss             0x0      0
ds             0x0      0
es             0x0      0
fs             0x0      0
gs             0x0      0
(gdb) disassemble /r 0x10002ac,+64
Dump of assembler code from 0x10002ac to 0x10002ec:
   0x00000000010002ac:  f4      hlt    
=> 0x00000000010002ad:  eb fd   jmp    0x10002ac
   0x00000000010002af:  48 8d 2d 4a fd ff ff    lea    -0x2b6(%rip),%rbp        # 0x1000000
   0x00000000010002b6:  8b 86 30 02 00 00       mov    0x230(%rsi),%eax
   0x00000000010002bc:  ff c8   dec    %eax
   0x00000000010002be:  48 01 c5        add    %rax,%rbp
   0x00000000010002c1:  48 f7 d0        not    %rax
   0x00000000010002c4:  48 21 c5        and    %rax,%rbp
   0x00000000010002c7:  48 81 fd 00 00 00 01    cmp    $0x1000000,%rbp
   0x00000000010002ce:  7d 07   jge    0x10002d7
   0x00000000010002d0:  48 c7 c5 00 00 00 01    mov    $0x1000000,%rbp
   0x00000000010002d7:  48 8d 9d 00 60 a3 00    lea    0xa36000(%rbp),%rbx
   0x00000000010002de:  48 8d a3 00 ec 9c 00    lea    0x9cec00(%rbx),%rsp
   0x00000000010002e5:  6a 00   pushq  $0x0
   0x00000000010002e7:  9d      popfq  
   0x00000000010002e8:  56      push   %rsi
   0x00000000010002e9:  48 8d 35 08 29 9c 00    lea    0x9c2908(%rip),%rsi        # 0x19c2bf8


> 	leaq	startup_32(%rip) /* - $startup_32 */, %rbp
> 	movl	BP_kernel_alignment(%rsi), %eax
> 	decl	%eax
> 	addq	%rax, %rbp
> 	notq	%rax
> 	andq	%rax, %rbp
> 	cmpq	$LOAD_PHYSICAL_ADDR, %rbp
> 	jge	1f
> #endif
> 	movq	$LOAD_PHYSICAL_ADDR, %rbp
> 1:
> 
> You may want to snoop around this code to make sure that we're not
> making some crazy calculation mistakes wrt where we decompress the
> kernel.

So the default LOAD_PHYSICAL_ADDR is being selected/used.

This all happens after efi_main() as far as I can understand.
Is there a way to let efi_printk() do string formatting? It should have
both source and destination addresses as it is doing the relocation (or at
least one step of it).

Bruno

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Boot with EFI stub fails on VMWare during decompression
       [not found]         ` <20150121145420.76511d61-I2t2yFIzmohO7ya8xxV06g@public.gmane.org>
@ 2015-01-26 11:23           ` Matt Fleming
  0 siblings, 0 replies; 7+ messages in thread
From: Matt Fleming @ 2015-01-26 11:23 UTC (permalink / raw)
  To: Bruno Prémont; +Cc: linux-efi

On Wed, 21 Jan, at 02:54:20PM, Bruno Prémont wrote:
> 
> So the default LOAD_PHYSICAL_ADDR is being selected/used.
> 
> This all happens after efi_main() as far as I can understand.
> Is there a way to let efi_printk() do string formatting? It should have
> both source and destination addresses as it is doing the relocation (or at
> least one step of it).

"Here's one I made earlier..."

Take a look at the patches on the 'efi-debug' branch, they may be
useful,

http://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi-debug

-- 
Matt Fleming, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-01-26 11:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-16 10:03 Boot with EFI stub fails on VMWare during decompression Bruno Prémont
     [not found] ` <20150116110344.715cc887-I2t2yFIzmohO7ya8xxV06g@public.gmane.org>
2015-01-16 11:15   ` Bruno Prémont
     [not found]     ` <20150116121545.56e4454b-I2t2yFIzmohO7ya8xxV06g@public.gmane.org>
2015-01-16 14:42       ` Bruno Prémont
2015-01-20 19:02   ` Matt Fleming
     [not found]     ` <20150120190238.GB12079-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2015-01-21  7:09       ` Bruno Prémont
2015-01-21 13:54       ` Bruno Prémont
     [not found]         ` <20150121145420.76511d61-I2t2yFIzmohO7ya8xxV06g@public.gmane.org>
2015-01-26 11:23           ` Matt Fleming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox