/none/tests/map_unmap
/none/tests/mmap_fcntl_bug
/none/tests/mq
+/none/tests/mmap_o_direct
/none/tests/mremap
/none/tests/mremap2
/none/tests/munmap_exe
479041 Executables without RW sections do not trigger debuginfo reading
480052 WARNING: unhandled amd64-freebsd syscall: 580
480126 Build failure on Raspberry Pi 5 / OS 6.1.0-rpi7-rpi-v8
+480405 valgrind 3.22.0 "m_debuginfo/image.c:586 (set_CEnt):
+ Assertion '!sr_isError(sr)' failed."
480488 Add support for FreeBSD 13.3
n-i-bz Add redirect for memccpy
if (img->source.is_local) {
// Simple: just read it
+
+ // PJF not quite so simple - see
+ // https://bugs.kde.org/show_bug.cgi?id=480405
+ // if img->source.fd was opened with O_DIRECT the memory needs
+ // to be aligned and also the length
+ // that's a lot of hassle just to take a quick peek to see if
+ // is an ELF binary so just twiddle the flag before and after
+ // peeking.
+ // This doesn't seem to be a problem on FreeBSD. I haven't tested
+ // on macOS or Solaris, hence the conditional compilation
+#if defined(VKI_O_DIRECT)
+ Int flags = VG_(fcntl)(img->source.fd, VKI_F_GETFL, 0);
+ if (flags & VKI_O_DIRECT) {
+ VG_(fcntl)(img->source.fd, VKI_F_SETFL, flags & ~VKI_O_DIRECT);
+ }
+#endif
SysRes sr = VG_(pread)(img->source.fd, &ce->data[0], (Int)len, off);
+#if defined(VKI_O_DIRECT)
+ if (flags & VKI_O_DIRECT) {
+ VG_(fcntl)(img->source.fd, VKI_F_SETFL, flags);
+ }
+#endif
vg_assert(!sr_isError(sr));
} else {
// Not so simple: poke the server
#define VKI_O_TRUNC 01000 /* not fcntl */
#define VKI_O_APPEND 02000
#define VKI_O_NONBLOCK 04000
+#define VKI_O_DIRECT 040000
#define VKI_O_LARGEFILE 0100000
#define VKI_AT_FDCWD -100
#define VKI_O_APPEND 02000
#define VKI_O_NONBLOCK 04000
#define VKI_O_LARGEFILE 0100000
+#define VKI_O_DIRECT 0200000
#define VKI_AT_FDCWD -100
#define VKI_O_APPEND 02000
#define VKI_O_NONBLOCK 04000
#define VKI_O_LARGEFILE 0100000
+#define VKI_O_DIRECT 0200000
#define VKI_AT_FDCWD -100
#define VKI_O_APPEND 0x0008
#define VKI_O_NONBLOCK 0x0080
#define VKI_O_LARGEFILE 0x2000
+#define VKI_O_DIRECT 0x8000
#define VKI_AT_FDCWD -100
#define VKI_O_APPEND 0x0008
#define VKI_O_NONBLOCK 0x0080
#define VKI_O_LARGEFILE 0x2000
+#define VKI_O_DIRECT 0x8000
#define VKI_AT_FDCWD -100
#define VKI_O_TRUNC 01000 /* not fcntl */
#define VKI_O_APPEND 02000
#define VKI_O_NONBLOCK 04000
+#define VKI_O_DIRECT 040000
#define VKI_O_LARGEFILE 0200000
#define VKI_AT_FDCWD -100
#define VKI_O_TRUNC 01000 /* not fcntl */
#define VKI_O_APPEND 02000
#define VKI_O_NONBLOCK 04000
+#define VKI_O_DIRECT 040000
#define VKI_O_LARGEFILE 0200000
#define VKI_AT_FDCWD -100
#define VKI_O_TRUNC 00001000 /* not fcntl */
#define VKI_O_APPEND 00002000
#define VKI_O_NONBLOCK 00004000
+#define VKI_O_DIRECT 00040000
#define VKI_AT_FDCWD -100
#define VKI_O_TRUNC 01000 /* not fcntl */
#define VKI_O_APPEND 02000
#define VKI_O_NONBLOCK 04000
+#define VKI_O_DIRECT 040000
#define VKI_O_LARGEFILE 0100000
#define VKI_AT_FDCWD -100
map_unmap.stderr.exp map_unmap.stdout.exp map_unmap.vgtest \
mmap_fcntl_bug.vgtest mmap_fcntl_bug.stdout.exp \
mmap_fcntl_bug.stderr.exp \
+ mmap_o_direct.stderr.exp mmap_o_direct.vgtest \
mq.stderr.exp mq.vgtest \
munmap_exe.stderr.exp munmap_exe.vgtest \
nestedfns.stderr.exp nestedfns.stdout.exp nestedfns.vgtest \
libvexmultiarch_test \
manythreads \
mmap_fcntl_bug \
+ mmap_o_direct \
munmap_exe map_unaligned map_unmap mq \
nocwd \
pending \
--- /dev/null
+#include <unistd.h>
+#define __USE_GNU
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <stddef.h>
+
+int main(void)
+{
+ int fd = open("mmap_o_direct.c", O_RDONLY | O_DIRECT);
+ if (-1 != fd)
+ {
+ void* m = mmap(NULL, 307, PROT_READ, MAP_PRIVATE, fd, 0);
+ munmap(m, 307);
+ close(fd);
+ }
+}
--- /dev/null
+prog: mmap_o_direct
+vgopts: -q