ubsan: Avoid i386 UBSAN handler crashes with Clang
authorKees Cook <keescook@chromium.org>
Wed, 24 Apr 2024 22:40:29 +0000 (15:40 -0700)
committerKees Cook <keescook@chromium.org>
Wed, 24 Apr 2024 22:45:38 +0000 (15:45 -0700)
commit2e431b23a13ce4459cf484c8f0b3218c7048b515
treed1946fc55676c51e2b83fb1ffc4bd4fe102e6c60
parentc209826737b733b4ccd38448d7b025bb128aaa8a
ubsan: Avoid i386 UBSAN handler crashes with Clang

When generating Runtime Calls, Clang doesn't respect the -mregparm=3
option used on i386. Hopefully this will be fixed correctly in Clang 19:
https://github.com/llvm/llvm-project/pull/89707
but we need to fix this for earlier Clang versions today. Force the
calling convention to use non-register arguments.

Reported-by: Erhard Furtner <erhard_f@mailbox.org>
Closes: https://github.com/KSPP/linux/issues/350
Link: https://lore.kernel.org/r/20240424224026.it.216-kees@kernel.org
Acked-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Justin Stitt <justinstitt@google.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
lib/ubsan.h