Hi,
when the kernel loads an ELF binary, it will also load its interpreter.
The kernel checks the rights of the interpreter, that way:

        if ((error = VOP_ACCESS(vp, VREAD, p->p_ucred, p)) != 0)
                goto bad1;

It should check with VEXEC instead of VREAD. Interpreters get executed,
so they have to be executable; a read-only interpreter shouldn't be
loaded by the kernel.

Index: exec_elf.c
===================================================================
RCS file: /cvs/src/sys/kern/exec_elf.c,v
retrieving revision 1.93
diff -u -r1.93 exec_elf.c
--- exec_elf.c  4 Jul 2013 17:37:05 -0000       1.93
+++ exec_elf.c  7 Oct 2013 19:03:33 -0000
@@ -345,7 +345,7 @@
                error = EACCES;
                goto bad;
        }
-       if ((error = VOP_ACCESS(vp, VREAD, p->p_ucred, p)) != 0)
+       if ((error = VOP_ACCESS(vp, VEXEC, p->p_ucred, p)) != 0)
                goto bad1;
        if ((error = ELFNAME(read_from)(p, nd.ni_vp, 0,
                                    (caddr_t)&eh, sizeof(eh))) != 0)


Ok/Comments?

Reply via email to