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:	Fri, 12 Dec 2014 15:56:57 +0100
From:	Borislav Petkov <bp@...en8.de>
To:	Thomas Gleixner <tglx@...utronix.de>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Jiang Liu <jiang.liu@...ux.intel.com>, x86@...nel.org,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	"Rafael J. Wysocki" <rjw@...ysocki.net>,
	Yinghai Lu <yinghai@...nel.org>
Subject: Re: [patch 3/4] x86: pci: acpi: Fix the range check for IO resources

On Thu, Dec 11, 2014 at 07:48:22PM -0000, Thomas Gleixner wrote:
> The range check in setup_res() checks the IO range against
> iomem_resource. That's just wrong.
> 
> Move the check into a separate function and use ioport_resource for IO
> ranges.
> 
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> ---
>  arch/x86/pci/acpi.c |   51 +++++++++++++++++++++++++++++++++------------------
>  1 file changed, 33 insertions(+), 18 deletions(-)
> 
> Index: tip/arch/x86/pci/acpi.c
> ===================================================================
> --- tip.orig/arch/x86/pci/acpi.c
> +++ tip/arch/x86/pci/acpi.c
> @@ -240,12 +240,41 @@ static acpi_status count_resource(struct
>  	return AE_OK;
>  }
>  
> +static bool valid_resource_range(struct resource *r, struct device *dev)
> +{
> +	struct resource *ior;
> +	u64 end;
> +
> +	ior = (r->flags & IORESOURCE_IO) ? &ioport_resource : &iomem_resource;
> +
> +	/*
> +	 * Exclude non-addressable range or non-addressable portion of
> +	 * range. We only check end because ior->start is always 0.
> +	 */
> +	end = r->end;
> +	r->end = min(r->end, ior->end);
> +	if (r->end <= r->start) {
> +		dev_info(dev, "host bridge %s window [%#llx-%#llx] invalid range\n",
> +			 r->flags & IORESOURCE_IO ? "io" : "mem",

I think you can simplify this and below even further as the check
Iagainst ORESOURCE_IO is done already when selecting the ior thing (diff
Iontop):

---
Index: b/arch/x86/pci/acpi.c
===================================================================
--- a/arch/x86/pci/acpi.c	2014-12-12 15:54:40.856317113 +0100
+++ b/arch/x86/pci/acpi.c	2014-12-12 15:53:16.832319561 +0100
@@ -255,7 +255,7 @@ static bool valid_resource_range(struct
 	r->end = min(r->end, ior->end);
 	if (r->end <= r->start) {
 		dev_info(dev, "host bridge %s window [%#llx-%#llx] invalid range\n",
-			 r->flags & IORESOURCE_IO ? "io" : "mem",
+			 ior->name,
 			 (unsigned long long)r->start, end);
 		return false;
 	}
@@ -264,7 +264,7 @@ static bool valid_resource_range(struct
 		return true;
 
 	dev_info(dev, "host bridge %s window [%#llx-%#llx] truncated to [%#llx-%#llx]\n",
-		 r->flags & IORESOURCE_IO ? "io" : "mem",
+		 ior->name,
 		 (unsigned long long)r->start, end,
 		 (unsigned long long)r->start, (unsigned long long)r->end);
 	return true;

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ