1 /* 2 * Copyright © 2021, Keith Packard <keithp@keithp.com> 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include "picolibc-hooks.h" 8 9 /* This function gets called if static buffer overflow detection is enabled on 10 * stdlib side (Picolibc here), in case such an overflow is detected. Picolibc 11 * provides an implementation not suitable for us, so we override it here. 12 */ __chk_fail(void)13__weak FUNC_NORETURN void __chk_fail(void) 14 { 15 printk("* buffer overflow detected *\n"); 16 z_except_reason(K_ERR_STACK_CHK_FAIL); 17 CODE_UNREACHABLE; 18 } 19