[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Move Linux 2.4 to writable pagetables. It doesn't boot, but that bug
ChangeSet 1.1375, 2005/03/25 20:03:52+00:00, kaf24@xxxxxxxxxxxxxxxxxxxx Move Linux 2.4 to writable pagetables. It doesn't boot, but that bug is not caused by this changeset (I see exactly the same behaviour with these changes backed out). Will need some investigation: first on 2.0-testing to see if any fixes are needed there... Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> b/linux-2.4.29-xen-sparse/arch/xen/kernel/head.S | 5 b/linux-2.4.29-xen-sparse/arch/xen/kernel/ldt.c | 1 b/linux-2.4.29-xen-sparse/arch/xen/kernel/traps.c | 1 b/linux-2.4.29-xen-sparse/arch/xen/mm/fault.c | 1 b/linux-2.4.29-xen-sparse/arch/xen/mm/init.c | 13 b/linux-2.4.29-xen-sparse/include/asm-xen/page.h | 17 b/linux-2.4.29-xen-sparse/include/asm-xen/pgalloc.h | 19 b/linux-2.4.29-xen-sparse/include/asm-xen/pgtable-2level.h | 34 b/linux-2.4.29-xen-sparse/include/asm-xen/pgtable.h | 45 b/linux-2.4.29-xen-sparse/mm/highmem.c | 1 b/linux-2.4.29-xen-sparse/mm/memory.c | 28 b/linux-2.4.29-xen-sparse/mm/mremap.c | 2 b/linux-2.6.11-xen-sparse/arch/xen/Kconfig | 4 b/linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig | 1 b/linux-2.6.11-xen-sparse/arch/xen/configs/xenU_defconfig | 1 b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/traps.c | 2 b/linux-2.6.11-xen-sparse/arch/xen/i386/mm/fault.c | 1 b/linux-2.6.11-xen-sparse/arch/xen/i386/mm/hypervisor.c | 9 b/linux-2.6.11-xen-sparse/arch/xen/i386/mm/pgtable.c | 2 b/linux-2.6.11-xen-sparse/arch/xen/kernel/reboot.c | 2 b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/page.h | 2 b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/pgtable.h | 2 b/linux-2.6.11-xen-sparse/include/asm-xen/hypervisor.h | 2 linux-2.4.29-xen-sparse/fs/exec.c | 1179 ---------- linux-2.4.29-xen-sparse/mm/swapfile.c | 1267 ----------- linux-2.4.29-xen-sparse/mm/vmalloc.c | 385 --- 26 files changed, 73 insertions(+), 2953 deletions(-) diff -Nru a/linux-2.4.29-xen-sparse/arch/xen/kernel/head.S b/linux-2.4.29-xen-sparse/arch/xen/kernel/head.S --- a/linux-2.4.29-xen-sparse/arch/xen/kernel/head.S 2005-03-25 18:03:38 -05:00 +++ b/linux-2.4.29-xen-sparse/arch/xen/kernel/head.S 2005-03-25 18:03:38 -05:00 @@ -1,6 +1,9 @@ .section __xen_guest - .asciz "GUEST_OS=linux,GUEST_VER=2.4,XEN_VER=3.0,VIRT_BASE=0xC0000000" + .ascii "GUEST_OS=linux,GUEST_VER=2.4,XEN_VER=3.0,VIRT_BASE=0xC0000000" + .ascii ",LOADER=generic" + .ascii ",PT_MODE_WRITABLE" + .byte 0 .text #include <linux/config.h> diff -Nru a/linux-2.4.29-xen-sparse/arch/xen/kernel/ldt.c b/linux-2.4.29-xen-sparse/arch/xen/kernel/ldt.c --- a/linux-2.4.29-xen-sparse/arch/xen/kernel/ldt.c 2005-03-25 18:03:38 -05:00 +++ b/linux-2.4.29-xen-sparse/arch/xen/kernel/ldt.c 2005-03-25 18:03:38 -05:00 @@ -84,6 +84,7 @@ } memcpy(new->ldt, old->ldt, old->size*LDT_ENTRY_SIZE); make_pages_readonly(new->ldt, (new->size*LDT_ENTRY_SIZE)/PAGE_SIZE); + flush_page_update_queue(); return 0; } diff -Nru a/linux-2.4.29-xen-sparse/arch/xen/kernel/traps.c b/linux-2.4.29-xen-sparse/arch/xen/kernel/traps.c --- a/linux-2.4.29-xen-sparse/arch/xen/kernel/traps.c 2005-03-25 18:03:38 -05:00 +++ b/linux-2.4.29-xen-sparse/arch/xen/kernel/traps.c 2005-03-25 18:03:38 -05:00 @@ -623,6 +623,7 @@ set_call_gate(&default_ldt[0],lcall7); set_call_gate(&default_ldt[4],lcall27); __make_page_readonly(&default_ldt[0]); + flush_page_update_queue(); cpu_init(); } diff -Nru a/linux-2.4.29-xen-sparse/arch/xen/mm/fault.c b/linux-2.4.29-xen-sparse/arch/xen/mm/fault.c --- a/linux-2.4.29-xen-sparse/arch/xen/mm/fault.c 2005-03-25 18:03:38 -05:00 +++ b/linux-2.4.29-xen-sparse/arch/xen/mm/fault.c 2005-03-25 18:03:38 -05:00 @@ -296,7 +296,6 @@ if (!pmd_present(*pmd_k)) goto no_context; set_pmd(pmd, *pmd_k); - XEN_flush_page_update_queue(); /* flush PMD update */ pte_k = pte_offset(pmd_k, address); if (!pte_present(*pte_k)) diff -Nru a/linux-2.4.29-xen-sparse/arch/xen/mm/init.c b/linux-2.4.29-xen-sparse/arch/xen/mm/init.c --- a/linux-2.4.29-xen-sparse/arch/xen/mm/init.c 2005-03-25 18:03:38 -05:00 +++ b/linux-2.4.29-xen-sparse/arch/xen/mm/init.c 2005-03-25 18:03:38 -05:00 @@ -142,7 +142,7 @@ } pte = pte_offset(pmd, vaddr); - queue_l1_entry_update(pte, phys | pgprot_val(prot)); + set_pte(pte, (pte_t) { phys | pgprot_val(prot) }); /* * It's enough to flush this one mapping. @@ -201,17 +201,13 @@ kpgd = pgd_offset_k((unsigned long)pte); kpmd = pmd_offset(kpgd, (unsigned long)pte); kpte = pte_offset(kpmd, (unsigned long)pte); - queue_l1_entry_update(kpte, - (*(unsigned long *)kpte)&~_PAGE_RW); - + set_pte(kpte, pte_wrprotect(*kpte)); set_pmd(pmd, __pmd(_KERNPG_TABLE + __pa(pte))); } vaddr += PMD_SIZE; } j = 0; } - - XEN_flush_page_update_queue(); } @@ -257,10 +253,8 @@ kpgd = pgd_offset_k((unsigned long)pte_base); kpmd = pmd_offset(kpgd, (unsigned long)pte_base); kpte = pte_offset(kpmd, (unsigned long)pte_base); - queue_l1_entry_update(kpte, - (*(unsigned long *)kpte)&~_PAGE_RW); + set_pte(kpte, pte_wrprotect(*kpte)); set_pmd(pmd, __pmd(_KERNPG_TABLE + __pa(pte_base))); - XEN_flush_page_update_queue(); } } @@ -311,6 +305,7 @@ pagetable_init(); zone_sizes_init(); + /* Switch to the real shared_info page, and clear the dummy page. */ set_fixmap(FIX_SHARED_INFO, xen_start_info.shared_info); HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO); diff -Nru a/linux-2.4.29-xen-sparse/fs/exec.c b/linux-2.4.29-xen-sparse/fs/exec.c --- a/linux-2.4.29-xen-sparse/fs/exec.c 2005-03-25 18:03:38 -05:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,1179 +0,0 @@ -/* - * linux/fs/exec.c - * - * Copyright (C) 1991, 1992 Linus Torvalds - */ - -/* - * #!-checking implemented by tytso. - */ -/* - * Demand-loading implemented 01.12.91 - no need to read anything but - * the header into memory. The inode of the executable is put into - * "current->executable", and page faults do the actual loading. Clean. - * - * Once more I can proudly say that linux stood up to being changed: it - * was less than 2 hours work to get demand-loading completely implemented. - * - * Demand loading changed July 1993 by Eric Youngdale. Use mmap instead, - * current->executable is only used by the procfs. This allows a dispatch - * table to check for several different types of binary formats. We keep - * trying until we recognize the file or we run out of supported binary - * formats. - */ - -#include <linux/config.h> -#include <linux/slab.h> -#include <linux/file.h> -#include <linux/mman.h> -#include <linux/a.out.h> -#include <linux/stat.h> -#include <linux/fcntl.h> -#include <linux/smp_lock.h> -#include <linux/init.h> -#include <linux/pagemap.h> -#include <linux/highmem.h> -#include <linux/spinlock.h> -#include <linux/personality.h> -#include <linux/swap.h> -#include <linux/utsname.h> -#define __NO_VERSION__ -#include <linux/module.h> - -#include <asm/uaccess.h> -#include <asm/pgalloc.h> -#include <asm/mmu_context.h> - -#ifdef CONFIG_KMOD -#include <linux/kmod.h> -#endif - -int core_uses_pid; -char core_pattern[65] = "core"; -int core_setuid_ok = 0; -/* The maximal length of core_pattern is also specified in sysctl.c */ - -static struct linux_binfmt *formats; -static rwlock_t binfmt_lock = RW_LOCK_UNLOCKED; - -int register_binfmt(struct linux_binfmt * fmt) -{ - struct linux_binfmt ** tmp = &formats; - - if (!fmt) - return -EINVAL; - if (fmt->next) - return -EBUSY; - write_lock(&binfmt_lock); - while (*tmp) { - if (fmt == *tmp) { - write_unlock(&binfmt_lock); - return -EBUSY; - } - tmp = &(*tmp)->next; - } - fmt->next = formats; - formats = fmt; - write_unlock(&binfmt_lock); - return 0; -} - -int unregister_binfmt(struct linux_binfmt * fmt) -{ - struct linux_binfmt ** tmp = &formats; - - write_lock(&binfmt_lock); - while (*tmp) { - if (fmt == *tmp) { - *tmp = fmt->next; - write_unlock(&binfmt_lock); - return 0; - } - tmp = &(*tmp)->next; - } - write_unlock(&binfmt_lock); - return -EINVAL; -} - -static inline void put_binfmt(struct linux_binfmt * fmt) -{ - if (fmt->module) - __MOD_DEC_USE_COUNT(fmt->module); -} - -/* - * Note that a shared library must be both readable and executable due to - * security reasons. - * - * Also note that we take the address to load from from the file itself. - */ -asmlinkage long sys_uselib(const char * library) -{ - struct file * file; - struct nameidata nd; - int error; - - error = user_path_walk(library, &nd); - if (error) - goto out; - - error = -EINVAL; - if (!S_ISREG(nd.dentry->d_inode->i_mode)) - goto exit; - - error = permission(nd.dentry->d_inode, MAY_READ | MAY_EXEC); - if (error) - goto exit; - - file = dentry_open(nd.dentry, nd.mnt, O_RDONLY); - error = PTR_ERR(file); - if (IS_ERR(file)) - goto out; - - error = -ENOEXEC; - if(file->f_op && file->f_op->read) { - struct linux_binfmt * fmt; - - read_lock(&binfmt_lock); - for (fmt = formats ; fmt ; fmt = fmt->next) { - if (!fmt->load_shlib) - continue; - if (!try_inc_mod_count(fmt->module)) - continue; - read_unlock(&binfmt_lock); - error = fmt->load_shlib(file); - read_lock(&binfmt_lock); - put_binfmt(fmt); - if (error != -ENOEXEC) - break; ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |