Skip to content

Commit fc028c3

Browse files
committed
rt: Move the addition of the stack canary into create_stack
1 parent 5fc2e9e commit fc028c3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/rt/rust_stack.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@ struct stk_seg {
1313
uint8_t data[];
1414
};
1515

16+
void
17+
add_stack_canary(stk_seg *stk);
18+
1619
template <class T>
1720
stk_seg *
1821
create_stack(T allocer, size_t sz) {
1922
size_t total_sz = sizeof(stk_seg) + sz;
2023
stk_seg *stk = (stk_seg *)allocer->malloc(total_sz, "stack");
2124
memset(stk, 0, sizeof(stk_seg));
25+
add_stack_canary(stk);
2226
stk->end = (uintptr_t) &stk->data[sz];
2327
return stk;
2428
}
@@ -35,9 +39,6 @@ config_valgrind_stack(stk_seg *stk);
3539
void
3640
unconfig_valgrind_stack(stk_seg *stk);
3741

38-
void
39-
add_stack_canary(stk_seg *stk);
40-
4142
void
4243
check_stack_canary(stk_seg *stk);
4344

src/rt/rust_task.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,6 @@ rust_task::new_stack(size_t requested_sz) {
593593
size_t sz = rust_stk_sz + RED_ZONE_SIZE;
594594
stk_seg *new_stk = create_stack(this, sz);
595595
LOGPTR(thread, "new stk", (uintptr_t)new_stk);
596-
add_stack_canary(new_stk);
597596
new_stk->prev = NULL;
598597
new_stk->next = stk;
599598
LOGPTR(thread, "stk end", new_stk->end);

0 commit comments

Comments
 (0)