[libc] Cache vdso::TypedSymbol and skip CFI checks (#247804)
vdso::TypedSymbol previously resolved Symbol::get() on every implicit
conversion and call operator. Callers that checked for null before
invoking or reading the pointer ran callonce() and loaded the global
vDSO cache twice per call. Calling kernel vDSO functions through
TypedSymbol::operator() also trapped under -fsanitize=cfi-icall, kcfi,
and function sanitisers because kernel symbols carry no compiler type
hashes.
Cache the resolved pointer in TypedSymbol's constructor so null checks
and calls share a single lookup:
* Add LIBC_NO_SANITIZE_CFI_FUNCTION in sanitizer.h (gating kcfi on
Clang 16+ to stay -Werror clean on older Clang and GCC) and apply it
to TypedSymbol::operator().
* Replace the implicit function-pointer conversion with explicit
operator bool and symmetric nullptr comparisons so callable symbols
always invoke through operator().
* Specialise TypedSymbol<VDSOSym::RTSigReturn> to expose get() without
operator(), and move its lookup inside the !SA_RESTORER branch in
unchecked_sigaction() so read-only queries avoid eager vDSO lookups.
Follows Clang's Control Flow Integrity indirect-call documentation:
https://clang.llvm.org/docs/ControlFlowIntegrity.html
Assisted-by: Automated tooling, human reviewed.