mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jinjie Ruan <ruanjinjie@huawei.com>
To: Thomas Gleixner <tglx@kernel.org>, <peterz@infradead.org>,
	<luto@kernel.org>, <linux-kernel@vger.kernel.org>
Cc: kernel test robot <lkp@intel.com>,
	<oe-kbuild-all@lists.linux.dev>,
	Sven Schnelle <svens@linux.ibm.com>
Subject: Re: [PATCH] entry: Provide stub for syscall_enter_audit() when auditing is disabled
Date: Tue, 21 Jul 2026 10:47:48 +0800	[thread overview]
Message-ID: <688eda6b-c5bd-4745-b45c-7e40ba3e53aa@huawei.com> (raw)
In-Reply-To: <87cxwhn09i.ffs@fw13>



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.


> 


  parent reply	other threads:[~2026-07-21  2:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20  9:49 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 [this message]
2026-07-21  7:58     ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=688eda6b-c5bd-4745-b45c-7e40ba3e53aa@huawei.com \
    --to=ruanjinjie@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=luto@kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=peterz@infradead.org \
    --cc=svens@linux.ibm.com \
    --cc=tglx@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®