From: Lionel Sambuc Date: Tue, 13 May 2014 10:07:25 +0000 (+0200) Subject: Message type for PM_EXEC_NEW X-Git-Tag: v3.3.0~290 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/verify-sign/verify.pl?a=commitdiff_plain;h=aeedd5c718e78b5f40fc8ff04165300723982b82;p=minix.git Message type for PM_EXEC_NEW Change-Id: Idff5dc394d8daf4cb0c40d65cfdf2d54c2f9acaa --- diff --git a/include/minix/callnr.h b/include/minix/callnr.h index 9c3c66676..20c418b1f 100644 --- a/include/minix/callnr.h +++ b/include/minix/callnr.h @@ -122,11 +122,6 @@ /* Field names for the reboot(2) call. */ #define PM_REBOOT_HOW m1_i1 /* int */ -/* Field names for the PM_EXEC_NEW call. */ -#define PM_EXEC_NEW_ENDPT m1_i1 /* endpoint_t */ -#define PM_EXEC_NEW_PTR m1_p1 /* struct exec_info * */ -#define PM_EXEC_NEW_SUID m1_i2 /* int */ - /* Field names for the PM_EXEC_RESTART call. */ #define PM_EXEC_RESTART_ENDPT m1_i1 /* endpoint_t */ #define PM_EXEC_RESTART_RESULT m1_i2 /* int */ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index b307e531d..db144032d 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -451,6 +451,21 @@ typedef struct { } mess_lc_vfs_umount; _ASSERT_MSG_SIZE(mess_lc_vfs_umount); +typedef struct { + endpoint_t endpt; + vir_bytes ptr; /* struct exec_info * */ + + uint8_t padding[48]; +} mess_lexec_pm_exec_new; +_ASSERT_MSG_SIZE(mess_lexec_pm_exec_new); + +typedef struct { + int suid; + + uint8_t padding[52]; +} mess_pm_lexec_exec_new; +_ASSERT_MSG_SIZE(mess_pm_lexec_exec_new); + typedef struct { endpoint_t endpt; @@ -989,6 +1004,8 @@ typedef struct { mess_lc_vfs_umask m_lc_vfs_umask; mess_lc_vfs_umount m_lc_vfs_umount; + mess_lexec_pm_exec_new m_lexec_pm_exec_new; + mess_lsys_pm_getepinfo m_lsys_pm_getepinfo; mess_lsys_pm_getprocnr m_lsys_pm_getprocnr; @@ -996,6 +1013,8 @@ typedef struct { mess_lsys_vfs_copyfd m_lsys_vfs_copyfd; mess_lsys_vfs_mapdriver m_lsys_vfs_mapdriver; + mess_pm_lexec_exec_new m_pm_lexec_exec_new; + mess_pm_lc_ptrace m_pm_lc_ptrace; mess_pm_lc_time m_pm_lc_time; mess_pm_lc_waitpid m_pm_lc_waitpid; diff --git a/lib/libexec/exec_general.c b/lib/libexec/exec_general.c index e590bf2dd..495913b68 100644 --- a/lib/libexec/exec_general.c +++ b/lib/libexec/exec_general.c @@ -82,11 +82,11 @@ int libexec_pm_newexec(endpoint_t proc_e, struct exec_info *e) memset(&m, 0, sizeof(m)); m.m_type = PM_EXEC_NEW; - m.PM_EXEC_NEW_ENDPT = proc_e; - m.PM_EXEC_NEW_PTR = (char *)e; + m.m_lexec_pm_exec_new.endpt = proc_e; + m.m_lexec_pm_exec_new.ptr = (vir_bytes)e; if ((r = ipc_sendrec(PM_PROC_NR, &m)) != OK) return(r); - e->allow_setuid = !!m.PM_EXEC_NEW_SUID; + e->allow_setuid = !!m.m_pm_lexec_exec_new.suid; return(m.m_type); } diff --git a/servers/pm/exec.c b/servers/pm/exec.c index 1c4af3099..4d7c142b3 100644 --- a/servers/pm/exec.c +++ b/servers/pm/exec.c @@ -61,7 +61,7 @@ int do_exec() int do_newexec(void) { int proc_e, proc_n, allow_setuid; - char *ptr; + vir_bytes ptr; struct mproc *rmp; struct exec_info args; int r; @@ -69,14 +69,13 @@ int do_newexec(void) if (who_e != VFS_PROC_NR && who_e != RS_PROC_NR) return EPERM; - proc_e= m_in.PM_EXEC_NEW_ENDPT; + proc_e= m_in.m_lexec_pm_exec_new.endpt; if (pm_isokendpt(proc_e, &proc_n) != OK) { panic("do_newexec: got bad endpoint: %d", proc_e); } rmp= &mproc[proc_n]; - ptr= m_in.PM_EXEC_NEW_PTR; - r= sys_datacopy(who_e, (vir_bytes)ptr, - SELF, (vir_bytes)&args, sizeof(args)); + ptr= m_in.m_lexec_pm_exec_new.ptr; + r= sys_datacopy(who_e, ptr, SELF, (vir_bytes)&args, sizeof(args)); if (r != OK) panic("do_newexec: sys_datacopy failed: %d", r); @@ -115,7 +114,7 @@ int do_newexec(void) /* Kill process if something goes wrong after this point. */ rmp->mp_flags |= PARTIAL_EXEC; - mp->mp_reply.PM_EXEC_NEW_SUID = (allow_setuid && args.allow_setuid); + mp->mp_reply.m_pm_lexec_exec_new.suid = (allow_setuid && args.allow_setuid); return r; }