Skip to content
This repository was archived by the owner on Jun 9, 2020. It is now read-only.

Commit 9468dcf

Browse files
committed
Fix mmap() to return errno rather than panic
mmap() should return errno, not panic, if the guest Linux application passed an invalid parameter.
1 parent dc59dca commit 9468dcf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/mm/mmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ do_mmap(gaddr_t addr, size_t len, int d_prot, int l_prot, int l_flags, int fd, o
110110

111111
void *ptr = mmap(0, len, d_prot, linux_to_darwin_mflags(l_flags), fd, offset);
112112
if (ptr == MAP_FAILED) {
113-
panic("mmap failed. addr :0x%llx, len: 0x%lux, prot: %d, l_flags: %d, fd: %d, offset: 0x%llx\n", addr, len, l_prot, l_flags, fd, offset);
113+
return -darwin_to_linux_errno(errno);
114114
}
115115

116116
do_munmap(addr, len);

0 commit comments

Comments
 (0)