Commit 18d24a3
committed
Replace constant stack canary with per-task random
This commit replaces fixed STACK_CANARY (0x33333333U) with per-task
random canary generated using xorshift32 PRNG. This prevents trivial
canary forgery attacks and significantly improves stack overflow
detection.
The xorshift32 PRNG provides sufficient entropy for embedded systems
without MMU/MPU support. Future enhancements can improve PRNG seeding
with hardware entropy sources.
Close #81 parent bb01758 commit 18d24a3
3 files changed
+23
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
85 | 88 | | |
86 | 89 | | |
87 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
27 | 34 | | |
28 | 35 | | |
29 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | 45 | | |
49 | 46 | | |
50 | 47 | | |
| |||
153 | 150 | | |
154 | 151 | | |
155 | 152 | | |
156 | | - | |
157 | | - | |
| 153 | + | |
| 154 | + | |
158 | 155 | | |
159 | 156 | | |
160 | 157 | | |
161 | | - | |
| 158 | + | |
162 | 159 | | |
163 | 160 | | |
164 | 161 | | |
| |||
544 | 541 | | |
545 | 542 | | |
546 | 543 | | |
547 | | - | |
548 | | - | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
549 | 552 | | |
550 | | - | |
| 553 | + | |
551 | 554 | | |
552 | 555 | | |
553 | 556 | | |
| |||
0 commit comments