Message type for PM_EXEC_NEW
Change-Id: Idff5dc394d8daf4cb0c40d65cfdf2d54c2f9acaa
This commit is contained in:
parent
a297e52a32
commit
aeedd5c718
|
@ -122,11 +122,6 @@
|
||||||
/* Field names for the reboot(2) call. */
|
/* Field names for the reboot(2) call. */
|
||||||
#define PM_REBOOT_HOW m1_i1 /* int */
|
#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. */
|
/* Field names for the PM_EXEC_RESTART call. */
|
||||||
#define PM_EXEC_RESTART_ENDPT m1_i1 /* endpoint_t */
|
#define PM_EXEC_RESTART_ENDPT m1_i1 /* endpoint_t */
|
||||||
#define PM_EXEC_RESTART_RESULT m1_i2 /* int */
|
#define PM_EXEC_RESTART_RESULT m1_i2 /* int */
|
||||||
|
|
|
@ -451,6 +451,21 @@ typedef struct {
|
||||||
} mess_lc_vfs_umount;
|
} mess_lc_vfs_umount;
|
||||||
_ASSERT_MSG_SIZE(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 {
|
typedef struct {
|
||||||
endpoint_t endpt;
|
endpoint_t endpt;
|
||||||
|
|
||||||
|
@ -989,6 +1004,8 @@ typedef struct {
|
||||||
mess_lc_vfs_umask m_lc_vfs_umask;
|
mess_lc_vfs_umask m_lc_vfs_umask;
|
||||||
mess_lc_vfs_umount m_lc_vfs_umount;
|
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_getepinfo m_lsys_pm_getepinfo;
|
||||||
mess_lsys_pm_getprocnr m_lsys_pm_getprocnr;
|
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_copyfd m_lsys_vfs_copyfd;
|
||||||
mess_lsys_vfs_mapdriver m_lsys_vfs_mapdriver;
|
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_ptrace m_pm_lc_ptrace;
|
||||||
mess_pm_lc_time m_pm_lc_time;
|
mess_pm_lc_time m_pm_lc_time;
|
||||||
mess_pm_lc_waitpid m_pm_lc_waitpid;
|
mess_pm_lc_waitpid m_pm_lc_waitpid;
|
||||||
|
|
|
@ -82,11 +82,11 @@ int libexec_pm_newexec(endpoint_t proc_e, struct exec_info *e)
|
||||||
|
|
||||||
memset(&m, 0, sizeof(m));
|
memset(&m, 0, sizeof(m));
|
||||||
m.m_type = PM_EXEC_NEW;
|
m.m_type = PM_EXEC_NEW;
|
||||||
m.PM_EXEC_NEW_ENDPT = proc_e;
|
m.m_lexec_pm_exec_new.endpt = proc_e;
|
||||||
m.PM_EXEC_NEW_PTR = (char *)e;
|
m.m_lexec_pm_exec_new.ptr = (vir_bytes)e;
|
||||||
if ((r = ipc_sendrec(PM_PROC_NR, &m)) != OK) return(r);
|
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);
|
return(m.m_type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ int do_exec()
|
||||||
int do_newexec(void)
|
int do_newexec(void)
|
||||||
{
|
{
|
||||||
int proc_e, proc_n, allow_setuid;
|
int proc_e, proc_n, allow_setuid;
|
||||||
char *ptr;
|
vir_bytes ptr;
|
||||||
struct mproc *rmp;
|
struct mproc *rmp;
|
||||||
struct exec_info args;
|
struct exec_info args;
|
||||||
int r;
|
int r;
|
||||||
|
@ -69,14 +69,13 @@ int do_newexec(void)
|
||||||
if (who_e != VFS_PROC_NR && who_e != RS_PROC_NR)
|
if (who_e != VFS_PROC_NR && who_e != RS_PROC_NR)
|
||||||
return EPERM;
|
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) {
|
if (pm_isokendpt(proc_e, &proc_n) != OK) {
|
||||||
panic("do_newexec: got bad endpoint: %d", proc_e);
|
panic("do_newexec: got bad endpoint: %d", proc_e);
|
||||||
}
|
}
|
||||||
rmp= &mproc[proc_n];
|
rmp= &mproc[proc_n];
|
||||||
ptr= m_in.PM_EXEC_NEW_PTR;
|
ptr= m_in.m_lexec_pm_exec_new.ptr;
|
||||||
r= sys_datacopy(who_e, (vir_bytes)ptr,
|
r= sys_datacopy(who_e, ptr, SELF, (vir_bytes)&args, sizeof(args));
|
||||||
SELF, (vir_bytes)&args, sizeof(args));
|
|
||||||
if (r != OK)
|
if (r != OK)
|
||||||
panic("do_newexec: sys_datacopy failed: %d", r);
|
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. */
|
/* Kill process if something goes wrong after this point. */
|
||||||
rmp->mp_flags |= PARTIAL_EXEC;
|
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;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue