diff options
| author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-08-27 19:48:00 +0200 |
|---|---|---|
| committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-08-27 19:48:00 +0200 |
| commit | 67ac13ead93a994cd02c175a9602a28f895c930c (patch) | |
| tree | 0b2383778e212734e419e3671ce2f219259264a4 /debian/patches/flavio0001-port-leak.patch.patch | |
| parent | 08b9024ae1c79edd1a5b77676538d6daf56c3b35 (diff) | |
add patch series
Diffstat (limited to 'debian/patches/flavio0001-port-leak.patch.patch')
| -rw-r--r-- | debian/patches/flavio0001-port-leak.patch.patch | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/debian/patches/flavio0001-port-leak.patch.patch b/debian/patches/flavio0001-port-leak.patch.patch new file mode 100644 index 0000000..56a9640 --- /dev/null +++ b/debian/patches/flavio0001-port-leak.patch.patch @@ -0,0 +1,143 @@ +From 56388f20c50149991d5494f759c77dd7c3161dc4 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Thu, 27 Aug 2015 19:47:25 +0200 +Subject: [PATCH gnumach 1/2] port-leak.patch + +--- + kern/ast.c | 2 +- + kern/exception.c | 32 ++++++++++++++++++++++++++++---- + kern/profile.c | 2 +- + kern/thread.c | 4 ++-- + kern/thread.h | 2 +- + 5 files changed, 33 insertions(+), 9 deletions(-) + +diff --git a/kern/ast.c b/kern/ast.c +index 4b9d63d..2772ed3 100644 +--- a/kern/ast.c ++++ b/kern/ast.c +@@ -96,7 +96,7 @@ ast_taken(void) + if (self != current_processor()->idle_thread) { + #ifndef MIGRATING_THREADS + while (thread_should_halt(self)) +- thread_halt_self(); ++ thread_halt_self(thread_exception_return); + #endif + + /* +diff --git a/kern/exception.c b/kern/exception.c +index 6cb3bfb..63a63d6 100644 +--- a/kern/exception.c ++++ b/kern/exception.c +@@ -231,7 +231,7 @@ exception_no_server(void) + */ + + while (thread_should_halt(self)) +- thread_halt_self(); ++ thread_halt_self(thread_exception_return); + + + #if 0 +@@ -257,7 +257,7 @@ exception_no_server(void) + */ + + (void) task_terminate(self->task); +- thread_halt_self(); ++ thread_halt_self(thread_exception_return); + panic("terminating the task didn't kill us"); + /*NOTREACHED*/ + } +@@ -848,6 +848,26 @@ exception_raise_continue(void) + } + + /* ++ * Routine: thread_release_and_exception_return ++ * Purpose: ++ * Continue after thread was halted. ++ * Conditions: ++ * Nothing locked. We are running on a new kernel stack and ++ * control goes back to thread_exception_return. ++ * Returns: ++ * Doesn't return. ++ */ ++static void ++thread_release_and_exception_return(void) ++{ ++ ipc_thread_t self = current_thread(); ++ /* reply port must be released */ ++ ipc_port_release(self->ith_port); ++ thread_exception_return(); ++ /*NOTREACHED*/ ++} ++ ++/* + * Routine: exception_raise_continue_slow + * Purpose: + * Continue after finishing an ipc_mqueue_receive +@@ -876,10 +896,14 @@ exception_raise_continue_slow( + */ + + while (thread_should_halt(self)) { +- /* don't terminate while holding a reference */ ++ /* if thread is about to terminate, release the port */ + if (self->ast & AST_TERMINATE) + ipc_port_release(reply_port); +- thread_halt_self(); ++ /* ++ * Use the continuation to release the port in ++ * case the thread is about to halt. ++ */ ++ thread_halt_self(thread_release_and_exception_return); + } + + ip_lock(reply_port); +diff --git a/kern/profile.c b/kern/profile.c +index 5510721..1fd265f 100644 +--- a/kern/profile.c ++++ b/kern/profile.c +@@ -172,7 +172,7 @@ printf("profile_thread: mach_msg failed returned %x\n",(int)mr); + sizeof(struct buf_to_send)); + } + +- thread_halt_self(); ++ thread_halt_self(thread_exception_return); + } + + +diff --git a/kern/thread.c b/kern/thread.c +index 865a1cc..e524688 100644 +--- a/kern/thread.c ++++ b/kern/thread.c +@@ -1132,7 +1132,7 @@ void __attribute__((noreturn)) walking_zombie(void) + * Thread calls this routine on exit from the kernel when it + * notices a halt request. + */ +-void thread_halt_self(void) ++void thread_halt_self(continuation_t continuation) + { + thread_t thread = current_thread(); + spl_t s; +@@ -1173,7 +1173,7 @@ void thread_halt_self(void) + thread_unlock(thread); + splx(s); + counter(c_thread_halt_self_block++); +- thread_block(thread_exception_return); ++ thread_block(continuation); + /* + * thread_release resets TH_HALTED. + */ +diff --git a/kern/thread.h b/kern/thread.h +index 0e85d8c..22b12fa 100644 +--- a/kern/thread.h ++++ b/kern/thread.h +@@ -362,7 +362,7 @@ extern void thread_release(thread_t); + extern kern_return_t thread_halt( + thread_t thread, + boolean_t must_halt); +-extern void thread_halt_self(void); ++extern void thread_halt_self(continuation_t); + extern void thread_force_terminate(thread_t); + extern thread_t kernel_thread( + task_t task, +-- +2.1.4 + |
