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]
Message-ID: <20220517175629.GA4788@ubuntu-20.04.3>
Date:   Tue, 17 May 2022 17:56:29 +0000
From:   James Liu <james.liu@....com>
To:     rafael@...nel.org, lenb@...nel.org
Cc:     linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ACPI: OSL: Fix the memory mapping of an ACPI GAS that
 addresses a data structure

Hi Rafael and all,
Could you take a look into this patches? The mentioned bug blocks EINJ
testing whenever a system firmware can correctly support GAS according 
to ACPI 6.4.

On Fri, Apr 01, 2022 at 05:28:40PM +0000, james.liu@....com wrote:
> From: James Liu <james.liu@....com>
> 
>     Modify acpi_os_map_generic_address and acpi_os_unmap_generic_address
>     to handle a case that a GAS table (i.e., Table 5.1 in ACPI 6.4) is used
>     to address a data structure; in this case, the GAS has the field of
>     "Register Bit Width" equal to 0.
> 
>     For example, "Injection Instruction Entry" (Table 18.25 in ACPI 6.4)
>     has a RegisterRegion field that is a GAS that points to a data
>     structure SET_ERROR_TYPE_WITH_ADDRESS (Table 18.30), which is required
>     when using EINJ (Error Injection module).
> 
>     This fix preserves a fairly sufficient memory space (i.e., page size)
>     to store the data structure so as to prevent EINJ module from loading
>     failure if platform firmware can support Injection Instruction Entry in
>     an EINJ table.
> 
> Signed-off-by: James Liu <james.liu@....com>
> ---
>  drivers/acpi/osl.c | 23 +++++++++++++++++++++--
>  1 file changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
> index 45c5c0e45..ab2f584b1 100644
> --- a/drivers/acpi/osl.c
> +++ b/drivers/acpi/osl.c
> @@ -457,9 +457,15 @@ void __iomem *acpi_os_map_generic_address(struct acpi_generic_address *gas)
>  	if (gas->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY)
>  		return NULL;
>  
> +	/* Handle a case that GAS is used to address an ACPI data structure */
> +	if (!gas->bit_width) {
> +		pr_info("An ACPI data structure at 0x%llx is mapped\n", addr);
> +		return  acpi_os_map_iomem(addr, PAGE_SIZE);
> +	}
> +
>  	/* Handle possible alignment issues */
>  	memcpy(&addr, &gas->address, sizeof(addr));
> -	if (!addr || !gas->bit_width)
> +	if (!addr)
>  		return NULL;
>  
>  	return acpi_os_map_iomem(addr, gas->bit_width / 8);
> @@ -474,9 +480,22 @@ void acpi_os_unmap_generic_address(struct acpi_generic_address *gas)
>  	if (gas->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY)
>  		return;
>  
> +	/* Handle a case that GAS is used to address an ACPI data structure */
> +	if (!gas->bit_width) {
> +		pr_info("An ACPI data structure at 0x%llx is unmapped\n", addr);
> +		mutex_lock(&acpi_ioremap_lock);
> +		map = acpi_map_lookup(addr, PAGE_SIZE);
> +		if (!map) {
> +			mutex_unlock(&acpi_ioremap_lock);
> +			return;
> +		}
> +		acpi_os_drop_map_ref(map);
> +		mutex_unlock(&acpi_ioremap_lock);
> +	}
> +
>  	/* Handle possible alignment issues */
>  	memcpy(&addr, &gas->address, sizeof(addr));
> -	if (!addr || !gas->bit_width)
> +	if (!addr)
>  		return;
>  
>  	mutex_lock(&acpi_ioremap_lock);
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ