I implemented a magic ring buffer (MRB) on linux using memfd_create, ftruncate, mmap, and munmap. The fd returned by memfd_create gets close()'d after the buffer is fully constructed. The MRB itself runs and works perfectly fine.
The problem:
- One tries to create a core-file on a process running this MRB with
gcore. - They then try to use
gdb <executable> -c <core-file>
gdb then prints a warning:
warning: Can't open file /memfd:magicringbuffer (deleted) during file-backed mapping note processing
Additional notes:
"magicringbuffer"is the string passed as thenameparameter inmemfd_create(const char *name, unsigned int flags);- built and run on CentOS version 7
Questions:
- What does this warning exactly mean? What causes it? Is it because the "file" is virtual? or because it was
close()'d? - What are the implications of it? Could it lead to missing debug symbols? The
<executable>is indeed a binary with debug symbols
I tried to look for an answer on the internet, but I found nothing satisfactory.