kernel/vm: Prohibit offset from being < 0 in mmap.

POSIX seems to be silent about whether this is permitted,
but at least FreeBSD explicitly does not allow it.

Fixes #16936.

Change-Id: If6b23410ae88245e706df77d276234f4775654f9
This commit is contained in:
Augustin Cavalier 2023-02-28 19:08:41 -05:00
parent 0ecd7516de
commit bc35a6e445

View File

@ -941,6 +941,8 @@ map_backing_store(VMAddressSpace* addressSpace, VMCache* cache, off_t offset,
#endif
return B_BAD_VALUE;
}
if (offset < 0)
return B_BAD_VALUE;
uint32 allocationFlags = HEAP_DONT_WAIT_FOR_MEMORY
| HEAP_DONT_LOCK_KERNEL_SPACE;