Sanity checks prevent VM panic for mmap, vm_remap and map_phys
This commit is contained in:
parent
c356e9997e
commit
b1408f61b4
1 changed files with 5 additions and 1 deletions
|
@ -55,7 +55,7 @@ PUBLIC int do_mmap(message *m)
|
|||
u32_t vrflags = VR_ANON | VR_WRITABLE;
|
||||
size_t len = (vir_bytes) m->VMM_LEN;
|
||||
|
||||
if(m->VMM_FD != -1) {
|
||||
if(m->VMM_FD != -1 || len <= 0) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
|
@ -143,6 +143,8 @@ PUBLIC int do_map_phys(message *m)
|
|||
target = m->VMMP_EP;
|
||||
len = m->VMMP_LEN;
|
||||
|
||||
if (len <= 0) return EINVAL;
|
||||
|
||||
if(target == SELF)
|
||||
target = m->m_source;
|
||||
|
||||
|
@ -234,6 +236,8 @@ PUBLIC int do_remap(message *m)
|
|||
sa = (vir_bytes) m->VMRE_SA;
|
||||
size = m->VMRE_SIZE;
|
||||
|
||||
if (size <= 0) return EINVAL;
|
||||
|
||||
if ((r = vm_isokendpt((endpoint_t) m->VMRE_D, &dn)) != OK)
|
||||
return EINVAL;
|
||||
if ((r = vm_isokendpt((endpoint_t) m->VMRE_S, &sn)) != OK)
|
||||
|
|
Loading…
Reference in a new issue