bryancall opened a new pull request, #14123: URL: https://github.com/apache/trafficserver/pull/14123
`DiscreteSpace::remove()` destroyed a node before taking it out of the red-black tree. `FixedArena::destroy()` runs the destructor and then writes its free list link over the start of the node, which is the vtable pointer, so the `node->remove()` call that followed was a member call on a destroyed object. The tree links survive the destroy, so every result was still correct, but UBSan's vptr check reports it: ``` DiscreteRange.h:1281:43: runtime error: member call on address 0x7d4ba13e15c0 which does not point to an object of type 'RBNode' ``` The order was reversed in [#12055](https://github.com/apache/trafficserver/pull/12055) when `remove()` gained its `update_tree` parameter for `mark_bulk()`. Upstream libswoc takes the node out of the tree before destroying it. This change does the same: unlink first, then destroy. The `update_tree == false` path used by `mark_bulk()` is unchanged. This was found while testing the fuzzer in [#13903](https://github.com/apache/trafficserver/pull/13903) with OSS-Fuzz's sanitizer flags. Testing: a new libswoc unit test marks `0.0.0.0/0` over three existing ranges, which removes their nodes through `remove()`, then erases a range and checks the result. The test only fails under UBSan with the vptr check on and recovery off. Built with gcc and `-fsanitize=address,undefined,vptr -fno-sanitize-recover=undefined,vptr`, it fails on master with the report above and passes with this change. ATS's own `ENABLE_UBSAN` turns the vptr check off, so CI will not catch a regression of this. The full ctest suite passes in an ASAN build, as does Uranium apart from two `test_stop_listening_sigterm_exits` cases that fail the same way on master under ASAN. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
