From 594521214a140a66dd831b6e57dc3f5254c80cc0 Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Tue, 13 May 2014 13:35:40 +0200 Subject: [PATCH] Message type for PM_SRV_FORK Change-Id: I0e112da380805d40901a4041fd82da6e842e1f9b --- include/minix/callnr.h | 4 ---- include/minix/ipc.h | 9 +++++++++ lib/libsys/srv_fork.c | 4 ++-- servers/pm/forkexit.c | 12 ++++++------ 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/include/minix/callnr.h b/include/minix/callnr.h index 060a3a65d..e70fa1743 100644 --- a/include/minix/callnr.h +++ b/include/minix/callnr.h @@ -85,10 +85,6 @@ #define PM_SIG_SET m2_sigset /* sigset_t */ #define PM_SIG_CTX m2_p1 /* struct sigcontext * */ -/* Field names for the srv_fork(2) call. */ -#define PM_SRV_FORK_UID m1_i1 /* uid_t */ -#define PM_SRV_FORK_GID m1_i2 /* gid_t */ - /* Field names for the getuid(2) call. */ #define PM_GETUID_EUID m1_i1 /* uid_t */ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index f0331b14d..e1ab66443 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -495,6 +495,14 @@ typedef struct { } mess_pm_lsys_getprocnr; _ASSERT_MSG_SIZE(mess_pm_lsys_getprocnr); +typedef struct { + uid_t uid; + gid_t gid; + + uint8_t padding[48]; +} mess_lsys_pm_srv_fork; +_ASSERT_MSG_SIZE(mess_lsys_pm_srv_fork); + typedef struct { endpoint_t endpt; cp_grant_id_t grant; @@ -1018,6 +1026,7 @@ typedef struct { mess_lsys_pm_getepinfo m_lsys_pm_getepinfo; mess_lsys_pm_getprocnr m_lsys_pm_getprocnr; + mess_lsys_pm_srv_fork m_lsys_pm_srv_fork; mess_lsys_vfs_checkperms m_lsys_vfs_checkperms; mess_lsys_vfs_copyfd m_lsys_vfs_copyfd; diff --git a/lib/libsys/srv_fork.c b/lib/libsys/srv_fork.c index 2ba69378b..d94ae532a 100644 --- a/lib/libsys/srv_fork.c +++ b/lib/libsys/srv_fork.c @@ -8,7 +8,7 @@ srv_fork(uid_t reuid, gid_t regid) message m; memset(&m, 0, sizeof(m)); - m.PM_SRV_FORK_UID = (int) reuid; - m.PM_SRV_FORK_GID = (int) regid; + m.m_lsys_pm_srv_fork.uid = reuid; + m.m_lsys_pm_srv_fork.gid = regid; return _taskcall(PM_PROC_NR, PM_SRV_FORK, &m); } diff --git a/servers/pm/forkexit.c b/servers/pm/forkexit.c index 85ffb6f36..9e714fd6a 100644 --- a/servers/pm/forkexit.c +++ b/servers/pm/forkexit.c @@ -194,10 +194,10 @@ int do_srv_fork() rmc->mp_exitstatus = 0; rmc->mp_sigstatus = 0; rmc->mp_endpoint = child_ep; /* passed back by VM */ - rmc->mp_realuid = (uid_t) m_in.PM_SRV_FORK_UID; - rmc->mp_effuid = (uid_t) m_in.PM_SRV_FORK_UID; - rmc->mp_realgid = (uid_t) m_in.PM_SRV_FORK_GID; - rmc->mp_effgid = (uid_t) m_in.PM_SRV_FORK_GID; + rmc->mp_realuid = m_in.m_lsys_pm_srv_fork.uid; + rmc->mp_effuid = m_in.m_lsys_pm_srv_fork.uid; + rmc->mp_realgid = m_in.m_lsys_pm_srv_fork.gid; + rmc->mp_effgid = m_in.m_lsys_pm_srv_fork.gid; for (i = 0; i < NR_ITIMERS; i++) rmc->mp_interval[i] = 0; /* reset timer intervals */ @@ -210,8 +210,8 @@ int do_srv_fork() m.VFS_PM_ENDPT = rmc->mp_endpoint; m.VFS_PM_PENDPT = rmp->mp_endpoint; m.VFS_PM_CPID = rmc->mp_pid; - m.VFS_PM_REUID = m_in.PM_SRV_FORK_UID; - m.VFS_PM_REGID = m_in.PM_SRV_FORK_GID; + m.VFS_PM_REUID = m_in.m_lsys_pm_srv_fork.uid; + m.VFS_PM_REGID = m_in.m_lsys_pm_srv_fork.gid; tell_vfs(rmc, &m); -- 2.44.0