- sys_privctl: don't mix message types
- sys_privctl: remove CTL_MM_PRIV (third parameter) - remove obsolete sys_svrctl.c library file
This commit is contained in:
parent
32b2758ba8
commit
979bcfc195
7 changed files with 17 additions and 27 deletions
|
@ -316,7 +316,7 @@ int devind;
|
|||
int proc;
|
||||
{
|
||||
int i, r;
|
||||
u8_t ilr;
|
||||
int ilr;
|
||||
struct io_range ior;
|
||||
struct mem_range mr;
|
||||
|
||||
|
@ -348,7 +348,7 @@ int proc;
|
|||
"pci_reserve3: for proc %d, adding I/O range [0x%x..0x%x]\n",
|
||||
proc, ior.ior_base, ior.ior_limit);
|
||||
}
|
||||
r= sys_privctl(proc, SYS_PRIV_ADD_IO, 0, &ior);
|
||||
r= sys_privctl(proc, SYS_PRIV_ADD_IO, &ior);
|
||||
if (r != OK)
|
||||
{
|
||||
printf("sys_privctl failed for proc %d: %d\n",
|
||||
|
@ -366,7 +366,7 @@ int proc;
|
|||
"pci_reserve3: for proc %d, should add memory range [0x%x..0x%x]\n",
|
||||
proc, mr.mr_base, mr.mr_limit);
|
||||
}
|
||||
r= sys_privctl(proc, SYS_PRIV_ADD_MEM, 0, &mr);
|
||||
r= sys_privctl(proc, SYS_PRIV_ADD_MEM, &mr);
|
||||
if (r != OK)
|
||||
{
|
||||
printf("sys_privctl failed for proc %d: %d\n",
|
||||
|
@ -378,7 +378,7 @@ int proc;
|
|||
if (ilr != PCI_ILR_UNKNOWN)
|
||||
{
|
||||
if(debug) printf("pci_reserve3: adding IRQ %d\n", ilr);
|
||||
r= sys_privctl(proc, SYS_PRIV_ADD_IRQ, ilr, NULL);
|
||||
r= sys_privctl(proc, SYS_PRIV_ADD_IRQ, &ilr);
|
||||
if (r != OK)
|
||||
{
|
||||
printf("sys_privctl failed for proc %d: %d\n",
|
||||
|
|
|
@ -493,7 +493,6 @@
|
|||
/* Field names for SYS_TRACE, SYS_PRIVCTL. */
|
||||
#define CTL_ENDPT m2_i1 /* process number of the caller */
|
||||
#define CTL_REQUEST m2_i2 /* server control request */
|
||||
#define CTL_MM_PRIV m2_i3 /* privilege as seen by PM */
|
||||
#define CTL_ARG_PTR m2_p1 /* pointer to argument */
|
||||
#define CTL_ADDRESS m2_l1 /* address at traced process' space */
|
||||
#define CTL_DATA m2_l2 /* data field for tracing */
|
||||
|
|
|
@ -40,7 +40,7 @@ _PROTOTYPE( int sys_newmap, (endpoint_t proc, struct mem_map *ptr));
|
|||
_PROTOTYPE( int sys_exit, (endpoint_t proc));
|
||||
_PROTOTYPE( int sys_trace, (int req, endpoint_t proc, long addr, long *data_p));
|
||||
|
||||
_PROTOTYPE( int sys_privctl, (endpoint_t proc, int req, int i, void *p));
|
||||
_PROTOTYPE( int sys_privctl, (endpoint_t proc, int req, void *p));
|
||||
_PROTOTYPE( int sys_setgrant, (cp_grant_t *grants, int ngrants));
|
||||
_PROTOTYPE( int sys_nice, (endpoint_t proc, int priority));
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
* m_type: SYS_PRIVCTL
|
||||
*
|
||||
* The parameters for this kernel call are:
|
||||
* m1_i1: PR_ENDPT (process number of caller)
|
||||
* m2_i1: CTL_ENDPT (process endpoint of target)
|
||||
* m2_i2: CTL_REQUEST (privilege control request)
|
||||
* m2_p1: CTL_ARG_PTR (pointer to request data)
|
||||
*/
|
||||
|
||||
#include "../system.h"
|
||||
|
@ -32,6 +34,7 @@ message *m_ptr; /* pointer to request message */
|
|||
struct io_range io_range;
|
||||
struct mem_range mem_range;
|
||||
struct priv priv;
|
||||
int irq;
|
||||
|
||||
/* Check whether caller is allowed to make this call. Privileged proceses
|
||||
* can only update the privileges of processes that are inhibited from
|
||||
|
@ -40,8 +43,8 @@ message *m_ptr; /* pointer to request message */
|
|||
*/
|
||||
caller_ptr = proc_addr(who_p);
|
||||
if (! (priv(caller_ptr)->s_flags & SYS_PROC)) return(EPERM);
|
||||
if(m_ptr->PR_ENDPT == SELF) proc_nr = who_p;
|
||||
else if(!isokendpt(m_ptr->PR_ENDPT, &proc_nr)) return(EINVAL);
|
||||
if(m_ptr->CTL_ENDPT == SELF) proc_nr = who_p;
|
||||
else if(!isokendpt(m_ptr->CTL_ENDPT, &proc_nr)) return(EINVAL);
|
||||
rp = proc_addr(proc_nr);
|
||||
|
||||
switch(m_ptr->CTL_REQUEST)
|
||||
|
@ -216,12 +219,14 @@ message *m_ptr; /* pointer to request message */
|
|||
if (!(priv(rp)->s_flags & SYS_PROC))
|
||||
return EPERM;
|
||||
|
||||
data_copy(who_e, (vir_bytes) m_ptr->CTL_ARG_PTR,
|
||||
SYSTEM, (vir_bytes) &irq, sizeof(irq));
|
||||
priv(rp)->s_flags |= CHECK_IRQ; /* Check IRQs */
|
||||
|
||||
i= priv(rp)->s_nr_irq;
|
||||
if (i >= NR_IRQ)
|
||||
return ENOMEM;
|
||||
priv(rp)->s_irq_tab[i]= m_ptr->CTL_MM_PRIV;
|
||||
priv(rp)->s_irq_tab[i]= irq;
|
||||
priv(rp)->s_nr_irq++;
|
||||
|
||||
return OK;
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
#include "syslib.h"
|
||||
|
||||
int sys_privctl(int proc, int request, int i, void *p)
|
||||
int sys_privctl(endpoint_t proc, int request, void *p)
|
||||
{
|
||||
message m;
|
||||
|
||||
m.CTL_ENDPT = proc;
|
||||
m.CTL_REQUEST = request;
|
||||
m.CTL_MM_PRIV = i;
|
||||
m.CTL_ARG_PTR = p;
|
||||
|
||||
return _taskcall(SYSTASK, SYS_PRIVCTL, &m);
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
#include "syslib.h"
|
||||
|
||||
int sys_svrctl(int proc, int request, int priv, vir_bytes argp)
|
||||
{
|
||||
message m;
|
||||
|
||||
m.CTL_ENDPT = proc;
|
||||
m.CTL_REQUEST = request;
|
||||
m.CTL_MM_PRIV = priv;
|
||||
m.CTL_ARG_PTR = (char *) argp;
|
||||
|
||||
return _taskcall(SYSTASK, SYS_PRIVCTL, &m);
|
||||
}
|
|
@ -855,7 +855,7 @@ endpoint_t *endpoint;
|
|||
/* Set the privilege structure for the child process to let is run.
|
||||
* This should succeed: we tested number in use above.
|
||||
*/
|
||||
if ((s = sys_privctl(child_proc_nr_e, SYS_PRIV_INIT, 0, privp)) < 0) {
|
||||
if ((s = sys_privctl(child_proc_nr_e, SYS_PRIV_INIT, privp)) < 0) {
|
||||
report("RS","sys_privctl call failed", s); /* to let child run */
|
||||
rp->r_flags |= RS_EXITING; /* expect exit */
|
||||
if(child_pid > 0) kill(child_pid, SIGKILL); /* kill driver */
|
||||
|
@ -1080,7 +1080,7 @@ struct rproc *rp;
|
|||
* run.
|
||||
*/
|
||||
proc_nr_e = getnprocnr(pid);
|
||||
r= sys_privctl(proc_nr_e, SYS_PRIV_USER, 0, NULL);
|
||||
r= sys_privctl(proc_nr_e, SYS_PRIV_USER, NULL);
|
||||
if (r < 0)
|
||||
printf("RS: run_script: sys_privctl call failed: %d\n", r);
|
||||
|
||||
|
|
Loading…
Reference in a new issue