[clang] [HIP] Fix ubsan function checks applied to kernel functions (PR #188872)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 3 09:18:07 PDT 2026


================
@@ -1033,9 +1033,11 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
   }
 
   // If we are checking function types, emit a function type signature as
-  // prologue data.
+  // prologue data. Kernel functions have strict alignment requirements and
+  // cannot be call indirectly so we do not instrument them.
   if (FD && SanOpts.has(SanitizerKind::Function) &&
-      !FD->getType()->isCFIUncheckedCalleeFunctionType()) {
+      !FD->getType()->isCFIUncheckedCalleeFunctionType() &&
+      !Fn->hasKernelCallingConv()) {
----------------
jhuber6 wrote:

I'm not aware of any but I'll double check.

https://github.com/llvm/llvm-project/pull/188872


More information about the cfe-commits mailing list