pde cache check works

no more silly vm checkranges
This commit is contained in:
Ben Gras
2009-06-07 15:55:44 +00:00
parent 4dae6c4bbc
commit 0702c826a2
17 changed files with 98 additions and 230 deletions

View File

@@ -28,9 +28,8 @@ register message *m_ptr; /* pointer to request message */
*/
size_t length;
vir_bytes src_vir;
int proc_nr, nr_e, nr;
int proc_nr, nr_e, nr, r;
struct proc *caller;
phys_bytes ph;
int wipe_rnd_bin = -1;
caller = proc_addr(who_p);
@@ -67,19 +66,6 @@ register message *m_ptr; /* pointer to request message */
src_vir = (vir_bytes) irq_hooks;
break;
}
case GET_SCHEDINFO: {
/* This is slightly complicated because we need two data structures
* at once, otherwise the scheduling information may be incorrect.
* Copy the queue heads and fall through to copy the process table.
*/
if((ph=umap_local(caller, D, (vir_bytes) m_ptr->I_VAL_PTR2,length)) == 0)
return EFAULT;
length = sizeof(struct proc *) * NR_SCHED_QUEUES;
CHECKRANGE_OR_SUSPEND(proc_addr(who_p), ph, length, 1);
data_copy(SYSTEM, (vir_bytes) rdy_head,
who_e, (vir_bytes) m_ptr->I_VAL_PTR2, length);
/* fall through to GET_PROCTAB */
}
case GET_PROCTAB: {
length = sizeof(struct proc) * (NR_PROCS + NR_TASKS);
src_vir = (vir_bytes) proc;
@@ -174,15 +160,16 @@ register message *m_ptr; /* pointer to request message */
/* Try to make the actual copy for the requested data. */
if (m_ptr->I_VAL_LEN > 0 && length > m_ptr->I_VAL_LEN) return (E2BIG);
if((ph=umap_local(caller, D, (vir_bytes) m_ptr->I_VAL_PTR,length)) == 0)
return EFAULT;
CHECKRANGE_OR_SUSPEND(caller, ph, length, 1);
if(data_copy(SYSTEM, src_vir, who_e, (vir_bytes) m_ptr->I_VAL_PTR, length) == OK) {
r = data_copy_vmcheck(SYSTEM, src_vir, who_e,
(vir_bytes) m_ptr->I_VAL_PTR, length);
if(r != OK) return r;
if(wipe_rnd_bin >= 0 && wipe_rnd_bin < RANDOM_SOURCES) {
krandom.bin[wipe_rnd_bin].r_size = 0;
krandom.bin[wipe_rnd_bin].r_next = 0;
}
}
return(OK);
}

View File

@@ -29,18 +29,13 @@ message *m_ptr; /* pointer to request message */
struct sigcontext sc, *scp;
struct sigframe fr, *frp;
int proc, r;
phys_bytes ph;
if (!isokendpt(m_ptr->SIG_ENDPT, &proc)) return(EINVAL);
if (iskerneln(proc)) return(EPERM);
rp = proc_addr(proc);
ph = umap_local(proc_addr(who_p), D, (vir_bytes) m_ptr->SIG_CTXT_PTR, sizeof(struct sigmsg));
if(!ph) return EFAULT;
CHECKRANGE_OR_SUSPEND(proc_addr(who_p), ph, sizeof(struct sigmsg), 1);
/* Get the sigmsg structure into our address space. */
if((r=data_copy(who_e, (vir_bytes) m_ptr->SIG_CTXT_PTR,
if((r=data_copy_vmcheck(who_e, (vir_bytes) m_ptr->SIG_CTXT_PTR,
SYSTEM, (vir_bytes) &smsg, (phys_bytes) sizeof(struct sigmsg))) != OK)
return r;
@@ -59,12 +54,9 @@ message *m_ptr; /* pointer to request message */
sc.sc_flags = 0; /* unused at this time */
sc.sc_mask = smsg.sm_mask;
ph = umap_local(rp, D, (vir_bytes) scp, sizeof(struct sigcontext));
if(!ph) return EFAULT;
CHECKRANGE_OR_SUSPEND(rp, ph, sizeof(struct sigcontext), 1);
/* Copy the sigcontext structure to the user's stack. */
if((r=data_copy(SYSTEM, (vir_bytes) &sc, m_ptr->SIG_ENDPT, (vir_bytes) scp,
(vir_bytes) sizeof(struct sigcontext))) != OK)
if((r=data_copy_vmcheck(SYSTEM, (vir_bytes) &sc, m_ptr->SIG_ENDPT,
(vir_bytes) scp, (vir_bytes) sizeof(struct sigcontext))) != OK)
return r;
/* Initialize the sigframe structure. */
@@ -78,11 +70,9 @@ message *m_ptr; /* pointer to request message */
fr.sf_signo = smsg.sm_signo;
fr.sf_retadr = (void (*)()) smsg.sm_sigreturn;
ph = umap_local(rp, D, (vir_bytes) frp, sizeof(struct sigframe));
if(!ph) return EFAULT;
CHECKRANGE_OR_SUSPEND(rp, ph, sizeof(struct sigframe), 1);
/* Copy the sigframe structure to the user's stack. */
if((r=data_copy(SYSTEM, (vir_bytes) &fr, m_ptr->SIG_ENDPT, (vir_bytes) frp,
if((r=data_copy_vmcheck(SYSTEM, (vir_bytes) &fr,
m_ptr->SIG_ENDPT, (vir_bytes) frp,
(vir_bytes) sizeof(struct sigframe))) != OK)
return r;

View File

@@ -16,7 +16,6 @@
PUBLIC int do_sysctl(m_ptr)
register message *m_ptr; /* pointer to request message */
{
phys_bytes ph;
vir_bytes len, buf;
static char mybuf[DIAG_BUFSIZE];
struct proc *caller, *target;
@@ -33,10 +32,7 @@ register message *m_ptr; /* pointer to request message */
caller->p_endpoint, len);
return EINVAL;
}
if((ph=umap_local(caller, D, buf, len)) == 0)
return EFAULT;
CHECKRANGE_OR_SUSPEND(caller, ph, len, 1);
if((s=data_copy(who_e, buf, SYSTEM, (vir_bytes) mybuf, len)) != OK) {
if((s=data_copy_vmcheck(who_e, buf, SYSTEM, (vir_bytes) mybuf, len)) != OK) {
kprintf("do_sysctl: diag for %d: len %d: copy failed: %d\n",
caller->p_endpoint, len, s);
return s;

View File

@@ -48,13 +48,11 @@ register message *m_ptr; /* pointer to request message */
case LOCAL_SEG:
phys_addr = lin_addr = umap_local(targetpr, seg_index, offset, count);
if(!lin_addr) return EFAULT;
CHECKRANGE_OR_SUSPEND(targetpr, lin_addr, count, 1);
naughty = 1;
break;
case REMOTE_SEG:
phys_addr = lin_addr = umap_remote(targetpr, seg_index, offset, count);
if(!lin_addr) return EFAULT;
CHECKRANGE_OR_SUSPEND(targetpr, lin_addr, count, 1);
naughty = 1;
break;
case GRANT_SEG:
@@ -93,7 +91,6 @@ register message *m_ptr; /* pointer to request message */
kprintf("SYSTEM:do_umap: umap_local failed\n");
return EFAULT;
}
CHECKRANGE_OR_SUSPEND(targetpr, lin_addr, count, 1);
if(vm_lookup(targetpr, lin_addr, &phys_addr, NULL) != OK) {
kprintf("SYSTEM:do_umap: vm_lookup failed\n");
return EFAULT;