Branch: Tag:

2018-11-28

2018-11-28 20:42:45 by Tobias S. Josefowitz <tobij@tobij.de>

GC: Avoid ordering the mc_marker queue on uninitialized fields

Both Pike.count_memory() (sometimes) and Pike.identify_cycle() (always)
ordered the mc_marker queue on uninitialized data. While apparently not
inherently problematic, initializing helps to avoid valgrind false
positives.

5224:       if (!ref_to) {    ref_to = my_make_mc_marker (thing, visit_fn, extra); +  ref_to->la_count = 0; /* initialize so the queue doesn't order on +  uninitialized memory (... valgrind) */    MC_DEBUG_MSG (ref_to, "got new thing");    }    else if (ref_to->flags & MC_FLAG_INTERNAL) {
6047:    }       ref_to = my_make_mc_marker(dst, visit_dst, extra); +  ref_to->la_count = 0; /* initialize just so the queue doesn't order on +  uninitialized memory (... valgrind) */       if (type != PIKE_T_UNKNOWN) {    /* NB: low_mapping_insert() for object indices may throw errors