[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] added 2.4 batch mode



ChangeSet 1.1245, 2005/03/15 14:50:10+00:00, 
rneugeba@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

        added 2.4 batch mode
        
        Signed-off-by: michael.fetterman@xxxxxxxxxxxx



 arch/xen/i386/mm/fault.c                  |    6 
 fs/exec.c                                 | 1432 +++++++++++++++++++++++++
 include/asm-xen/asm-i386/pgtable-2level.h |    8 
 mm/highmem.c                              |  607 ++++++++++
 mm/memory.c                               |   44 
 mm/swapfile.c                             | 1711 ++++++++++++++++++++++++++++++
 6 files changed, 3807 insertions(+), 1 deletion(-)


diff -Nru a/linux-2.6.10-xen-sparse/arch/xen/i386/mm/fault.c 
b/linux-2.6.10-xen-sparse/arch/xen/i386/mm/fault.c
--- a/linux-2.6.10-xen-sparse/arch/xen/i386/mm/fault.c  2005-04-05 12:08:51 
-04:00
+++ b/linux-2.6.10-xen-sparse/arch/xen/i386/mm/fault.c  2005-04-05 12:08:51 
-04:00
@@ -231,6 +231,12 @@
        error_code |= (regs->xcs & 2) << 1;
        if (regs->eflags & X86_EFLAGS_VM)
                error_code |= 4;
+
+#ifdef CONFIG_XEN_BATCH_MODE2
+    /* ensure all updates have completed */
+    flush_page_update_queue();
+#endif
+
                
        if (notify_die(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
                                        SIGSEGV) == NOTIFY_STOP)
diff -Nru a/linux-2.6.10-xen-sparse/fs/exec.c 
b/linux-2.6.10-xen-sparse/fs/exec.c
--- /dev/null   Wed Dec 31 16:00:00 196900
+++ b/linux-2.6.10-xen-sparse/fs/exec.c 2005-04-05 12:08:51 -04:00
@@ -0,0 +1,1432 @@
+/*
+ *  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/key.h>
+#include <linux/personality.h>
+#include <linux/binfmts.h>
+#include <linux/swap.h>
+#include <linux/utsname.h>
+#include <linux/module.h>
+#include <linux/namei.h>
+#include <linux/proc_fs.h>
+#include <linux/ptrace.h>
+#include <linux/mount.h>
+#include <linux/security.h>
+#include <linux/syscalls.h>
+#include <linux/rmap.h>
+
+#include <asm/uaccess.h>
+#include <asm/mmu_context.h>
+
+#ifdef CONFIG_KMOD
+#include <linux/kmod.h>
+#endif
+
+int core_uses_pid;
+char core_pattern[65] = "core";
+/* 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;       
+}
+
+EXPORT_SYMBOL(register_binfmt);
+
+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;
+}
+
+EXPORT_SYMBOL(unregister_binfmt);
+
+static inline void put_binfmt(struct linux_binfmt * fmt)
+{
+       module_put(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 __user * library)
+{
+       struct file * file;
+       struct nameidata nd;
+       int error;
+
+       nd.intent.open.flags = FMODE_READ;
+       error = __user_walk(library, LOOKUP_FOLLOW|LOOKUP_OPEN, &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, &nd);
+       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) {
+               struct linux_binfmt * fmt;
+
+               read_lock(&binfmt_lock);
+               for (fmt = formats ; fmt ; fmt = fmt->next) {
+                       if (!fmt->load_shlib)
+                               continue;
+                       if (!try_module_get(fmt->module))
+                               continue;
+                       read_unlock(&binfmt_lock);
+                       error = fmt->load_shlib(file);
+                       read_lock(&binfmt_lock);
+                       put_binfmt(fmt);
+                       if (error != -ENOEXEC)
+                               break;
+               }
+               read_unlock(&binfmt_lock);
+       }
+       fput(file);
+out:
+       return error;
+exit:
+       path_release(&nd);
+       goto out;
+}
+
+/*
+ * count() counts the number of strings in array ARGV.
+ */
+static int count(char __user * __user * argv, int max)
+{
+       int i = 0;
+
+       if (argv != NULL) {
+               for (;;) {
+                       char __user * p;
+
+                       if (get_user(p, argv))
+                               return -EFAULT;
+                       if (!p)
+                               break;
+                       argv++;
+                       if(++i > max)
+                               return -E2BIG;
+               }
+       }
+       return i;
+}
+
+/*
+ * 'copy_strings()' copies argument/environment strings from user
+ * memory to free pages in kernel mem. These are in a format ready
+ * to be put directly into the top of new user memory.
+ */
+int copy_strings(int argc,char __user * __user * argv, struct linux_binprm 
*bprm)
+{
+       struct page *kmapped_page = NULL;
+       char *kaddr = NULL;
+       int ret;
+
+       while (argc-- > 0) {
+               char __user *str;
+               int len;
+               unsigned long pos;
+
+               if (get_user(str, argv+argc) ||
+                               !(len = strnlen_user(str, bprm->p))) {
+                       ret = -EFAULT;
+                       goto out;
+               }
+
+               if (bprm->p < len)  {
+                       ret = -E2BIG;
+                       goto out;
+               }
+
+               bprm->p -= len;
+               /* XXX: add architecture specific overflow check here. */
+               pos = bprm->p;
+
+               while (len > 0) {
+                       int i, new, err;
+                       int offset, bytes_to_copy;
+                       struct page *page;
+
+                       offset = pos % PAGE_SIZE;
+                       i = pos/PAGE_SIZE;

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.