https://bugs.kde.org/show_bug.cgi?id=480405

--- Comment #11 from Paul Floyd <pjfl...@wanadoo.fr> ---
OK I've found the problem.

You're opening the files with O_DIRECT. But then Valgrind is just using a pread
based on the size to see if it is an ELF load.

That's causing a EINVAL because of this

       EINVAL fd is attached to an object which is unsuitable for reading; or 
the  file  was
              opened  with  the  O_DIRECT  flag, and either the address
specified in buf, the
              value specified in count, or the file offset is not suitably
aligned.

As a workaround, you can just remove the O_DIRECT.

In Valgrind, handling the memory restrictions looks complicated. Instead I'll
look at 1) getting the fd flags with fcntl, 2) checking if O_DIRECT is set 3)
turning it off if it is, 4) doing the pread and 5) restoring the flag if needed

As a reminder to myself, the code in question is

   if (img->source.is_local) {
      // Simple: just read it
      SysRes sr = VG_(pread)(img->source.fd, &ce->data[0], (Int)len, off);
      vg_assert(!sr_isError(sr));

in image.c

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to