patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / arch / ia64 / ia32 / binfmt_elf32.c
index ad67b04..fcd84c5 100644 (file)
@@ -73,15 +73,13 @@ ia64_elf32_init (struct pt_regs *regs)
         */
        vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
        if (vma) {
+               memset(vma, 0, sizeof(*vma));
                vma->vm_mm = current->mm;
                vma->vm_start = IA32_GDT_OFFSET;
                vma->vm_end = vma->vm_start + PAGE_SIZE;
                vma->vm_page_prot = PAGE_SHARED;
-               vma->vm_flags = VM_READ|VM_MAYREAD;
+               vma->vm_flags = VM_READ|VM_MAYREAD|VM_RESERVED;
                vma->vm_ops = &ia32_shared_page_vm_ops;
-               vma->vm_pgoff = 0;
-               vma->vm_file = NULL;
-               vma->vm_private_data = NULL;
                down_write(&current->mm->mmap_sem);
                {
                        insert_vm_struct(current->mm, vma);
@@ -95,15 +93,12 @@ ia64_elf32_init (struct pt_regs *regs)
         */
        vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
        if (vma) {
+               memset(vma, 0, sizeof(*vma));
                vma->vm_mm = current->mm;
                vma->vm_start = IA32_LDT_OFFSET;
                vma->vm_end = vma->vm_start + PAGE_ALIGN(IA32_LDT_ENTRIES*IA32_LDT_ENTRY_SIZE);
                vma->vm_page_prot = PAGE_SHARED;
                vma->vm_flags = VM_READ|VM_WRITE|VM_MAYREAD|VM_MAYWRITE;
-               vma->vm_ops = NULL;
-               vma->vm_pgoff = 0;
-               vma->vm_file = NULL;
-               vma->vm_private_data = NULL;
                down_write(&current->mm->mmap_sem);
                {
                        insert_vm_struct(current->mm, vma);
@@ -176,6 +171,8 @@ ia32_setup_arg_pages (struct linux_binprm *bprm, int executable_stack)
                return -ENOMEM;
        }
 
+       memset(mpnt, 0, sizeof(*mpnt));
+
        down_write(&current->mm->mmap_sem);
        {
                mpnt->vm_mm = current->mm;
@@ -189,10 +186,6 @@ ia32_setup_arg_pages (struct linux_binprm *bprm, int executable_stack)
                        mpnt->vm_flags = VM_STACK_FLAGS;
                mpnt->vm_page_prot = (mpnt->vm_flags & VM_EXEC)?
                                        PAGE_COPY_EXEC: PAGE_COPY;
-               mpnt->vm_ops = NULL;
-               mpnt->vm_pgoff = 0;
-               mpnt->vm_file = NULL;
-               mpnt->vm_private_data = 0;
                insert_vm_struct(current->mm, mpnt);
                // current->mm->total_vm = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
                vx_vmpages_sub(current->mm, current->mm->total_vm -
@@ -203,7 +196,7 @@ ia32_setup_arg_pages (struct linux_binprm *bprm, int executable_stack)
                struct page *page = bprm->page[i];
                if (page) {
                        bprm->page[i] = NULL;
-                       put_dirty_page(current, page, stack_base, mpnt->vm_page_prot);
+                       install_arg_page(mpnt, page, stack_base);
                }
                stack_base += PAGE_SIZE;
        }
@@ -230,3 +223,16 @@ elf32_map (struct file *filep, unsigned long addr, struct elf_phdr *eppnt, int p
        return ia32_do_mmap(filep, (addr & IA32_PAGE_MASK), eppnt->p_filesz + pgoff, prot, type,
                            eppnt->p_offset - pgoff);
 }
+
+#define cpu_uses_ia32el()      (local_cpu_data->family > 0x1f)
+
+static int __init check_elf32_binfmt(void)
+{
+       if (cpu_uses_ia32el()) {
+               printk("Please use IA-32 EL for executing IA-32 binaries\n");
+               return unregister_binfmt(&elf_format);
+       }
+       return 0;
+}
+
+module_init(check_elf32_binfmt)