Fix sgx_tprotect_rsrv_mem failure on EDMM-enabled platform
This commit is contained in:
parent
d4b99fa9c7
commit
e574ab65d3
@ -14,7 +14,13 @@ bitflags! {
|
|||||||
|
|
||||||
impl VMPerms {
|
impl VMPerms {
|
||||||
pub fn from_u32(bits: u32) -> Result<VMPerms> {
|
pub fn from_u32(bits: u32) -> Result<VMPerms> {
|
||||||
Self::from_bits(bits).ok_or_else(|| errno!(EINVAL, "invalid bits"))
|
let mut perms = Self::from_bits(bits).ok_or_else(|| errno!(EINVAL, "invalid bits"))?;
|
||||||
|
|
||||||
|
// SGX SDK doesn't accept permissions like write or exec without read.
|
||||||
|
if perms != VMPerms::NONE {
|
||||||
|
perms |= VMPerms::READ
|
||||||
|
}
|
||||||
|
Ok(perms)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn can_read(&self) -> bool {
|
pub fn can_read(&self) -> bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user