Skip to content

Crash consistency bug in clht_gc_free #18

@iangneal

Description

@iangneal

Bug

Exposed by crashing after freeing the hash table in clht_gc_free.

RECIPE/P-CLHT/src/clht_gc.c

Lines 239 to 242 in fc508dd

PMEMoid table_oid = {pool_uuid, hashtable->table_off};
pmemobj_free(&table_oid);
PMEMoid ht_oid = pmemobj_oid((void *)hashtable);
pmemobj_free(&ht_oid);

  • pmemobj_free sets the PMEMoid object to NULL when freeing objects.
  • With the current design of storing the offset in hashtable->table_off, the offset is never set to null, and so a crash can cause a double-free to occur.

Steps to reproduce

gdb --args ./example 20 20
> break clht_gc.c:241
> run
> quit
# Then, re-run
./example 20 0

Will output something like:

Simple Example of P-CLHT
operation,n,ops/s
Throughput: load, inf ,ops/us
Throughput: run, inf ,ops/us
<libpmemobj>: <1> [palloc.c:295 palloc_heap_action_exec] assertion failure: 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions