File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/hyperlight_host/src/mem Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
1414limitations under the License.
1515*/
1616
17+ use std:: cmp:: Ordering ;
18+
1719use flatbuffers:: FlatBufferBuilder ;
1820use 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
You can’t perform that action at this time.
0 commit comments