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

PR for Rawposix(dispatcher.rs, fs_call.rs, misc.rs) #47

Merged
merged 41 commits into from
Nov 11, 2024
Merged

Conversation

robinyuan1002
Copy link

@robinyuan1002 robinyuan1002 commented Oct 1, 2024

  1. modify dispatcher.rs and type.rs to support argument type conversion, mention we have three special syscall fork/exec/exit with used by wasmtime so it won't pass the regular dispatcher path.

  2. add implementation of futex and nanosleep.

Copy link
Member

@Yaxuan-w Yaxuan-w left a comment

Choose a reason for hiding this comment

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

Great work! Minor suggestions. I think we should first merge the porting_fdtables branch to this before we merge this to main

src/interface/misc.rs Outdated Show resolved Hide resolved
src/safeposix/syscalls/fs_calls.rs Outdated Show resolved Hide resolved
src/safeposix/syscalls/net_calls.rs Outdated Show resolved Hide resolved
@robinyuan1002 robinyuan1002 requested a review from Yaxuan-w October 1, 2024 20:02
src/interface/misc.rs Outdated Show resolved Hide resolved
@robinyuan1002 robinyuan1002 requested a review from Yaxuan-w October 2, 2024 03:06
Copy link
Member

@Yaxuan-w Yaxuan-w left a comment

Choose a reason for hiding this comment

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

Code looks great now! Minor suggestions to the instructions of PR to be more specific. Great job

src/lib.rs Outdated
}
}

pub fn lind_fork(parent_cageid: u64, child_cageid: u64) -> i32 {
Copy link
Member

Choose a reason for hiding this comment

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

add comments to explain why those three are special

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought we were removing these?

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO all of this should just be consolidated through the dispatcher, and if not it needs a comment with a good reason.

Copy link
Contributor

@qianxichen233 qianxichen233 Nov 4, 2024

Choose a reason for hiding this comment

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

These functions in lib.rs (e.g. lind_fork, lind_exit, lind_exec) are used by multi-process in wasmtime for better readability. Since fork, exit and exec syscall is intercepted and handled internally within wasmtime, so I write a wrapper for these three syscalls. In this way, when I need to call the rawposix fork in clone syscall in wasmtime, I can use lind_fork instead of something like lind_syscall_api(cageid, 68, ..., child_cageid, NOTUSED, NOTUSED, ...), which looks a little bit redundent

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we use lind_syscall_api everywhere else? I see no reason to do this or why the other functions were moved out of the dispatcher. The lib.rs file should look as it did before.

Copy link
Contributor

Choose a reason for hiding this comment

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

lib.rs is now cleaned up

@@ -641,4 +641,4 @@ pub fn kernel_select(
};

return result;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

still needs newline

src/interface/types.rs Outdated Show resolved Hide resolved
@rennergade
Copy link
Contributor

I think besides some minutiae the biggest thing here is figuring out whats going on in lib.rs I'm still very confused about that.

robinyuan1002 and others added 2 commits November 4, 2024 13:46
Cargo.toml Outdated Show resolved Hide resolved
@@ -201,252 +176,655 @@ pub extern "C" fn rustposix_thread_init(cageid: u64, signalflag: u64) {
interface::signalflag_set(signalflag);
}

/// The `lind_syscall_api` function acts as the central handler for executing various system calls
Copy link
Contributor

Choose a reason for hiding this comment

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

this isn't a very helpful comment, can you talk more about how this function works and less about Lind as a whole?

Copy link
Contributor

Choose a reason for hiding this comment

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

updated

Copy link
Contributor

@rennergade rennergade left a comment

Choose a reason for hiding this comment

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

I think the syscall api comment needs to be more informative. Perhaps @qianxichen233 can help. Other than that you need to fix the merge conflict then its good to go.

@@ -137,7 +142,6 @@ macro_rules! get_onearg {
}
};
}

//this macro takes in a syscall invocation name (i.e. cage.fork_syscall), and all of the arguments
Copy link
Contributor

Choose a reason for hiding this comment

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

do we not use these macros anymore? if not we should remove them

let buf = (start_address + arg2) as *const u8;
let count = arg3 as usize;
interface::check_cageid(cageid);
unsafe {
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't realize we were using unsafe to do all these calls, I think this is probably bad. Why do we do this?

Copy link
Contributor

@rennergade rennergade left a comment

Choose a reason for hiding this comment

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

Approved!

@rennergade rennergade merged commit 2052478 into main Nov 11, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants