diff mbox series

[16/18] efi: add 'runtime' pointer to struct efi

Message ID 20200216182334.8121-17-ardb@kernel.org (mailing list archive)
State New, archived
Headers show
Series efi: clean up contents of struct efi | expand

Commit Message

Ard Biesheuvel Feb. 16, 2020, 6:23 p.m. UTC
Instead of going through the EFI system table each time, just copy the
runtime services table pointer into struct efi directly. This is the
last use of the system table pointer in struct efi, allowing us to
drop it in a future patch, along with a fair amount of quirky handling
of the translated address.

Note that usually, the runtime services pointer changes value during
the call to SetVirtualAddressMap(), so grab the updated value as soon
as that call returns. (Mixed mode uses a 1:1 mapping, and kexec boot
enters with the updated address in the system table, so in those cases,
we don't need to do anything here)

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 arch/x86/include/asm/efi.h              |  3 ++-
 arch/x86/kernel/asm-offsets_32.c        |  5 +++++
 arch/x86/platform/efi/efi.c             |  9 ++++++---
 arch/x86/platform/efi/efi_32.c          | 13 +++++++-----
 arch/x86/platform/efi/efi_64.c          | 14 +++++++------
 arch/x86/platform/efi/efi_stub_32.S     | 21 +++++++++++++++-----
 drivers/firmware/efi/arm-init.c         |  1 +
 drivers/firmware/efi/runtime-wrappers.c |  4 ++--
 include/linux/efi.h                     |  1 +
 9 files changed, 49 insertions(+), 22 deletions(-)

Comments

Guenter Roeck March 3, 2020, 4:03 p.m. UTC | #1
On Sun, Feb 16, 2020 at 07:23:32PM +0100, Ard Biesheuvel wrote:
> Instead of going through the EFI system table each time, just copy the
> runtime services table pointer into struct efi directly. This is the
> last use of the system table pointer in struct efi, allowing us to
> drop it in a future patch, along with a fair amount of quirky handling
> of the translated address.
> 
> Note that usually, the runtime services pointer changes value during
> the call to SetVirtualAddressMap(), so grab the updated value as soon
> as that call returns. (Mixed mode uses a 1:1 mapping, and kexec boot
> enters with the updated address in the system table, so in those cases,
> we don't need to do anything here)
> 
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

This patch results in a crash with i386 efi boots if PAE (CONFIG_HIGHMEM64G=y)
is enabled. Bisect and crash logs attached. There is also a warning which
I don't recall seeing before, but it may not be caused by this patch
(I didn' bisect the warning). The warning is seen with all i386:efi boots,
not only when PAE is enabled. The warning log is also attached.

Guenter

---
Qemu command line:

qemu-system-i386 -kernel arch/x86/boot/bzImage -M pc -cpu Westmere \
	-no-reboot -m 256 -snapshot \
	-bios OVMF-pure-efi-32.fd \
	-usb -device usb-storage,drive=d0 \
	-drive file=rootfs.ext2,if=none,id=d0,format=raw \
	--append 'earlycon=uart8250,io,0x3f8,9600n8 panic=-1 slub_debug=FZPUA root=/dev/sda rootwait mem=256M console=ttyS0' \
	-nographic

---
# bad: [e78aa714e3261e23c7413fd6e719820e271ff128] Add linux-next specific files for 20200303
# good: [98d54f81e36ba3bf92172791eba5ca5bd813989b] Linux 5.6-rc4
git bisect start 'HEAD' 'v5.6-rc4'
# good: [a2a09dd01b6aa08d10393c8d917de75787e3132e] Merge remote-tracking branch 'crypto/master'
git bisect good a2a09dd01b6aa08d10393c8d917de75787e3132e
# good: [5a8e63833f9ef8c26c42220a839bbb9687bfe71b] Merge remote-tracking branch 'spi/for-next'
git bisect good 5a8e63833f9ef8c26c42220a839bbb9687bfe71b
# bad: [e02ce27a4ed5d49b92cc5269c15a1acdd9bacd9b] Merge remote-tracking branch 'thunderbolt/next'
git bisect bad e02ce27a4ed5d49b92cc5269c15a1acdd9bacd9b
# bad: [943cba4a99fe46ebca32b66bedb867fddeff9a7b] Merge remote-tracking branch 'edac/edac-for-next'
git bisect bad 943cba4a99fe46ebca32b66bedb867fddeff9a7b
# good: [a47d8a0913d007555df3cde040091305878b45b1] Merge branch 'locking/kcsan'
git bisect good a47d8a0913d007555df3cde040091305878b45b1
# bad: [fe4db90a80cd12ebe4efe385d40d6636330149ed] efi: Add support for EFI_RT_PROPERTIES table
git bisect bad fe4db90a80cd12ebe4efe385d40d6636330149ed
# good: [0255973bd6e471e1c34284328098bfab89840df3] efi/libstub: Describe efi_relocate_kernel()
git bisect good 0255973bd6e471e1c34284328098bfab89840df3
# good: [686312927b13fc30b23b0e0f9be097c292343048] efi/ia64: Switch to efi_config_parse_tables()
git bisect good 686312927b13fc30b23b0e0f9be097c292343048
# bad: [223e3ee56f77570157aba8cc550208af430a869b] efi/x86: add headroom to decompressor BSS to account for setup block
git bisect bad 223e3ee56f77570157aba8cc550208af430a869b
# good: [9cd437ac0ef4f324a92e2579784b03bb487ae7fb] efi/x86: Make fw_vendor, config_table and runtime sysfs nodes x86 specific
git bisect good 9cd437ac0ef4f324a92e2579784b03bb487ae7fb
# bad: [59f2a619a2db86111e8bb30f349aebff6eb75baa] efi: Add 'runtime' pointer to struct efi
git bisect bad 59f2a619a2db86111e8bb30f349aebff6eb75baa
# good: [09308012d8546dda75e96c02bed19e2ba1e875fd] efi/x86: Merge assignments of efi.runtime_version
git bisect good 09308012d8546dda75e96c02bed19e2ba1e875fd
# first bad commit: [59f2a619a2db86111e8bb30f349aebff6eb75baa] efi: Add 'runtime' pointer to struct efi

---
Crash:

[    1.022602] ------------[ cut here ]------------
[    1.022602] kernel BUG at arch/x86/mm/pat/set_memory.c:348!
[    1.022602] invalid opcode: 0000 [#1] SMP PTI
[    1.022602] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W         5.6.0-rc4-next-20200303 #1
[    1.022602] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015
[    1.022602] EIP: change_page_attr_set_clr+0x26c/0x280
[    1.022602] Code: c1 eb 05 c1 e8 03 83 e0 03 09 c3 0f b6 9b 40 89 83 c8 85 db 0f 95 45 a3 e9 b1 fe ff ff 80 3d 88 ef 93 c8 00 0f 85 b7 fe ff ff <0f> 0b e8 6d 8b 00 00 8d b4 26 00 00 00 00 8d b6 00 00 00 00 55 89
[    1.022602] EAX: 00000046 EBX: 00000000 ECX: 00000000 EDX: 00000000
[    1.022602] ESI: 00000000 EDI: 00000000 EBP: c880fef4 ESP: c880fe94
[    1.022602] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00000046
[    1.022602] CR0: 80050033 CR2: ffbff000 CR3: 08a36000 CR4: 000006b0
[    1.022602] Call Trace:
[    1.022602]  ? memremap+0x1d/0x1b0
[    1.022602]  set_memory_x+0x39/0x40
[    1.022602]  efi_set_executable+0x5a/0x68
[    1.022602]  runtime_code_page_mkexec+0x2e/0x39
[    1.022602]  efi_runtime_update_mappings+0x11/0x14
[    1.022602]  efi_enter_virtual_mode+0x36c/0x388
[    1.022602]  start_kernel+0x3b7/0x443
[    1.022602]  i386_start_kernel+0x43/0x45
[    1.022602]  startup_32_smp+0x164/0x168
[    1.022602] Modules linked in:
[    1.022602] ---[ end trace 9d84af499f5da089 ]---
[    1.022602] EIP: change_page_attr_set_clr+0x26c/0x280
[    1.022602] Code: c1 eb 05 c1 e8 03 83 e0 03 09 c3 0f b6 9b 40 89 83 c8 85 db 0f 95 45 a3 e9 b1 fe ff ff 80 3d 88 ef 93 c8 00 0f 85 b7 fe ff ff <0f> 0b e8 6d 8b 00 00 8d b4 26 00 00 00 00 8d b6 00 00 00 00 55 89
[    1.022602] EAX: 00000046 EBX: 00000000 ECX: 00000000 EDX: 00000000
[    1.022602] ESI: 00000000 EDI: 00000000 EBP: c880fef4 ESP: c880fe94
[    1.022602] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00000046
[    1.022602] CR0: 80050033 CR2: ffbff000 CR3: 08a36000 CR4: 000006b0
[    1.022602] Kernel panic - not syncing: Attempted to kill the idle task!

---
Warning:

[    0.645996] ------------[ cut here ]------------
[    0.645996] WARNING: CPU: 0 PID: 0 at arch/x86/kernel/traps.c:811 do_debug+0x161/0x1e0
[    0.645996] Modules linked in:
[    0.645996] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.6.0-rc4-next-20200303 #1
[    0.645996] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
[    0.645996] EIP: do_debug+0x161/0x1e0
[    0.645996] Code: 84 2b ff ff ff eb da 66 90 e8 cb 89 0c 00 e9 35 ff ff ff 8d b6 00 00 00 00 0f b7 53 34 83 e2 03 66 83 fa 03 0f 84 79 ff ff ff <0f> 0b 80 e4 bf 89 86 3c 0d 00 00 f0 80 0e 10 81 63 38 ff fe ff ff
[    0.645996] EAX: 00004000 EBX: cd3f9ec8 ECX: 00000000 EDX: 00000000
[    0.645996] ESI: cd408e80 EDI: 00004000 EBP: cd3f9ec0 ESP: cd3f9ea4
[    0.645996] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00000093
[    0.645996] CR0: 80050033 CR2: ffd19000 CR3: 0d615000 CR4: 00000690
[    0.645996] Call Trace:
[    0.645996]  ? do_error_trap+0xd0/0xd0
[    0.645996]  common_exception+0x147/0x162
[    0.645996] EIP: trace_hardirqs_off+0x0/0x100
[    0.645996] Code: e8 85 3b f9 ff 8b 55 ec b8 60 34 43 cd e8 68 a1 f8 ff 64 ff 0d e4 47 5f cd 8b 5d 04 e9 49 ff ff ff 0f 0b eb 91 8d 74 26 00 90 <55> 89 e5 57 56 53 83 ec 08 64 a1 70 6e 60 cd 85 c0 0f 85 95 00 00
[    0.645996] EAX: 00000000 EBX: 000001e0 ECX: d0863f10 EDX: 80050033
[    0.645996] ESI: 00000000 EDI: 00000030 EBP: cd3f9f48 ESP: cd3f9f24
[    0.645996] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 000001c2
[    0.645996]  ? do_error_trap+0xd0/0xd0
[    0.645996]  ? trace_hardirqs_on_caller+0x100/0x100
[    0.645996]  ? efi_set_virtual_address_map+0x7d/0xb8
[    0.645996]  efi_enter_virtual_mode+0x340/0x380
[    0.645996]  start_kernel+0x3a6/0x432
[    0.645996]  i386_start_kernel+0x43/0x45
[    0.645996]  startup_32_smp+0x164/0x168
[    0.645996] irq event stamp: 3346
[    0.645996] hardirqs last  enabled at (3345): [<cc3e6ba5>] __slab_alloc.constprop.99+0x45/0x60
[    0.645996] hardirqs last disabled at (3346): [<cd568df9>] efi_set_virtual_address_map+0x51/0xb8
[    0.645996] softirqs last  enabled at (3298): [<ccf3c155>] __do_softirq+0x2c5/0x3bb
[    0.645996] softirqs last disabled at (3291): [<cc21fafd>] call_on_stack+0xd/0x50
[    0.645996] ---[ end trace 4d4ba9fe34c1e861 ]---
Ard Biesheuvel March 3, 2020, 4:39 p.m. UTC | #2
On Tue, 3 Mar 2020 at 17:03, Guenter Roeck <linux@roeck-us.net> wrote:
>
> On Sun, Feb 16, 2020 at 07:23:32PM +0100, Ard Biesheuvel wrote:
> > Instead of going through the EFI system table each time, just copy the
> > runtime services table pointer into struct efi directly. This is the
> > last use of the system table pointer in struct efi, allowing us to
> > drop it in a future patch, along with a fair amount of quirky handling
> > of the translated address.
> >
> > Note that usually, the runtime services pointer changes value during
> > the call to SetVirtualAddressMap(), so grab the updated value as soon
> > as that call returns. (Mixed mode uses a 1:1 mapping, and kexec boot
> > enters with the updated address in the system table, so in those cases,
> > we don't need to do anything here)
> >
> > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
>
> This patch results in a crash with i386 efi boots if PAE (CONFIG_HIGHMEM64G=y)
> is enabled. Bisect and crash logs attached. There is also a warning which
> I don't recall seeing before, but it may not be caused by this patch
> (I didn' bisect the warning). The warning is seen with all i386:efi boots,
> not only when PAE is enabled. The warning log is also attached.
>
> Guenter
>
> ---
> Qemu command line:
>
> qemu-system-i386 -kernel arch/x86/boot/bzImage -M pc -cpu Westmere \
>         -no-reboot -m 256 -snapshot \
>         -bios OVMF-pure-efi-32.fd \
>         -usb -device usb-storage,drive=d0 \
>         -drive file=rootfs.ext2,if=none,id=d0,format=raw \
>         --append 'earlycon=uart8250,io,0x3f8,9600n8 panic=-1 slub_debug=FZPUA root=/dev/sda rootwait mem=256M console=ttyS0' \
>         -nographic
>

I am failing to reproduce this. Do you have a .config and a copy of
OVMF-pure-efi-32.fd anywhere?


> ---
> # bad: [e78aa714e3261e23c7413fd6e719820e271ff128] Add linux-next specific files for 20200303
> # good: [98d54f81e36ba3bf92172791eba5ca5bd813989b] Linux 5.6-rc4
> git bisect start 'HEAD' 'v5.6-rc4'
> # good: [a2a09dd01b6aa08d10393c8d917de75787e3132e] Merge remote-tracking branch 'crypto/master'
> git bisect good a2a09dd01b6aa08d10393c8d917de75787e3132e
> # good: [5a8e63833f9ef8c26c42220a839bbb9687bfe71b] Merge remote-tracking branch 'spi/for-next'
> git bisect good 5a8e63833f9ef8c26c42220a839bbb9687bfe71b
> # bad: [e02ce27a4ed5d49b92cc5269c15a1acdd9bacd9b] Merge remote-tracking branch 'thunderbolt/next'
> git bisect bad e02ce27a4ed5d49b92cc5269c15a1acdd9bacd9b
> # bad: [943cba4a99fe46ebca32b66bedb867fddeff9a7b] Merge remote-tracking branch 'edac/edac-for-next'
> git bisect bad 943cba4a99fe46ebca32b66bedb867fddeff9a7b
> # good: [a47d8a0913d007555df3cde040091305878b45b1] Merge branch 'locking/kcsan'
> git bisect good a47d8a0913d007555df3cde040091305878b45b1
> # bad: [fe4db90a80cd12ebe4efe385d40d6636330149ed] efi: Add support for EFI_RT_PROPERTIES table
> git bisect bad fe4db90a80cd12ebe4efe385d40d6636330149ed
> # good: [0255973bd6e471e1c34284328098bfab89840df3] efi/libstub: Describe efi_relocate_kernel()
> git bisect good 0255973bd6e471e1c34284328098bfab89840df3
> # good: [686312927b13fc30b23b0e0f9be097c292343048] efi/ia64: Switch to efi_config_parse_tables()
> git bisect good 686312927b13fc30b23b0e0f9be097c292343048
> # bad: [223e3ee56f77570157aba8cc550208af430a869b] efi/x86: add headroom to decompressor BSS to account for setup block
> git bisect bad 223e3ee56f77570157aba8cc550208af430a869b
> # good: [9cd437ac0ef4f324a92e2579784b03bb487ae7fb] efi/x86: Make fw_vendor, config_table and runtime sysfs nodes x86 specific
> git bisect good 9cd437ac0ef4f324a92e2579784b03bb487ae7fb
> # bad: [59f2a619a2db86111e8bb30f349aebff6eb75baa] efi: Add 'runtime' pointer to struct efi
> git bisect bad 59f2a619a2db86111e8bb30f349aebff6eb75baa
> # good: [09308012d8546dda75e96c02bed19e2ba1e875fd] efi/x86: Merge assignments of efi.runtime_version
> git bisect good 09308012d8546dda75e96c02bed19e2ba1e875fd
> # first bad commit: [59f2a619a2db86111e8bb30f349aebff6eb75baa] efi: Add 'runtime' pointer to struct efi
>
> ---
> Crash:
>
> [    1.022602] ------------[ cut here ]------------
> [    1.022602] kernel BUG at arch/x86/mm/pat/set_memory.c:348!
> [    1.022602] invalid opcode: 0000 [#1] SMP PTI
> [    1.022602] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W         5.6.0-rc4-next-20200303 #1
> [    1.022602] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015
> [    1.022602] EIP: change_page_attr_set_clr+0x26c/0x280
> [    1.022602] Code: c1 eb 05 c1 e8 03 83 e0 03 09 c3 0f b6 9b 40 89 83 c8 85 db 0f 95 45 a3 e9 b1 fe ff ff 80 3d 88 ef 93 c8 00 0f 85 b7 fe ff ff <0f> 0b e8 6d 8b 00 00 8d b4 26 00 00 00 00 8d b6 00 00 00 00 55 89
> [    1.022602] EAX: 00000046 EBX: 00000000 ECX: 00000000 EDX: 00000000
> [    1.022602] ESI: 00000000 EDI: 00000000 EBP: c880fef4 ESP: c880fe94
> [    1.022602] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00000046
> [    1.022602] CR0: 80050033 CR2: ffbff000 CR3: 08a36000 CR4: 000006b0
> [    1.022602] Call Trace:
> [    1.022602]  ? memremap+0x1d/0x1b0
> [    1.022602]  set_memory_x+0x39/0x40
> [    1.022602]  efi_set_executable+0x5a/0x68
> [    1.022602]  runtime_code_page_mkexec+0x2e/0x39
> [    1.022602]  efi_runtime_update_mappings+0x11/0x14
> [    1.022602]  efi_enter_virtual_mode+0x36c/0x388
> [    1.022602]  start_kernel+0x3b7/0x443
> [    1.022602]  i386_start_kernel+0x43/0x45
> [    1.022602]  startup_32_smp+0x164/0x168
> [    1.022602] Modules linked in:
> [    1.022602] ---[ end trace 9d84af499f5da089 ]---
> [    1.022602] EIP: change_page_attr_set_clr+0x26c/0x280
> [    1.022602] Code: c1 eb 05 c1 e8 03 83 e0 03 09 c3 0f b6 9b 40 89 83 c8 85 db 0f 95 45 a3 e9 b1 fe ff ff 80 3d 88 ef 93 c8 00 0f 85 b7 fe ff ff <0f> 0b e8 6d 8b 00 00 8d b4 26 00 00 00 00 8d b6 00 00 00 00 55 89
> [    1.022602] EAX: 00000046 EBX: 00000000 ECX: 00000000 EDX: 00000000
> [    1.022602] ESI: 00000000 EDI: 00000000 EBP: c880fef4 ESP: c880fe94
> [    1.022602] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00000046
> [    1.022602] CR0: 80050033 CR2: ffbff000 CR3: 08a36000 CR4: 000006b0
> [    1.022602] Kernel panic - not syncing: Attempted to kill the idle task!
>
> ---
> Warning:
>
> [    0.645996] ------------[ cut here ]------------
> [    0.645996] WARNING: CPU: 0 PID: 0 at arch/x86/kernel/traps.c:811 do_debug+0x161/0x1e0
> [    0.645996] Modules linked in:
> [    0.645996] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.6.0-rc4-next-20200303 #1
> [    0.645996] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
> [    0.645996] EIP: do_debug+0x161/0x1e0
> [    0.645996] Code: 84 2b ff ff ff eb da 66 90 e8 cb 89 0c 00 e9 35 ff ff ff 8d b6 00 00 00 00 0f b7 53 34 83 e2 03 66 83 fa 03 0f 84 79 ff ff ff <0f> 0b 80 e4 bf 89 86 3c 0d 00 00 f0 80 0e 10 81 63 38 ff fe ff ff
> [    0.645996] EAX: 00004000 EBX: cd3f9ec8 ECX: 00000000 EDX: 00000000
> [    0.645996] ESI: cd408e80 EDI: 00004000 EBP: cd3f9ec0 ESP: cd3f9ea4
> [    0.645996] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00000093
> [    0.645996] CR0: 80050033 CR2: ffd19000 CR3: 0d615000 CR4: 00000690
> [    0.645996] Call Trace:
> [    0.645996]  ? do_error_trap+0xd0/0xd0
> [    0.645996]  common_exception+0x147/0x162
> [    0.645996] EIP: trace_hardirqs_off+0x0/0x100
> [    0.645996] Code: e8 85 3b f9 ff 8b 55 ec b8 60 34 43 cd e8 68 a1 f8 ff 64 ff 0d e4 47 5f cd 8b 5d 04 e9 49 ff ff ff 0f 0b eb 91 8d 74 26 00 90 <55> 89 e5 57 56 53 83 ec 08 64 a1 70 6e 60 cd 85 c0 0f 85 95 00 00
> [    0.645996] EAX: 00000000 EBX: 000001e0 ECX: d0863f10 EDX: 80050033
> [    0.645996] ESI: 00000000 EDI: 00000030 EBP: cd3f9f48 ESP: cd3f9f24
> [    0.645996] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 000001c2
> [    0.645996]  ? do_error_trap+0xd0/0xd0
> [    0.645996]  ? trace_hardirqs_on_caller+0x100/0x100
> [    0.645996]  ? efi_set_virtual_address_map+0x7d/0xb8
> [    0.645996]  efi_enter_virtual_mode+0x340/0x380
> [    0.645996]  start_kernel+0x3a6/0x432
> [    0.645996]  i386_start_kernel+0x43/0x45
> [    0.645996]  startup_32_smp+0x164/0x168
> [    0.645996] irq event stamp: 3346
> [    0.645996] hardirqs last  enabled at (3345): [<cc3e6ba5>] __slab_alloc.constprop.99+0x45/0x60
> [    0.645996] hardirqs last disabled at (3346): [<cd568df9>] efi_set_virtual_address_map+0x51/0xb8
> [    0.645996] softirqs last  enabled at (3298): [<ccf3c155>] __do_softirq+0x2c5/0x3bb
> [    0.645996] softirqs last disabled at (3291): [<cc21fafd>] call_on_stack+0xd/0x50
> [    0.645996] ---[ end trace 4d4ba9fe34c1e861 ]---
>
Guenter Roeck March 3, 2020, 5:53 p.m. UTC | #3
On Tue, Mar 03, 2020 at 05:39:43PM +0100, Ard Biesheuvel wrote:
> On Tue, 3 Mar 2020 at 17:03, Guenter Roeck <linux@roeck-us.net> wrote:
> >
> > On Sun, Feb 16, 2020 at 07:23:32PM +0100, Ard Biesheuvel wrote:
> > > Instead of going through the EFI system table each time, just copy the
> > > runtime services table pointer into struct efi directly. This is the
> > > last use of the system table pointer in struct efi, allowing us to
> > > drop it in a future patch, along with a fair amount of quirky handling
> > > of the translated address.
> > >
> > > Note that usually, the runtime services pointer changes value during
> > > the call to SetVirtualAddressMap(), so grab the updated value as soon
> > > as that call returns. (Mixed mode uses a 1:1 mapping, and kexec boot
> > > enters with the updated address in the system table, so in those cases,
> > > we don't need to do anything here)
> > >
> > > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> >
> > This patch results in a crash with i386 efi boots if PAE (CONFIG_HIGHMEM64G=y)
> > is enabled. Bisect and crash logs attached. There is also a warning which
> > I don't recall seeing before, but it may not be caused by this patch
> > (I didn' bisect the warning). The warning is seen with all i386:efi boots,
> > not only when PAE is enabled. The warning log is also attached.
> >
> > Guenter
> >
> > ---
> > Qemu command line:
> >
> > qemu-system-i386 -kernel arch/x86/boot/bzImage -M pc -cpu Westmere \
> >         -no-reboot -m 256 -snapshot \
> >         -bios OVMF-pure-efi-32.fd \
> >         -usb -device usb-storage,drive=d0 \
> >         -drive file=rootfs.ext2,if=none,id=d0,format=raw \
> >         --append 'earlycon=uart8250,io,0x3f8,9600n8 panic=-1 slub_debug=FZPUA root=/dev/sda rootwait mem=256M console=ttyS0' \
> >         -nographic
> >
> 
> I am failing to reproduce this. Do you have a .config and a copy of
> OVMF-pure-efi-32.fd anywhere?
> 

https://github.com/groeck/linux-build-test/blob/master/rootfs/firmware/OVMF-pure-efi-32.fd
https://github.com/groeck/linux-build-test/blob/master/rootfs/x86/rootfs.ext2.gz

Config file is below, shortened by "make savedefconfig" on the actual
configuration used on next-20200303. Qemu version is 4.2, though that
should not really matter. Note that it isn't necessary to boot from usb,
that was just my test case.

Here is a pointer to a complete log, showing the various conditions
resulting in the warning and the crash:

https://kerneltests.org/builders/qemu-x86-next/builds/1310/steps/qemubuildcommand_1/logs/stdio

Guenter

---
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
CONFIG_USELIB=y
CONFIG_AUDIT=y
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_PREEMPT_VOLUNTARY=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_TASKSTATS=y
CONFIG_TASK_DELAY_ACCT=y
CONFIG_TASK_XACCT=y
CONFIG_TASK_IO_ACCOUNTING=y
CONFIG_LOG_BUF_SHIFT=18
CONFIG_CGROUPS=y
CONFIG_CGROUP_SCHED=y
CONFIG_CGROUP_FREEZER=y
CONFIG_CPUSETS=y
CONFIG_CGROUP_CPUACCT=y
CONFIG_NAMESPACES=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_EXPERT=y
# CONFIG_COMPAT_BRK is not set
CONFIG_PROFILING=y
CONFIG_SMP=y
CONFIG_NR_CPUS=8
CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS=y
CONFIG_MICROCODE_AMD=y
CONFIG_X86_MSR=y
CONFIG_X86_CPUID=y
CONFIG_X86_CHECK_BIOS_CORRUPTION=y
# CONFIG_MTRR_SANITIZER is not set
CONFIG_EFI=y
CONFIG_EFI_STUB=y
CONFIG_HZ_1000=y
CONFIG_KEXEC=y
CONFIG_CRASH_DUMP=y
CONFIG_HIBERNATION=y
CONFIG_PM_DEBUG=y
CONFIG_PM_TRACE_RTC=y
CONFIG_ACPI_DOCK=y
CONFIG_ACPI_BGRT=y
CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_X86_ACPI_CPUFREQ=y
CONFIG_EFI_VARS=y
CONFIG_EFI_CAPSULE_LOADER=y
# CONFIG_KVM_WERROR is not set
CONFIG_KPROBES=y
CONFIG_JUMP_LABEL=y
CONFIG_STATIC_KEYS_SELFTEST=y
CONFIG_COMPAT_32BIT_TIME=y
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
# CONFIG_UNUSED_SYMBOLS is not set
CONFIG_BINFMT_MISC=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_XFRM_USER=y
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_IP_ROUTE_MULTIPATH=y
CONFIG_IP_ROUTE_VERBOSE=y
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_IP_PNP_BOOTP=y
CONFIG_IP_PNP_RARP=y
CONFIG_IP_MROUTE=y
CONFIG_IP_PIMSM_V1=y
CONFIG_IP_PIMSM_V2=y
CONFIG_SYN_COOKIES=y
# CONFIG_INET_DIAG is not set
CONFIG_TCP_CONG_ADVANCED=y
# CONFIG_TCP_CONG_BIC is not set
# CONFIG_TCP_CONG_WESTWOOD is not set
# CONFIG_TCP_CONG_HTCP is not set
CONFIG_TCP_MD5SIG=y
CONFIG_INET6_AH=y
CONFIG_INET6_ESP=y
CONFIG_NETLABEL=y
CONFIG_NETFILTER=y
# CONFIG_NETFILTER_ADVANCED is not set
CONFIG_NF_CONNTRACK=y
CONFIG_NF_CONNTRACK_FTP=y
CONFIG_NF_CONNTRACK_IRC=y
CONFIG_NF_CONNTRACK_SIP=y
CONFIG_NF_CT_NETLINK=y
CONFIG_NF_NAT=y
CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=y
CONFIG_NETFILTER_XT_TARGET_NFLOG=y
CONFIG_NETFILTER_XT_TARGET_SECMARK=y
CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
CONFIG_NETFILTER_XT_MATCH_POLICY=y
CONFIG_NETFILTER_XT_MATCH_STATE=y
CONFIG_IP_NF_IPTABLES=y
CONFIG_IP_NF_FILTER=y
CONFIG_IP_NF_TARGET_REJECT=y
CONFIG_IP_NF_TARGET_MASQUERADE=m
CONFIG_IP_NF_MANGLE=y
CONFIG_IP6_NF_IPTABLES=y
CONFIG_IP6_NF_MATCH_IPV6HEADER=y
CONFIG_IP6_NF_FILTER=y
CONFIG_IP6_NF_TARGET_REJECT=y
CONFIG_IP6_NF_MANGLE=y
CONFIG_NET_SCHED=y
CONFIG_NET_EMATCH=y
CONFIG_NET_CLS_ACT=y
CONFIG_HAMRADIO=y
CONFIG_CFG80211=y
CONFIG_MAC80211=y
CONFIG_MAC80211_LEDS=y
CONFIG_RFKILL=y
CONFIG_RFKILL_INPUT=y
CONFIG_PCI=y
CONFIG_PCIEPORTBUS=y
CONFIG_PCI_MSI=y
CONFIG_HOTPLUG_PCI=y
CONFIG_PCCARD=y
CONFIG_YENTA=y
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_DEBUG_DEVRES=y
CONFIG_PM_QOS_KUNIT_TEST=y
CONFIG_CONNECTOR=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_VIRTIO_BLK=y
CONFIG_BLK_DEV_NVME=y
CONFIG_PCI_ENDPOINT_TEST=y
CONFIG_BLK_DEV_SD=y
CONFIG_BLK_DEV_SR=y
CONFIG_CHR_DEV_SG=y
CONFIG_SCSI_CONSTANTS=y
CONFIG_MEGARAID_SAS=y
CONFIG_SCSI_SYM53C8XX_2=y
CONFIG_SCSI_DC395x=y
CONFIG_SCSI_AM53C974=y
CONFIG_SCSI_VIRTIO=y
CONFIG_ATA=y
CONFIG_SATA_AHCI=y
CONFIG_ATA_PIIX=y
CONFIG_PATA_AMD=y
CONFIG_PATA_OLDPIIX=y
CONFIG_PATA_SCH=y
CONFIG_PATA_MPIIX=y
CONFIG_ATA_GENERIC=y
CONFIG_MD=y
CONFIG_BLK_DEV_MD=y
CONFIG_BLK_DEV_DM=y
CONFIG_DM_MIRROR=y
CONFIG_DM_ZERO=y
CONFIG_FUSION=y
CONFIG_FUSION_SAS=y
CONFIG_MACINTOSH_DRIVERS=y
CONFIG_MAC_EMUMOUSEBTN=y
CONFIG_NETDEVICES=y
CONFIG_NETCONSOLE=y
CONFIG_BNX2=y
CONFIG_TIGON3=y
CONFIG_NET_TULIP=y
CONFIG_E100=y
CONFIG_E1000=y
CONFIG_E1000E=y
CONFIG_SKY2=y
CONFIG_NE2K_PCI=y
CONFIG_FORCEDETH=y
CONFIG_8139TOO=y
# CONFIG_8139TOO_PIO is not set
CONFIG_R8169=y
CONFIG_FDDI=y
CONFIG_INPUT_POLLDEV=y
CONFIG_INPUT_EVDEV=y
CONFIG_INPUT_JOYSTICK=y
CONFIG_INPUT_TABLET=y
CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_INPUT_MISC=y
# CONFIG_LEGACY_PTYS is not set
CONFIG_SERIAL_NONSTANDARD=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_NR_UARTS=32
CONFIG_SERIAL_8250_EXTENDED=y
CONFIG_SERIAL_8250_MANY_PORTS=y
CONFIG_SERIAL_8250_SHARE_IRQ=y
CONFIG_SERIAL_8250_DETECT_IRQ=y
CONFIG_SERIAL_8250_RSA=y
CONFIG_HW_RANDOM=y
CONFIG_NVRAM=y
CONFIG_HPET=y
# CONFIG_HPET_MMAP is not set
CONFIG_I2C_I801=y
CONFIG_WATCHDOG=y
CONFIG_AGP=y
CONFIG_AGP_AMD64=y
CONFIG_AGP_INTEL=y
CONFIG_DRM=y
CONFIG_DRM_I915=y
CONFIG_FB_MODE_HELPERS=y
CONFIG_FB_TILEBLITTING=y
CONFIG_FB_EFI=y
CONFIG_VGACON_SOFT_SCROLLBACK=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_LOGO=y
# CONFIG_LOGO_LINUX_MONO is not set
# CONFIG_LOGO_LINUX_VGA16 is not set
CONFIG_SOUND=y
CONFIG_SND=y
CONFIG_SND_HRTIMER=y
CONFIG_SND_SEQUENCER=y
CONFIG_SND_SEQ_DUMMY=y
CONFIG_SND_HDA_INTEL=y
CONFIG_SND_HDA_HWDEP=y
CONFIG_HIDRAW=y
CONFIG_HID_A4TECH=y
CONFIG_HID_APPLE=y
CONFIG_HID_BELKIN=y
CONFIG_HID_CHERRY=y
CONFIG_HID_CHICONY=y
CONFIG_HID_CYPRESS=y
CONFIG_HID_EZKEY=y
CONFIG_HID_GYRATION=y
CONFIG_HID_ITE=y
CONFIG_HID_KENSINGTON=y
CONFIG_HID_LOGITECH=y
CONFIG_LOGITECH_FF=y
CONFIG_HID_REDRAGON=y
CONFIG_HID_MICROSOFT=y
CONFIG_HID_MONTEREY=y
CONFIG_HID_NTRIG=y
CONFIG_HID_PANTHERLORD=y
CONFIG_PANTHERLORD_FF=y
CONFIG_HID_PETALYNX=y
CONFIG_HID_SAMSUNG=y
CONFIG_HID_SONY=y
CONFIG_HID_SUNPLUS=y
CONFIG_HID_TOPSEED=y
CONFIG_HID_PID=y
CONFIG_USB_HIDDEV=y
CONFIG_USB=y
CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
CONFIG_USB_MON=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_UHCI_HCD=y
CONFIG_USB_PRINTER=y
CONFIG_USB_STORAGE=y
CONFIG_USB_UAS=y
CONFIG_USB_TEST=y
CONFIG_USB_EHSET_TEST_FIXTURE=y
CONFIG_USB_LINK_LAYER_TEST=y
CONFIG_MMC=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_PCI=y
CONFIG_EDAC=y
CONFIG_RTC_CLASS=y
# CONFIG_RTC_HCTOSYS is not set
CONFIG_DMADEVICES=y
CONFIG_DMATEST=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_BALLOON=y
CONFIG_VIRTIO_MMIO=y
CONFIG_EEEPC_LAPTOP=y
CONFIG_EXT3_FS=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
CONFIG_EXT4_KUNIT_TESTS=y
CONFIG_BTRFS_FS=y
CONFIG_QUOTA=y
CONFIG_QUOTA_NETLINK_INTERFACE=y
# CONFIG_PRINT_QUOTA_WARNING is not set
CONFIG_QFMT_V2=y
CONFIG_AUTOFS4_FS=y
CONFIG_ISO9660_FS=y
CONFIG_JOLIET=y
CONFIG_ZISOFS=y
CONFIG_MSDOS_FS=y
CONFIG_VFAT_FS=y
CONFIG_PROC_KCORE=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_HUGETLBFS=y
CONFIG_SQUASHFS=y
CONFIG_SQUASHFS_XATTR=y
CONFIG_SQUASHFS_4K_DEVBLK_SIZE=y
CONFIG_NFS_FS=y
CONFIG_NFS_V3_ACL=y
CONFIG_NFS_V4=y
CONFIG_ROOT_NFS=y
CONFIG_NLS_DEFAULT="utf8"
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ASCII=y
CONFIG_NLS_ISO8859_1=y
CONFIG_NLS_UTF8=y
CONFIG_SECURITY=y
CONFIG_SECURITY_NETWORK=y
CONFIG_SECURITY_SELINUX=y
CONFIG_SECURITY_SELINUX_BOOTPARAM=y
CONFIG_SECURITY_SELINUX_DISABLE=y
# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
CONFIG_CRC32_SELFTEST=y
CONFIG_GLOB_SELFTEST=y
CONFIG_STRING_SELFTEST=y
CONFIG_PRINTK_TIME=y
CONFIG_FRAME_WARN=1024
CONFIG_MAGIC_SYSRQ=y
CONFIG_DEBUG_RODATA_TEST=y
CONFIG_DEBUG_STACK_USAGE=y
CONFIG_DEBUG_MEMORY_INIT=y
# CONFIG_SCHED_DEBUG is not set
CONFIG_SCHEDSTATS=y
CONFIG_PROVE_LOCKING=y
CONFIG_DEBUG_LOCKDEP=y
CONFIG_DEBUG_ATOMIC_SLEEP=y
CONFIG_DEBUG_LOCKING_API_SELFTESTS=y
CONFIG_WW_MUTEX_SELFTEST=y
CONFIG_DEBUG_LIST=y
CONFIG_RCU_EQS_DEBUG=y
CONFIG_BLK_DEV_IO_TRACE=y
CONFIG_PROVIDE_OHCI1394_DMA_INIT=y
CONFIG_EARLY_PRINTK_DBGP=y
CONFIG_DEBUG_TLBFLUSH=y
CONFIG_DEBUG_BOOT_PARAMS=y
CONFIG_DEBUG_NMI_SELFTEST=y
CONFIG_UNWINDER_FRAME_POINTER=y
CONFIG_KUNIT=y
CONFIG_KUNIT_TEST=y
CONFIG_TEST_SORT=y
CONFIG_RBTREE_TEST=y
CONFIG_INTERVAL_TREE_TEST=y
CONFIG_TEST_BITMAP=y
CONFIG_TEST_UUID=y
CONFIG_TEST_FIRMWARE=y
CONFIG_TEST_SYSCTL=y
CONFIG_SYSCTL_KUNIT_TEST=y
CONFIG_LIST_KUNIT_TEST=y
Ard Biesheuvel March 3, 2020, 6:01 p.m. UTC | #4
On Tue, 3 Mar 2020 at 18:54, Guenter Roeck <linux@roeck-us.net> wrote:
>
> On Tue, Mar 03, 2020 at 05:39:43PM +0100, Ard Biesheuvel wrote:
> > On Tue, 3 Mar 2020 at 17:03, Guenter Roeck <linux@roeck-us.net> wrote:
> > >
> > > On Sun, Feb 16, 2020 at 07:23:32PM +0100, Ard Biesheuvel wrote:
> > > > Instead of going through the EFI system table each time, just copy the
> > > > runtime services table pointer into struct efi directly. This is the
> > > > last use of the system table pointer in struct efi, allowing us to
> > > > drop it in a future patch, along with a fair amount of quirky handling
> > > > of the translated address.
> > > >
> > > > Note that usually, the runtime services pointer changes value during
> > > > the call to SetVirtualAddressMap(), so grab the updated value as soon
> > > > as that call returns. (Mixed mode uses a 1:1 mapping, and kexec boot
> > > > enters with the updated address in the system table, so in those cases,
> > > > we don't need to do anything here)
> > > >
> > > > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> > >
> > > This patch results in a crash with i386 efi boots if PAE (CONFIG_HIGHMEM64G=y)
> > > is enabled. Bisect and crash logs attached. There is also a warning which
> > > I don't recall seeing before, but it may not be caused by this patch
> > > (I didn' bisect the warning). The warning is seen with all i386:efi boots,
> > > not only when PAE is enabled. The warning log is also attached.
> > >
> > > Guenter
> > >
> > > ---
> > > Qemu command line:
> > >
> > > qemu-system-i386 -kernel arch/x86/boot/bzImage -M pc -cpu Westmere \
> > >         -no-reboot -m 256 -snapshot \
> > >         -bios OVMF-pure-efi-32.fd \
> > >         -usb -device usb-storage,drive=d0 \
> > >         -drive file=rootfs.ext2,if=none,id=d0,format=raw \
> > >         --append 'earlycon=uart8250,io,0x3f8,9600n8 panic=-1 slub_debug=FZPUA root=/dev/sda rootwait mem=256M console=ttyS0' \
> > >         -nographic
> > >
> >
> > I am failing to reproduce this. Do you have a .config and a copy of
> > OVMF-pure-efi-32.fd anywhere?
> >
>
> https://github.com/groeck/linux-build-test/blob/master/rootfs/firmware/OVMF-pure-efi-32.fd
> https://github.com/groeck/linux-build-test/blob/master/rootfs/x86/rootfs.ext2.gz
>
> Config file is below, shortened by "make savedefconfig" on the actual
> configuration used on next-20200303. Qemu version is 4.2, though that
> should not really matter. Note that it isn't necessary to boot from usb,
> that was just my test case.
>
> Here is a pointer to a complete log, showing the various conditions
> resulting in the warning and the crash:
>
> https://kerneltests.org/builders/qemu-x86-next/builds/1310/steps/qemubuildcommand_1/logs/stdio
>

Thanks.

How do I generate your exact .config from the below? I still cannot
reproduce with the different firmware.

My qemu is 3.1 btw


>
> ---
> # CONFIG_LOCALVERSION_AUTO is not set
> CONFIG_SYSVIPC=y
> CONFIG_POSIX_MQUEUE=y
> CONFIG_USELIB=y
> CONFIG_AUDIT=y
> CONFIG_NO_HZ=y
> CONFIG_HIGH_RES_TIMERS=y
> CONFIG_PREEMPT_VOLUNTARY=y
> CONFIG_BSD_PROCESS_ACCT=y
> CONFIG_TASKSTATS=y
> CONFIG_TASK_DELAY_ACCT=y
> CONFIG_TASK_XACCT=y
> CONFIG_TASK_IO_ACCOUNTING=y
> CONFIG_LOG_BUF_SHIFT=18
> CONFIG_CGROUPS=y
> CONFIG_CGROUP_SCHED=y
> CONFIG_CGROUP_FREEZER=y
> CONFIG_CPUSETS=y
> CONFIG_CGROUP_CPUACCT=y
> CONFIG_NAMESPACES=y
> CONFIG_BLK_DEV_INITRD=y
> CONFIG_EXPERT=y
> # CONFIG_COMPAT_BRK is not set
> CONFIG_PROFILING=y
> CONFIG_SMP=y
> CONFIG_NR_CPUS=8
> CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS=y
> CONFIG_MICROCODE_AMD=y
> CONFIG_X86_MSR=y
> CONFIG_X86_CPUID=y
> CONFIG_X86_CHECK_BIOS_CORRUPTION=y
> # CONFIG_MTRR_SANITIZER is not set
> CONFIG_EFI=y
> CONFIG_EFI_STUB=y
> CONFIG_HZ_1000=y
> CONFIG_KEXEC=y
> CONFIG_CRASH_DUMP=y
> CONFIG_HIBERNATION=y
> CONFIG_PM_DEBUG=y
> CONFIG_PM_TRACE_RTC=y
> CONFIG_ACPI_DOCK=y
> CONFIG_ACPI_BGRT=y
> CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
> CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
> CONFIG_CPU_FREQ_GOV_ONDEMAND=y
> CONFIG_X86_ACPI_CPUFREQ=y
> CONFIG_EFI_VARS=y
> CONFIG_EFI_CAPSULE_LOADER=y
> # CONFIG_KVM_WERROR is not set
> CONFIG_KPROBES=y
> CONFIG_JUMP_LABEL=y
> CONFIG_STATIC_KEYS_SELFTEST=y
> CONFIG_COMPAT_32BIT_TIME=y
> CONFIG_MODULES=y
> CONFIG_MODULE_UNLOAD=y
> CONFIG_MODULE_FORCE_UNLOAD=y
> # CONFIG_UNUSED_SYMBOLS is not set
> CONFIG_BINFMT_MISC=y
> CONFIG_NET=y
> CONFIG_PACKET=y
> CONFIG_UNIX=y
> CONFIG_XFRM_USER=y
> CONFIG_INET=y
> CONFIG_IP_MULTICAST=y
> CONFIG_IP_ADVANCED_ROUTER=y
> CONFIG_IP_MULTIPLE_TABLES=y
> CONFIG_IP_ROUTE_MULTIPATH=y
> CONFIG_IP_ROUTE_VERBOSE=y
> CONFIG_IP_PNP=y
> CONFIG_IP_PNP_DHCP=y
> CONFIG_IP_PNP_BOOTP=y
> CONFIG_IP_PNP_RARP=y
> CONFIG_IP_MROUTE=y
> CONFIG_IP_PIMSM_V1=y
> CONFIG_IP_PIMSM_V2=y
> CONFIG_SYN_COOKIES=y
> # CONFIG_INET_DIAG is not set
> CONFIG_TCP_CONG_ADVANCED=y
> # CONFIG_TCP_CONG_BIC is not set
> # CONFIG_TCP_CONG_WESTWOOD is not set
> # CONFIG_TCP_CONG_HTCP is not set
> CONFIG_TCP_MD5SIG=y
> CONFIG_INET6_AH=y
> CONFIG_INET6_ESP=y
> CONFIG_NETLABEL=y
> CONFIG_NETFILTER=y
> # CONFIG_NETFILTER_ADVANCED is not set
> CONFIG_NF_CONNTRACK=y
> CONFIG_NF_CONNTRACK_FTP=y
> CONFIG_NF_CONNTRACK_IRC=y
> CONFIG_NF_CONNTRACK_SIP=y
> CONFIG_NF_CT_NETLINK=y
> CONFIG_NF_NAT=y
> CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=y
> CONFIG_NETFILTER_XT_TARGET_NFLOG=y
> CONFIG_NETFILTER_XT_TARGET_SECMARK=y
> CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
> CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
> CONFIG_NETFILTER_XT_MATCH_POLICY=y
> CONFIG_NETFILTER_XT_MATCH_STATE=y
> CONFIG_IP_NF_IPTABLES=y
> CONFIG_IP_NF_FILTER=y
> CONFIG_IP_NF_TARGET_REJECT=y
> CONFIG_IP_NF_TARGET_MASQUERADE=m
> CONFIG_IP_NF_MANGLE=y
> CONFIG_IP6_NF_IPTABLES=y
> CONFIG_IP6_NF_MATCH_IPV6HEADER=y
> CONFIG_IP6_NF_FILTER=y
> CONFIG_IP6_NF_TARGET_REJECT=y
> CONFIG_IP6_NF_MANGLE=y
> CONFIG_NET_SCHED=y
> CONFIG_NET_EMATCH=y
> CONFIG_NET_CLS_ACT=y
> CONFIG_HAMRADIO=y
> CONFIG_CFG80211=y
> CONFIG_MAC80211=y
> CONFIG_MAC80211_LEDS=y
> CONFIG_RFKILL=y
> CONFIG_RFKILL_INPUT=y
> CONFIG_PCI=y
> CONFIG_PCIEPORTBUS=y
> CONFIG_PCI_MSI=y
> CONFIG_HOTPLUG_PCI=y
> CONFIG_PCCARD=y
> CONFIG_YENTA=y
> CONFIG_DEVTMPFS=y
> CONFIG_DEVTMPFS_MOUNT=y
> CONFIG_DEBUG_DEVRES=y
> CONFIG_PM_QOS_KUNIT_TEST=y
> CONFIG_CONNECTOR=y
> CONFIG_BLK_DEV_LOOP=y
> CONFIG_VIRTIO_BLK=y
> CONFIG_BLK_DEV_NVME=y
> CONFIG_PCI_ENDPOINT_TEST=y
> CONFIG_BLK_DEV_SD=y
> CONFIG_BLK_DEV_SR=y
> CONFIG_CHR_DEV_SG=y
> CONFIG_SCSI_CONSTANTS=y
> CONFIG_MEGARAID_SAS=y
> CONFIG_SCSI_SYM53C8XX_2=y
> CONFIG_SCSI_DC395x=y
> CONFIG_SCSI_AM53C974=y
> CONFIG_SCSI_VIRTIO=y
> CONFIG_ATA=y
> CONFIG_SATA_AHCI=y
> CONFIG_ATA_PIIX=y
> CONFIG_PATA_AMD=y
> CONFIG_PATA_OLDPIIX=y
> CONFIG_PATA_SCH=y
> CONFIG_PATA_MPIIX=y
> CONFIG_ATA_GENERIC=y
> CONFIG_MD=y
> CONFIG_BLK_DEV_MD=y
> CONFIG_BLK_DEV_DM=y
> CONFIG_DM_MIRROR=y
> CONFIG_DM_ZERO=y
> CONFIG_FUSION=y
> CONFIG_FUSION_SAS=y
> CONFIG_MACINTOSH_DRIVERS=y
> CONFIG_MAC_EMUMOUSEBTN=y
> CONFIG_NETDEVICES=y
> CONFIG_NETCONSOLE=y
> CONFIG_BNX2=y
> CONFIG_TIGON3=y
> CONFIG_NET_TULIP=y
> CONFIG_E100=y
> CONFIG_E1000=y
> CONFIG_E1000E=y
> CONFIG_SKY2=y
> CONFIG_NE2K_PCI=y
> CONFIG_FORCEDETH=y
> CONFIG_8139TOO=y
> # CONFIG_8139TOO_PIO is not set
> CONFIG_R8169=y
> CONFIG_FDDI=y
> CONFIG_INPUT_POLLDEV=y
> CONFIG_INPUT_EVDEV=y
> CONFIG_INPUT_JOYSTICK=y
> CONFIG_INPUT_TABLET=y
> CONFIG_INPUT_TOUCHSCREEN=y
> CONFIG_INPUT_MISC=y
> # CONFIG_LEGACY_PTYS is not set
> CONFIG_SERIAL_NONSTANDARD=y
> CONFIG_SERIAL_8250=y
> CONFIG_SERIAL_8250_CONSOLE=y
> CONFIG_SERIAL_8250_NR_UARTS=32
> CONFIG_SERIAL_8250_EXTENDED=y
> CONFIG_SERIAL_8250_MANY_PORTS=y
> CONFIG_SERIAL_8250_SHARE_IRQ=y
> CONFIG_SERIAL_8250_DETECT_IRQ=y
> CONFIG_SERIAL_8250_RSA=y
> CONFIG_HW_RANDOM=y
> CONFIG_NVRAM=y
> CONFIG_HPET=y
> # CONFIG_HPET_MMAP is not set
> CONFIG_I2C_I801=y
> CONFIG_WATCHDOG=y
> CONFIG_AGP=y
> CONFIG_AGP_AMD64=y
> CONFIG_AGP_INTEL=y
> CONFIG_DRM=y
> CONFIG_DRM_I915=y
> CONFIG_FB_MODE_HELPERS=y
> CONFIG_FB_TILEBLITTING=y
> CONFIG_FB_EFI=y
> CONFIG_VGACON_SOFT_SCROLLBACK=y
> CONFIG_FRAMEBUFFER_CONSOLE=y
> CONFIG_LOGO=y
> # CONFIG_LOGO_LINUX_MONO is not set
> # CONFIG_LOGO_LINUX_VGA16 is not set
> CONFIG_SOUND=y
> CONFIG_SND=y
> CONFIG_SND_HRTIMER=y
> CONFIG_SND_SEQUENCER=y
> CONFIG_SND_SEQ_DUMMY=y
> CONFIG_SND_HDA_INTEL=y
> CONFIG_SND_HDA_HWDEP=y
> CONFIG_HIDRAW=y
> CONFIG_HID_A4TECH=y
> CONFIG_HID_APPLE=y
> CONFIG_HID_BELKIN=y
> CONFIG_HID_CHERRY=y
> CONFIG_HID_CHICONY=y
> CONFIG_HID_CYPRESS=y
> CONFIG_HID_EZKEY=y
> CONFIG_HID_GYRATION=y
> CONFIG_HID_ITE=y
> CONFIG_HID_KENSINGTON=y
> CONFIG_HID_LOGITECH=y
> CONFIG_LOGITECH_FF=y
> CONFIG_HID_REDRAGON=y
> CONFIG_HID_MICROSOFT=y
> CONFIG_HID_MONTEREY=y
> CONFIG_HID_NTRIG=y
> CONFIG_HID_PANTHERLORD=y
> CONFIG_PANTHERLORD_FF=y
> CONFIG_HID_PETALYNX=y
> CONFIG_HID_SAMSUNG=y
> CONFIG_HID_SONY=y
> CONFIG_HID_SUNPLUS=y
> CONFIG_HID_TOPSEED=y
> CONFIG_HID_PID=y
> CONFIG_USB_HIDDEV=y
> CONFIG_USB=y
> CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
> CONFIG_USB_MON=y
> CONFIG_USB_XHCI_HCD=y
> CONFIG_USB_EHCI_HCD=y
> CONFIG_USB_OHCI_HCD=y
> CONFIG_USB_UHCI_HCD=y
> CONFIG_USB_PRINTER=y
> CONFIG_USB_STORAGE=y
> CONFIG_USB_UAS=y
> CONFIG_USB_TEST=y
> CONFIG_USB_EHSET_TEST_FIXTURE=y
> CONFIG_USB_LINK_LAYER_TEST=y
> CONFIG_MMC=y
> CONFIG_MMC_SDHCI=y
> CONFIG_MMC_SDHCI_PCI=y
> CONFIG_EDAC=y
> CONFIG_RTC_CLASS=y
> # CONFIG_RTC_HCTOSYS is not set
> CONFIG_DMADEVICES=y
> CONFIG_DMATEST=y
> CONFIG_VIRTIO_PCI=y
> CONFIG_VIRTIO_BALLOON=y
> CONFIG_VIRTIO_MMIO=y
> CONFIG_EEEPC_LAPTOP=y
> CONFIG_EXT3_FS=y
> CONFIG_EXT4_FS_POSIX_ACL=y
> CONFIG_EXT4_FS_SECURITY=y
> CONFIG_EXT4_KUNIT_TESTS=y
> CONFIG_BTRFS_FS=y
> CONFIG_QUOTA=y
> CONFIG_QUOTA_NETLINK_INTERFACE=y
> # CONFIG_PRINT_QUOTA_WARNING is not set
> CONFIG_QFMT_V2=y
> CONFIG_AUTOFS4_FS=y
> CONFIG_ISO9660_FS=y
> CONFIG_JOLIET=y
> CONFIG_ZISOFS=y
> CONFIG_MSDOS_FS=y
> CONFIG_VFAT_FS=y
> CONFIG_PROC_KCORE=y
> CONFIG_TMPFS_POSIX_ACL=y
> CONFIG_HUGETLBFS=y
> CONFIG_SQUASHFS=y
> CONFIG_SQUASHFS_XATTR=y
> CONFIG_SQUASHFS_4K_DEVBLK_SIZE=y
> CONFIG_NFS_FS=y
> CONFIG_NFS_V3_ACL=y
> CONFIG_NFS_V4=y
> CONFIG_ROOT_NFS=y
> CONFIG_NLS_DEFAULT="utf8"
> CONFIG_NLS_CODEPAGE_437=y
> CONFIG_NLS_ASCII=y
> CONFIG_NLS_ISO8859_1=y
> CONFIG_NLS_UTF8=y
> CONFIG_SECURITY=y
> CONFIG_SECURITY_NETWORK=y
> CONFIG_SECURITY_SELINUX=y
> CONFIG_SECURITY_SELINUX_BOOTPARAM=y
> CONFIG_SECURITY_SELINUX_DISABLE=y
> # CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
> CONFIG_CRC32_SELFTEST=y
> CONFIG_GLOB_SELFTEST=y
> CONFIG_STRING_SELFTEST=y
> CONFIG_PRINTK_TIME=y
> CONFIG_FRAME_WARN=1024
> CONFIG_MAGIC_SYSRQ=y
> CONFIG_DEBUG_RODATA_TEST=y
> CONFIG_DEBUG_STACK_USAGE=y
> CONFIG_DEBUG_MEMORY_INIT=y
> # CONFIG_SCHED_DEBUG is not set
> CONFIG_SCHEDSTATS=y
> CONFIG_PROVE_LOCKING=y
> CONFIG_DEBUG_LOCKDEP=y
> CONFIG_DEBUG_ATOMIC_SLEEP=y
> CONFIG_DEBUG_LOCKING_API_SELFTESTS=y
> CONFIG_WW_MUTEX_SELFTEST=y
> CONFIG_DEBUG_LIST=y
> CONFIG_RCU_EQS_DEBUG=y
> CONFIG_BLK_DEV_IO_TRACE=y
> CONFIG_PROVIDE_OHCI1394_DMA_INIT=y
> CONFIG_EARLY_PRINTK_DBGP=y
> CONFIG_DEBUG_TLBFLUSH=y
> CONFIG_DEBUG_BOOT_PARAMS=y
> CONFIG_DEBUG_NMI_SELFTEST=y
> CONFIG_UNWINDER_FRAME_POINTER=y
> CONFIG_KUNIT=y
> CONFIG_KUNIT_TEST=y
> CONFIG_TEST_SORT=y
> CONFIG_RBTREE_TEST=y
> CONFIG_INTERVAL_TREE_TEST=y
> CONFIG_TEST_BITMAP=y
> CONFIG_TEST_UUID=y
> CONFIG_TEST_FIRMWARE=y
> CONFIG_TEST_SYSCTL=y
> CONFIG_SYSCTL_KUNIT_TEST=y
> CONFIG_LIST_KUNIT_TEST=y
Ard Biesheuvel March 3, 2020, 6:14 p.m. UTC | #5
On Tue, 3 Mar 2020 at 19:01, Ard Biesheuvel <ardb@kernel.org> wrote:
>
> On Tue, 3 Mar 2020 at 18:54, Guenter Roeck <linux@roeck-us.net> wrote:
> >
> > On Tue, Mar 03, 2020 at 05:39:43PM +0100, Ard Biesheuvel wrote:
> > > On Tue, 3 Mar 2020 at 17:03, Guenter Roeck <linux@roeck-us.net> wrote:
> > > >
> > > > On Sun, Feb 16, 2020 at 07:23:32PM +0100, Ard Biesheuvel wrote:
> > > > > Instead of going through the EFI system table each time, just copy the
> > > > > runtime services table pointer into struct efi directly. This is the
> > > > > last use of the system table pointer in struct efi, allowing us to
> > > > > drop it in a future patch, along with a fair amount of quirky handling
> > > > > of the translated address.
> > > > >
> > > > > Note that usually, the runtime services pointer changes value during
> > > > > the call to SetVirtualAddressMap(), so grab the updated value as soon
> > > > > as that call returns. (Mixed mode uses a 1:1 mapping, and kexec boot
> > > > > enters with the updated address in the system table, so in those cases,
> > > > > we don't need to do anything here)
> > > > >
> > > > > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> > > >
> > > > This patch results in a crash with i386 efi boots if PAE (CONFIG_HIGHMEM64G=y)
> > > > is enabled. Bisect and crash logs attached. There is also a warning which
> > > > I don't recall seeing before, but it may not be caused by this patch
> > > > (I didn' bisect the warning). The warning is seen with all i386:efi boots,
> > > > not only when PAE is enabled. The warning log is also attached.
> > > >
> > > > Guenter
> > > >
> > > > ---
> > > > Qemu command line:
> > > >
> > > > qemu-system-i386 -kernel arch/x86/boot/bzImage -M pc -cpu Westmere \
> > > >         -no-reboot -m 256 -snapshot \
> > > >         -bios OVMF-pure-efi-32.fd \
> > > >         -usb -device usb-storage,drive=d0 \
> > > >         -drive file=rootfs.ext2,if=none,id=d0,format=raw \
> > > >         --append 'earlycon=uart8250,io,0x3f8,9600n8 panic=-1 slub_debug=FZPUA root=/dev/sda rootwait mem=256M console=ttyS0' \
> > > >         -nographic
> > > >
> > >
> > > I am failing to reproduce this. Do you have a .config and a copy of
> > > OVMF-pure-efi-32.fd anywhere?
> > >
> >
> > https://github.com/groeck/linux-build-test/blob/master/rootfs/firmware/OVMF-pure-efi-32.fd
> > https://github.com/groeck/linux-build-test/blob/master/rootfs/x86/rootfs.ext2.gz
> >
> > Config file is below, shortened by "make savedefconfig" on the actual
> > configuration used on next-20200303. Qemu version is 4.2, though that
> > should not really matter. Note that it isn't necessary to boot from usb,
> > that was just my test case.
> >
> > Here is a pointer to a complete log, showing the various conditions
> > resulting in the warning and the crash:
> >
> > https://kerneltests.org/builders/qemu-x86-next/builds/1310/steps/qemubuildcommand_1/logs/stdio
> >
>
> Thanks.
>
> How do I generate your exact .config from the below? I still cannot
> reproduce with the different firmware.
>
> My qemu is 3.1 btw
>

Also, I don't see CONFIG_HIGHMEM64G=y anywhere below??


>
> >
> > ---
> > # CONFIG_LOCALVERSION_AUTO is not set
> > CONFIG_SYSVIPC=y
> > CONFIG_POSIX_MQUEUE=y
> > CONFIG_USELIB=y
> > CONFIG_AUDIT=y
> > CONFIG_NO_HZ=y
> > CONFIG_HIGH_RES_TIMERS=y
> > CONFIG_PREEMPT_VOLUNTARY=y
> > CONFIG_BSD_PROCESS_ACCT=y
> > CONFIG_TASKSTATS=y
> > CONFIG_TASK_DELAY_ACCT=y
> > CONFIG_TASK_XACCT=y
> > CONFIG_TASK_IO_ACCOUNTING=y
> > CONFIG_LOG_BUF_SHIFT=18
> > CONFIG_CGROUPS=y
> > CONFIG_CGROUP_SCHED=y
> > CONFIG_CGROUP_FREEZER=y
> > CONFIG_CPUSETS=y
> > CONFIG_CGROUP_CPUACCT=y
> > CONFIG_NAMESPACES=y
> > CONFIG_BLK_DEV_INITRD=y
> > CONFIG_EXPERT=y
> > # CONFIG_COMPAT_BRK is not set
> > CONFIG_PROFILING=y
> > CONFIG_SMP=y
> > CONFIG_NR_CPUS=8
> > CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS=y
> > CONFIG_MICROCODE_AMD=y
> > CONFIG_X86_MSR=y
> > CONFIG_X86_CPUID=y
> > CONFIG_X86_CHECK_BIOS_CORRUPTION=y
> > # CONFIG_MTRR_SANITIZER is not set
> > CONFIG_EFI=y
> > CONFIG_EFI_STUB=y
> > CONFIG_HZ_1000=y
> > CONFIG_KEXEC=y
> > CONFIG_CRASH_DUMP=y
> > CONFIG_HIBERNATION=y
> > CONFIG_PM_DEBUG=y
> > CONFIG_PM_TRACE_RTC=y
> > CONFIG_ACPI_DOCK=y
> > CONFIG_ACPI_BGRT=y
> > CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
> > CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
> > CONFIG_CPU_FREQ_GOV_ONDEMAND=y
> > CONFIG_X86_ACPI_CPUFREQ=y
> > CONFIG_EFI_VARS=y
> > CONFIG_EFI_CAPSULE_LOADER=y
> > # CONFIG_KVM_WERROR is not set
> > CONFIG_KPROBES=y
> > CONFIG_JUMP_LABEL=y
> > CONFIG_STATIC_KEYS_SELFTEST=y
> > CONFIG_COMPAT_32BIT_TIME=y
> > CONFIG_MODULES=y
> > CONFIG_MODULE_UNLOAD=y
> > CONFIG_MODULE_FORCE_UNLOAD=y
> > # CONFIG_UNUSED_SYMBOLS is not set
> > CONFIG_BINFMT_MISC=y
> > CONFIG_NET=y
> > CONFIG_PACKET=y
> > CONFIG_UNIX=y
> > CONFIG_XFRM_USER=y
> > CONFIG_INET=y
> > CONFIG_IP_MULTICAST=y
> > CONFIG_IP_ADVANCED_ROUTER=y
> > CONFIG_IP_MULTIPLE_TABLES=y
> > CONFIG_IP_ROUTE_MULTIPATH=y
> > CONFIG_IP_ROUTE_VERBOSE=y
> > CONFIG_IP_PNP=y
> > CONFIG_IP_PNP_DHCP=y
> > CONFIG_IP_PNP_BOOTP=y
> > CONFIG_IP_PNP_RARP=y
> > CONFIG_IP_MROUTE=y
> > CONFIG_IP_PIMSM_V1=y
> > CONFIG_IP_PIMSM_V2=y
> > CONFIG_SYN_COOKIES=y
> > # CONFIG_INET_DIAG is not set
> > CONFIG_TCP_CONG_ADVANCED=y
> > # CONFIG_TCP_CONG_BIC is not set
> > # CONFIG_TCP_CONG_WESTWOOD is not set
> > # CONFIG_TCP_CONG_HTCP is not set
> > CONFIG_TCP_MD5SIG=y
> > CONFIG_INET6_AH=y
> > CONFIG_INET6_ESP=y
> > CONFIG_NETLABEL=y
> > CONFIG_NETFILTER=y
> > # CONFIG_NETFILTER_ADVANCED is not set
> > CONFIG_NF_CONNTRACK=y
> > CONFIG_NF_CONNTRACK_FTP=y
> > CONFIG_NF_CONNTRACK_IRC=y
> > CONFIG_NF_CONNTRACK_SIP=y
> > CONFIG_NF_CT_NETLINK=y
> > CONFIG_NF_NAT=y
> > CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=y
> > CONFIG_NETFILTER_XT_TARGET_NFLOG=y
> > CONFIG_NETFILTER_XT_TARGET_SECMARK=y
> > CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
> > CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
> > CONFIG_NETFILTER_XT_MATCH_POLICY=y
> > CONFIG_NETFILTER_XT_MATCH_STATE=y
> > CONFIG_IP_NF_IPTABLES=y
> > CONFIG_IP_NF_FILTER=y
> > CONFIG_IP_NF_TARGET_REJECT=y
> > CONFIG_IP_NF_TARGET_MASQUERADE=m
> > CONFIG_IP_NF_MANGLE=y
> > CONFIG_IP6_NF_IPTABLES=y
> > CONFIG_IP6_NF_MATCH_IPV6HEADER=y
> > CONFIG_IP6_NF_FILTER=y
> > CONFIG_IP6_NF_TARGET_REJECT=y
> > CONFIG_IP6_NF_MANGLE=y
> > CONFIG_NET_SCHED=y
> > CONFIG_NET_EMATCH=y
> > CONFIG_NET_CLS_ACT=y
> > CONFIG_HAMRADIO=y
> > CONFIG_CFG80211=y
> > CONFIG_MAC80211=y
> > CONFIG_MAC80211_LEDS=y
> > CONFIG_RFKILL=y
> > CONFIG_RFKILL_INPUT=y
> > CONFIG_PCI=y
> > CONFIG_PCIEPORTBUS=y
> > CONFIG_PCI_MSI=y
> > CONFIG_HOTPLUG_PCI=y
> > CONFIG_PCCARD=y
> > CONFIG_YENTA=y
> > CONFIG_DEVTMPFS=y
> > CONFIG_DEVTMPFS_MOUNT=y
> > CONFIG_DEBUG_DEVRES=y
> > CONFIG_PM_QOS_KUNIT_TEST=y
> > CONFIG_CONNECTOR=y
> > CONFIG_BLK_DEV_LOOP=y
> > CONFIG_VIRTIO_BLK=y
> > CONFIG_BLK_DEV_NVME=y
> > CONFIG_PCI_ENDPOINT_TEST=y
> > CONFIG_BLK_DEV_SD=y
> > CONFIG_BLK_DEV_SR=y
> > CONFIG_CHR_DEV_SG=y
> > CONFIG_SCSI_CONSTANTS=y
> > CONFIG_MEGARAID_SAS=y
> > CONFIG_SCSI_SYM53C8XX_2=y
> > CONFIG_SCSI_DC395x=y
> > CONFIG_SCSI_AM53C974=y
> > CONFIG_SCSI_VIRTIO=y
> > CONFIG_ATA=y
> > CONFIG_SATA_AHCI=y
> > CONFIG_ATA_PIIX=y
> > CONFIG_PATA_AMD=y
> > CONFIG_PATA_OLDPIIX=y
> > CONFIG_PATA_SCH=y
> > CONFIG_PATA_MPIIX=y
> > CONFIG_ATA_GENERIC=y
> > CONFIG_MD=y
> > CONFIG_BLK_DEV_MD=y
> > CONFIG_BLK_DEV_DM=y
> > CONFIG_DM_MIRROR=y
> > CONFIG_DM_ZERO=y
> > CONFIG_FUSION=y
> > CONFIG_FUSION_SAS=y
> > CONFIG_MACINTOSH_DRIVERS=y
> > CONFIG_MAC_EMUMOUSEBTN=y
> > CONFIG_NETDEVICES=y
> > CONFIG_NETCONSOLE=y
> > CONFIG_BNX2=y
> > CONFIG_TIGON3=y
> > CONFIG_NET_TULIP=y
> > CONFIG_E100=y
> > CONFIG_E1000=y
> > CONFIG_E1000E=y
> > CONFIG_SKY2=y
> > CONFIG_NE2K_PCI=y
> > CONFIG_FORCEDETH=y
> > CONFIG_8139TOO=y
> > # CONFIG_8139TOO_PIO is not set
> > CONFIG_R8169=y
> > CONFIG_FDDI=y
> > CONFIG_INPUT_POLLDEV=y
> > CONFIG_INPUT_EVDEV=y
> > CONFIG_INPUT_JOYSTICK=y
> > CONFIG_INPUT_TABLET=y
> > CONFIG_INPUT_TOUCHSCREEN=y
> > CONFIG_INPUT_MISC=y
> > # CONFIG_LEGACY_PTYS is not set
> > CONFIG_SERIAL_NONSTANDARD=y
> > CONFIG_SERIAL_8250=y
> > CONFIG_SERIAL_8250_CONSOLE=y
> > CONFIG_SERIAL_8250_NR_UARTS=32
> > CONFIG_SERIAL_8250_EXTENDED=y
> > CONFIG_SERIAL_8250_MANY_PORTS=y
> > CONFIG_SERIAL_8250_SHARE_IRQ=y
> > CONFIG_SERIAL_8250_DETECT_IRQ=y
> > CONFIG_SERIAL_8250_RSA=y
> > CONFIG_HW_RANDOM=y
> > CONFIG_NVRAM=y
> > CONFIG_HPET=y
> > # CONFIG_HPET_MMAP is not set
> > CONFIG_I2C_I801=y
> > CONFIG_WATCHDOG=y
> > CONFIG_AGP=y
> > CONFIG_AGP_AMD64=y
> > CONFIG_AGP_INTEL=y
> > CONFIG_DRM=y
> > CONFIG_DRM_I915=y
> > CONFIG_FB_MODE_HELPERS=y
> > CONFIG_FB_TILEBLITTING=y
> > CONFIG_FB_EFI=y
> > CONFIG_VGACON_SOFT_SCROLLBACK=y
> > CONFIG_FRAMEBUFFER_CONSOLE=y
> > CONFIG_LOGO=y
> > # CONFIG_LOGO_LINUX_MONO is not set
> > # CONFIG_LOGO_LINUX_VGA16 is not set
> > CONFIG_SOUND=y
> > CONFIG_SND=y
> > CONFIG_SND_HRTIMER=y
> > CONFIG_SND_SEQUENCER=y
> > CONFIG_SND_SEQ_DUMMY=y
> > CONFIG_SND_HDA_INTEL=y
> > CONFIG_SND_HDA_HWDEP=y
> > CONFIG_HIDRAW=y
> > CONFIG_HID_A4TECH=y
> > CONFIG_HID_APPLE=y
> > CONFIG_HID_BELKIN=y
> > CONFIG_HID_CHERRY=y
> > CONFIG_HID_CHICONY=y
> > CONFIG_HID_CYPRESS=y
> > CONFIG_HID_EZKEY=y
> > CONFIG_HID_GYRATION=y
> > CONFIG_HID_ITE=y
> > CONFIG_HID_KENSINGTON=y
> > CONFIG_HID_LOGITECH=y
> > CONFIG_LOGITECH_FF=y
> > CONFIG_HID_REDRAGON=y
> > CONFIG_HID_MICROSOFT=y
> > CONFIG_HID_MONTEREY=y
> > CONFIG_HID_NTRIG=y
> > CONFIG_HID_PANTHERLORD=y
> > CONFIG_PANTHERLORD_FF=y
> > CONFIG_HID_PETALYNX=y
> > CONFIG_HID_SAMSUNG=y
> > CONFIG_HID_SONY=y
> > CONFIG_HID_SUNPLUS=y
> > CONFIG_HID_TOPSEED=y
> > CONFIG_HID_PID=y
> > CONFIG_USB_HIDDEV=y
> > CONFIG_USB=y
> > CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
> > CONFIG_USB_MON=y
> > CONFIG_USB_XHCI_HCD=y
> > CONFIG_USB_EHCI_HCD=y
> > CONFIG_USB_OHCI_HCD=y
> > CONFIG_USB_UHCI_HCD=y
> > CONFIG_USB_PRINTER=y
> > CONFIG_USB_STORAGE=y
> > CONFIG_USB_UAS=y
> > CONFIG_USB_TEST=y
> > CONFIG_USB_EHSET_TEST_FIXTURE=y
> > CONFIG_USB_LINK_LAYER_TEST=y
> > CONFIG_MMC=y
> > CONFIG_MMC_SDHCI=y
> > CONFIG_MMC_SDHCI_PCI=y
> > CONFIG_EDAC=y
> > CONFIG_RTC_CLASS=y
> > # CONFIG_RTC_HCTOSYS is not set
> > CONFIG_DMADEVICES=y
> > CONFIG_DMATEST=y
> > CONFIG_VIRTIO_PCI=y
> > CONFIG_VIRTIO_BALLOON=y
> > CONFIG_VIRTIO_MMIO=y
> > CONFIG_EEEPC_LAPTOP=y
> > CONFIG_EXT3_FS=y
> > CONFIG_EXT4_FS_POSIX_ACL=y
> > CONFIG_EXT4_FS_SECURITY=y
> > CONFIG_EXT4_KUNIT_TESTS=y
> > CONFIG_BTRFS_FS=y
> > CONFIG_QUOTA=y
> > CONFIG_QUOTA_NETLINK_INTERFACE=y
> > # CONFIG_PRINT_QUOTA_WARNING is not set
> > CONFIG_QFMT_V2=y
> > CONFIG_AUTOFS4_FS=y
> > CONFIG_ISO9660_FS=y
> > CONFIG_JOLIET=y
> > CONFIG_ZISOFS=y
> > CONFIG_MSDOS_FS=y
> > CONFIG_VFAT_FS=y
> > CONFIG_PROC_KCORE=y
> > CONFIG_TMPFS_POSIX_ACL=y
> > CONFIG_HUGETLBFS=y
> > CONFIG_SQUASHFS=y
> > CONFIG_SQUASHFS_XATTR=y
> > CONFIG_SQUASHFS_4K_DEVBLK_SIZE=y
> > CONFIG_NFS_FS=y
> > CONFIG_NFS_V3_ACL=y
> > CONFIG_NFS_V4=y
> > CONFIG_ROOT_NFS=y
> > CONFIG_NLS_DEFAULT="utf8"
> > CONFIG_NLS_CODEPAGE_437=y
> > CONFIG_NLS_ASCII=y
> > CONFIG_NLS_ISO8859_1=y
> > CONFIG_NLS_UTF8=y
> > CONFIG_SECURITY=y
> > CONFIG_SECURITY_NETWORK=y
> > CONFIG_SECURITY_SELINUX=y
> > CONFIG_SECURITY_SELINUX_BOOTPARAM=y
> > CONFIG_SECURITY_SELINUX_DISABLE=y
> > # CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
> > CONFIG_CRC32_SELFTEST=y
> > CONFIG_GLOB_SELFTEST=y
> > CONFIG_STRING_SELFTEST=y
> > CONFIG_PRINTK_TIME=y
> > CONFIG_FRAME_WARN=1024
> > CONFIG_MAGIC_SYSRQ=y
> > CONFIG_DEBUG_RODATA_TEST=y
> > CONFIG_DEBUG_STACK_USAGE=y
> > CONFIG_DEBUG_MEMORY_INIT=y
> > # CONFIG_SCHED_DEBUG is not set
> > CONFIG_SCHEDSTATS=y
> > CONFIG_PROVE_LOCKING=y
> > CONFIG_DEBUG_LOCKDEP=y
> > CONFIG_DEBUG_ATOMIC_SLEEP=y
> > CONFIG_DEBUG_LOCKING_API_SELFTESTS=y
> > CONFIG_WW_MUTEX_SELFTEST=y
> > CONFIG_DEBUG_LIST=y
> > CONFIG_RCU_EQS_DEBUG=y
> > CONFIG_BLK_DEV_IO_TRACE=y
> > CONFIG_PROVIDE_OHCI1394_DMA_INIT=y
> > CONFIG_EARLY_PRINTK_DBGP=y
> > CONFIG_DEBUG_TLBFLUSH=y
> > CONFIG_DEBUG_BOOT_PARAMS=y
> > CONFIG_DEBUG_NMI_SELFTEST=y
> > CONFIG_UNWINDER_FRAME_POINTER=y
> > CONFIG_KUNIT=y
> > CONFIG_KUNIT_TEST=y
> > CONFIG_TEST_SORT=y
> > CONFIG_RBTREE_TEST=y
> > CONFIG_INTERVAL_TREE_TEST=y
> > CONFIG_TEST_BITMAP=y
> > CONFIG_TEST_UUID=y
> > CONFIG_TEST_FIRMWARE=y
> > CONFIG_TEST_SYSCTL=y
> > CONFIG_SYSCTL_KUNIT_TEST=y
> > CONFIG_LIST_KUNIT_TEST=y
Guenter Roeck March 3, 2020, 8:30 p.m. UTC | #6
On Tue, Mar 03, 2020 at 07:14:52PM +0100, Ard Biesheuvel wrote:
> On Tue, 3 Mar 2020 at 19:01, Ard Biesheuvel <ardb@kernel.org> wrote:
> >
> > On Tue, 3 Mar 2020 at 18:54, Guenter Roeck <linux@roeck-us.net> wrote:
> > >
> > > On Tue, Mar 03, 2020 at 05:39:43PM +0100, Ard Biesheuvel wrote:
> > > > On Tue, 3 Mar 2020 at 17:03, Guenter Roeck <linux@roeck-us.net> wrote:
> > > > >
> > > > > On Sun, Feb 16, 2020 at 07:23:32PM +0100, Ard Biesheuvel wrote:
> > > > > > Instead of going through the EFI system table each time, just copy the
> > > > > > runtime services table pointer into struct efi directly. This is the
> > > > > > last use of the system table pointer in struct efi, allowing us to
> > > > > > drop it in a future patch, along with a fair amount of quirky handling
> > > > > > of the translated address.
> > > > > >
> > > > > > Note that usually, the runtime services pointer changes value during
> > > > > > the call to SetVirtualAddressMap(), so grab the updated value as soon
> > > > > > as that call returns. (Mixed mode uses a 1:1 mapping, and kexec boot
> > > > > > enters with the updated address in the system table, so in those cases,
> > > > > > we don't need to do anything here)
> > > > > >
> > > > > > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> > > > >
> > > > > This patch results in a crash with i386 efi boots if PAE (CONFIG_HIGHMEM64G=y)
> > > > > is enabled. Bisect and crash logs attached. There is also a warning which
> > > > > I don't recall seeing before, but it may not be caused by this patch
> > > > > (I didn' bisect the warning). The warning is seen with all i386:efi boots,
> > > > > not only when PAE is enabled. The warning log is also attached.
> > > > >
> > > > > Guenter
> > > > >
> > > > > ---
> > > > > Qemu command line:
> > > > >
> > > > > qemu-system-i386 -kernel arch/x86/boot/bzImage -M pc -cpu Westmere \
> > > > >         -no-reboot -m 256 -snapshot \
> > > > >         -bios OVMF-pure-efi-32.fd \
> > > > >         -usb -device usb-storage,drive=d0 \
> > > > >         -drive file=rootfs.ext2,if=none,id=d0,format=raw \
> > > > >         --append 'earlycon=uart8250,io,0x3f8,9600n8 panic=-1 slub_debug=FZPUA root=/dev/sda rootwait mem=256M console=ttyS0' \
> > > > >         -nographic
> > > > >
> > > >
> > > > I am failing to reproduce this. Do you have a .config and a copy of
> > > > OVMF-pure-efi-32.fd anywhere?
> > > >
> > >
> > > https://github.com/groeck/linux-build-test/blob/master/rootfs/firmware/OVMF-pure-efi-32.fd
> > > https://github.com/groeck/linux-build-test/blob/master/rootfs/x86/rootfs.ext2.gz
> > >
> > > Config file is below, shortened by "make savedefconfig" on the actual
> > > configuration used on next-20200303. Qemu version is 4.2, though that
> > > should not really matter. Note that it isn't necessary to boot from usb,
> > > that was just my test case.
> > >
> > > Here is a pointer to a complete log, showing the various conditions
> > > resulting in the warning and the crash:
> > >
> > > https://kerneltests.org/builders/qemu-x86-next/builds/1310/steps/qemubuildcommand_1/logs/stdio
> > >
> >
> > Thanks.
> >
> > How do I generate your exact .config from the below? I still cannot
> > reproduce with the different firmware.
> >
> > My qemu is 3.1 btw
> >
> 
> Also, I don't see CONFIG_HIGHMEM64G=y anywhere below??
> 

Sorry, I should have used make ARCH=i386 savedefconfig. Another attempt
below. This needs to be built with "make ARCH=i386".

Guenter

---
CONFIG_SYSVIPC=y
CONFIG_PREEMPT=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_LOG_BUF_SHIFT=14
CONFIG_EXPERT=y
CONFIG_PROFILING=y
CONFIG_ARCH_PXA=y
CONFIG_PXA_SHARPSL=y
CONFIG_MACH_AKITA=y
CONFIG_MACH_BORZOI=y
CONFIG_ZBOOT_ROM_TEXT=0x0
CONFIG_ZBOOT_ROM_BSS=0x0
CONFIG_CMDLINE="console=ttyS0,115200n8 console=tty1 noinitrd root=/dev/mtdblock2 rootfstype=jffs2   debug"
CONFIG_FPE_NWFPE=y
CONFIG_OPROFILE=m
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
# CONFIG_BLK_DEV_BSG is not set
CONFIG_PARTITION_ADVANCED=y
CONFIG_BINFMT_MISC=m
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_SYN_COOKIES=y
CONFIG_INET6_AH=m
CONFIG_INET6_ESP=m
CONFIG_INET6_IPCOMP=m
CONFIG_IPV6_TUNNEL=m
CONFIG_NETFILTER=y
CONFIG_IP_NF_IPTABLES=m
CONFIG_IP_NF_MATCH_ECN=m
CONFIG_IP_NF_MATCH_TTL=m
CONFIG_IP_NF_FILTER=m
CONFIG_IP_NF_MANGLE=m
CONFIG_IP_NF_RAW=m
CONFIG_IP_NF_ARPTABLES=m
CONFIG_IP_NF_ARPFILTER=m
CONFIG_IP_NF_ARP_MANGLE=m
CONFIG_IP6_NF_IPTABLES=m
CONFIG_IP6_NF_MATCH_EUI64=m
CONFIG_IP6_NF_MATCH_FRAG=m
CONFIG_IP6_NF_MATCH_OPTS=m
CONFIG_IP6_NF_MATCH_HL=m
CONFIG_IP6_NF_MATCH_IPV6HEADER=m
CONFIG_IP6_NF_MATCH_RT=m
CONFIG_IP6_NF_FILTER=m
CONFIG_IP6_NF_MANGLE=m
CONFIG_IP6_NF_RAW=m
CONFIG_BT=m
CONFIG_BT_RFCOMM=m
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_BNEP=m
CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y
CONFIG_BT_HIDP=m
CONFIG_BT_HCIUART=m
CONFIG_BT_HCIUART_H4=y
CONFIG_BT_HCIUART_BCSP=y
CONFIG_BT_HCIBCM203X=m
CONFIG_BT_HCIBPA10X=m
CONFIG_BT_HCIBFUSB=m
CONFIG_BT_HCIDTL1=m
CONFIG_BT_HCIBT3C=m
CONFIG_BT_HCIBLUECARD=m
CONFIG_BT_HCIVHCI=m
CONFIG_PCCARD=y
CONFIG_PCMCIA_PXA2XX=y
CONFIG_MTD=y
CONFIG_MTD_CMDLINE_PARTS=y
CONFIG_MTD_BLOCK=y
CONFIG_MTD_ROM=y
CONFIG_MTD_COMPLEX_MAPPINGS=y
CONFIG_MTD_RAW_NAND=y
CONFIG_MTD_NAND_SHARPSL=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_SD=y
CONFIG_CHR_DEV_ST=m
CONFIG_BLK_DEV_SR=m
CONFIG_CHR_DEV_SG=m
CONFIG_ATA=y
CONFIG_PATA_PCMCIA=y
CONFIG_NETDEVICES=y
CONFIG_PCMCIA_PCNET=m
CONFIG_PPP=m
CONFIG_PPP_BSDCOMP=m
CONFIG_PPP_ASYNC=m
CONFIG_USB_CATC=m
CONFIG_USB_KAWETH=m
CONFIG_USB_PEGASUS=m
CONFIG_USB_RTL8150=m
CONFIG_USB_USBNET=m
# CONFIG_USB_NET_CDC_SUBSET is not set
CONFIG_INPUT_EVDEV=y
# CONFIG_KEYBOARD_ATKBD is not set
# CONFIG_INPUT_MOUSE is not set
CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_ADS7846=y
CONFIG_INPUT_MISC=y
CONFIG_INPUT_UINPUT=m
# CONFIG_SERIO is not set
# CONFIG_LEGACY_PTYS is not set
CONFIG_SERIAL_8250=m
CONFIG_SERIAL_8250_CS=m
CONFIG_SERIAL_PXA=y
CONFIG_SERIAL_PXA_CONSOLE=y
CONFIG_SPI_PXA2XX=y
CONFIG_FB=y
CONFIG_FB_PXA=y
CONFIG_LCD_CLASS_DEVICE=y
CONFIG_LCD_CORGI=y
CONFIG_BACKLIGHT_CLASS_DEVICE=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
CONFIG_HID_A4TECH=m
CONFIG_HID_APPLE=m
CONFIG_HID_BELKIN=m
CONFIG_HID_CHERRY=m
CONFIG_HID_CHICONY=m
CONFIG_HID_CYPRESS=m
CONFIG_HID_EZKEY=m
CONFIG_HID_GYRATION=m
CONFIG_HID_MICROSOFT=m
CONFIG_HID_MONTEREY=m
CONFIG_HID_PANTHERLORD=m
CONFIG_HID_PETALYNX=m
CONFIG_HID_SAMSUNG=m
CONFIG_HID_SUNPLUS=m
CONFIG_USB_KBD=m
CONFIG_USB_MOUSE=m
CONFIG_USB=m
CONFIG_USB_MON=m
CONFIG_USB_OHCI_HCD=m
CONFIG_USB_SL811_HCD=m
CONFIG_USB_SL811_CS=m
CONFIG_USB_ACM=m
CONFIG_USB_PRINTER=m
CONFIG_USB_STORAGE=m
CONFIG_USB_MDC800=m
CONFIG_USB_MICROTEK=m
CONFIG_USB_SERIAL=m
CONFIG_USB_SERIAL_GENERIC=y
CONFIG_USB_SERIAL_BELKIN=m
CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
CONFIG_USB_SERIAL_CYPRESS_M8=m
CONFIG_USB_SERIAL_EMPEG=m
CONFIG_USB_SERIAL_FTDI_SIO=m
CONFIG_USB_SERIAL_VISOR=m
CONFIG_USB_SERIAL_IPAQ=m
CONFIG_USB_SERIAL_IR=m
CONFIG_USB_SERIAL_EDGEPORT=m
CONFIG_USB_SERIAL_EDGEPORT_TI=m
CONFIG_USB_SERIAL_GARMIN=m
CONFIG_USB_SERIAL_IPW=m
CONFIG_USB_SERIAL_KEYSPAN_PDA=m
CONFIG_USB_SERIAL_KEYSPAN=m
CONFIG_USB_SERIAL_KLSI=m
CONFIG_USB_SERIAL_KOBIL_SCT=m
CONFIG_USB_SERIAL_MCT_U232=m
CONFIG_USB_SERIAL_PL2303=m
CONFIG_USB_SERIAL_SAFE=m
CONFIG_USB_SERIAL_TI=m
CONFIG_USB_SERIAL_CYBERJACK=m
CONFIG_USB_SERIAL_XIRCOM=m
CONFIG_USB_SERIAL_OMNINET=m
CONFIG_USB_EMI62=m
CONFIG_USB_EMI26=m
CONFIG_USB_LEGOTOWER=m
CONFIG_USB_LCD=m
CONFIG_USB_CYTHERM=m
CONFIG_USB_IDMOUSE=m
CONFIG_USB_GADGET=m
CONFIG_USB_ZERO=m
CONFIG_USB_ETH=m
CONFIG_USB_GADGETFS=m
CONFIG_USB_MASS_STORAGE=m
CONFIG_USB_G_SERIAL=m
CONFIG_MMC=y
CONFIG_MMC_PXA=y
CONFIG_EXT2_FS=y
CONFIG_EXT2_FS_XATTR=y
CONFIG_EXT2_FS_POSIX_ACL=y
CONFIG_EXT2_FS_SECURITY=y
CONFIG_EXT3_FS=y
CONFIG_MSDOS_FS=y
CONFIG_VFAT_FS=y
CONFIG_TMPFS=y
CONFIG_JFFS2_FS=y
CONFIG_JFFS2_SUMMARY=y
CONFIG_JFFS2_COMPRESSION_OPTIONS=y
CONFIG_JFFS2_RUBIN=y
CONFIG_CRAMFS=m
CONFIG_NFS_FS=m
CONFIG_NFS_V4=m
CONFIG_NLS_DEFAULT="cp437"
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ISO8859_1=y
CONFIG_NLS_UTF8=y
CONFIG_CRYPTO_TEST=m
CONFIG_CRYPTO_HMAC=y
CONFIG_CRYPTO_MD4=m
CONFIG_CRYPTO_MICHAEL_MIC=m
CONFIG_CRYPTO_SHA512=m
CONFIG_CRYPTO_WP512=m
CONFIG_CRYPTO_ANUBIS=m
CONFIG_CRYPTO_ARC4=m
CONFIG_CRYPTO_BLOWFISH=m
CONFIG_CRYPTO_CAST5=m
CONFIG_CRYPTO_CAST6=m
CONFIG_CRYPTO_KHAZAD=m
CONFIG_CRYPTO_SERPENT=m
CONFIG_CRYPTO_TEA=m
CONFIG_CRYPTO_TWOFISH=m
CONFIG_CRC_CCITT=y
CONFIG_LIBCRC32C=m
CONFIG_FONTS=y
CONFIG_FONT_8x8=y
CONFIG_FONT_8x16=y
CONFIG_MAGIC_SYSRQ=y
# CONFIG_DEBUG_PREEMPT is not set
# CONFIG_FTRACE is not set
CONFIG_DEBUG_LL=y
Ard Biesheuvel March 3, 2020, 9:40 p.m. UTC | #7
On Tue, 3 Mar 2020 at 21:30, Guenter Roeck <linux@roeck-us.net> wrote:
>
> On Tue, Mar 03, 2020 at 07:14:52PM +0100, Ard Biesheuvel wrote:
> > On Tue, 3 Mar 2020 at 19:01, Ard Biesheuvel <ardb@kernel.org> wrote:
> > >
> > > On Tue, 3 Mar 2020 at 18:54, Guenter Roeck <linux@roeck-us.net> wrote:
> > > >
> > > > On Tue, Mar 03, 2020 at 05:39:43PM +0100, Ard Biesheuvel wrote:
> > > > > On Tue, 3 Mar 2020 at 17:03, Guenter Roeck <linux@roeck-us.net> wrote:
> > > > > >
> > > > > > On Sun, Feb 16, 2020 at 07:23:32PM +0100, Ard Biesheuvel wrote:
> > > > > > > Instead of going through the EFI system table each time, just copy the
> > > > > > > runtime services table pointer into struct efi directly. This is the
> > > > > > > last use of the system table pointer in struct efi, allowing us to
> > > > > > > drop it in a future patch, along with a fair amount of quirky handling
> > > > > > > of the translated address.
> > > > > > >
> > > > > > > Note that usually, the runtime services pointer changes value during
> > > > > > > the call to SetVirtualAddressMap(), so grab the updated value as soon
> > > > > > > as that call returns. (Mixed mode uses a 1:1 mapping, and kexec boot
> > > > > > > enters with the updated address in the system table, so in those cases,
> > > > > > > we don't need to do anything here)
> > > > > > >
> > > > > > > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> > > > > >
> > > > > > This patch results in a crash with i386 efi boots if PAE (CONFIG_HIGHMEM64G=y)
> > > > > > is enabled. Bisect and crash logs attached. There is also a warning which
> > > > > > I don't recall seeing before, but it may not be caused by this patch
> > > > > > (I didn' bisect the warning). The warning is seen with all i386:efi boots,
> > > > > > not only when PAE is enabled. The warning log is also attached.
> > > > > >
> > > > > > Guenter
> > > > > >
> > > > > > ---
> > > > > > Qemu command line:
> > > > > >
> > > > > > qemu-system-i386 -kernel arch/x86/boot/bzImage -M pc -cpu Westmere \
> > > > > >         -no-reboot -m 256 -snapshot \
> > > > > >         -bios OVMF-pure-efi-32.fd \
> > > > > >         -usb -device usb-storage,drive=d0 \
> > > > > >         -drive file=rootfs.ext2,if=none,id=d0,format=raw \
> > > > > >         --append 'earlycon=uart8250,io,0x3f8,9600n8 panic=-1 slub_debug=FZPUA root=/dev/sda rootwait mem=256M console=ttyS0' \
> > > > > >         -nographic
> > > > > >
> > > > >
> > > > > I am failing to reproduce this. Do you have a .config and a copy of
> > > > > OVMF-pure-efi-32.fd anywhere?
> > > > >
> > > >
> > > > https://github.com/groeck/linux-build-test/blob/master/rootfs/firmware/OVMF-pure-efi-32.fd
> > > > https://github.com/groeck/linux-build-test/blob/master/rootfs/x86/rootfs.ext2.gz
> > > >
> > > > Config file is below, shortened by "make savedefconfig" on the actual
> > > > configuration used on next-20200303. Qemu version is 4.2, though that
> > > > should not really matter. Note that it isn't necessary to boot from usb,
> > > > that was just my test case.
> > > >
> > > > Here is a pointer to a complete log, showing the various conditions
> > > > resulting in the warning and the crash:
> > > >
> > > > https://kerneltests.org/builders/qemu-x86-next/builds/1310/steps/qemubuildcommand_1/logs/stdio
> > > >
> > >
> > > Thanks.
> > >
> > > How do I generate your exact .config from the below? I still cannot
> > > reproduce with the different firmware.
> > >
> > > My qemu is 3.1 btw
> > >
> >
> > Also, I don't see CONFIG_HIGHMEM64G=y anywhere below??
> >
>
> Sorry, I should have used make ARCH=i386 savedefconfig. Another attempt
> below. This needs to be built with "make ARCH=i386".
>

It still doesn't enable CONFIG_HIGHMEM64G, and so it is not entirely
clear to me how I should derive your failing config from this.
Couldn't you simply share the whole thing?




> CONFIG_SYSVIPC=y
> CONFIG_PREEMPT=y
> CONFIG_BSD_PROCESS_ACCT=y
> CONFIG_LOG_BUF_SHIFT=14
> CONFIG_EXPERT=y
> CONFIG_PROFILING=y
> CONFIG_ARCH_PXA=y
> CONFIG_PXA_SHARPSL=y
> CONFIG_MACH_AKITA=y
> CONFIG_MACH_BORZOI=y
> CONFIG_ZBOOT_ROM_TEXT=0x0
> CONFIG_ZBOOT_ROM_BSS=0x0
> CONFIG_CMDLINE="console=ttyS0,115200n8 console=tty1 noinitrd root=/dev/mtdblock2 rootfstype=jffs2   debug"
> CONFIG_FPE_NWFPE=y
> CONFIG_OPROFILE=m
> CONFIG_MODULES=y
> CONFIG_MODULE_UNLOAD=y
> CONFIG_MODULE_FORCE_UNLOAD=y
> # CONFIG_BLK_DEV_BSG is not set
> CONFIG_PARTITION_ADVANCED=y
> CONFIG_BINFMT_MISC=m
> CONFIG_NET=y
> CONFIG_PACKET=y
> CONFIG_UNIX=y
> CONFIG_INET=y
> CONFIG_SYN_COOKIES=y
> CONFIG_INET6_AH=m
> CONFIG_INET6_ESP=m
> CONFIG_INET6_IPCOMP=m
> CONFIG_IPV6_TUNNEL=m
> CONFIG_NETFILTER=y
> CONFIG_IP_NF_IPTABLES=m
> CONFIG_IP_NF_MATCH_ECN=m
> CONFIG_IP_NF_MATCH_TTL=m
> CONFIG_IP_NF_FILTER=m
> CONFIG_IP_NF_MANGLE=m
> CONFIG_IP_NF_RAW=m
> CONFIG_IP_NF_ARPTABLES=m
> CONFIG_IP_NF_ARPFILTER=m
> CONFIG_IP_NF_ARP_MANGLE=m
> CONFIG_IP6_NF_IPTABLES=m
> CONFIG_IP6_NF_MATCH_EUI64=m
> CONFIG_IP6_NF_MATCH_FRAG=m
> CONFIG_IP6_NF_MATCH_OPTS=m
> CONFIG_IP6_NF_MATCH_HL=m
> CONFIG_IP6_NF_MATCH_IPV6HEADER=m
> CONFIG_IP6_NF_MATCH_RT=m
> CONFIG_IP6_NF_FILTER=m
> CONFIG_IP6_NF_MANGLE=m
> CONFIG_IP6_NF_RAW=m
> CONFIG_BT=m
> CONFIG_BT_RFCOMM=m
> CONFIG_BT_RFCOMM_TTY=y
> CONFIG_BT_BNEP=m
> CONFIG_BT_BNEP_MC_FILTER=y
> CONFIG_BT_BNEP_PROTO_FILTER=y
> CONFIG_BT_HIDP=m
> CONFIG_BT_HCIUART=m
> CONFIG_BT_HCIUART_H4=y
> CONFIG_BT_HCIUART_BCSP=y
> CONFIG_BT_HCIBCM203X=m
> CONFIG_BT_HCIBPA10X=m
> CONFIG_BT_HCIBFUSB=m
> CONFIG_BT_HCIDTL1=m
> CONFIG_BT_HCIBT3C=m
> CONFIG_BT_HCIBLUECARD=m
> CONFIG_BT_HCIVHCI=m
> CONFIG_PCCARD=y
> CONFIG_PCMCIA_PXA2XX=y
> CONFIG_MTD=y
> CONFIG_MTD_CMDLINE_PARTS=y
> CONFIG_MTD_BLOCK=y
> CONFIG_MTD_ROM=y
> CONFIG_MTD_COMPLEX_MAPPINGS=y
> CONFIG_MTD_RAW_NAND=y
> CONFIG_MTD_NAND_SHARPSL=y
> CONFIG_BLK_DEV_LOOP=y
> CONFIG_BLK_DEV_SD=y
> CONFIG_CHR_DEV_ST=m
> CONFIG_BLK_DEV_SR=m
> CONFIG_CHR_DEV_SG=m
> CONFIG_ATA=y
> CONFIG_PATA_PCMCIA=y
> CONFIG_NETDEVICES=y
> CONFIG_PCMCIA_PCNET=m
> CONFIG_PPP=m
> CONFIG_PPP_BSDCOMP=m
> CONFIG_PPP_ASYNC=m
> CONFIG_USB_CATC=m
> CONFIG_USB_KAWETH=m
> CONFIG_USB_PEGASUS=m
> CONFIG_USB_RTL8150=m
> CONFIG_USB_USBNET=m
> # CONFIG_USB_NET_CDC_SUBSET is not set
> CONFIG_INPUT_EVDEV=y
> # CONFIG_KEYBOARD_ATKBD is not set
> # CONFIG_INPUT_MOUSE is not set
> CONFIG_INPUT_TOUCHSCREEN=y
> CONFIG_TOUCHSCREEN_ADS7846=y
> CONFIG_INPUT_MISC=y
> CONFIG_INPUT_UINPUT=m
> # CONFIG_SERIO is not set
> # CONFIG_LEGACY_PTYS is not set
> CONFIG_SERIAL_8250=m
> CONFIG_SERIAL_8250_CS=m
> CONFIG_SERIAL_PXA=y
> CONFIG_SERIAL_PXA_CONSOLE=y
> CONFIG_SPI_PXA2XX=y
> CONFIG_FB=y
> CONFIG_FB_PXA=y
> CONFIG_LCD_CLASS_DEVICE=y
> CONFIG_LCD_CORGI=y
> CONFIG_BACKLIGHT_CLASS_DEVICE=y
> CONFIG_FRAMEBUFFER_CONSOLE=y
> CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
> CONFIG_HID_A4TECH=m
> CONFIG_HID_APPLE=m
> CONFIG_HID_BELKIN=m
> CONFIG_HID_CHERRY=m
> CONFIG_HID_CHICONY=m
> CONFIG_HID_CYPRESS=m
> CONFIG_HID_EZKEY=m
> CONFIG_HID_GYRATION=m
> CONFIG_HID_MICROSOFT=m
> CONFIG_HID_MONTEREY=m
> CONFIG_HID_PANTHERLORD=m
> CONFIG_HID_PETALYNX=m
> CONFIG_HID_SAMSUNG=m
> CONFIG_HID_SUNPLUS=m
> CONFIG_USB_KBD=m
> CONFIG_USB_MOUSE=m
> CONFIG_USB=m
> CONFIG_USB_MON=m
> CONFIG_USB_OHCI_HCD=m
> CONFIG_USB_SL811_HCD=m
> CONFIG_USB_SL811_CS=m
> CONFIG_USB_ACM=m
> CONFIG_USB_PRINTER=m
> CONFIG_USB_STORAGE=m
> CONFIG_USB_MDC800=m
> CONFIG_USB_MICROTEK=m
> CONFIG_USB_SERIAL=m
> CONFIG_USB_SERIAL_GENERIC=y
> CONFIG_USB_SERIAL_BELKIN=m
> CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
> CONFIG_USB_SERIAL_CYPRESS_M8=m
> CONFIG_USB_SERIAL_EMPEG=m
> CONFIG_USB_SERIAL_FTDI_SIO=m
> CONFIG_USB_SERIAL_VISOR=m
> CONFIG_USB_SERIAL_IPAQ=m
> CONFIG_USB_SERIAL_IR=m
> CONFIG_USB_SERIAL_EDGEPORT=m
> CONFIG_USB_SERIAL_EDGEPORT_TI=m
> CONFIG_USB_SERIAL_GARMIN=m
> CONFIG_USB_SERIAL_IPW=m
> CONFIG_USB_SERIAL_KEYSPAN_PDA=m
> CONFIG_USB_SERIAL_KEYSPAN=m
> CONFIG_USB_SERIAL_KLSI=m
> CONFIG_USB_SERIAL_KOBIL_SCT=m
> CONFIG_USB_SERIAL_MCT_U232=m
> CONFIG_USB_SERIAL_PL2303=m
> CONFIG_USB_SERIAL_SAFE=m
> CONFIG_USB_SERIAL_TI=m
> CONFIG_USB_SERIAL_CYBERJACK=m
> CONFIG_USB_SERIAL_XIRCOM=m
> CONFIG_USB_SERIAL_OMNINET=m
> CONFIG_USB_EMI62=m
> CONFIG_USB_EMI26=m
> CONFIG_USB_LEGOTOWER=m
> CONFIG_USB_LCD=m
> CONFIG_USB_CYTHERM=m
> CONFIG_USB_IDMOUSE=m
> CONFIG_USB_GADGET=m
> CONFIG_USB_ZERO=m
> CONFIG_USB_ETH=m
> CONFIG_USB_GADGETFS=m
> CONFIG_USB_MASS_STORAGE=m
> CONFIG_USB_G_SERIAL=m
> CONFIG_MMC=y
> CONFIG_MMC_PXA=y
> CONFIG_EXT2_FS=y
> CONFIG_EXT2_FS_XATTR=y
> CONFIG_EXT2_FS_POSIX_ACL=y
> CONFIG_EXT2_FS_SECURITY=y
> CONFIG_EXT3_FS=y
> CONFIG_MSDOS_FS=y
> CONFIG_VFAT_FS=y
> CONFIG_TMPFS=y
> CONFIG_JFFS2_FS=y
> CONFIG_JFFS2_SUMMARY=y
> CONFIG_JFFS2_COMPRESSION_OPTIONS=y
> CONFIG_JFFS2_RUBIN=y
> CONFIG_CRAMFS=m
> CONFIG_NFS_FS=m
> CONFIG_NFS_V4=m
> CONFIG_NLS_DEFAULT="cp437"
> CONFIG_NLS_CODEPAGE_437=y
> CONFIG_NLS_ISO8859_1=y
> CONFIG_NLS_UTF8=y
> CONFIG_CRYPTO_TEST=m
> CONFIG_CRYPTO_HMAC=y
> CONFIG_CRYPTO_MD4=m
> CONFIG_CRYPTO_MICHAEL_MIC=m
> CONFIG_CRYPTO_SHA512=m
> CONFIG_CRYPTO_WP512=m
> CONFIG_CRYPTO_ANUBIS=m
> CONFIG_CRYPTO_ARC4=m
> CONFIG_CRYPTO_BLOWFISH=m
> CONFIG_CRYPTO_CAST5=m
> CONFIG_CRYPTO_CAST6=m
> CONFIG_CRYPTO_KHAZAD=m
> CONFIG_CRYPTO_SERPENT=m
> CONFIG_CRYPTO_TEA=m
> CONFIG_CRYPTO_TWOFISH=m
> CONFIG_CRC_CCITT=y
> CONFIG_LIBCRC32C=m
> CONFIG_FONTS=y
> CONFIG_FONT_8x8=y
> CONFIG_FONT_8x16=y
> CONFIG_MAGIC_SYSRQ=y
> # CONFIG_DEBUG_PREEMPT is not set
> # CONFIG_FTRACE is not set
> CONFIG_DEBUG_LL=y
diff mbox series

Patch

diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 78fc28da2e29..0de57151c732 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -218,7 +218,8 @@  extern void efi_thunk_runtime_setup(void);
 efi_status_t efi_set_virtual_address_map(unsigned long memory_map_size,
 					 unsigned long descriptor_size,
 					 u32 descriptor_version,
-					 efi_memory_desc_t *virtual_map);
+					 efi_memory_desc_t *virtual_map,
+					 unsigned long systab_phys);
 
 /* arch specific definitions used by the stub code */
 
diff --git a/arch/x86/kernel/asm-offsets_32.c b/arch/x86/kernel/asm-offsets_32.c
index 82826f2275cc..2b4256ebe86e 100644
--- a/arch/x86/kernel/asm-offsets_32.c
+++ b/arch/x86/kernel/asm-offsets_32.c
@@ -3,6 +3,8 @@ 
 # error "Please do not build this file directly, build asm-offsets.c instead"
 #endif
 
+#include <linux/efi.h>
+
 #include <asm/ucontext.h>
 
 #define __SYSCALL_I386(nr, sym, qual) [nr] = 1,
@@ -64,4 +66,7 @@  void foo(void)
 	BLANK();
 	DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
 	DEFINE(NR_syscalls, sizeof(syscalls));
+
+	BLANK();
+	DEFINE(EFI_svam, offsetof(efi_runtime_services_t, set_virtual_address_map));
 }
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 57651facb99d..40eb4d2e3321 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -55,8 +55,8 @@ 
 #include <asm/uv/uv.h>
 
 static efi_system_table_t efi_systab __initdata;
-static u64 efi_systab_phys __initdata;
 
+static unsigned long efi_systab_phys __initdata;
 static unsigned long prop_phys = EFI_INVALID_TABLE_ADDR;
 static unsigned long uga_phys = EFI_INVALID_TABLE_ADDR;
 static unsigned long efi_runtime, efi_nr_tables;
@@ -338,7 +338,7 @@  void __init efi_print_memmap(void)
 	}
 }
 
-static int __init efi_systab_init(u64 phys)
+static int __init efi_systab_init(unsigned long phys)
 {
 	int size = efi_enabled(EFI_64BIT) ? sizeof(efi_system_table_64_t)
 					  : sizeof(efi_system_table_32_t);
@@ -952,7 +952,8 @@  static void __init __efi_enter_virtual_mode(void)
 	status = efi_set_virtual_address_map(efi.memmap.desc_size * count,
 					     efi.memmap.desc_size,
 					     efi.memmap.desc_version,
-					     (efi_memory_desc_t *)pa);
+					     (efi_memory_desc_t *)pa,
+					     efi_systab_phys);
 	if (status != EFI_SUCCESS) {
 		pr_err("Unable to switch EFI into virtual mode (status=%lx)!\n",
 		       status);
@@ -986,6 +987,8 @@  void __init efi_enter_virtual_mode(void)
 	if (efi_enabled(EFI_PARAVIRT))
 		return;
 
+	efi.runtime = (efi_runtime_services_t *)efi_runtime;
+
 	if (efi_setup)
 		kexec_enter_virtual_mode();
 	else
diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c
index 081d466002c9..c049c432745d 100644
--- a/arch/x86/platform/efi/efi_32.c
+++ b/arch/x86/platform/efi/efi_32.c
@@ -66,14 +66,16 @@  void __init efi_map_region(efi_memory_desc_t *md)
 void __init efi_map_region_fixed(efi_memory_desc_t *md) {}
 void __init parse_efi_setup(u64 phys_addr, u32 data_len) {}
 
-efi_status_t efi_call_svam(efi_set_virtual_address_map_t *__efiapi *,
-			   u32, u32, u32, void *);
+efi_status_t efi_call_svam(efi_runtime_services_t * const *,
+			   u32, u32, u32, void *, u32);
 
 efi_status_t __init efi_set_virtual_address_map(unsigned long memory_map_size,
 						unsigned long descriptor_size,
 						u32 descriptor_version,
-						efi_memory_desc_t *virtual_map)
+						efi_memory_desc_t *virtual_map,
+						unsigned long systab_phys)
 {
+	const efi_system_table_t *systab = (efi_system_table_t *)systab_phys;
 	struct desc_ptr gdt_descr;
 	efi_status_t status;
 	unsigned long flags;
@@ -90,9 +92,10 @@  efi_status_t __init efi_set_virtual_address_map(unsigned long memory_map_size,
 
 	/* Disable interrupts around EFI calls: */
 	local_irq_save(flags);
-	status = efi_call_svam(&efi.systab->runtime->set_virtual_address_map,
+	status = efi_call_svam(&systab->runtime,
 			       memory_map_size, descriptor_size,
-			       descriptor_version, virtual_map);
+			       descriptor_version, virtual_map,
+			       __pa(&efi.runtime));
 	local_irq_restore(flags);
 
 	load_fixmap_gdt(0);
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index fa8506e76bbe..f78f7da666fb 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -500,12 +500,9 @@  static DEFINE_SPINLOCK(efi_runtime_lock);
  */
 #define __efi_thunk(func, ...)						\
 ({									\
-	efi_runtime_services_32_t *__rt;				\
 	unsigned short __ds, __es;					\
 	efi_status_t ____s;						\
 									\
-	__rt = (void *)(unsigned long)efi.systab->mixed_mode.runtime;	\
-									\
 	savesegment(ds, __ds);						\
 	savesegment(es, __es);						\
 									\
@@ -513,7 +510,7 @@  static DEFINE_SPINLOCK(efi_runtime_lock);
 	loadsegment(ds, __KERNEL_DS);					\
 	loadsegment(es, __KERNEL_DS);					\
 									\
-	____s = efi64_thunk(__rt->func, __VA_ARGS__);			\
+	____s = efi64_thunk(efi.runtime->mixed_mode.func, __VA_ARGS__);	\
 									\
 	loadsegment(ds, __ds);						\
 	loadsegment(es, __es);						\
@@ -886,8 +883,10 @@  efi_status_t __init __no_sanitize_address
 efi_set_virtual_address_map(unsigned long memory_map_size,
 			    unsigned long descriptor_size,
 			    u32 descriptor_version,
-			    efi_memory_desc_t *virtual_map)
+			    efi_memory_desc_t *virtual_map,
+			    unsigned long systab_phys)
 {
+	const efi_system_table_t *systab = (efi_system_table_t *)systab_phys;
 	efi_status_t status;
 	unsigned long flags;
 	pgd_t *save_pgd = NULL;
@@ -910,13 +909,16 @@  efi_set_virtual_address_map(unsigned long memory_map_size,
 
 	/* Disable interrupts around EFI calls: */
 	local_irq_save(flags);
-	status = efi_call(efi.systab->runtime->set_virtual_address_map,
+	status = efi_call(efi.runtime->set_virtual_address_map,
 			  memory_map_size, descriptor_size,
 			  descriptor_version, virtual_map);
 	local_irq_restore(flags);
 
 	kernel_fpu_end();
 
+	/* grab the virtually remapped EFI runtime services table pointer */
+	efi.runtime = READ_ONCE(systab->runtime);
+
 	if (save_pgd)
 		efi_uv1_memmap_phys_epilog(save_pgd);
 	else
diff --git a/arch/x86/platform/efi/efi_stub_32.S b/arch/x86/platform/efi/efi_stub_32.S
index 75c46e7a809f..09237236fb25 100644
--- a/arch/x86/platform/efi/efi_stub_32.S
+++ b/arch/x86/platform/efi/efi_stub_32.S
@@ -8,14 +8,20 @@ 
 
 #include <linux/linkage.h>
 #include <linux/init.h>
+#include <asm/asm-offsets.h>
 #include <asm/page_types.h>
 
 	__INIT
 SYM_FUNC_START(efi_call_svam)
-	push	8(%esp)
-	push	8(%esp)
+	push	%ebp
+	movl	%esp, %ebp
+	push	%ebx
+
+	push	16(%esp)
+	push	16(%esp)
 	push	%ecx
 	push	%edx
+	movl	%eax, %ebx		// &systab_phys->runtime
 
 	/*
 	 * Switch to the flat mapped alias of this routine, by jumping to the
@@ -35,15 +41,20 @@  SYM_FUNC_START(efi_call_svam)
 	subl	$__PAGE_OFFSET, %esp
 
 	/* call the EFI routine */
-	call	*(%eax)
+	movl	(%eax), %eax
+	call	*EFI_svam(%eax)
 
-	/* convert ESP back to a kernel VA, and pop the outgoing args */
-	addl	$__PAGE_OFFSET + 16, %esp
+	/* grab the virtually remapped EFI runtime services table pointer */
+	movl	(%ebx), %ecx
+	movl	36(%esp), %edx		// &efi.runtime
+	movl	%ecx, (%edx)
 
 	/* re-enable paging */
 	movl	%cr0, %edx
 	orl	$0x80000000, %edx
 	movl	%edx, %cr0
 
+	pop	%ebx
+	leave
 	ret
 SYM_FUNC_END(efi_call_svam)
diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c
index 5fc2f6813b84..77048f7a9659 100644
--- a/drivers/firmware/efi/arm-init.c
+++ b/drivers/firmware/efi/arm-init.c
@@ -104,6 +104,7 @@  static int __init uefi_init(void)
 	if (retval)
 		goto out;
 
+	efi.runtime = efi.systab->runtime;
 	efi.runtime_version = efi.systab->hdr.revision;
 
 	efi_systab_report_header(&efi.systab->hdr,
diff --git a/drivers/firmware/efi/runtime-wrappers.c b/drivers/firmware/efi/runtime-wrappers.c
index 65fffaa22210..1410beaef5c3 100644
--- a/drivers/firmware/efi/runtime-wrappers.c
+++ b/drivers/firmware/efi/runtime-wrappers.c
@@ -40,9 +40,9 @@ 
  * code doesn't get too cluttered:
  */
 #define efi_call_virt(f, args...)   \
-	efi_call_virt_pointer(efi.systab->runtime, f, args)
+	efi_call_virt_pointer(efi.runtime, f, args)
 #define __efi_call_virt(f, args...) \
-	__efi_call_virt_pointer(efi.systab->runtime, f, args)
+	__efi_call_virt_pointer(efi.runtime, f, args)
 
 struct efi_runtime_work efi_rts_work;
 
diff --git a/include/linux/efi.h b/include/linux/efi.h
index a42045568df3..1f69c4c2dd5c 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -529,6 +529,7 @@  typedef struct {
  * All runtime access to EFI goes through this structure:
  */
 extern struct efi {
+	const efi_runtime_services_t	*runtime;		/* EFI runtime services table */
 	efi_system_table_t *systab;	/* EFI system table */
 	unsigned int runtime_version;	/* Runtime services version */
 	unsigned long acpi;		/* ACPI table  (IA64 ext 0.71) */