mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-06-03 10:44:16 +03:00
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:
parent
dd7e283b6f
commit
26b1c13982
3 changed files with 37 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue