mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-14 07:46:48 +00:00
Fix panic in mmap
by invalid perms
This commit is contained in:
parent
8421046dba
commit
fc895c5697
@ -24,7 +24,7 @@ pub fn sys_mmap(
|
|||||||
offset: u64,
|
offset: u64,
|
||||||
ctx: &Context,
|
ctx: &Context,
|
||||||
) -> Result<SyscallReturn> {
|
) -> Result<SyscallReturn> {
|
||||||
let perms = VmPerms::from_posix_prot_bits(perms as u32).unwrap();
|
let perms = VmPerms::from_bits_truncate(perms as u32);
|
||||||
let option = MMapOptions::try_from(flags as u32)?;
|
let option = MMapOptions::try_from(flags as u32)?;
|
||||||
let res = do_sys_mmap(
|
let res = do_sys_mmap(
|
||||||
addr as usize,
|
addr as usize,
|
||||||
|
@ -16,12 +16,6 @@ bitflags! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl VmPerms {
|
|
||||||
pub fn from_posix_prot_bits(bits: u32) -> Option<Self> {
|
|
||||||
VmPerms::from_bits(bits)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<Rights> for VmPerms {
|
impl From<Rights> for VmPerms {
|
||||||
fn from(rights: Rights) -> VmPerms {
|
fn from(rights: Rights) -> VmPerms {
|
||||||
let mut vm_perm = VmPerms::empty();
|
let mut vm_perm = VmPerms::empty();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user