This repository was archived by the owner on Nov 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 50
This repository was archived by the owner on Nov 4, 2024. It is now read-only.
pmemcheck incosistently reporting issues w.r.t. stores outside of transactions #47
Copy link
Copy link
Open
Labels
Description
This code:
VALGRIND_REMOVE_FROM_TX(run, runsize);
pmemops_persist(&heap->p_ops, run->bitmap, sizeof(run->bitmap));
struct chunk_header run_data_hdr;
run_data_hdr.type = CHUNK_TYPE_RUN_DATA;
run_data_hdr.flags = 0;
struct chunk_header *data_hdr;
for (unsigned i = 1; i < m->size_idx; ++i) {
data_hdr = &z->chunk_headers[m->chunk_id + i];
VALGRIND_DO_MAKE_MEM_UNDEFINED(data_hdr, sizeof(*data_hdr));
VALGRIND_ADD_TO_TX(data_hdr, sizeof(*data_hdr));
run_data_hdr.size_idx = i;
*data_hdr = run_data_hdr;
VALGRIND_REMOVE_FROM_TX(data_hdr, sizeof(*data_hdr));
}
pmemops_persist(&heap->p_ops,
&z->chunk_headers[m->chunk_id + 1],
sizeof(struct chunk_header) * (m->size_idx - 1));
struct chunk_header *hdr = &z->chunk_headers[m->chunk_id];
ASSERT(hdr->type == CHUNK_TYPE_FREE);
VALGRIND_ADD_TO_TX(hdr, sizeof(*hdr));
struct chunk_header run_hdr;
run_hdr.size_idx = hdr->size_idx;
run_hdr.type = CHUNK_TYPE_RUN;
run_hdr.flags = header_type_to_flag[c->header_type];
*hdr = run_hdr;
VALGRIND_REMOVE_FROM_TX(hdr, sizeof(*hdr));
*data_hdr = run_data_hdr;
is the problematic assignment.
Produces the following issue:
==28070== Number of stores made without adding to transaction: 14
==28070== Stores made without adding to transactions:
==28070== [0] at 0x4C471F7: heap_run_init (heap.c:393)
==28070== by 0x4C47AFE: heap_create_run (heap.c:517)
==28070== by 0x4C48A01: heap_ensure_run_bucket_filled (heap.c:825)
==28070== by 0x4C48DF0: heap_get_bestfit_block (heap.c:909)
==28070== by 0x4C5AD50: palloc_operation (palloc.c:211)
==28070== by 0x4C5C1D0: pmalloc_operation (pmalloc.c:116)
==28070== by 0x4C5C3F7: pmalloc_construct (pmalloc.c:166)
==28070== by 0x4C648E1: tx_alloc_common (tx.c:1010)
==28070== by 0x4C679B1: pmemobj_tx_alloc (tx.c:1961)
==28070== by 0x404F2B: sc8_verify_abort (obj_convert.c:467)
==28070== by 0x405A67: main (obj_convert.c:594)
==28070== Address: 0x6102490 size: 16
But only sometimes (can't reproduce this reliably outside of this specific case: pmem/pmdk#2242).
Regardless of anything else, the report is false, because the store is clearly added to the transaction.
Wrapping the entire code section in a add_to_tx, that encompasses the entire modifiable area, fixes the problem.