-
Notifications
You must be signed in to change notification settings - Fork 2
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
update execve #113
base: main
Are you sure you want to change the base?
update execve #113
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Minor suggestions and we can merge dup3 pr after this one
@@ -133,17 +133,8 @@ impl Cage { | |||
/* | |||
* exec() will only return if error happens |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comments about what we're doing here and man page link
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also add how's our exec in rawposix is different from linux and why are we doing in this way
let mainsigsetatomic = self | ||
.sigset | ||
.get( | ||
&self | ||
.main_threadid | ||
.load(interface::RustAtomicOrdering::Relaxed), | ||
) | ||
.unwrap(); | ||
let mainsigset = interface::RustAtomicU64::new( | ||
mainsigsetatomic.load(interface::RustAtomicOrdering::Relaxed), | ||
); | ||
newsigset.insert(0, mainsigset); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should comment out currently
@@ -785,8 +785,20 @@ impl<T: Clone + Send + 'static + std::marker::Sync, U: Clone + Send + 'static + | |||
// to-do: exec should not change the process id/cage id, however, the exec call from rustposix takes an | |||
// argument to change the process id. If we pass the same cageid, it would cause some error | |||
// lind_exec(cloned_pid as u64, cloned_pid as u64); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should delete this comment
interface::cagetable_remove(self.cageid); | ||
|
||
interface::cagetable_insert(child_cageid, newcage); | ||
interface::cagetable_insert(self.cageid, newcage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why choose delete the old cage and create a new one instead of modifying on the existing one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Yaxuan-w and I discussed this previously. I believe she mentioned some data types were difficult to modify. But I think those issues may not exist anymore? I agree it would be better to modify the existing struct if we can.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
she mentioned some data types were difficult to modify.
These're not issues for this version rawposix because all things are in same library.
The issue would raise when splitting type conversion and constants as external libs, since this would cause circular imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quote reply
Reference in new issue
I believe both way works. Must we modify on the existing one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My preference would be to modify the existing struct rather than create a new one. Makes more sense logically as well as in terms of reducing overhead and complexity.
zombies: interface::RustLock::new(cloned_zombies), // when a process exec-ed, its child relationship should be perserved | ||
child_num: interface::RustAtomicU64::new(child_num), | ||
child_num: interface::RustAtomicU64::new(0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
child relationship should be perserved, so child_num should be kept
@@ -133,17 +133,8 @@ impl Cage { | |||
/* | |||
* exec() will only return if error happens |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also add how's our exec in rawposix is different from linux and why are we doing in this way
zombies: interface::RustLock::new(cloned_zombies), // when a process exec-ed, its child relationship should be perserved | ||
child_num: interface::RustAtomicU64::new(child_num), | ||
child_num: interface::RustAtomicU64::new(0), | ||
vmmap: interface::RustLock::new(Vmmap::new()), // memory is cleared after exec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the real memory address should also be cleaned up not just vmmap. Probably need to add an interface in mem.rs to do memory cleanup
This isn't really a great description for the PR, ideally you want to list the changes you made and why |
At a minimum, the rationale for this needs to be thoroughly documented.
So, anyone who reads the code should know exactly why we did it this way
from reading the comments, when we are done.
…On Thu, Feb 20, 2025 at 8:41 PM Nicholas Renner ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/RawPOSIX/src/safeposix/syscalls/sys_calls.rs
<#113 (comment)>
:
> + interface::cagetable_remove(self.cageid);
- interface::cagetable_insert(child_cageid, newcage);
+ interface::cagetable_insert(self.cageid, newcage);
@Yaxuan-w <https://github.com/Yaxuan-w> and I discussed this previously.
I believe she mentioned some data types were difficult to modify. But I
think those issues may not exist anymore? I agree it would be better to
modify the existing struct if we can.
—
Reply to this email directly, view it on GitHub
<#113 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGRODZYJPCG7TEV7WMIWLT2QZ73FAVCNFSM6AAAAABXSB7ABKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDMMZRGYZDGOJYGM>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
@@ -5,3 +5,4 @@ int __execve (const char *__path, char *const __argv[], char *const __envp[]) | |||
{ | |||
return MAKE_SYSCALL(69, "syscall|execve", __path, __argv, __envp, NOTUSED, NOTUSED, NOTUSED); | |||
} | |||
weak_alias (__execve, execve) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make this strong alias rather than weak alias
Is there ever a reason we need to use weak_alias? my understanding is
that this isn't very portable.
…On Fri, Feb 21, 2025 at 3:38 PM Qianxi Chen ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/glibc/sysdeps/unix/sysv/linux/i386/execve.c
<#113 (comment)>
:
> @@ -5,3 +5,4 @@ int __execve (const char *__path, char *const __argv[], char *const __envp[])
{
return MAKE_SYSCALL(69, "syscall|execve", __path, __argv, __envp, NOTUSED, NOTUSED, NOTUSED);
}
+weak_alias (__execve, execve)
let's make this strong alias rather than weak alias
—
Reply to this email directly, view it on GitHub
<#113 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGRODY2FU747C3AABJ3TCT2Q6FFTAVCNFSM6AAAAABXSB7ABKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDMMZUGE3TCNBZHA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I believe in this case both work, but strong alias is the best way |
Some modify with Wasmtime and Rawposix to support execve. So for right now we don't need to change cage anymore, we do exactly the same behavior with linux.