Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Porting VMMAP to RawPOSIX [REVIEW for comments] #87

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f81ca4b
porting vmmap
Yaxuan-w Nov 4, 2024
ff4db4f
porting to dispatcher
Yaxuan-w Nov 4, 2024
198cb56
fix: cargo build errors
Nov 8, 2024
8fd990d
feat: update vmmaap exec_syscall
Nov 8, 2024
7bb319f
fix: updated vmmap init
Nov 8, 2024
5fdc169
feat: add implementation for exit and exec
Nov 8, 2024
f1bc365
fix: rm clear memory call
Nov 8, 2024
3f95f23
feat: rever comment
Nov 8, 2024
f02d111
refactor: revert comment
Nov 8, 2024
a2c3e1f
Added more comments to vmmap.rs
ruchjoshi-nyu Nov 11, 2024
66737e6
Changed max_prot function definition to get_max_prot
ruchjoshi-nyu Nov 13, 2024
429d91f
Updated vmmap.rs as per comments
ruchjoshi-nyu Nov 13, 2024
cf69c60
merge main
rennergade Nov 21, 2024
c240392
mmap/munmap implementation
qianxichen233 Nov 21, 2024
d119e86
update comment
qianxichen233 Nov 21, 2024
7104fea
fix get_max_prot
rennergade Nov 21, 2024
6d600da
Added comments
ruchjoshi-nyu Nov 23, 2024
c191b56
feat: add test cases for vmmap
Nov 24, 2024
6d492e9
Merge remote-tracking branch 'origin/vmmap-alice' into mmap-qianxi
qianxichen233 Nov 25, 2024
c90e7b9
resolved some comments
qianxichen233 Nov 25, 2024
700ea92
Merge pull request #97 from Lind-Project/vmmap-with-added-comments
rennergade Nov 26, 2024
5f77427
Merge pull request #90 from Lind-Project/feat-exec-exit-implementation
rennergade Nov 26, 2024
7dee68e
resolved some comments
qianxichen233 Dec 3, 2024
e1d98dc
merged from alice-mmap
qianxichen233 Dec 3, 2024
df5419c
Merge pull request #96 from Lind-Project/mmap-qianxi
rennergade Dec 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ ringbuf = "0.2.6"
dashmap = { version = "5.1", features=["serde"] }
parking_lot = "0.12"
bit-set = "0.5"
nodit = "0.9.2" # Used for VMMAP
quick_cache = "0.6.9"

[dependencies.lazy_static]
version = "1.0"
Expand Down
4 changes: 0 additions & 4 deletions src/interface/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// Author: Nicholas Renner
//
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move all the removing commented out code in these files to a different pr?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Module definitions for the SafePOSIX Rust interface
// this interface limits kernel access from Rust to the popular paths as defined in Lock-in-Pop

mod comm;
pub mod errnos;
Expand Down
149 changes: 3 additions & 146 deletions src/safeposix/cage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,80 +2,25 @@
use crate::interface;
//going to get the datatypes and errnos from the cage file from now on
pub use crate::interface::errnos::{syscall_error, Errno};
// pub use crate::interface::types::{
// Arg, EpollEvent, FSData, IoctlPtrUnion, PipeArray, PollStruct, Rlimit, ShmidsStruct, StatData,
// };

pub use crate::interface::types::{
Arg, EpollEvent, IoctlPtrUnion, PipeArray, PollStruct,
};

use super::filesystem::normpath;
// use super::net::SocketHandle;
pub use super::syscalls::fs_constants::*;
pub use super::syscalls::net_constants::*;
pub use super::syscalls::sys_constants::*;
pub use super::vmmap::*;
pub use super::vmmap_constants::*;

pub use crate::interface::CAGE_TABLE;

// #[derive(Debug, Clone)]
// pub enum FileDescriptor {
// File(FileDesc),
// Stream(StreamDesc),
// Socket(SocketDesc),
// Pipe(PipeDesc),
// Epoll(EpollDesc),
// }

// #[derive(Debug, Clone)]
// pub struct FileDesc {
// pub position: usize,
// pub inode: usize,
// pub flags: i32,
// pub advlock: interface::RustRfc<interface::AdvisoryLock>,
// }

// #[derive(Debug, Clone)]
// pub struct StreamDesc {
// pub position: usize,
// pub stream: i32, //0 for stdin, 1 for stdout, 2 for stderr
// pub flags: i32,
// pub advlock: interface::RustRfc<interface::AdvisoryLock>,
// }

// #[derive(Debug, Clone)]
// pub struct SocketDesc {
// pub flags: i32,
// pub domain: i32,
// pub rawfd: i32,
// pub handle: interface::RustRfc<interface::RustLock<SocketHandle>>,
// pub advlock: interface::RustRfc<interface::AdvisoryLock>,
// }

// #[derive(Debug, Clone)]
// pub struct PipeDesc {
// pub pipe: interface::RustRfc<interface::EmulatedPipe>,
// pub flags: i32,
// pub advlock: interface::RustRfc<interface::AdvisoryLock>,
// }

// #[derive(Debug, Clone)]
// pub struct EpollDesc {
// pub mode: i32,
// pub registered_fds: interface::RustHashMap<i32, EpollEvent>,
// pub advlock: interface::RustRfc<interface::AdvisoryLock>,
// pub errno: i32,
// pub flags: i32,
// }

// pub type FdTable = Vec<interface::RustRfc<interface::RustLock<Option<FileDescriptor>>>>;

#[derive(Debug)]
pub struct Cage {
pub cageid: u64,
pub cwd: interface::RustLock<interface::RustRfc<interface::RustPathBuf>>,
pub parent: u64,
// pub filedescriptortable: FdTable,
pub cancelstatus: interface::RustAtomicBool,
pub getgid: interface::RustAtomicI32,
pub getuid: interface::RustAtomicI32,
Expand All @@ -91,41 +36,10 @@ pub struct Cage {
pub pendingsigset: interface::RustHashMap<u64, interface::RustAtomicU64>,
pub main_threadid: interface::RustAtomicU64,
pub interval_timer: interface::IntervalTimer,
pub vmmap: Vmmap,
}

impl Cage {
// pub fn get_next_fd(
// &self,
// startfd: Option<i32>,
// ) -> (
// i32,
// Option<interface::RustLockWriteGuard<Option<FileDescriptor>>>,
// ) {
// let start = match startfd {
// Some(startfd) => startfd,
// None => STARTINGFD,
// };

// // let's get the next available fd number. The standard says we need to return the lowest open fd number.
// for fd in start..MAXFD {
// let fdguard = self.filedescriptortable[fd as usize].try_write();
// if let Some(ref fdopt) = fdguard {
// // we grab the lock here and if there is no occupied cage, we return the fdno and guard while keeping the fd slot locked
// if fdopt.is_none() {
// return (fd, fdguard);
// }
// }
// }
// return (
// syscall_error(
// Errno::ENFILE,
// "get_next_fd",
// "no available file descriptor number could be found",
// ),
// None,
// );
// }

pub fn changedir(&self, newdir: interface::RustPathBuf) {
let newwd = interface::RustRfc::new(normpath(newdir, self));
let mut cwdbox = self.cwd.write();
Expand All @@ -152,61 +66,4 @@ impl Cage {
}
}

// pub fn get_filedescriptor(
// &self,
// fd: i32,
// ) -> Result<interface::RustRfc<interface::RustLock<Option<FileDescriptor>>>, ()> {
// if (fd < 0) || (fd >= MAXFD) {
// Err(())
// } else {
// Ok(self.filedescriptortable[fd as usize].clone())
// }
// }
}

// pub fn init_fdtable() -> FdTable {
// let mut fdtable = Vec::new();
// // load lower handle stubs
// let stdin = interface::RustRfc::new(interface::RustLock::new(Some(FileDescriptor::Stream(
// StreamDesc {
// position: 0,
// stream: 0,
// flags: O_RDONLY,
// advlock: interface::RustRfc::new(interface::AdvisoryLock::new()),
// },
// ))));
// let stdout = interface::RustRfc::new(interface::RustLock::new(Some(FileDescriptor::Stream(
// StreamDesc {
// position: 0,
// stream: 1,
// flags: O_WRONLY,
// advlock: interface::RustRfc::new(interface::AdvisoryLock::new()),
// },
// ))));
// let stderr = interface::RustRfc::new(interface::RustLock::new(Some(FileDescriptor::Stream(
// StreamDesc {
// position: 0,
// stream: 2,
// flags: O_WRONLY,
// advlock: interface::RustRfc::new(interface::AdvisoryLock::new()),
// },
// ))));
// fdtable.push(stdin);
// fdtable.push(stdout);
// fdtable.push(stderr);

// for _fd in 3..MAXFD as usize {
// fdtable.push(interface::RustRfc::new(interface::RustLock::new(None)));
// }
// fdtable
// }

// pub fn create_unix_sockpipes() -> (
// interface::RustRfc<interface::EmulatedPipe>,
// interface::RustRfc<interface::EmulatedPipe>,
// ) {
// let pipe1 = interface::RustRfc::new(interface::new_pipe(UDSOCK_CAPACITY));
// let pipe2 = interface::RustRfc::new(interface::new_pipe(UDSOCK_CAPACITY));

// (pipe1, pipe2)
// }
2 changes: 2 additions & 0 deletions src/safeposix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ pub mod filesystem;
pub mod net;
pub mod shm;
pub mod syscalls;
pub mod vmmap;
pub mod vmmap_constants;
Loading
Loading