lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 24 Apr 2024 18:24:50 +0100
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Thomas Gleixner <tglx@...utronix.de>, Peter Zijlstra
	<peterz@...radead.org>, <linux-pm@...r.kernel.org>,
	<loongarch@...ts.linux.dev>, <linux-acpi@...r.kernel.org>,
	<linux-arch@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<linux-arm-kernel@...ts.infradead.org>, <kvmarm@...ts.linux.dev>,
	<x86@...nel.org>, Russell King <linux@...linux.org.uk>, "Rafael J . Wysocki"
	<rafael@...nel.org>, Miguel Luis <miguel.luis@...cle.com>, "James Morse"
	<james.morse@....com>, Salil Mehta <salil.mehta@...wei.com>, Jean-Philippe
 Brucker <jean-philippe@...aro.org>, Catalin Marinas
	<catalin.marinas@....com>, Will Deacon <will@...nel.org>,
	<linuxarm@...wei.com>
CC: Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>, "Dave
 Hansen" <dave.hansen@...ux.intel.com>, <justin.he@....com>,
	<jianyong.wu@....com>
Subject: Re: [PATCH v7 14/16] arm64: Kconfig: Enable hotplug CPU on arm64 if
 ACPI_PROCESSOR is enabled.

On Thu, 18 Apr 2024 14:54:10 +0100
Jonathan Cameron <Jonathan.Cameron@...wei.com> wrote:

> In order to move arch_register_cpu() to be called via the same path
> for initially present CPUs described by ACPI and hotplugged CPUs
> ACPI_HOTPLUG_CPU needs to be enabled.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> ---
> v7: No change.
> ---
>  arch/arm64/Kconfig       |  1 +
>  arch/arm64/kernel/acpi.c | 16 ++++++++++++++++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 7b11c98b3e84..fed7d0d54179 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -5,6 +5,7 @@ config ARM64
>  	select ACPI_CCA_REQUIRED if ACPI
>  	select ACPI_GENERIC_GSI if ACPI
>  	select ACPI_GTDT if ACPI
> +	select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR
>  	select ACPI_IORT if ACPI
>  	select ACPI_REDUCED_HARDWARE_ONLY if ACPI
>  	select ACPI_MCFG if (ACPI && PCI)
> diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
> index dba8fcec7f33..a74e80d58df3 100644
> --- a/arch/arm64/kernel/acpi.c
> +++ b/arch/arm64/kernel/acpi.c
> @@ -29,6 +29,7 @@
>  #include <linux/pgtable.h>
>  
>  #include <acpi/ghes.h>
> +#include <acpi/processor.h>
>  #include <asm/cputype.h>
>  #include <asm/cpu_ops.h>
>  #include <asm/daifflags.h>
> @@ -413,6 +414,21 @@ void arch_reserve_mem_area(acpi_physical_address addr, size_t size)
>  	memblock_mark_nomap(addr, size);
>  }
>  
> +#ifdef CONFIG_ACPI_HOTPLUG_CPU
> +int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 apci_id,
> +		 int *pcpu)
> +{

There are shipping firmware's in the wild that have DSDT entries for
way more CPUs than are actually present and don't bother with niceties like
providing _STA() methods.

As such, we need to check somewhere that the pcpu after this call is valid.

Given today this only applies to arm64 (as the x86 code has an implementation
of this function that will replace an invalid ID with a valid one) I'll add
a small catch here.

	if (*pcpu < 0) {
		pr_warn("Unable to map from CPU ACPI ID to anything useful\n");
		return -EINVAL;
	}

I'll have an entirely polite discussion with the relevant team at somepoint, but
on the plus side this is a sensible bit of hardening.

Jonathan

p.s. I want all those other cores!!!!

> +	return 0;
> +}
> +EXPORT_SYMBOL(acpi_map_cpu); /* check why */
> +
> +int acpi_unmap_cpu(int cpu)
> +{
> +	return 0;
> +}
> +EXPORT_SYMBOL(acpi_unmap_cpu);
> +#endif /* CONFIG_ACPI_HOTPLUG_CPU */
> +
>  #ifdef CONFIG_ACPI_FFH
>  /*
>   * Implements ARM64 specific callbacks to support ACPI FFH Operation Region as


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ