|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH 3/3] plat/kvm: Fix overwriting on stack for arm64
On arm64, the _libkvmplat_cfg.bstack.end is the memory upper boundary.
Any overflow writing beyond this will cause an exception.
Fix it by writing the thread inside the boundary.
Signed-off-by: Jia He <justin.he@xxxxxxx>
---
plat/kvm/memory.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/plat/kvm/memory.c b/plat/kvm/memory.c
index e96bad2..d84eaed 100644
--- a/plat/kvm/memory.c
+++ b/plat/kvm/memory.c
@@ -181,6 +181,7 @@ int _ukplat_mem_mappings_init(void)
void ukplat_stack_set_current_thread(void *thread_addr)
{
- *((unsigned long *) _libkvmplat_cfg.bstack.end) =
+ unsigned long size = sizeof(thread_addr);
+ *((unsigned long *) _libkvmplat_cfg.bstack.end - size) =
(unsigned long) thread_addr;
}
--
2.17.1
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |