Fix sgx_tprotect_rsrv_mem failure on EDMM-enabled platform

This commit is contained in:
Hui, Chunyang 2023-06-21 07:26:41 +00:00 committed by volcano
parent d4b99fa9c7
commit e574ab65d3

@ -14,7 +14,13 @@ bitflags! {
impl 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 {