- some exec debugging prints when errors happen
- lookup mounted_on check to avoid NULL dereference - some errors in exec() shouldn't be fatal
This commit is contained in:
parent
e402927576
commit
f5459e38db
4 changed files with 45 additions and 13 deletions
|
@ -104,8 +104,6 @@ printf("return at %s, %d\n", __FILE__, __LINE__);
|
||||||
/* Fetch the stack from the user before destroying the old core image. */
|
/* Fetch the stack from the user before destroying the old core image. */
|
||||||
if (frame_len > ARG_MAX)
|
if (frame_len > ARG_MAX)
|
||||||
{
|
{
|
||||||
printf("pm_exec: bad frame_len\n");
|
|
||||||
printf("return at %s, %d\n", __FILE__, __LINE__);
|
|
||||||
return(ENOMEM); /* stack too big */
|
return(ENOMEM); /* stack too big */
|
||||||
}
|
}
|
||||||
r = sys_datacopy(proc_e, (vir_bytes) frame,
|
r = sys_datacopy(proc_e, (vir_bytes) frame,
|
||||||
|
@ -210,7 +208,7 @@ printf("return at %s, %d\n", __FILE__, __LINE__);
|
||||||
progname, new_uid, new_gid, &stack_top, &load_text, &allow_setuid);
|
progname, new_uid, new_gid, &stack_top, &load_text, &allow_setuid);
|
||||||
if (r != OK)
|
if (r != OK)
|
||||||
{
|
{
|
||||||
printf("pm_exec: exec_newmap failed: %d\n", r);
|
printf("VFS: pm_exec: exec_newmem failed: %d\n", r);
|
||||||
put_vnode(vp);
|
put_vnode(vp);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -223,7 +221,7 @@ printf("return at %s, %d\n", __FILE__, __LINE__);
|
||||||
proc_e, (vir_bytes) vsp, (phys_bytes)frame_len);
|
proc_e, (vir_bytes) vsp, (phys_bytes)frame_len);
|
||||||
if (r != OK) {
|
if (r != OK) {
|
||||||
printf("vfs: datacopy returns %d trying to copy to %p\n", r, vsp);
|
printf("vfs: datacopy returns %d trying to copy to %p\n", r, vsp);
|
||||||
panic(__FILE__,"pm_exec stack copy err on", proc_e);
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
off = hdrlen;
|
off = hdrlen;
|
||||||
|
@ -591,7 +589,11 @@ phys_bytes seg_bytes; /* how much is to be transferred? */
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
/* Make sure that the file is big enough */
|
/* Make sure that the file is big enough */
|
||||||
if (vp->v_size < off+seg_bytes) return EIO;
|
if (vp->v_size < off+seg_bytes) {
|
||||||
|
printf("VFS: read_seg: file isn't big enough (size %ld, need %ld)\n",
|
||||||
|
vp->v_size, off+seg_bytes);
|
||||||
|
return EIO;
|
||||||
|
}
|
||||||
|
|
||||||
if (seg != D)
|
if (seg != D)
|
||||||
{
|
{
|
||||||
|
@ -612,7 +614,10 @@ printf("read_seg for user %d, seg %d: buf 0x%x, size %d, pos %d\n",
|
||||||
r = req_readwrite(vp->v_fs_e, vp->v_inode_nr, vp->v_index,
|
r = req_readwrite(vp->v_fs_e, vp->v_inode_nr, vp->v_index,
|
||||||
cvul64(off+o), READING, FS_PROC_NR, buf, n, &new_pos,
|
cvul64(off+o), READING, FS_PROC_NR, buf, n, &new_pos,
|
||||||
&cum_io_incr);
|
&cum_io_incr);
|
||||||
if (r != OK) return r;
|
if (r != OK) {
|
||||||
|
printf("VFS: read_seg: req_readwrite failed (text)\n");
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
if (cum_io_incr != n)
|
if (cum_io_incr != n)
|
||||||
{
|
{
|
||||||
|
@ -623,8 +628,10 @@ printf("read_seg for user %d, seg %d: buf 0x%x, size %d, pos %d\n",
|
||||||
|
|
||||||
r= sys_vircopy(FS_PROC_NR, D, (vir_bytes)buf, proc_e, seg, o,
|
r= sys_vircopy(FS_PROC_NR, D, (vir_bytes)buf, proc_e, seg, o,
|
||||||
n);
|
n);
|
||||||
if (r != OK)
|
if (r != OK) {
|
||||||
|
printf("VFS: read_seg: copy failed (text)\n");
|
||||||
return r;
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
o += n;
|
o += n;
|
||||||
}
|
}
|
||||||
|
@ -639,7 +646,10 @@ printf("read_seg for user %d, seg %d: buf 0x%x, size %d, pos %d\n",
|
||||||
/* Issue request */
|
/* Issue request */
|
||||||
r = req_readwrite(vp->v_fs_e, vp->v_inode_nr, vp->v_index, cvul64(off),
|
r = req_readwrite(vp->v_fs_e, vp->v_inode_nr, vp->v_index, cvul64(off),
|
||||||
READING, proc_e, 0, seg_bytes, &new_pos, &cum_io_incr);
|
READING, proc_e, 0, seg_bytes, &new_pos, &cum_io_incr);
|
||||||
if (r != OK) return r;
|
if (r != OK) {
|
||||||
|
printf("VFS: read_seg: req_readwrite failed (data)\n");
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
if (r == OK && cum_io_incr != seg_bytes)
|
if (r == OK && cum_io_incr != seg_bytes)
|
||||||
printf("VFSread_seg segment has not been read properly by exec() \n");
|
printf("VFSread_seg segment has not been read properly by exec() \n");
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <minix/const.h>
|
#include <minix/const.h>
|
||||||
#include <minix/endpoint.h>
|
#include <minix/endpoint.h>
|
||||||
#include <minix/safecopies.h>
|
#include <minix/safecopies.h>
|
||||||
|
#include <minix/debug.h>
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "fproc.h"
|
#include "fproc.h"
|
||||||
#include "param.h"
|
#include "param.h"
|
||||||
|
@ -59,6 +60,10 @@ PUBLIC int main()
|
||||||
|
|
||||||
SANITYCHECK;
|
SANITYCHECK;
|
||||||
|
|
||||||
|
#if DO_SANITYCHECKS
|
||||||
|
FIXME("VFS: DO_SANITYCHECKS is on");
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This is the main loop that gets work, processes it, and sends replies. */
|
/* This is the main loop that gets work, processes it, and sends replies. */
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
SANITYCHECK;
|
SANITYCHECK;
|
||||||
|
@ -285,9 +290,14 @@ PRIVATE void get_work()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(who_p >= 0 && fproc[who_p].fp_endpoint != who_e) {
|
if(who_p >= 0 && fproc[who_p].fp_endpoint != who_e) {
|
||||||
printf("FS: receive endpoint inconsistent (%d, %d, %d).\n",
|
if(fproc[who_p].fp_endpoint == NONE) {
|
||||||
who_e, fproc[who_p].fp_endpoint, who_e);
|
printf("slot unknown even\n");
|
||||||
|
}
|
||||||
|
printf("FS: receive endpoint inconsistent (source %d, who_p %d, stored ep %d, who_e %d).\n",
|
||||||
|
m_in.m_source, who_p, fproc[who_p].fp_endpoint, who_e);
|
||||||
|
#if 0
|
||||||
panic(__FILE__, "FS: inconsistent endpoint ", NO_NUM);
|
panic(__FILE__, "FS: inconsistent endpoint ", NO_NUM);
|
||||||
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
call_nr = m_in.m_type;
|
call_nr = m_in.m_type;
|
||||||
|
|
|
@ -308,12 +308,20 @@ node_details_t *node;
|
||||||
dir_vp = 0;
|
dir_vp = 0;
|
||||||
/* Start node is now the mounted partition's root node */
|
/* Start node is now the mounted partition's root node */
|
||||||
for (vmp = &vmnt[0]; vmp != &vmnt[NR_MNTS]; ++vmp) {
|
for (vmp = &vmnt[0]; vmp != &vmnt[NR_MNTS]; ++vmp) {
|
||||||
if (vmp->m_mounted_on->v_inode_nr == res.inode_nr &&
|
if (vmp->m_dev != NO_DEV) {
|
||||||
|
if(vmp->m_mounted_on &&
|
||||||
|
vmp->m_mounted_on->v_inode_nr ==
|
||||||
|
res.inode_nr &&
|
||||||
vmp->m_mounted_on->v_fs_e == res.fs_e) {
|
vmp->m_mounted_on->v_fs_e == res.fs_e) {
|
||||||
dir_vp = vmp->m_root_node;
|
dir_vp = vmp->m_root_node;
|
||||||
|
if(!dir_vp) {
|
||||||
|
panic(__FILE__,
|
||||||
|
"vfs: root_node NULL", NO_NUM);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!dir_vp) {
|
if (!dir_vp) {
|
||||||
printf(
|
printf(
|
||||||
"vfs:lookup_rel: res.inode_nr = %d, res.fs_e = %d\n",
|
"vfs:lookup_rel: res.inode_nr = %d, res.fs_e = %d\n",
|
||||||
|
|
|
@ -126,7 +126,11 @@ mode_t *new_modep;
|
||||||
m.REQ_INODE_NR = inode_nr;
|
m.REQ_INODE_NR = inode_nr;
|
||||||
m.REQ_UID = fp->fp_effuid;
|
m.REQ_UID = fp->fp_effuid;
|
||||||
m.REQ_GID = fp->fp_effgid;
|
m.REQ_GID = fp->fp_effgid;
|
||||||
|
if (newuid == -1)
|
||||||
|
newuid = fp->fp_effuid;
|
||||||
m.REQ_NEW_UID = newuid;
|
m.REQ_NEW_UID = newuid;
|
||||||
|
if (newgid == -1)
|
||||||
|
newgid = fp->fp_effgid;
|
||||||
m.REQ_NEW_GID = newgid;
|
m.REQ_NEW_GID = newgid;
|
||||||
|
|
||||||
/* Send/rec request */
|
/* Send/rec request */
|
||||||
|
|
Loading…
Reference in a new issue