Skip to content

Commit 39ffd29

Browse files
tw4452852wenlingz
authored andcommitted
schedule: add magic number at the bottom of schedule stack
Add this magic number to prevent potential overflow when dumping host stack. Tracked-On: #2455 Signed-off-by: Tw <wei.tan@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent efc64d7 commit 39ffd29

File tree

1 file changed

+2
-0
lines changed
  • hypervisor/arch/x86/guest

1 file changed

+2
-0
lines changed

hypervisor/arch/x86/guest/vcpu.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <schedule.h>
99
#include <security.h>
1010
#include <virtual_cr.h>
11+
#include <init.h>
1112

1213
inline uint64_t vcpu_get_gpreg(const struct acrn_vcpu *vcpu, uint32_t reg)
1314
{
@@ -637,6 +638,7 @@ static uint64_t build_stack_frame(struct acrn_vcpu *vcpu)
637638
rsp &= ~(CPU_STACK_ALIGN - 1UL);
638639
sp = (uint64_t *)rsp;
639640

641+
*sp-- = SP_BOTTOM_MAGIC;
640642
*sp-- = (uint64_t)run_sched_thread; /*return address*/
641643
*sp-- = 0UL; /* flag */
642644
*sp-- = 0UL; /* rbx */

0 commit comments

Comments
 (0)