Skip to content

Commit

Permalink
Add security checks in ualloc()
Browse files Browse the repository at this point in the history
Check that the memory allocated is page-aligned, and that the end of
the returned memory is not inside the enclave.
  • Loading branch information
lkatalin committed Mar 31, 2020
1 parent 807c640 commit 81949c2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion enarx-keep-sgx-shim/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ impl<'a> Handler<'a> {
)
};

if self.enclave.contains(&ret) {
// Make sure the allocated memory is page-aligned and outside of the enclave.
if self.enclave.contains(&ret) || self.enclave.contains(&(ret + bytes)) || ret & 0xfff != 0
{
self.attacked();
}

Expand Down

0 comments on commit 81949c2

Please sign in to comment.