Skip to content

Commit daac8fa

Browse files
committed
fix
Signed-off-by: Simon Davies <[email protected]>
1 parent 7a4b6d1 commit daac8fa

File tree

1 file changed

+7
-1
lines changed
  • src/hyperlight_host/src/mem

1 file changed

+7
-1
lines changed

src/hyperlight_host/src/mem/mgr.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
use std::cmp::Ordering;
18+
1719
use flatbuffers::FlatBufferBuilder;
1820
use hyperlight_common::flatbuffer_wrappers::function_call::{
1921
FunctionCall, validate_guest_function_call_buffer,
@@ -309,7 +311,11 @@ impl SandboxMemoryManager<HostSharedMemory> {
309311
/// of why it isn't.
310312
#[instrument(err(Debug), skip_all, parent = Span::current(), level= "Trace")]
311313
pub(crate) fn check_stack_guard(&self) -> Result<bool> {
312-
Ok(true)
314+
let expected = self.stack_cookie;
315+
let offset = self.layout.get_top_of_user_stack_offset();
316+
let actual: [u8; STACK_COOKIE_LEN] = self.shared_mem.read(offset)?;
317+
let cmp_res = expected.iter().cmp(actual.iter());
318+
Ok(cmp_res == Ordering::Equal)
313319
}
314320

315321
/// Get the address of the dispatch function in memory

0 commit comments

Comments
 (0)