Previously, ##sys#kill-other-threads wouldn't clear the ##sys#fd-list,
leading to errors when unrecognized file descriptors were encountered
during scheduling. Additionally, it would set slots in random heap
locations near ##sys#fd-list (potentially leading to heap corruption)
since it incorrectly tried to suspend a list rather than a thread; the
fd list has a different format than the timeout-list, and its `cdr` is a
list of threads that must be each suspended individually.
---
scheduler.scm | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/scheduler.scm b/scheduler.scm
index 4f9f8d8..9b1f549 100644
--- a/scheduler.scm
+++ b/scheduler.scm
@@ -590,12 +590,9 @@ EOF
(set! ready-queue-head (list primordial))
(set! ready-queue-tail ready-queue-head)
(suspend primordial) ; clear block-obj. and recipients
- (for-each
- (lambda (a) (suspend (cdr a)))
- ##sys#timeout-list)
+ (for-each (lambda (a) (suspend (cdr a))) ##sys#timeout-list)
+ (for-each (lambda (a) (for-each suspend (cdr a))) ##sys#fd-list)
(set! ##sys#timeout-list '())
- (for-each
- (lambda (a) (suspend (cdr a)))
- ##sys#fd-list)
+ (set! ##sys#fd-list '())
(thunk)
(exit)))))
--
2.8.1
_______________________________________________
Chicken-hackers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-hackers