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, 18 Apr 2008 10:41:56 -0700
From:	Dave Hansen <dave@...ux.vnet.ibm.com>
To:	Mel Gorman <mel@....ul.ie>
Cc:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Shi Weihua <shiwh@...fujitsu.com>, akpm@...ux-foundation.org,
	balbir@...ux.vnet.ibm.com, xemul@...nvz.org,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org, hugh@...itas.com
Subject: Re: [PATCH]Fix usemap for DISCONTIG/FLATMEM with not-aligned zone
	initilaization.


On Fri, 2008-04-18 at 17:15 +0100, Mel Gorman wrote:
> -void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone,
> +void __meminit memmap_init_zone(unsigned long size, int nid, struct zone *zone,
>                 unsigned long start_pfn, enum memmap_context context)
>  {
>         struct page *page;
>         unsigned long end_pfn = start_pfn + size;
>         unsigned long pfn;
> +       int zoneidx = zone_idx(zone);
> +
> +       /*
> +        * Sanity check the values passed in. It is possible an architecture
> +        * calling this function directly will use values outside of the memory
> +        * they registered
> +        */
> +       if (start_pfn < zone->zone_start_pfn) {
> +               WARN_ON_ONCE(1);
> +               start_pfn = zone->zone_start_pfn;
> +       }
> +
> +       if (size > zone->spanned_pages) {
> +               WARN_ON_ONCE(1);
> +               size = zone->spanned_pages;
> +       }

I was thinking about whether size needs to be modified in there like
this:

	if (start_pfn < zone->zone_start_pfn) {
		WARN_ON_ONCE(1);
+		size -= zone->zone_start_pfn - start_pfn;
		start_pfn = zone->zone_start_pfn;
	}

and I realized that your modification of size actually happens after its
only use in the function (to calculate end_pfn).  Seems like we either
be error-checking end_pfn or delaying its calculation until after 'size'
is fixed.

-- Dave

--
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