ia64/xen-unstable

changeset 2106:bf212ae2e94c

bitkeeper revision 1.1159.1.1 (41137be7CbsfIV_H_aLlq3moTPnDwA)

Ensure binary patches are applied only to private VMAs.
author kaf24@scramble.cl.cam.ac.uk
date Fri Aug 06 12:39:03 2004 +0000 (2004-08-06)
parents 4c3d4467e243
children 6a95987050ca a989641f2755
files linux-2.6.7-xen-sparse/arch/xen/kernel/fixup.c
line diff
     1.1 --- a/linux-2.6.7-xen-sparse/arch/xen/kernel/fixup.c	Fri Aug 06 11:53:45 2004 +0000
     1.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/kernel/fixup.c	Fri Aug 06 12:39:03 2004 +0000
     1.3 @@ -409,6 +409,22 @@ asmlinkage void do_fixup_4gb_segment(str
     1.4      *(unsigned long *)&patch[1] = 
     1.5          (fixup_buf_user + fe->fixup_idx) - (eip + 5);
     1.6  
     1.7 +    /*
     1.8 +     * Check that the page to be patched is part of a read-only VMA. This 
     1.9 +     * means that our patch will never erroneously get flushed to disc.
    1.10 +     */
    1.11 +    if ( eip < PAGE_OFFSET ) /* don't need to check the fixmap area */
    1.12 +    {
    1.13 +        /* [SMP] Need to the mmap_sem semaphore. */
    1.14 +        struct vm_area_struct *vma = find_vma(current->mm, eip);
    1.15 +        if ( (vma == NULL) || (vma->vm_flags & VM_MAYSHARE) )
    1.16 +        {
    1.17 +            DPRINTK("Cannot patch a shareable VMA.");
    1.18 +            return;
    1.19 +        }
    1.20 +    }
    1.21 +
    1.22 +    /* [SMP] Need to pause other threads while patching. */
    1.23      pgd = pgd_offset(current->mm, eip);
    1.24      pmd = pmd_offset(pgd, eip);
    1.25      pte = pte_offset_kernel(pmd, eip);