nanosleep, clock_nanosleep: use locked heap for blockq actions
Since timer_handlers are now invoked without the kernel lock held, use of the
general heap for blockq actions was leading to allocator corruption and
occasional crashes on closure deallocations.
@@ -45,7 +45,7 @@ sysreturn nanosleep(const struct timespec *req, struct timespec *rem)
timestamp tnow = now(CLOCK_ID_MONOTONIC);
thread_log(current, "nanosleep: req %p (%T) rem %p, now %T", req, interval, rem, tnow);
return blockq_check_timeout(current->thread_bq, current,
- closure(heap_general(get_kernel_heaps()), nanosleep_bh,
+ closure(heap_locked(get_kernel_heaps()), nanosleep_bh,
current, tnow, CLOCK_ID_MONOTONIC, interval, rem), false,
CLOCK_ID_MONOTONIC, interval, false);
}
@@ -76,7 +76,7 @@ sysreturn clock_nanosleep(clockid_t _clock_id, int flags, const struct timespec
id, flags, req, treq, rem, tnow);
return blockq_check_timeout(current->thread_bq, current,
- closure(heap_general(get_kernel_heaps()), nanosleep_bh,
+ closure(heap_locked(get_kernel_heaps()), nanosleep_bh,
current, tnow, id, treq, rem), false,
id, treq, (flags & TIMER_ABSTIME) != 0);
}
