Commit a2be266
committed
zephyr: Protect Zephyr heap metadata from corruption
Zephyr stores heap metadata just before each allocated chunk. This change
ensures metadata for each chunk is stored in its own separate cache line.
So if invalidate/writeback is mistakenly called for non-cached memory,
metadata of a neighboring chunk does not get corrupted.
We already have such size alignment constraints implemented for cached
allocations; this change adds the same size alignment for non-cached
allocations.
This is a workaround for potential problems caused by invalidate/writeback
calls for non-cached memory, which are wrong and should never happen in
well-written code. However, such problems could be easily introduced and
are quite hard to debug.
The trade-off -- we waste an additional cache line for each chunk's
metadata for non-cached allocations (as we already do for cached
allocations).
Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>1 parent 8d44f26 commit a2be266
1 file changed
+14
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
379 | 393 | | |
380 | 394 | | |
381 | 395 | | |
| |||
394 | 408 | | |
395 | 409 | | |
396 | 410 | | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
| |||
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | 473 | | |
479 | 474 | | |
480 | 475 | | |
| |||
0 commit comments