Commit 7572c80
Add ASan/TSan/Valgrind configs and GitHub Actions CI (#21)
* Add ASan/TSan/Valgrind configs and GitHub Actions CI
Add `--config=asan`, `--config=tsan` and `--config=valgrind` to
.bazelrc, mirroring the configuration used by the dallison/co
coroutines repository.
Add a GitHub Actions workflow that builds and tests on
ubuntu-latest, ubuntu-24.04-arm and macos-latest, plus dedicated
sanitizer and Valgrind jobs on Linux.
Bump coroutines to 3.3.1 to pick up the matching sanitizer / fiber
cooperation hooks.
Fix a heap-buffer-overflow in sockets_test caught by ASan: the UDP
unicast and broadcast tests called std::strcmp on a Receive_buffer
sized exactly TEST_DATA.size(), which has no NUL terminator. The
preceding ASSERT_EQ on a string_view already validates the bytes
fully, so the strcmp calls are redundant and have been removed.
* Fix CI failures for ASan, TSan, Valgrind and macOS sockets
- payload_buffer_test: zero backing storage with calloc so Hexdump does not
read uninitialized padding under Memcheck. Tear down the resizable-buffer
test with an explicit destructor plus free() after realloc, fixing ASan
alloc-dealloc-mismatch from operator delete on malloc/realloc storage.
- pipe_test: compare fixed-length pipe reads with std::string_view instead of
ASSERT_STREQ/strcmp on non-NUL-terminated buffers. Skip the high-iteration
OverFull stress tests under TSan where the sanitizer hits nested DEADLYSIGNAL
on many fiber switches.
- sockets_test: skip UDP broadcast and multicast loopback tests on Apple
platforms where GitHub Actions macOS runners reject or drop those packets.
* Free backing storage in small-block PayloadBuffer tests
SmallBlockAllocSimple, SmallBlockAlloc, and SmallBlockAllocFree used
placement-new into calloc storage but never destroyed the object or
released the block, which Valgrind reported as definitely lost. Tear
down with an explicit destructor and free().
* Fix VectorHeader/pointer invalidation after buffer relocation
PayloadBuffer's VectorPush, VectorReserve, VectorResize, Realloc,
PrimeBitmapAllocator, and BitMapRun::Allocate all dereferenced pointers
into the buffer (hdr, p) after Allocate/Realloc/AllocateBitMapRun calls
that may have relocated the underlying buffer, leaving those pointers
dangling. Save the offset before any allocation and re-derive the
pointer afterward across all six call sites.
Also drop a leftover write through the dangling hdr in VectorPush that
slipped through a previous partial fix.
Add VectorPushWithResize, VectorReserveWithResize, and
VectorResizeWithResize regression tests that drive the resizer with a
small (256-byte) resizable buffer and verify data integrity afterward.
The existing tests all used fixed-size buffers and could not trigger
the bug.
Original fix by Damian Stulich <damjan.stulic@getcruise.com>.1 parent 22b987b commit 7572c80
9 files changed
Lines changed: 586 additions & 230 deletions
File tree
- .github/workflows
- toolbelt
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | 1 | | |
9 | 2 | | |
10 | 3 | | |
11 | 4 | | |
12 | 5 | | |
13 | 6 | | |
14 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
0 commit comments