bryancall opened a new pull request, #13610:
URL: https://github.com/apache/trafficserver/pull/13610

   Adds UndefinedBehaviorSanitizer as a build option next to the existing 
`ENABLE_ASAN` and `ENABLE_TSAN`.
   
   ### Why this is not part of the asan/tsan either-or chain
   
   ASAN replaces the allocator and TSAN replaces the thread runtime, so those 
two are mutually exclusive and the existing code enforces that with an 
`if`/`elseif`. UBSan only instruments arithmetic, shifts, and type loads, so it 
composes with either of them. The new block sits outside that chain, which is 
what lets `dev-asan-ubsan` produce `-fsanitize=address,undefined` in a single 
build.
   
   ### Presets
   
   A hidden `ubsan` preset matching the shape of the existing hidden `asan` and 
`tsan` presets, plus two visible ones:
   
   ```
   cmake --preset dev-ubsan
   cmake --preset dev-asan-ubsan
   ```
   
   ### Two deliberate choices
   
   `vptr` is excluded. That check needs a matching `type_info` at every 
polymorphic access, and a plugin loaded with `dlopen` does not reliably share 
type identity with the main image, so it reports the plugin boundary rather 
than a real defect.
   
   Findings are non-fatal, so a single run reports every distinct site instead 
of stopping at the first. Setting `UBSAN_OPTIONS=halt_on_error=1` at runtime 
aborts instead, which is what a gating job would want.
   
   ### No CI job turns this on
   
   Enabling it anywhere would be a separate change. The option is inert until 
someone asks for one of the presets.
   
   ### What it reports on the current tree
   
   For context on whether the option earns its place, on this tree with clang 
22 on Fedora:
   
   * unit tests: 211 runtime errors across 57 distinct sites, with all 179 
tests still passing
   * a full 572 test autest run: 617 distinct sites
   
   Grouping those by root cause collapses them a great deal, and a handful look 
worth fixing. The largest single group is a hasher buffer that is declared as a 
plain `char` array and then has a polymorphic object constructed into it, which 
makes every access through it misaligned on the URL hash and cache key path. 
Another is the plugin entry point, declared at the call site as `void (*)(int, 
char **)` while every plugin in the tree defines `TSPluginInit(int, const char 
*argv[])`.
   
   Those fixes are separate pull requests. This one only adds the option so the 
findings are reproducible.
   
   ### Testing
   
   Configured and built with clang 22 on Fedora 44 using `dev-ubsan` with 
autest and experimental plugins enabled. Build and install both clean, `ctest` 
179/179 passing, and the resulting binary links the UBSan runtime handlers.
   


-- 
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]

Reply via email to