/* Initialize process table, including timers. */
for (rmp=&mproc[0]; rmp<&mproc[NR_PROCS]; rmp++) {
init_timer(&rmp->mp_timer);
+ rmp->mp_magic = MP_MAGIC;
}
/* Build the set of signals which cause core dumps, and the set of signals
#include <timers.h>
#include <signal.h>
+#include <sys/cdefs.h>
+
/* Needs to be included here, for 'ps' etc */
#include "const.h"
sigset_t mp_ksigpending; /* bitmap for pending signals from the kernel */
sigset_t mp_sigtrace; /* signals to hand to tracer first */
struct sigaction mp_sigact[_NSIG]; /* as in sigaction(2) */
+#ifdef __ACK__
+ char mp_padding[60]; /* align structure with new libc */
+#endif
vir_bytes mp_sigreturn; /* address of C library __sigreturn function */
struct timer mp_timer; /* watchdog timer for alarm(2), setitimer(2) */
clock_t mp_interval[NR_ITIMERS]; /* setitimer(2) repetition intervals */
endpoint_t mp_scheduler; /* scheduler endpoint id */
char mp_name[PROC_NAME_LEN]; /* process name */
+
+ int mp_magic; /* sanity check, MP_MAGIC */
} mproc[NR_PROCS];
/* Flag values */
#define TRACE_ZOMBIE 0x10000 /* waiting for tracer to issue WAIT call */
#define DELAY_CALL 0x20000 /* waiting for call before sending signal */
-
+#define MP_MAGIC 0xC0FFEE0
get_inode_index(node) != NO_INDEX);
}
+PRIVATE int mproc_ok(struct mproc *tab, int slots)
+{
+ int i;
+
+ /* sanity check of mproc */
+
+ for(i = 0; i < slots; i++) {
+ if(tab[i].mp_magic != MP_MAGIC) {
+ printf("procfs: mproc table magic number mismatch\n");
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
/*===========================================================================*
* update_tables *
*===========================================================================*/
if ((r = getsysinfo(PM_PROC_NR, SI_PROC_TAB, mproc)) != OK) return r;
+ if(!mproc_ok(mproc, NR_PROCS)) return EINVAL;
+
if ((r = getsysinfo(VFS_PROC_NR, SI_PROC_TAB, fproc)) != OK) return r;
return OK;