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:	Mon, 10 Jan 2011 18:11:21 -0500
From:	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
To:	stefano.stabellini@...citrix.com
Cc:	linux-kernel@...r.kernel.org, xen-devel@...ts.xensource.com,
	Jeremy.Fitzhardinge@...rix.com
Subject: Re: [PATCH 05/12] xen: add m2p override mechanism

On Mon, Jan 10, 2011 at 10:36:34AM +0000, stefano.stabellini@...citrix.com wrote:
> From: Jeremy Fitzhardinge <jeremy.fitzhardinge@...rix.com>
> 
> Add a simple hashtable based mechanism to override some portions of the
> m2p, so that we can find out the pfn corresponding to an mfn of a
> granted page. In fact entries corresponding to granted pages in the m2p
> hold the original pfn value of the page in the source domain that
> granted it.
> 
> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@...rix.com>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@...citrix.com>
> ---
>  arch/x86/include/asm/xen/page.h |   16 ++++++-
>  arch/x86/xen/p2m.c              |   80 +++++++++++++++++++++++++++++++++++++++
>  2 files changed, 93 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h
> index 8760cc6..50f0a0f 100644
> --- a/arch/x86/include/asm/xen/page.h
> +++ b/arch/x86/include/asm/xen/page.h
> @@ -42,6 +42,11 @@ extern unsigned int   machine_to_phys_order;
>  extern unsigned long get_phys_to_machine(unsigned long pfn);
>  extern bool set_phys_to_machine(unsigned long pfn, unsigned long mfn);
>  
> +extern void m2p_add_override(unsigned long mfn, struct page *page);
> +extern void m2p_remove_override(struct page *page);
> +extern struct page *m2p_find_override(unsigned long mfn);
> +extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn);
> +
>  static inline unsigned long pfn_to_mfn(unsigned long pfn)
>  {
>  	unsigned long mfn;
> @@ -72,9 +77,6 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn)
>  	if (xen_feature(XENFEAT_auto_translated_physmap))
>  		return mfn;
>  
> -	if (unlikely((mfn >> machine_to_phys_order) != 0))
> -		return ~0;
> -
>  	pfn = 0;
>  	/*
>  	 * The array access can fail (e.g., device space beyond end of RAM).
> @@ -83,6 +85,14 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn)
>  	 */
>  	__get_user(pfn, &machine_to_phys_mapping[mfn]);
>  
> +	/*
> +	 * If this appears to be a foreign mfn (because the pfn
> +	 * doesn't map back to the mfn), then check the local override
> +	 * table to see if there's a better pfn to use.
> +	 */
> +	if (get_phys_to_machine(pfn) != mfn)

Any reason to not use 'pfn_to_mfn' call instead? If we do want
to use the get_hhys_to_machine wouldn't be easier to just
check for 'FOREIGN_FRAME_BIT' set? Or is just mostly a copy-n-paste
of mfn_to_local_pfn?

Asking this b/c with some of my changes this will be triggered on
identity mappings. The reason being that the IDENTITY_FRAME_BIT
is still set when using get_phys_to_machine. However on the 'pfn_to_mfn'
call, that is cleared (along with the FOREIGN_FRAME_BIT)...

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