summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorDavid Greenman <dg@FreeBSD.org>1997-04-18 02:37:08 +0000
committerDavid Greenman <dg@FreeBSD.org>1997-04-18 02:37:08 +0000
commitccba9c3f37cf55bb7c0740cf9901c17afd277a77 (patch)
treeaf49d80af2ef9a80811ad6ad7b4871ac8e764387 /sys/kern
parentcaf9e52f18a975dd920f53f3072088c37ba4d434 (diff)
Notes
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_exec.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index a47ec082328e..1b232475c87d 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: kern_exec.c,v 1.47.2.5 1997/04/04 04:18:20 davidg Exp $
+ * $Id: kern_exec.c,v 1.47.2.6 1997/04/04 07:30:44 davidg Exp $
*/
#include <sys/param.h>
@@ -57,6 +57,7 @@
#include <vm/vm_map.h>
#include <vm/vm_kern.h>
#include <vm/vm_extern.h>
+#include <vm/vm_object.h>
#include <machine/reg.h>
@@ -150,10 +151,6 @@ interpret:
}
imgp->vp = ndp->ni_vp;
- if (imgp->vp == NULL) {
- error = ENOEXEC;
- goto exec_fail_dealloc;
- }
/*
* Check file permissions (also 'opens' file)
@@ -168,7 +165,10 @@ interpret:
* Get the image header, which we define here as meaning the first
* page of the executable.
*/
- if (imgp->vp->v_mount && imgp->vp->v_mount->mnt_stat.f_iosize >= PAGE_SIZE) {
+ if (imgp->vp->v_object && imgp->vp->v_mount &&
+ imgp->vp->v_mount->mnt_stat.f_iosize >= PAGE_SIZE &&
+ imgp->vp->v_object->un_pager.vnp.vnp_size >=
+ imgp->vp->v_mount->mnt_stat.f_iosize) {
/*
* Get a buffer with (at least) the first page.
*/
@@ -176,6 +176,8 @@ interpret:
p->p_ucred, &bp);
imgp->image_header = bp->b_data;
} else {
+ int resid;
+
/*
* The filesystem block size is too small, so do this the hard
* way. Malloc some space and read PAGE_SIZE worth of the image
@@ -183,7 +185,12 @@ interpret:
*/
imgp->image_header = malloc(PAGE_SIZE, M_TEMP, M_WAITOK);
error = vn_rdwr(UIO_READ, imgp->vp, (void *)imgp->image_header, PAGE_SIZE, 0,
- UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, NULL, p);
+ UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, p);
+ /*
+ * Clear out any remaining junk.
+ */
+ if (!error && resid)
+ bzero((char *)imgp->image_header + PAGE_SIZE - resid, resid);
}
VOP_UNLOCK(imgp->vp);
if (error)