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: <alpine.DEB.2.02.1210091240300.29539@kaball.uk.xensource.com>
Date:	Tue, 9 Oct 2012 13:22:49 +0100
From:	Stefano Stabellini <stefano.stabellini@...citrix.com>
To:	"H. Peter Anvin" <hpa@...or.com>
CC:	Yinghai Lu <yinghai@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...e.hu>, Jacob Shin <jacob.shin@....com>,
	Tejun Heo <tj@...nel.org>,
	Stefano Stabellini <Stefano.Stabellini@...citrix.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
	Jeremy Fitzhardinge <jeremy@...p.org>
Subject: Re: [PATCH 08/10] x86, xen, mm: fix mapping_pagetable_reserve
 logic

On Tue, 9 Oct 2012, H. Peter Anvin wrote:
> On 10/09/2012 02:33 PM, Yinghai Lu wrote:
> >>
> >> make_range_readwrite is particularly toxic, though, because it makes it
> >> sound like it something along the lines of set_memory_rw(), which it
> >> most distinctly is not.
> > 
> > it just change some page range from RO back to RW.
> > 
> > so how about update_range_ro_to_rw?
> > 
> 
> You're focusing on what the low-level mechanics of one particular
> implementation (Xen) of the hook, and then try to make it describe the
> hook itself.
> 
> What the hook does, if I am reading it correctly, is take a range that
> used to be page tables and turn it back to "ordinary memory".  As such,
> assuming I'm following the logic correctly, something like
> pagetable_unreserve() seems like a reasonable name.
> 
> However, why during initialization, why do we have to unreserve memory
> that has already been reserved for pagetables?  (Keep in mind there may
> very well be an entirely sensible answer for that question -- I just
> can't tell from the patchset without a much more in-depth analysis.
> Keep in mind that that in-depth analysis sucks up time, and it doesn't
> scale to expect the maintainer to have to do that.)

I can give some hints: find_early_table_space allocates more memory than
needed for pagetable pages, the allocated range is
pgt_buf_start-pgt_buf_top.

In fact init_memory_mapping doesn't use all the memory in that range,
and after building the pagetables calls pagetable_reserve to reserve
only the range of memory that actually used.
On native is just a memblock_reserve, to make sure that pagetable pages
are not reused as normal memory.
On Xen, in addition to that, we also make RW the rest of the range
pgt_buf_start-pgt_buf_top.

The first problem that I can see with this scheme is that
pgt_buf_start-pgt_buf_top is assumed to be the pagetable pages range by
the Xen subsystem while it should be exported with a more appropriate
hook.

If we had a hook in find_early_table_space called "pagetable_reserve"
that tells everybody what is the pagetable pages range in memory, then
we could have a "pagetable_unreserve" hook to release the unused
portions of that memory range. This would make more sense to me.
--
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