Open Yaxuan-w opened 6 days ago
Address picked by host calling vmmap, then use this addr to call kernel mmap, a function before mmap in dispatcher to check and pick addr for vmmap
All translation about address should be done in dispatcher stage. Including all functions related to pointers — handle situations depends on flags
Here's the syscall with pointer list generated by @ChinmayShringi
// Uses pointers getcwd_syscall // getcwd_syscall(&self, buf: *mut u8, bufsize: u32) -> i32 read_syscall // read_syscall(&self, virtual_fd: i32, readbuf: *mut u8, count: usize) -> i32 write_syscall // write_syscall(&self, virtual_fd: i32, buf: *const u8, count: usize) -> i32 ioctl_syscall // ioctl_syscall(&self, virtual_fd: i32, request: u64, ptrunion: *mut u8) -> i32 mmap_syscall // mmap_syscall(&self, addr: *mut u8, len: usize, prot: i32, flags: i32, virtual_fd: i32, off: i64) -> i32 munmap_syscall // munmap_syscall(&self, addr: *mut u8, len: usize) -> i32 getdents_syscall // getdents_syscall(&self, virtual_fd: i32, buf: *mut u8, nbytes: u32) -> i32 send_syscall // send_syscall(&self, virtual_fd: i32, buf: *const u8, buflen: usize, flags: i32) -> i32 sendto_syscall // sendto_syscall(&self, virtual_fd: i32, buf: *const u8, buflen: usize, flags: i32, dest_addr: &GenSockaddr) -> i32 shmat_syscall // shmat_syscall(&self, shmid: i32, shmaddr: *mut u8, shmflg: i32) -> i32 shmdt_syscall // shmdt_syscall(&self, shmaddr: *mut u8) -> i32 pread_syscall // pread_syscall(&self, virtual_fd: i32, buf: *mut u8, count: usize, offset: i64) -> i32 pwrite_syscall // pwrite_syscall(&self, virtual_fd: i32, buf: *const u8, count: usize, offset: i64) -> i32 getifaddrs_syscall // getifaddrs_syscall(&self, buf: *mut u8, count: usize) -> i32 writev_syscall // writev_syscall(&self,virtual_fd: i32,iovec: *const interface::IovecStruct,iovcnt: i32,) -> i32 recv_syscall // recv_syscall(&self, virtual_fd: i32, buf: *mut u8, buflen: usize, flags: i32) -> i32 recvfrom_syscall // recvfrom_syscall(&self, virtual_fd: i32, buf: *mut u8, buflen: usize, flags: i32, addr: &mut Option<&mut GenSockaddr>) -> i32 getsockopt_syscall // getsockopt_syscall(&self, virtual_fd: i32, level: i32, optname: i32, optval: *mut u8, optlen: *mut u32) -> i32 setsockopt_syscall // setsockopt_syscall(&self, virtual_fd: i32, level: i32, optname: i32, optval: *const u8, optlen: u32) -> i32 gethostname_syscall // gethostname_syscall(&self, name: *mut u8, len: isize) -> i32 select_syscall epoll_wait poll_ctl
We should double check the above list, I think things like poll pipe and socketpair all also use addresses, may be more.
Implementing VMMAP in RawPOSIX
Add current code into RawPOSIX
Integration
Address picked by host calling vmmap, then use this addr to call kernel mmap, a function before mmap in dispatcher to check and pick addr for vmmap
All translation about address should be done in dispatcher stage. Including all functions related to pointers — handle situations depends on flags
Test
Here's the syscall with pointer list generated by @ChinmayShringi