Re: Getting "Serious error when reading debug info" when using mmap

"Oren Eini (Ayende Rahien)" <[email protected]>
Newsgroups gmane.comp.debugging.valgrind
Message-ID <CAF0G-Zi1WLAAR9ePrA85K7NO-jM+AsfrrwtzT15iFPk8Pg4piA@mail.gmail.com>
FWIW, I'm pretty sure that the issue is around the use of O_DIRECT and
alignment of memory.
Note that in the call to pread64() , the buffer isn't 4KB aligned, which is
usually required for O_DIRECT.
I assume that this generates the error and the rest of the issue.

On Wed, Dec 16, 2020 at 11:17 PM Oren Eini (Ayende Rahien) <
[email protected]> wrote:

> Hi,
> I'm getting a strange error when running Valgrind.
>
> --23266-- WARNING: Serious error when reading debug info
> --23266-- When reading debug info from /tmp/db/test.txt:
> --23266-- can't read file to inspect ELF header
>
> Note that the file in question is a data file, which I'm mmaping
>
> I can reproduce this using the following code:
> https://gist.github.com/ayende/d65a7a3c06556d62c8fa0f88b04ea449
>
> valgrind-3.16.1 & clang version 10.0.0-4ubuntu1
>
> This seems to be related to mmaping a file, but I can't figure out exactly
> why
>
> Running Valgrind under `strace` gives:
>
>     mmap(0x4e4d000, 65536, PROT_READ, MAP_SHARED|MAP_FIXED, 3, 0) =
> 0x4e4d000
>     statx(3, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL,
> {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFREG|0600,
> stx_size=262144, ...}) = 0
>     readlink("/proc/self/fd/3", "/tmp/db/test.txt", 4096) = 16
>     statx(AT_FDCWD, "/tmp/db/test.txt", AT_STATX_SYNC_AS_STAT, STATX_ALL,
> {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFREG|0600,
> stx_size=262144, ...}) = 0
>     pread64(3, 0x10032c68a0, 1024, 0)       = -1 EINVAL (Invalid argument)
>     getpid()                                = 23260
>     write(1027, "--23260-- WARNING: Serious error"..., 57--23260--
> WARNING: Serious error when reading debug info
>     ) = 57
>     getpid()                                = 23260
>     write(1027, "--23260-- When reading debug inf"..., 57--23260-- When
> reading debug info from /tmp/db/test.txt:
>
> So it looks like the `pread64()` code is failing, but I can't figure out
> why that is the case, or why it would cause Valgrind to give this error.
> Any ideas?
>


-- 
<https://ravendb.net/> *Oren Eini*
*CEO   /   Hibernating Rhinos LTD <https://hibernatingrhinos.com/>*
Mobile:  972-52-548-6969
Sales:  [email protected]
Skype:  ayenderahien
Support:  [email protected]
<https://www.facebook.com/pages/RavenDB/265907650186374>
<https://twitter.com/ravendb>
<https://www.linkedin.com/company/hibernating-rhinos-ltd-/>
<https://ravendb.net/emailsignature/displayeventpage>

_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.