patch-2.0.31 linux/fs/binfmt_elf.c

Next file: linux/fs/buffer.c
Previous file: linux/fs/binfmt_aout.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.30/linux/fs/binfmt_elf.c linux/fs/binfmt_elf.c
@@ -549,8 +549,10 @@
 		}
 	}
 	
+	if (flush_old_exec(bprm))
+		return -ENOMEM;
+
 	/* OK, This is the point of no return */
-	flush_old_exec(bprm);
 
 	current->mm->end_data = 0;
 	current->mm->end_code = 0;
@@ -880,7 +882,7 @@
  */
 static inline int maydump(struct vm_area_struct *vma)
 {
-	if (!(vma->vm_flags & (VM_READ|VM_WRITE|VM_EXEC)))
+	if (!(vma->vm_flags & (VM_READ|VM_EXEC)))
 		return 0;
 #if 1
 	if (vma->vm_flags & (VM_WRITE|VM_GROWSUP|VM_GROWSDOWN))
@@ -1140,7 +1142,7 @@
 		set_fs(fs);
 		
 		len = current->mm->arg_end - current->mm->arg_start;
-		len = len >= ELF_PRARGSZ ? ELF_PRARGSZ : len;
+		len = (len >= ELF_PRARGSZ-1) ? ELF_PRARGSZ-1 : len;
 		memcpy_fromfs(&psinfo.pr_psargs,
 			      (const char *)current->mm->arg_start, len);
 		for(i = 0; i < len; i++)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov