* [PATCH] entry: Provide stub for syscall_enter_audit() when auditing is disabled
@ 2026-07-20 9:49 Jinjie Ruan
2026-07-20 15:34 ` Thomas Gleixner
0 siblings, 1 reply; 6+ messages in thread
From: Jinjie Ruan @ 2026-07-20 9:49 UTC (permalink / raw)
To: tglx, peterz, luto, linux-kernel; +Cc: ruanjinjie
When CONFIG_AUDITSYSCALL is not set, syscall_enter_audit() is not
defined, causing following undefined reference warning. So add an empty
inline stub to resolve the missing symbol.
include/linux/entry-common.h:109:(.noinstr.text+0x2e6): undefined reference to `syscall_enter_audit'
Fixes: ff2b9a905930 ("entry: Rework syscall_audit_enter()")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202607181530.2nx8zb3J-lkp@intel.com/
---
include/linux/entry-common.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h
index 6574b7183c01..016165cffc9f 100644
--- a/include/linux/entry-common.h
+++ b/include/linux/entry-common.h
@@ -60,7 +60,11 @@ static __always_inline bool arch_ptrace_report_syscall_permit_entry(struct pt_re
void trace_syscall_enter(struct pt_regs *regs);
void trace_syscall_exit(struct pt_regs *regs, long ret);
+#ifdef CONFIG_AUDITSYSCALL
void syscall_enter_audit(struct pt_regs *regs);
+#else
+static inline void syscall_enter_audit(struct pt_regs *regs) { }
+#endif
static __always_inline long syscall_trace_enter(struct pt_regs *regs, unsigned long work,
long syscall)
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] entry: Provide stub for syscall_enter_audit() when auditing is disabled
2026-07-20 9:49 [PATCH] entry: Provide stub for syscall_enter_audit() when auditing is disabled Jinjie Ruan
@ 2026-07-20 15:34 ` Thomas Gleixner
2026-07-20 18:34 ` Thomas Gleixner
2026-07-21 2:47 ` Jinjie Ruan
0 siblings, 2 replies; 6+ messages in thread
From: Thomas Gleixner @ 2026-07-20 15:34 UTC (permalink / raw)
To: Jinjie Ruan, peterz, luto, linux-kernel
Cc: kernel test robot, oe-kbuild-all, Sven Schnelle
On Mon, Jul 20 2026 at 17:49, Jinjie Ruan wrote:
> When CONFIG_AUDITSYSCALL is not set, syscall_enter_audit() is not
> defined, causing following undefined reference warning. So add an empty
> inline stub to resolve the missing symbol.
>
> include/linux/entry-common.h:109:(.noinstr.text+0x2e6): undefined reference to `syscall_enter_audit'
>
> Fixes: ff2b9a905930 ("entry: Rework syscall_audit_enter()")
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202607181530.2nx8zb3J-lkp@intel.com/
This does not make any sense at all.
The call site is:
if (audit_context())
syscall_enter_audit(....);
audit.h has:
#ifdef CONFIG_AUDITSYSCALL
...
#else
static inline struct audit_context *audit_context(void) { return NULL; }
#endif
which means the call to syscall_enter_audit() should not ever end up in
the linker phase due to dead code elimination.
Such constructs which rely on dead code elimination are not unique. The
kernel is full of them.
The .config in the report builds without problems with s390-linux-gcc
15.2.0 (I verified that before merging), but fails with the version used
by the robot:
compiler: s390-linux-gcc (GCC) 13.4.0
So that's a broken compiler and without understanding the actual root
cause we are not going to paper over it.
When I disable CONFIG_KASAN in that config the problem goes away....
I have no idea how that's related especially as the code in question is
non instrumentable to begin with.
Looking at the disassembly:
if (unlikely(audit_context()))
2da: c0 e5 00 00 00 00 brasl %r14,2da <__do_syscall+0x2da>
2dc: R_390_PLT32DBL audit_context+0x2
So dead code elimination does not work because the compiler puts the
stub return NULL inline out of line....
The proper fix is below. The fixes tag wants to be:
Fixes: s390 cross GCC 13.4.0 brainfart
Thanks,
tglx
---
include/linux/audit.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -343,7 +343,7 @@ static inline void audit_set_context(str
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(v
}
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;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] entry: Provide stub for syscall_enter_audit() when auditing is disabled
2026-07-20 15:34 ` Thomas Gleixner
@ 2026-07-20 18:34 ` Thomas Gleixner
2026-07-21 2:41 ` Jinjie Ruan
2026-07-21 2:47 ` Jinjie Ruan
1 sibling, 1 reply; 6+ messages in thread
From: Thomas Gleixner @ 2026-07-20 18:34 UTC (permalink / raw)
To: Jinjie Ruan, peterz, luto, linux-kernel
Cc: kernel test robot, oe-kbuild-all, Sven Schnelle
On Mon, Jul 20 2026 at 17:34, Thomas Gleixner wrote:
> On Mon, Jul 20 2026 at 17:49, Jinjie Ruan wrote:
> The .config in the report builds without problems with s390-linux-gcc
> 15.2.0 (I verified that before merging), but fails with the version used
> by the robot:
>
> compiler: s390-linux-gcc (GCC) 13.4.0
>
> So that's a broken compiler and without understanding the actual root
> cause we are not going to paper over it.
What's even more amazing is that the same config modified for x86/64
builds just fine with gcc 13.4.0, while one would assume that the
decision to uninline a basically empty inline would happen before the
architecture specific backend is invoked. But what do I know. :)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] entry: Provide stub for syscall_enter_audit() when auditing is disabled
2026-07-20 18:34 ` Thomas Gleixner
@ 2026-07-21 2:41 ` Jinjie Ruan
0 siblings, 0 replies; 6+ messages in thread
From: Jinjie Ruan @ 2026-07-21 2:41 UTC (permalink / raw)
To: Thomas Gleixner, peterz, luto, linux-kernel
Cc: kernel test robot, oe-kbuild-all, Sven Schnelle
On 7/21/2026 2:34 AM, Thomas Gleixner wrote:
> On Mon, Jul 20 2026 at 17:34, Thomas Gleixner wrote:
>> On Mon, Jul 20 2026 at 17:49, Jinjie Ruan wrote:
>> The .config in the report builds without problems with s390-linux-gcc
>> 15.2.0 (I verified that before merging), but fails with the version used
>> by the robot:
>>
>> compiler: s390-linux-gcc (GCC) 13.4.0
>>
>> So that's a broken compiler and without understanding the actual root
>> cause we are not going to paper over it.
>
> What's even more amazing is that the same config modified for x86/64
> builds just fine with gcc 13.4.0, while one would assume that the
> decision to uninline a basically empty inline would happen before the
> architecture specific backend is invoked. But what do I know. :)
Yes, I also couldn't reproduce this compilation issue on x86, so it does
appear to be a compiler problem.
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] entry: Provide stub for syscall_enter_audit() when auditing is disabled
2026-07-20 15:34 ` Thomas Gleixner
2026-07-20 18:34 ` Thomas Gleixner
@ 2026-07-21 2:47 ` Jinjie Ruan
2026-07-21 7:58 ` Thomas Gleixner
1 sibling, 1 reply; 6+ messages in thread
From: Jinjie Ruan @ 2026-07-21 2:47 UTC (permalink / raw)
To: Thomas Gleixner, peterz, luto, linux-kernel
Cc: kernel test robot, oe-kbuild-all, Sven Schnelle
On 7/20/2026 11:34 PM, Thomas Gleixner wrote:
> On Mon, Jul 20 2026 at 17:49, Jinjie Ruan wrote:
>> When CONFIG_AUDITSYSCALL is not set, syscall_enter_audit() is not
>> defined, causing following undefined reference warning. So add an empty
>> inline stub to resolve the missing symbol.
>>
>> include/linux/entry-common.h:109:(.noinstr.text+0x2e6): undefined reference to `syscall_enter_audit'
>>
>> Fixes: ff2b9a905930 ("entry: Rework syscall_audit_enter()")
>> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
>> Reported-by: kernel test robot <lkp@intel.com>
>> Closes: https://lore.kernel.org/oe-kbuild-all/202607181530.2nx8zb3J-lkp@intel.com/
>
> This does not make any sense at all.
>
> The call site is:
>
> if (audit_context())
> syscall_enter_audit(....);
>
> audit.h has:
>
> #ifdef CONFIG_AUDITSYSCALL
> ...
> #else
> static inline struct audit_context *audit_context(void) { return NULL; }
> #endif
>
> which means the call to syscall_enter_audit() should not ever end up in
> the linker phase due to dead code elimination.
I agree with you.
>
> Such constructs which rely on dead code elimination are not unique. The
> kernel is full of them.
>
> The .config in the report builds without problems with s390-linux-gcc
> 15.2.0 (I verified that before merging), but fails with the version used
> by the robot:
>
> compiler: s390-linux-gcc (GCC) 13.4.0
>
> So that's a broken compiler and without understanding the actual root
> cause we are not going to paper over it.
>
> When I disable CONFIG_KASAN in that config the problem goes away....
>
> I have no idea how that's related especially as the code in question is
> non instrumentable to begin with.
>
> Looking at the disassembly:
>
> if (unlikely(audit_context()))
> 2da: c0 e5 00 00 00 00 brasl %r14,2da <__do_syscall+0x2da>
> 2dc: R_390_PLT32DBL audit_context+0x2
>
> So dead code elimination does not work because the compiler puts the
> stub return NULL inline out of line....
>
> The proper fix is below. The fixes tag wants to be:
>
> Fixes: s390 cross GCC 13.4.0 brainfart
>
> Thanks,
>
> tglx
> ---
> include/linux/audit.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> --- a/include/linux/audit.h
> +++ b/include/linux/audit.h
> @@ -343,7 +343,7 @@ static inline void audit_set_context(str
> 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(v
> }
> 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;
> }
Thank you!
I will revise it according to this.
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] entry: Provide stub for syscall_enter_audit() when auditing is disabled
2026-07-21 2:47 ` Jinjie Ruan
@ 2026-07-21 7:58 ` Thomas Gleixner
0 siblings, 0 replies; 6+ messages in thread
From: Thomas Gleixner @ 2026-07-21 7:58 UTC (permalink / raw)
To: Jinjie Ruan, peterz, luto, linux-kernel
Cc: kernel test robot, oe-kbuild-all, Sven Schnelle
On Tue, Jul 21 2026 at 10:47, Jinjie Ruan wrote:
> On 7/20/2026 11:34 PM, Thomas Gleixner wrote:
>
> I will revise it according to this.
I've folded it already into the core/entry branch commit and force
pushed the result.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-07-21 7:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-20 9:49 [PATCH] entry: Provide stub for syscall_enter_audit() when auditing is disabled Jinjie Ruan
2026-07-20 15:34 ` Thomas Gleixner
2026-07-20 18:34 ` Thomas Gleixner
2026-07-21 2:41 ` Jinjie Ruan
2026-07-21 2:47 ` Jinjie Ruan
2026-07-21 7:58 ` Thomas Gleixner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox