From 23a158b3612512f152105945cbf2787fbaf80be1 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Sun, 21 Dec 2008 03:46:42 +0000 Subject: [PATCH] don't check senda() buffer if size is 0. --- kernel/proc.c | 15 +++++++++------ kernel/system.c | 7 +++++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/kernel/proc.c b/kernel/proc.c index 692eafb4c..7b3c678e8 100755 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -315,8 +315,13 @@ long bit_map; /* notification event set or flags */ phys_bytes lin; /* Map to linear address. */ - if((lin = umap_local(caller_ptr, D, (vir_bytes) m_ptr, msg_size)) == 0) + if(msg_size > 0 && + (lin = umap_local(caller_ptr, D, (vir_bytes) m_ptr, msg_size)) == 0) { + kprintf("umap_local failed for %s / %d on 0x%lx size %d\n", + caller_ptr->p_name, caller_ptr->p_endpoint, + m_ptr, msg_size); return EFAULT; + } /* Check if message pages in calling process are mapped. * We don't have to check the recipient if this is a send, @@ -327,13 +332,12 @@ long bit_map; /* notification event set or flags */ * and those pages may not be shared between processes. */ - if(vm_running && + if(vm_running && msg_size > 0 && (r=vm_checkrange(caller_ptr, caller_ptr, lin, msg_size, 1, 0)) != OK) { if(r != VMSUSPEND) { kprintf("SYSTEM:sys_call:vm_checkrange: err %d\n", r); return r; } - minix_panic("vmsuspend", __LINE__); /* We can't go ahead with this call. Caller is suspended * and we have to save the state in its process struct. @@ -344,8 +348,8 @@ long bit_map; /* notification event set or flags */ caller_ptr->p_vmrequest.saved.sys_call.bit_map = bit_map; caller_ptr->p_vmrequest.type = VMSTYPE_SYS_CALL; - kprintf("SYSTEM: %s:%d: suspending call 0x%lx on ipc buffer 0x%lx\n", - caller_ptr->p_name, caller_ptr->p_endpoint, call_nr, m_ptr); + kprintf("SYSTEM: %s:%d: suspending call 0x%lx on ipc buffer 0x%lx length 0x%lx\n", + caller_ptr->p_name, caller_ptr->p_endpoint, call_nr, m_ptr, msg_size); /* vm_checkrange() will have suspended caller with VMREQUEST. */ return OK; @@ -482,7 +486,6 @@ PUBLIC void sys_call_restart(caller) struct proc *caller; { int r; - minix_panic("sys_call_restart", NO_NUM); kprintf("restarting sys_call code 0x%lx, " "m_ptr 0x%lx, srcdst %d, bitmap 0x%lx, but not really\n", caller->p_vmrequest.saved.sys_call.call_nr, diff --git a/kernel/system.c b/kernel/system.c index 5f8a32710..8f5a2460e 100755 --- a/kernel/system.c +++ b/kernel/system.c @@ -465,8 +465,11 @@ register struct proc *rc; /* slot of process to clean up */ RTS_LOCK_SET(rc, NO_ENDPOINT); if (priv(rc)->s_flags & SYS_PROC) { - if (priv(rc)->s_asynsize) - kprintf("clear_endpoint: clearing s_asynsize\n"); + if (priv(rc)->s_asynsize) { + kprintf("clear_endpoint: clearing s_asynsize of %s / %d\n", + rc->p_name, rc->p_endpoint); + proc_stacktrace(rc); + } priv(rc)->s_asynsize= 0; }