WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] IA64: fix efi_emulate_set_virtual_address

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] IA64: fix efi_emulate_set_virtual_address_map()
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 08 Jan 2009 06:57:48 -0800
Delivery-date: Thu, 08 Jan 2009 07:03:08 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
# Date 1228891187 -32400
# Node ID 3acca92b9597798baeaabf68fbcfc7920635099b
# Parent  e239a47180fb97e8c907cead1f6acec72cee0322
IA64: fix efi_emulate_set_virtual_address_map()

get_page() before touching guest pages.
Otherwise pages may be freed during those operations.

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
 xen/arch/ia64/xen/fw_emul.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+)

diff -r e239a47180fb -r 3acca92b9597 xen/arch/ia64/xen/fw_emul.c
--- a/xen/arch/ia64/xen/fw_emul.c       Wed Dec 10 15:39:46 2008 +0900
+++ b/xen/arch/ia64/xen/fw_emul.c       Wed Dec 10 15:39:47 2008 +0900
@@ -1334,6 +1334,10 @@ efi_emulate_set_virtual_address_map(
        efi_desc_size = sizeof(efi_memory_desc_t);
 
        for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
+               struct page_info *efi_runtime_page = NULL;
+               struct page_info *fpswa_inf_page = NULL;
+               struct page_info *fw_table_page = NULL;
+               
                if (copy_from_user(&entry, p, sizeof(efi_memory_desc_t))) {
                        printk ("efi_emulate_set_virtual_address_map: 
copy_from_user() fault. addr=0x%p\n", p);
                        return EFI_UNSUPPORTED;
@@ -1342,6 +1346,27 @@ efi_emulate_set_virtual_address_map(
                /* skip over non-PAL_CODE memory descriptors; EFI_RUNTIME is 
included in PAL_CODE. */
                 if (md->type != EFI_PAL_CODE)
                         continue;
+
+               /* get pages to prevend them from being freed 
+                * during touching them.
+                * those entres are in [FW_TABLES_BASE_PADDR, ...]
+                * see dom_fw.h for its layout.
+                */
+               efi_runtime_page = virt_to_page(efi_runtime);
+               fpswa_inf_page = virt_to_page(fpswa_inf);
+               fw_table_page = virt_to_page(
+                       domain_mpa_to_imva(d, FW_TABLES_BASE_PADDR));
+               if (get_page(efi_runtime_page, d) == 0)
+                       return EFI_INVALID_PARAMETER;
+               if (get_page(fpswa_inf_page, d) == 0) {
+                       put_page(efi_runtime_page);
+                       return EFI_INVALID_PARAMETER;
+               }
+               if (get_page(fw_table_page, d) == 0) {
+                       put_page(fpswa_inf_page);
+                       put_page(efi_runtime_page);
+                       return EFI_INVALID_PARAMETER;
+               }
 
 #define EFI_HYPERCALL_PATCH_TO_VIRT(tgt,call) \
        do { \
@@ -1365,6 +1390,10 @@ efi_emulate_set_virtual_address_map(
                *vfn++ = FW_HYPERCALL_FPSWA_PATCH_INDEX * 16UL + md->virt_addr;
                *vfn   = 0;
                fpswa_inf->fpswa = (void *) (FW_HYPERCALL_FPSWA_ENTRY_INDEX * 
16UL + md->virt_addr);
+
+               put_page(fw_table_page);
+               put_page(fpswa_inf_page);
+               put_page(efi_runtime_page);
                break;
        }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] IA64: fix efi_emulate_set_virtual_address_map(), Xen patchbot-unstable <=