*** kern_exec.c.orig Wed Jun 10 01:26:56 1998 --- kern_exec.c Wed Jun 10 01:27:02 1998 *************** *** 75,80 **** --- 75,84 ---- static caddr_t usrstack = (caddr_t)USRSTACK; SYSCTL_INT(_kern, KERN_USRSTACK, usrstack, 0, &usrstack, 0, ""); + static int log_root_exec = 0; + SYSCTL_INT(_kern, OID_AUTO, log_root_exec, CTLFLAG_RW, + &log_root_exec, 0, ""); + /* * execsw_set is constructed for us by the linker. Each of the items * is a pointer to a `const struct execsw', hence the double pointer here. *************** *** 105,110 **** --- 109,115 ---- struct image_params image_params, *imgp; struct vattr attr; struct buf *bp = NULL; + char *stringp; imgp = &image_params; *************** *** 330,335 **** --- 335,351 ---- */ p->p_cred->p_svuid = p->p_ucred->cr_uid; p->p_cred->p_svgid = p->p_ucred->cr_gid; + + if (log_root_exec && p->p_cred->pc_ucred->cr_uid == 0) { + log(LOG_NOTICE, "ROOT exec "); + for (i = 0, stringp = imgp->stringbase; + i < 20 && i < imgp->argc; i++) { + log(LOG_NOTICE, "%s ", stringp); + while (*stringp++); + } + log(LOG_NOTICE, "\n"); + } + /* * Store the vp for use in procfs