Background threads: fix an indexing bug.
We have a buffer overrun that manifests in the case where arena indices higher than the number of CPUs are accessed before arena indices lower than the number of CPUs. This fixes the bug and adds a test.
This commit is contained in:
committed by
David Goldblatt
parent
dd7e283b6f
commit
26b1c13982
@@ -600,7 +600,8 @@ background_threads_enable(tsd_t *tsd) {
|
||||
arena_get(tsd_tsdn(tsd), i, false) == NULL) {
|
||||
continue;
|
||||
}
|
||||
background_thread_info_t *info = &background_thread_info[i];
|
||||
background_thread_info_t *info = &background_thread_info[
|
||||
i % ncpus];
|
||||
malloc_mutex_lock(tsd_tsdn(tsd), &info->mtx);
|
||||
assert(info->state == background_thread_stopped);
|
||||
background_thread_init(tsd, info);
|
||||
|
Reference in New Issue
Block a user