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: <20120825004859.GB10812@jshin-Toonie>
Date:	Fri, 24 Aug 2012 19:49:04 -0500
From:	Jacob Shin <jacob.shin@....com>
To:	"H. Peter Anvin" <hpa@...or.com>
CC:	X86-ML <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
	Yinghai Lu <yinghai@...nel.org>, Tejun Heo <tj@...nel.org>,
	Dave Young <dyoung@...hat.com>,
	Chao Wang <chaowang@...hat.com>,
	Vivek Goyal <vgoyal@...hat.com>,
	Andreas Herrmann <andreas.herrmann3@....com>,
	Borislav Petkov <borislav.petkov@....com>
Subject: Re: [PATCH 3/5] x86: Only direct map addresses that are marked as
 E820_RAM

On Fri, Aug 24, 2012 at 05:30:21PM -0700, H. Peter Anvin wrote:
> On 08/24/2012 04:55 PM, Jacob Shin wrote:
> >+
> >+	for (i = 0; i < e820.nr_map; i++) {
> >+		struct e820entry *ei = &e820.map[i];
> >+		u64 start = ei->addr;
> >+		u64 end = ei->addr + ei->size;
> >+
> >+		/* we only map E820_RAM */
> >+		if (ei->type != E820_RAM)
> >+			continue;
> >+
> >+		if (end <= ISA_END_ADDRESS)
> >+			continue;
> >+
> >+		if (start <= ISA_END_ADDRESS)
> >+			start = 0;
> >+#ifdef CONFIG_X86_32
> >+		/* on 32 bit, we only map up to max_low_pfn */
> >+		if ((start >> PAGE_SHIFT) >= max_low_pfn)
> >+			continue;
> >+
> >+		if ((end >> PAGE_SHIFT) > max_low_pfn)
> >+			end = max_low_pfn << PAGE_SHIFT;
> >+#endif
> >+		/* the ISA range is always mapped regardless of holes */
> >+		if (!pfn_range_is_mapped(0, ISA_END_ADDRESS << PAGE_SHIFT) &&
> >+		    start != 0)
> >+			init_memory_mapping(0, ISA_END_ADDRESS);
> >+
> >+		init_memory_mapping(start, end);
> >+	}
> >+
> 
> The ISA range mapping doesn't really make sense *inside* the loop,
> no? It seems you could do that before you enter the loop and then
> simply have:
> 
> +		if (end <= ISA_END_ADDRESS)
> +			continue;
> +
> +		if (start <= ISA_END_ADDRESS)
> +			start = ISA_END_ADDRESS;
> 
> ... no?

Right, I think what I was attempting to do was to merge the 1MB
with E820_RAM right above 1MB:

So instead of:

init_memory_mapping(0, 1MB)
init_memory_mapping(1MB, 2GB)

It would be:

init_memory_mapping(0, 2GB)

While taking care of the odd case where there is a gap right after
1MB.

But if its not worth it, I can move it out of the loop.

> 
> 	-hpa
> 
> -- 
> H. Peter Anvin, Intel Open Source Technology Center
> I work for Intel.  I don't speak on their behalf.
> 
> 

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