[PATCH v2] audit: Force audit_context() to be always inlined
From: Jinjie Ruan
Date: Tue Jul 21 2026 - 00:01:19 EST
commit 6f25517010dd ("entry: Rework syscall_audit_enter()") relies on
dead code elimination to remove the call to syscall_enter_audit() when
CONFIG_AUDITSYSCALL is disabled. However, with s390 GCC 13.4.0 +
CONFIG_KASAN, audit_context() is not inlined despite being marked
inline, causing an undefined reference to syscall_enter_audit().
Force audit_context() to be __always_inline to ensure the conditional
can be constant-folded and dead code elimination works correctly.
Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
Suggested-by: Thomas Gleixner <tglx@xxxxxxxxxx>
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-kbuild-all/202607181530.2nx8zb3J-lkp@xxxxxxxxx/
---
include/linux/audit.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 45abb3722d30..d79df1b75e74 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -343,7 +343,7 @@ static inline void audit_set_context(struct task_struct *task, struct audit_cont
task->audit_context = ctx;
}
-static inline struct audit_context *audit_context(void)
+static __always_inline struct audit_context *audit_context(void)
{
return current->audit_context;
}
@@ -623,7 +623,7 @@ static inline bool audit_dummy_context(void)
}
static inline void audit_set_context(struct task_struct *task, struct audit_context *ctx)
{ }
-static inline struct audit_context *audit_context(void)
+static __always_inline struct audit_context *audit_context(void)
{
return NULL;
}
--
2.34.1