1 /*- 2 * Copyright (c) 2023 Dmitry Chagin <dchagin@FreeBSD.org> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7 #include <sys/systm.h> 8 #include <vm/vm_param.h> 9 10 #include <atf-c.h> 11 12 extern int checkstack(void); 13 14 static int jumpstack0(void) __noinline; 15 static int jumpstack1(void) __noinline; 16 17 18 static int 19 jumpstack0(void) 20 { 21 char stack[SGROWSIZ]; 22 23 explicit_bzero(stack, sizeof(stack)); 24 return (checkstack()); 25 } 26 27 static int 28 jumpstack1(void) 29 { 30 char stack[SGROWSIZ * 2]; 31 32 explicit_bzero(stack, sizeof(stack)); 33 return (checkstack()); 34 } 35 36 ATF_TC_WITHOUT_HEAD(dt_need_test); 37 ATF_TC_BODY(dt_need_test, tc) 38 { 39 40 ATF_REQUIRE(jumpstack0() == 0); 41 ATF_REQUIRE(jumpstack1() == 0); 42 } 43 44 ATF_TP_ADD_TCS(tp) 45 { 46 47 ATF_TP_ADD_TC(tp, dt_need_test); 48 49 return (atf_no_error()); 50 } 51