vmbase: Write string terminator to stack canary
Writes a null byte to the top of the stack canary, making it
act as a string terminator, for protection against unterminated string
reads.
Bug: 265778654
Test: atest vmbase_example.integration_test
Change-Id: I45452fbfca942569743c3d556cab027bd6d80a04
diff --git a/vmbase/entry.S b/vmbase/entry.S
index ab46465..408f5d1 100644
--- a/vmbase/entry.S
+++ b/vmbase/entry.S
@@ -225,6 +225,9 @@
adr_l x30, __stack_chk_guard
str x29, [x30]
+ /* Write a null byte to the top of the stack guard to act as a string terminator. */
+ strb wzr, [x30]
+
/* Call into Rust code. */
bl rust_entry