plasma-umass / Mesh

A memory allocator that automatically reduces the memory footprint of C/C++ applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug in the gcc lib

kyoguan opened this issue · comments

We found the gcc lib has a bug, call the system call futex without the FUTEX_PRIVATE_FLAG flag. This would block the thread after mesh, because the phys address changed. clang' lib without this bug.

eg. std::future would trigger this bug.

yikes! do you have links to the bug or a small reproducer? is it in libgcc or glibc? its surprising to me that freeing the meshed page wouldn't clear/purge the waiting futex, otherwise it seems like a process could get notified about a futex in a different process (if/when the memory is reused)

https://github.com/gcc-mirror/gcc/blob/df3e7e7eba31450357b3773f5fb028b5ec2d3669/libstdc%2B%2B-v3/src/c%2B%2B11/futex.cc

here:
const unsigned futex_wait_op = 0;
const unsigned futex_wake_op = 1;

they should be
const unsigned futex_wait_op = 0 | 128;
const unsigned futex_wake_op = 1 | 128;