Re: [PATCH 6.7 000/707] 6.7.11-rc2 review

From: Sasha Levin
Date: Tue Mar 26 2024 - 07:23:37 EST


On Mon, Mar 25, 2024 at 01:47:40PM -0600, Daniel Díaz wrote:
Hello!

On Mon, 25 Mar 2024 at 12:14, Sami Tolvanen <samitolvanen@xxxxxxxxxx> wrote:
On Mon, Mar 25, 2024 at 11:43:48AM -0600, Daniel Díaz wrote:
> Hello!
>
> On 25/03/24 6:00 a. m., Sasha Levin wrote:
> > This is the start of the stable review cycle for the 6.7.11 release.
> > There are 707 patches in this series, all will be posted as a response
> > to this one. If anyone has any issues with these being applied, please
> > let me know.
> >
> > Responses should be made by Wed Mar 27 12:00:02 PM UTC 2024.
> > Anything received after that time might be too late.
> >
> > The whole patch series can be found in one patch at:
> > https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-6.7.y&id2=v6.7.10
> > or in the git tree and branch at:
> > git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.7.y
> > and the diffstat can be found below.
> >
> > Thanks,
> > Sasha
>
> We see *lots* of new warnings in RISC-V with Clang 17. Here's one:
>
> -----8<-----
> /builds/linux/mm/oom_kill.c:1195:1: warning: unused function '___se_sys_process_mrelease' [-Wunused-function]
> 1195 | SYSCALL_DEFINE2(process_mrelease, int, pidfd, unsigned int, flags)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /builds/linux/include/linux/syscalls.h:221:36: note: expanded from macro 'SYSCALL_DEFINE2'
> 221 | #define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /builds/linux/include/linux/syscalls.h:231:2: note: expanded from macro 'SYSCALL_DEFINEx'
> 231 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /builds/linux/arch/riscv/include/asm/syscall_wrapper.h:81:2: note: expanded from macro '__SYSCALL_DEFINEx'
> 81 | __SYSCALL_SE_DEFINEx(x, sys, name, __VA_ARGS__) \
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /builds/linux/arch/riscv/include/asm/syscall_wrapper.h:40:14: note: expanded from macro '__SYSCALL_SE_DEFINEx'
> 40 | static long ___se_##prefix##name(__MAP(x,__SC_LONG,__VA_ARGS__))
> | ^~~~~~~~~~~~~~~~~~~~
> <scratch space>:30:1: note: expanded from here
> 30 | ___se_sys_process_mrelease
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 warning generated.
> ----->8-----

Yup, I can reproduce this with ToT Clang. It looks like the alias
isn't sufficient for Clang and we need to add an explicit __used
attribute. Can you confirm if this patch fixes the issue for you?

diff --git a/arch/riscv/include/asm/syscall_wrapper.h b/arch/riscv/include/asm/syscall_wrapper.h
index 980094c2e976..ac80216549ff 100644
--- a/arch/riscv/include/asm/syscall_wrapper.h
+++ b/arch/riscv/include/asm/syscall_wrapper.h
@@ -36,7 +36,8 @@ asmlinkage long __riscv_sys_ni_syscall(const struct pt_regs *);
ulong) \
__attribute__((alias(__stringify(___se_##prefix##name)))); \
__diag_pop(); \
- static long noinline ___se_##prefix##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
+ static long noinline ___se_##prefix##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
+ __used; \
static long ___se_##prefix##name(__MAP(x,__SC_LONG,__VA_ARGS__))

It does: the hundreds of warnings are gone. Build-tested with Clang

I'm assuming this fix needs to land upstream, and isn't specific for
stable?

I'll drop the offending commit for now, thanks!

--
Thanks,
Sasha