Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Mar 2017 09:33:36 +0000 (UTC)
From:      =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= <royger@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r315402 - head/sys/x86/acpica
Message-ID:  <201703160933.v2G9XaDX057831@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: royger
Date: Thu Mar 16 09:33:36 2017
New Revision: 315402
URL: https://svnweb.freebsd.org/changeset/base/315402

Log:
  x86/srat: fix parsing of APIC IDs > MAX_APIC_ID
  
  Ignore them like it's done in the MADT parser. This allows booting on a box
  with SRAT and APIC IDs > 255.
  
  Reported by:	Wei Liu <wei.liu2@citrix.com>
  Tested by:	Wei Liu <wei.liu2@citrix.com>
  Reviewed by:	kib
  MFC after:	2 weeks
  Sponsored by:	Citrix Systems R&D

Modified:
  head/sys/x86/acpica/srat.c

Modified: head/sys/x86/acpica/srat.c
==============================================================================
--- head/sys/x86/acpica/srat.c	Thu Mar 16 09:17:14 2017	(r315401)
+++ head/sys/x86/acpica/srat.c	Thu Mar 16 09:33:36 2017	(r315402)
@@ -202,6 +202,12 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *e
 			    "enabled" : "disabled");
 		if (!(cpu->Flags & ACPI_SRAT_CPU_ENABLED))
 			break;
+		if (cpu->ApicId > MAX_APIC_ID) {
+			printf("SRAT: Ignoring local APIC ID %u (too high)\n",
+			    cpu->ApicId);
+			break;
+		}
+
 		if (cpus[cpu->ApicId].enabled) {
 			printf("SRAT: Duplicate local APIC ID %u\n",
 			    cpu->ApicId);
@@ -220,6 +226,12 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *e
 			    "enabled" : "disabled");
 		if (!(x2apic->Flags & ACPI_SRAT_CPU_ENABLED))
 			break;
+		if (x2apic->ApicId > MAX_APIC_ID) {
+			printf("SRAT: Ignoring local APIC ID %u (too high)\n",
+			    x2apic->ApicId);
+			break;
+		}
+
 		KASSERT(!cpus[x2apic->ApicId].enabled,
 		    ("Duplicate local APIC ID %u", x2apic->ApicId));
 		cpus[x2apic->ApicId].domain = x2apic->ProximityDomain;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703160933.v2G9XaDX057831>