summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin V. Arkhipov <voxus@gentoo.org>2004-11-15 17:00:36 +0000
committerKonstantin V. Arkhipov <voxus@gentoo.org>2004-11-15 17:00:36 +0000
commit58e987ad7d4e8b26b47aba7dc24d6b097aaf7fff (patch)
tree7306564627fbf818f0e916a194795c099e1141e1 /sys-kernel/openmosix-sources/files
parentMarked ~ppc64; bug #71282 (Manifest recommit) (diff)
downloadgentoo-2-58e987ad7d4e8b26b47aba7dc24d6b097aaf7fff.tar.gz
gentoo-2-58e987ad7d4e8b26b47aba7dc24d6b097aaf7fff.tar.bz2
gentoo-2-58e987ad7d4e8b26b47aba7dc24d6b097aaf7fff.zip
uuups, missing patch
Diffstat (limited to 'sys-kernel/openmosix-sources/files')
-rw-r--r--sys-kernel/openmosix-sources/files/openmosix-sources-binfmt_elf.patch72
1 files changed, 72 insertions, 0 deletions
diff --git a/sys-kernel/openmosix-sources/files/openmosix-sources-binfmt_elf.patch b/sys-kernel/openmosix-sources/files/openmosix-sources-binfmt_elf.patch
new file mode 100644
index 000000000000..534e4c064a52
--- /dev/null
+++ b/sys-kernel/openmosix-sources/files/openmosix-sources-binfmt_elf.patch
@@ -0,0 +1,72 @@
+--- linux-2.4.27/fs/binfmt_elf.c 2004-11-10 12:25:16 -08:00
++++ linux-2.4.27-plasmaroo/fs/binfmt_elf.c 2004-11-10 12:25:16 -08:00
+@@ -335,9 +335,12 @@
+ goto out;
+
+ retval = kernel_read(interpreter,interp_elf_ex->e_phoff,(char *)elf_phdata,size);
+- error = retval;
+- if (retval < 0)
++ error = -EIO;
++ if (retval != size) {
++ if (retval < 0)
++ error = retval;
+ goto out_close;
++ }
+
+ eppnt = elf_phdata;
+ for (i=0; i<interp_elf_ex->e_phnum; i++, eppnt++) {
+@@ -532,8 +535,11 @@
+ goto out;
+
+ retval = kernel_read(bprm->file, elf_ex.e_phoff, (char *) elf_phdata, size);
+- if (retval < 0)
++ if (retval != size) {
++ if (retval >= 0)
++ retval = -EIO;
+ goto out_free_ph;
++ }
+
+ files = current->files; /* Refcounted so ok */
+ retval = unshare_files();
+@@ -580,8 +586,14 @@
+ retval = kernel_read(bprm->file, elf_ppnt->p_offset,
+ elf_interpreter,
+ elf_ppnt->p_filesz);
+- if (retval < 0)
++ if (retval != elf_ppnt->p_filesz) {
++ if (retval >= 0)
++ retval = -EIO;
+ goto out_free_interp;
++ }
++ /* make sure path is NULL terminated */
++ elf_interpreter[elf_ppnt->p_filesz - 1] = '\0';
++
+ /* If the program interpreter is one of these two,
+ * then assume an iBCS2 image. Otherwise assume
+ * a native linux image.
+@@ -616,8 +628,11 @@
+ if (IS_ERR(interpreter))
+ goto out_free_interp;
+ retval = kernel_read(interpreter, 0, bprm->buf, BINPRM_BUF_SIZE);
+- if (retval < 0)
++ if (retval != BINPRM_BUF_SIZE) {
++ if (retval >= 0)
++ retval = -EIO;
+ goto out_free_dentry;
++ }
+
+ /* Get the exec headers */
+ loc->interp_ex = *((struct exec *) bprm->buf);
+@@ -776,8 +791,10 @@
+ }
+
+ error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt, elf_prot, elf_flags);
+- if (BAD_ADDR(error))
+- continue;
++ if (BAD_ADDR(error)) {
++ send_sig(SIGKILL, current, 0);
++ goto out_free_dentry;
++ }
+
+ if (!load_addr_set) {
+ load_addr_set = 1;