rt: Don't check the stack canary on most upcalls
This commit is contained in:
@@ -133,6 +133,9 @@ static stk_seg*
|
|||||||
new_stk(rust_scheduler *sched, rust_task *task, size_t requested_sz)
|
new_stk(rust_scheduler *sched, rust_task *task, size_t requested_sz)
|
||||||
{
|
{
|
||||||
LOG(task, mem, "creating new stack for task %" PRIxPTR, task);
|
LOG(task, mem, "creating new stack for task %" PRIxPTR, task);
|
||||||
|
if (task->stk) {
|
||||||
|
check_stack_canary(task->stk);
|
||||||
|
}
|
||||||
|
|
||||||
// The minimum stack size, in bytes, of a Rust stack, excluding red zone
|
// The minimum stack size, in bytes, of a Rust stack, excluding red zone
|
||||||
size_t min_sz = get_min_stk_size(sched->min_stack_size);
|
size_t min_sz = get_min_stk_size(sched->min_stack_size);
|
||||||
|
|||||||
@@ -27,18 +27,12 @@ check_stack_alignment() __attribute__ ((aligned (16)));
|
|||||||
static void check_stack_alignment() { }
|
static void check_stack_alignment() { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline void
|
|
||||||
do_sanity_check(rust_task *task) {
|
|
||||||
check_stack_alignment();
|
|
||||||
task->check_stack_canary();
|
|
||||||
}
|
|
||||||
|
|
||||||
#define UPCALL_SWITCH_STACK(A, F) call_upcall_on_c_stack((void*)A, (void*)F)
|
#define UPCALL_SWITCH_STACK(A, F) call_upcall_on_c_stack((void*)A, (void*)F)
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
call_upcall_on_c_stack(void *args, void *fn_ptr) {
|
call_upcall_on_c_stack(void *args, void *fn_ptr) {
|
||||||
|
check_stack_alignment();
|
||||||
rust_task *task = rust_scheduler::get_task();
|
rust_task *task = rust_scheduler::get_task();
|
||||||
do_sanity_check(task);
|
|
||||||
rust_scheduler *sched = task->sched;
|
rust_scheduler *sched = task->sched;
|
||||||
sched->c_context.call_shim_on_c_stack(args, fn_ptr);
|
sched->c_context.call_shim_on_c_stack(args, fn_ptr);
|
||||||
}
|
}
|
||||||
@@ -55,7 +49,6 @@ extern "C" void record_sp(void *limit);
|
|||||||
extern "C" CDECL void
|
extern "C" CDECL void
|
||||||
upcall_call_shim_on_c_stack(void *args, void *fn_ptr) {
|
upcall_call_shim_on_c_stack(void *args, void *fn_ptr) {
|
||||||
rust_task *task = rust_scheduler::get_task();
|
rust_task *task = rust_scheduler::get_task();
|
||||||
do_sanity_check(task);
|
|
||||||
|
|
||||||
// FIXME (1226) - The shim functions generated by rustc contain the
|
// FIXME (1226) - The shim functions generated by rustc contain the
|
||||||
// morestack prologue, so we need to let them know they have enough
|
// morestack prologue, so we need to let them know they have enough
|
||||||
@@ -645,9 +638,7 @@ upcall_del_stack() {
|
|||||||
extern "C" CDECL void
|
extern "C" CDECL void
|
||||||
upcall_reset_stack_limit() {
|
upcall_reset_stack_limit() {
|
||||||
rust_task *task = rust_scheduler::get_task();
|
rust_task *task = rust_scheduler::get_task();
|
||||||
do_sanity_check(task);
|
|
||||||
task->reset_stack_limit();
|
task->reset_stack_limit();
|
||||||
task->check_stack_canary();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user