Commit dddddb0
committed
Enforce alignment of stinger sub-structures.
STINGER makes one large contiguous allocation, then packs several sub-
structures into this chunk of memory. The alignment of each struct
within the chunk depends on the total length of all the structs and
arrays before it.
According to section 8.1.1 of the Intel® 64 and IA-32 Architectures
Developer's Manual: Vol. 3A, "Accesses to cacheable memory that are
split across cache lines and page boundaries are not guaranteed to be
atomic". Operations like readfe() and writeef() can cause deadlocks
if they operate on pointers to unaligned 64-bit data.
Most sub-structures are composed of int64_t's, so they are aligned
regardless of size. But stinger_names includes char arrays, the
size of which is specified by the configuration variable
STINGER_NAME_STR_MAX, plus one for a null terminator byte. The
default value of 255 works, but changing this value can break the
alignment of the other structures, causing deadlocks.
This patch adds several checks to ensure that the all of the
STINGER sub-structures are aligned to an 8-byte boundary.1 parent 92348d4 commit dddddb0
3 files changed
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
142 | 147 | | |
143 | 148 | | |
144 | 149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
11 | 16 | | |
12 | 17 | | |
13 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
467 | 467 | | |
468 | 468 | | |
469 | 469 | | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
470 | 495 | | |
471 | 496 | | |
472 | 497 | | |
| |||
484 | 509 | | |
485 | 510 | | |
486 | 511 | | |
| 512 | + | |
487 | 513 | | |
488 | 514 | | |
489 | 515 | | |
| 516 | + | |
490 | 517 | | |
491 | 518 | | |
492 | 519 | | |
| 520 | + | |
493 | 521 | | |
494 | 522 | | |
495 | 523 | | |
| 524 | + | |
496 | 525 | | |
497 | 526 | | |
498 | 527 | | |
| 528 | + | |
499 | 529 | | |
500 | 530 | | |
501 | 531 | | |
| 532 | + | |
502 | 533 | | |
503 | 534 | | |
504 | 535 | | |
| |||
0 commit comments