From: "Jan Beulich" Subject: [PATCH] linux/x86-64: kern_addr_valid() must not walk page tables mapping hypervisor space Date: Mon, 12 Apr 2010 14:56:42 +0100 Message-ID: <4BC342BA0200007800039BF2@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part4C66C98A.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part4C66C98A.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Signed-off-by: Jan Beulich --- a/arch/x86_64/mm/init-xen.c +++ b/arch/x86_64/mm/init-xen.c @@ -1160,6 +1160,19 @@ int kern_addr_valid(unsigned long addr) if (above !=3D 0 && above !=3D -1UL) return 0;=20 =09 +#ifdef CONFIG_XEN + /* + * Don't walk page tables for hypervisor addresses, but allow + * the M2P table to be accessed through e.g. /proc/kcore. + */ + if (addr >=3D (unsigned long)machine_to_phys_mapping && + addr < (unsigned long)(machine_to_phys_mapping + + (1UL << machine_to_phys_order))) + return 1; + if (addr >=3D HYPERVISOR_VIRT_START && addr < HYPERVISOR_VIRT_END) + return 0; +#endif + pgd =3D pgd_offset_k(addr); if (pgd_none(*pgd)) return 0; --=__Part4C66C98A.0__= Content-Type: text/plain; name="xen-x86_64-kern_addr_valid.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="xen-x86_64-kern_addr_valid.patch" Subject: x86-64: kern_addr_valid() must not walk page tables mapping = hypervisor space=0A=0ASigned-off-by: Jan Beulich =0A= =0A--- a/arch/x86_64/mm/init-xen.c=0A+++ b/arch/x86_64/mm/init-xen.c=0A@@ = -1160,6 +1160,19 @@ int kern_addr_valid(unsigned long addr)=0A if (above = !=3D 0 && above !=3D -1UL)=0A return 0; =0A =0A+#ifdef = CONFIG_XEN=0A+ /*=0A+ * Don't walk page tables for hypervisor addresses,= but allow=0A+ * the M2P table to be accessed through e.g. /proc/kcore.= =0A+ */=0A+ if (addr >=3D (unsigned long)machine_to_phys_mapping = &&=0A+ addr < (unsigned long)(machine_to_phys_mapping +=0A+ = (1UL << machine_to_phys_order)))=0A+ return = 1;=0A+ if (addr >=3D HYPERVISOR_VIRT_START && addr < HYPERVISOR_VIRT_END)= =0A+ return 0;=0A+#endif=0A+=0A pgd =3D pgd_offset_k(addr);= =0A if (pgd_none(*pgd))=0A return 0;=0A --=__Part4C66C98A.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part4C66C98A.0__=--