bryancall commented on code in PR #13610: URL: https://github.com/apache/trafficserver/pull/13610#discussion_r3915758945
########## CMakeLists.txt: ########## @@ -449,6 +450,23 @@ elseif(ENABLE_TSAN) add_link_options(-g -fsanitize=thread) endif() +# UndefinedBehaviorSanitizer. Deliberately not part of the either/or chain above: +# UBSan instruments arithmetic, shifts, and type loads rather than replacing the +# allocator or the thread runtime, so it composes with an asan build +# (-fsanitize=address,undefined) as well as standing on its own. +# +# vptr is excluded. It 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 the check reports the plugin boundary rather than a real bug. +# +# Findings are non-fatal by default so a single run reports every distinct site +# instead of stopping at the first. Set UBSAN_OPTIONS=halt_on_error=1 at runtime +# to abort instead, which is what a gating job would want. +if(ENABLE_UBSAN) + add_compile_options(-g -fsanitize=undefined -fno-sanitize=vptr -fno-omit-frame-pointer) + add_link_options(-g -fsanitize=undefined -fno-sanitize=vptr) Review Comment: `-fno-sanitize=vptr` is a negative flag, so disabling a check that does not apply to C is accepted rather than rejected. Verified on both toolchains: the tree has 3 C object rules and all 3 build with the flag under clang 22, and GCC 16 compiled 55 objects (C and C++) before failing at link for an unrelated reason. `clang -fsanitize=undefined -fno-sanitize=vptr -c t.c` and the gcc equivalent both exit 0. Leaving it applied to both languages keeps this block the same shape as the asan and tsan blocks above it. -- 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]
