diff --git a/platforms/posix/src/px4/windows/posix/fs/mman.cpp b/platforms/posix/src/px4/windows/posix/fs/mman.cpp index c817f7aa97..38d083996f 100644 --- a/platforms/posix/src/px4/windows/posix/fs/mman.cpp +++ b/platforms/posix/src/px4/windows/posix/fs/mman.cpp @@ -60,6 +60,14 @@ static DWORD mman_page_protect(int prot) extern "C" void *mmap(void *, size_t length, int prot, int flags, int fd, off_t offset) { + /* MAP_FIXED is rejected because the Windows backend (VirtualAlloc / + * MapViewOfFile) cannot safely replace existing mappings at a caller + * supplied address. The shim header documents this contract. */ + if (flags & MAP_FIXED) { + errno = ENOTSUP; + return MAP_FAILED; + } + const bool anon = (flags & (MAP_ANON | MAP_ANONYMOUS)) != 0; if (anon || fd < 0) {