* [PATCH v2] audit: Force audit_context() to be always inlined
@ 2026-07-21 4:01 Jinjie Ruan
2026-07-21 7:59 ` Thomas Gleixner
0 siblings, 1 reply; 4+ messages in thread
From: Jinjie Ruan @ 2026-07-21 4:01 UTC (permalink / raw)
To: paul, eparis, tglx, audit, linux-kernel; +Cc: ruanjinjie
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@huawei.com>
Suggested-by: Thomas Gleixner <tglx@kernel.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202607181530.2nx8zb3J-lkp@intel.com/
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] audit: Force audit_context() to be always inlined
2026-07-21 4:01 [PATCH v2] audit: Force audit_context() to be always inlined Jinjie Ruan
@ 2026-07-21 7:59 ` Thomas Gleixner
2026-07-23 17:21 ` Paul Moore
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2026-07-21 7:59 UTC (permalink / raw)
To: Jinjie Ruan, paul, eparis, audit, linux-kernel; +Cc: ruanjinjie
On Tue, Jul 21 2026 at 12:01, Jinjie Ruan wrote:
> 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@huawei.com>
> Suggested-by: Thomas Gleixner <tglx@kernel.org>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202607181530.2nx8zb3J-lkp@intel.com/
Obsolete. Is already in:
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?h=core/entry&id=6f25517010ddd3f8080d7e06b9b1cb1b64b73772
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] audit: Force audit_context() to be always inlined
2026-07-21 7:59 ` Thomas Gleixner
@ 2026-07-23 17:21 ` Paul Moore
2026-07-24 14:53 ` Thomas Gleixner
0 siblings, 1 reply; 4+ messages in thread
From: Paul Moore @ 2026-07-23 17:21 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: Jinjie Ruan, eparis, audit, linux-kernel
On Tue, Jul 21, 2026 at 3:59 AM Thomas Gleixner <tglx@kernel.org> wrote:
> On Tue, Jul 21 2026 at 12:01, Jinjie Ruan wrote:
> > 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@huawei.com>
> > Suggested-by: Thomas Gleixner <tglx@kernel.org>
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202607181530.2nx8zb3J-lkp@intel.com/
>
> Obsolete. Is already in:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?h=core/entry&id=6f25517010ddd3f8080d7e06b9b1cb1b64b73772
It would have been nice to see that patch CC'd to the audit mailing
list for obvious reasons.
Since I'm just looking at that tip tree patch now (perhaps there are
other preceding patches that affect this?), does it still compile
properly when CONFIG_AUDITSYSCALL is not defined? With
syscall_trace_enter() calling out to syscall_enter_audit() that is no
longer inlined in the same header, and no dummy function/macro defined
for syscall_enter_audit() when !CONFIG_AUDITSYSCALL, it looks like
there might be an issue on some configurations, no?
--
paul-moore.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] audit: Force audit_context() to be always inlined
2026-07-23 17:21 ` Paul Moore
@ 2026-07-24 14:53 ` Thomas Gleixner
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2026-07-24 14:53 UTC (permalink / raw)
To: Paul Moore; +Cc: Jinjie Ruan, eparis, audit, linux-kernel
On Thu, Jul 23 2026 at 13:21, Paul Moore wrote:
> On Tue, Jul 21, 2026 at 3:59 AM Thomas Gleixner <tglx@kernel.org> wrote:
>> On Tue, Jul 21 2026 at 12:01, Jinjie Ruan wrote:
>> > 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@huawei.com>
>> > Suggested-by: Thomas Gleixner <tglx@kernel.org>
>> > Reported-by: kernel test robot <lkp@intel.com>
>> > Closes: https://lore.kernel.org/oe-kbuild-all/202607181530.2nx8zb3J-lkp@intel.com/
>>
>> Obsolete. Is already in:
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?h=core/entry&id=6f25517010ddd3f8080d7e06b9b1cb1b64b73772
>
> It would have been nice to see that patch CC'd to the audit mailing
> list for obvious reasons.
>
> Since I'm just looking at that tip tree patch now (perhaps there are
> other preceding patches that affect this?), does it still compile
> properly when CONFIG_AUDITSYSCALL is not defined? With
> syscall_trace_enter() calling out to syscall_enter_audit() that is no
> longer inlined in the same header, and no dummy function/macro defined
> for syscall_enter_audit() when !CONFIG_AUDITSYSCALL, it looks like
> there might be an issue on some configurations, no?
It compiles properly due to dead code elimination on everything except on
old s390 compilers for whatever reasons.
I'll bite the bullet and add the stub inline for syscall_enter_audit(),
though keeping audit_context() __always_inline makes a lot of sense as
especially clang has a tendency to out of line the most trivial inlines.
Thanks,
tglx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-07-24 14:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-21 4:01 [PATCH v2] audit: Force audit_context() to be always inlined Jinjie Ruan
2026-07-21 7:59 ` Thomas Gleixner
2026-07-23 17:21 ` Paul Moore
2026-07-24 14:53 ` Thomas Gleixner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.