From 430df165430659e75dea6786621f50c514fa47af Mon Sep 17 00:00:00 2001 From: Giacomo Tesio Date: Tue, 10 Oct 2017 00:14:49 +0200 Subject: [PATCH] kernel: ignore errors on awake_gc_proc Calling resrcwait in awake_gc_proc (that is called from pexit and thus from sys_exits) means that we have to ignore errors that could cause the syscall to return. The funny part here was that one single test for newlib showed the issue by faulting in a note handler AFTER completing with success: /arch/amd64/qa/lib/newlib/sigchld/213-sigqueue The fact was that in the executable, the function notifier() was located just after the exits() function, whose last line was a call to _exits(). Thus, when the _exits returned, the notifier() code was executed. --- sys/src/kern/port/awake.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/src/kern/port/awake.c b/sys/src/kern/port/awake.c index 6f7bea0..9cec4ec 100644 --- a/sys/src/kern/port/awake.c +++ b/sys/src/kern/port/awake.c @@ -336,8 +336,11 @@ awake_gc_proc(Proc *p) assert(p->wakeups[0].count == 0); assert(p->wakeups[1].count == 0); - while(p->nwakeups > 0) + while(p->nwakeups > 0){ + while(waserror()) + ; resrcwait(nil, nil); + } } static long