mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-18 03:56:42 +00:00
Remove redundant empty page in init stack
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
c335873d12
commit
c778e0c07c
@ -176,14 +176,9 @@ impl InitStack {
|
|||||||
ldso_load_info: &Option<LdsoLoadInfo>,
|
ldso_load_info: &Option<LdsoLoadInfo>,
|
||||||
aux_vec: &mut AuxVec,
|
aux_vec: &mut AuxVec,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
// write a zero page. When a user program tries to read a cstring(like argv) from init stack,
|
// FIXME: Some OSes may put the first page of excutable file here
|
||||||
// it will typically read 4096 bytes and then find the first '\0' in the buffer
|
// for interpreting elf headers.
|
||||||
// (we now read 128 bytes, which is set by MAX_FILENAME_LEN).
|
|
||||||
// If we don't have this zero page, the read may go into guard page,
|
|
||||||
// which will cause unrecoverable page fault(The guard page is not backed up by any vmo).
|
|
||||||
// So we add a zero page here, to ensure the read will not go into guard page.
|
|
||||||
// FIXME: Some other OSes put the first page of excutable file here.
|
|
||||||
self.write_bytes(&[0u8; PAGE_SIZE], root_vmar)?;
|
|
||||||
// write envp string
|
// write envp string
|
||||||
let envp_pointers = self.write_envp_strings(root_vmar)?;
|
let envp_pointers = self.write_envp_strings(root_vmar)?;
|
||||||
// write argv string
|
// write argv string
|
||||||
|
Reference in New Issue
Block a user