]>
Commit | Line | Data |
---|---|---|
4e9bce12 JP |
1 | // SPDX-License-Identifier: GPL-2.0+ |
2 | /* | |
3 | * Copyright 2021 Broadcom | |
4 | */ | |
5 | ||
6 | #include <common.h> | |
7 | #include <command.h> | |
8 | ||
9 | static int do_test_stackprot_fail(struct cmd_tbl *cmdtp, int flag, int argc, | |
10 | char *const argv[]) | |
11 | { | |
2fc62f29 TR |
12 | /* |
13 | * In order to avoid having the compiler optimize away the stack smashing | |
14 | * we need to do a little something here. | |
15 | */ | |
4e9bce12 JP |
16 | char a[128]; |
17 | ||
18 | memset(a, 0xa5, 512); | |
2fc62f29 TR |
19 | |
20 | printf("We have smashed our stack as this should not exceed 128: sizeof(a) = %ld\n", strlen(a)); | |
21 | ||
4e9bce12 JP |
22 | return 0; |
23 | } | |
24 | ||
25 | U_BOOT_CMD(stackprot_test, 1, 1, do_test_stackprot_fail, | |
26 | "test stack protector fail", ""); |