mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-24 09:53:24 +00:00
Set process executable path to interpreter path
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
15f3e46e3b
commit
bf961756b9
@ -38,7 +38,7 @@ impl PosixThreadExt for Thread {
|
||||
let fs_path = FsPath::new(AT_FDCWD, executable_path)?;
|
||||
fs_resolver.lookup(&fs_path)?
|
||||
};
|
||||
let elf_load_info =
|
||||
let (_, elf_load_info) =
|
||||
load_program_to_root_vmar(root_vmar, elf_file, argv, envp, fs_resolver, 1)?;
|
||||
|
||||
let vm_space = root_vmar.vm_space().clone();
|
||||
|
@ -24,7 +24,7 @@ pub fn load_program_to_root_vmar(
|
||||
envp: Vec<CString>,
|
||||
fs_resolver: &FsResolver,
|
||||
recursion_limit: usize,
|
||||
) -> Result<ElfLoadInfo> {
|
||||
) -> Result<(String, ElfLoadInfo)> {
|
||||
let abs_path = elf_file.abs_path();
|
||||
let vnode = elf_file.vnode();
|
||||
let file_header = {
|
||||
@ -54,5 +54,5 @@ pub fn load_program_to_root_vmar(
|
||||
}
|
||||
let elf_load_info =
|
||||
load_elf_to_root_vmar(root_vmar, &*file_header, elf_file, fs_resolver, argv, envp)?;
|
||||
Ok(elf_load_info)
|
||||
Ok((abs_path, elf_load_info))
|
||||
}
|
||||
|
@ -114,10 +114,11 @@ fn do_execve(
|
||||
// load elf content to new vm space
|
||||
let fs_resolver = &*current.fs().read();
|
||||
debug!("load program to root vmar");
|
||||
let elf_load_info = load_program_to_root_vmar(root_vmar, elf_file, argv, envp, fs_resolver, 1)?;
|
||||
let (new_executable_path, elf_load_info) =
|
||||
load_program_to_root_vmar(root_vmar, elf_file, argv, envp, fs_resolver, 1)?;
|
||||
debug!("load elf in execve succeeds");
|
||||
// set executable path
|
||||
*current.executable_path().write() = executable_path;
|
||||
*current.executable_path().write() = new_executable_path;
|
||||
// set signal disposition to default
|
||||
current.sig_dispositions().lock().inherit();
|
||||
// set cpu context to default
|
||||
|
Reference in New Issue
Block a user