diff --git a/board/qca/arm/common/cmd_bootqca.c b/board/qca/arm/common/cmd_bootqca.c index a787d556bf..d1a5ad068d 100644 --- a/board/qca/arm/common/cmd_bootqca.c +++ b/board/qca/arm/common/cmd_bootqca.c @@ -82,6 +82,7 @@ typedef struct { void __stack_chk_fail(void) { printf("stack-protector: U-boot stack is corrupted.\n"); + bad_mode (); } /* * Set the root device and bootargs for mounting root filesystem. diff --git a/common/cmd_boot.c b/common/cmd_boot.c index 8f2e0701b5..ad5fcdf050 100644 --- a/common/cmd_boot.c +++ b/common/cmd_boot.c @@ -44,6 +44,25 @@ static int do_go(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) printf ("## Application terminated, rc = 0x%lX\n", rc); return rcode; } +static int do_canary(cmd_tbl_t *cmdtp, int flag, int argc, + char * const argv[]) +{ + char Buffer[10] = {'\0'}; + printf("Stack Canary test start.\n"); + + if (argc < 2 || argc > 2) + return CMD_RET_USAGE; + + strlcpy(Buffer, argv[1], strlen(argv[1])); + + return 0; +} + +U_BOOT_CMD( + canary, 2, 0, do_canary, + "test stack canary", + "\n canary HelloworldHelloWorld \n" +); /* -------------------------------------------------------------------- */