Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash consistency bug in clht_gc_free #18

Open
iangneal opened this issue Apr 28, 2021 · 2 comments
Open

Crash consistency bug in clht_gc_free #18

iangneal opened this issue Apr 28, 2021 · 2 comments

Comments

@iangneal
Copy link

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
@SeKwonLee
Copy link
Member

Hi @Dahca ,

Thanks for the report. Let me get back to you after checking and fixing it. However, if you already have a solution, I would appreciate it if you make a pull request for it.

@iangneal
Copy link
Author

Hey @SeKwonLee,

I'd be happy to submit a PR for this in the near future, but I will be slightly delayed by an upcoming deadline. I'll ping this issue once I have a solution or if I have any issues in coming up with one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants