Skip to content

Commit 2aee6fe

Browse files
committed
stress-bad-altstack: exercise illegal last page as stack address
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
1 parent bb10c5d commit 2aee6fe

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

stress-bad-altstack.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ static int stress_bad_altstack_child(stress_args_t *args)
122122
struct rlimit rlim;
123123
#endif
124124
void *func_ptr = (void *)stress_stack_sigalt_no_check;
125+
void *last_page = (void *)~(uintptr_t)(args->page_size - 1);
125126

126127
if (sigsetjmp(jmp_env, 1) != 0) {
127128
/*
@@ -203,7 +204,7 @@ static int stress_bad_altstack_child(stress_args_t *args)
203204
retry:
204205
if (UNLIKELY(!stress_continue(args)))
205206
return EXIT_SUCCESS;
206-
rnd = stress_mwc32modn(11);
207+
rnd = stress_mwc32modn(12);
207208
switch (rnd) {
208209
#if defined(HAVE_MPROTECT)
209210
case 1:
@@ -288,6 +289,10 @@ static int stress_bad_altstack_child(stress_args_t *args)
288289
}
289290
#endif
290291
goto retry;
292+
case 11:
293+
/* Illegal last page */
294+
stress_bad_altstack_force_fault(last_page);
295+
goto retry;
291296
default:
292297
case 0:
293298
/* Illegal unmapped stack */

0 commit comments

Comments
 (0)