You are not logged in.

#26 2017-06-05 10:57:57

leomao
Member
Registered: 2013-04-27
Posts: 18

Re: [SOLVED] Arch won't boot after selecting "Arch Linux" in systemd-boot

I have an affected system and a non-affected system.
It seems that we have collected enough info from affected systems.
Here is the acpi dump from a non-affected system:

/*
 * Intel ACPI Component Architecture
 * AML/ASL+ Disassembler version 20170303 (64-bit version)
 * Copyright (c) 2000 - 2017 Intel Corporation
 * 
 * Disassembly of bgrt.dat, Mon Jun  5 18:45:02 2017
 *
 * ACPI Data Table [BGRT]
 *
 * Format: [HexOffset DecimalOffset ByteLength]  FieldName : FieldValue
 */

[000h 0000   4]                    Signature : "BGRT"    [Boot Graphics Resource Table]
[004h 0004   4]                 Table Length : 00000038
[008h 0008   1]                     Revision : 01
[009h 0009   1]                     Checksum : AF
[00Ah 0010   6]                       Oem ID : "LENOVO"
[010h 0016   8]                 Oem Table ID : "CB-01   "
[018h 0024   4]                 Oem Revision : 00000001
[01Ch 0028   4]              Asl Compiler ID : "LENO"
[020h 0032   4]        Asl Compiler Revision : 00000001

[024h 0036   2]                      Version : 0001
[026h 0038   1]                       Status : 00
[027h 0039   1]                   Image Type : 00
[028h 0040   8]                Image Address : 0000000096A17018
[030h 0048   4]                Image OffsetX : 000002AE
[034h 0052   4]                Image OffsetY : 00000102

Raw Table Data: Length 56 (0x38)

  0000: 42 47 52 54 38 00 00 00 01 AF 4C 45 4E 4F 56 4F  // BGRT8.....LENOVO
  0010: 43 42 2D 30 31 20 20 20 01 00 00 00 4C 45 4E 4F  // CB-01   ....LENO
  0020: 01 00 00 00 01 00 00 00 18 70 A1 96 00 00 00 00  // .........p......
  0030: AE 02 00 00 02 01 00 00                          // ........

Offline

#27 2017-06-05 20:47:01

loqs
Member
Registered: 2014-03-06
Posts: 17,378

Re: [SOLVED] Arch won't boot after selecting "Arch Linux" in systemd-boot

@spinnau and @Maniaxx you might want to consider posting the acpi dumps you have even if you are short of working samples as 4.12-rc4 was just released.
This leaves potentially as little as three weeks to get a fix developed and accepted into mainline or it will miss the 4.12 release window.
Meaning it would have to be patched in both 4.11 and 4.12 via stable and the new merge window for 4.13 opening after 4.12 is released will almost certainly delay patch acceptance into mainline.

Offline

#28 2017-06-06 13:23:34

spinnau
Member
Registered: 2017-06-05
Posts: 34

Re: [SOLVED] Arch won't boot after selecting "Arch Linux" in systemd-boot

I have another non-affected EFI system here, that will boot fine with 4.11.3-1. Here is the acpi dump:

/*
 * Intel ACPI Component Architecture
 * AML/ASL+ Disassembler version 20170303 (64-bit version)
 * Copyright (c) 2000 - 2017 Intel Corporation
 * 
 * Disassembly of bgrt.dat, Tue Jun  6 14:37:28 2017
 *
 * ACPI Data Table [BGRT]
 *
 * Format: [HexOffset DecimalOffset ByteLength]  FieldName : FieldValue
 */

[000h 0000   4]                    Signature : "BGRT"    [Boot Graphics Resource Table]
[004h 0004   4]                 Table Length : 00000038
[008h 0008   1]                     Revision : 00
[009h 0009   1]                     Checksum : E5
[00Ah 0010   6]                       Oem ID : "HPQOEM"
[010h 0016   8]                 Oem Table ID : "SLIC-BPC"
[018h 0024   4]                 Oem Revision : 20150713
[01Ch 0028   4]              Asl Compiler ID : "AMI "
[020h 0032   4]        Asl Compiler Revision : 00010013

[024h 0036   2]                      Version : 0001
[026h 0038   1]                       Status : 01
[027h 0039   1]                   Image Type : 00
[028h 0040   8]                Image Address : 00000000D5360018
[030h 0048   4]                Image OffsetX : 0000032F
[034h 0052   4]                Image OffsetY : 0000010B

Raw Table Data: Length 56 (0x38)

  0000: 42 47 52 54 38 00 00 00 00 E5 48 50 51 4F 45 4D  // BGRT8.....HPQOEM
  0010: 53 4C 49 43 2D 42 50 43 13 07 15 20 41 4D 49 20  // SLIC-BPC... AMI 
  0020: 13 00 01 00 01 00 01 00 18 00 36 D5 00 00 00 00  // ..........6.....
  0030: 2F 03 00 00 0B 01 00 00                          // /.......

I have also attached the posted ACPI dumps to the kernel bug report https://bugzilla.kernel.org/show_bug.cgi?id=195633.

Offline

#29 2017-06-07 13:30:32

Maniaxx
Member
Registered: 2014-05-14
Posts: 738

Re: [SOLVED] Arch won't boot after selecting "Arch Linux" in systemd-boot

Thanks for the dumps.
A fix is in progress. early_memremap doesn't detect invalid physical memory.


sys2064

Offline

#30 2017-06-09 14:29:47

loqs
Member
Registered: 2014-03-06
Posts: 17,378

Re: [SOLVED] Arch won't boot after selecting "Arch Linux" in systemd-boot

This is the reworked fix https://git.kernel.org/pub/scm/linux/ke … b9d441df42

diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
index 04ca8764f0c0..b58233e4ed71 100644
--- a/arch/x86/platform/efi/efi-bgrt.c
+++ b/arch/x86/platform/efi/efi-bgrt.c
@@ -27,6 +27,26 @@ struct bmp_header {
 	u32 size;
 } __packed;
 
+static bool efi_bgrt_addr_valid(u64 addr)
+{
+	efi_memory_desc_t *md;
+
+	for_each_efi_memory_desc(md) {
+		u64 size;
+		u64 end;
+
+		if (md->type != EFI_BOOT_SERVICES_DATA)
+			continue;
+
+		size = md->num_pages << EFI_PAGE_SHIFT;
+		end = md->phys_addr + size;
+		if (addr >= md->phys_addr && addr < end)
+			return true;
+	}
+
+	return false;
+}
+
 void __init efi_bgrt_init(struct acpi_table_header *table)
 {
 	void *image;
@@ -36,6 +56,9 @@ void __init efi_bgrt_init(struct acpi_table_header *table)
 	if (acpi_disabled)
 		return;
 
+	if (!efi_enabled(EFI_MEMMAP))
+		return;
+
 	if (table->length < sizeof(bgrt_tab)) {
 		pr_notice("Ignoring BGRT: invalid length %u (expected %zu)\n",
 		       table->length, sizeof(bgrt_tab));
@@ -62,6 +85,10 @@ void __init efi_bgrt_init(struct acpi_table_header *table)
 		goto out;
 	}
 
+	if (!efi_bgrt_addr_valid(bgrt->image_address)) {
+		pr_notice("Ignoring BGRT: invalid image address\n");
+		goto out;
+	}
 	image = early_memremap(bgrt->image_address, sizeof(bmp_header));
 	if (!image) {
 		pr_notice("Ignoring BGRT: failed to map image header memory\n");

Patch rebased to 4.11 series should fix the issue on both EFI and bios booting.

Last edited by loqs (2017-06-09 15:01:48)

Offline

#31 2017-06-09 19:27:15

spinnau
Member
Registered: 2017-06-05
Posts: 34

Re: [SOLVED] Arch won't boot after selecting "Arch Linux" in systemd-boot

Thanks to all for the work. I can confirm, that the patch applied to linux-4.11.3 solves the issue on my system with EFI boot.

Offline

#32 2017-06-10 08:06:59

noctavian
Member
Registered: 2013-07-11
Posts: 14

Re: [SOLVED] Arch won't boot after selecting "Arch Linux" in systemd-boot

I can also confirm that linux-4.11.3 with the patch above boots in UEFI mode on my system.

Offline

Board footer

Powered by FluxBB