From e0f3a5acf1b5b6582bfa83d690578a5bcdbd7274 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Fri, 17 Apr 2009 13:46:37 +0000 Subject: [PATCH] - enable ipc warnings by default - ipc checking code in kernel didn't properly catch the sendrec() to self case; added special case check - triggered by PM using stock panic() - needs its own _exit() reported by Joren l'Ami. --- kernel/debug.h | 2 +- kernel/proc.c | 7 +++++++ servers/pm/forkexit.c | 10 ++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/kernel/debug.h b/kernel/debug.h index 87c674ca2..034a26e82 100644 --- a/kernel/debug.h +++ b/kernel/debug.h @@ -19,7 +19,7 @@ * Of course the call still fails, but nothing is printed if these warnings * are disabled. */ -#define DEBUG_ENABLE_IPC_WARNINGS 0 +#define DEBUG_ENABLE_IPC_WARNINGS 1 #define DEBUG_STACKTRACE 1 #define DEBUG_VMASSERT 1 #define DEBUG_SCHED_CHECK 1 diff --git a/kernel/proc.c b/kernel/proc.c index 11960020a..0b5f43c36 100755 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -201,6 +201,13 @@ long bit_map; /* notification event set or flags */ } else { + if(caller_ptr->p_endpoint == src_dst_e) { +#if DEBUG_ENABLE_IPC_WARNINGS + kprintf("sys_call: trap %d by %d with self %d\n", + call_nr, proc_nr(caller_ptr), src_dst_e); +#endif + return EINVAL; + } /* Require a valid source and/or destination process. */ if(!isokendpt(src_dst_e, &src_dst_p)) { #if DEBUG_ENABLE_IPC_WARNINGS diff --git a/servers/pm/forkexit.c b/servers/pm/forkexit.c index 63656ad6b..4bfe4ad30 100644 --- a/servers/pm/forkexit.c +++ b/servers/pm/forkexit.c @@ -417,3 +417,13 @@ register struct mproc *rmp; /* tells which process is exiting */ rmp->mp_child_stime = 0; procs_in_use--; } + +PUBLIC void _exit(int code) +{ + sys_exit(SELF); +} + +PUBLIC void __exit(int code) +{ + sys_exit(SELF); +}