Skip to contentSkip to conversation

LoongArch: Don't define __ARCH_WANT_NEW_STAT for LA32

PATCH In review Xi Ruoyao 3 participants 4 messages Dec 15, 2025 – Feb 14 LoongArch

lore
Share & tools
lore

Xi Ruoyao

author
#0 lore raw

PATCH 1/1 LoongArch: Don't define __ARCH_WANT_NEW_STAT for LA32

While on LA64 we had added __ARCH_WANT_NEW_STAT back for technological aesthetics reason, on LA32 the newstat family suffers Y2038 issue and it should not be used at all, as the commit 82b355d161c9 ("y2038: Remove newstat family from default syscall set") has already pointed out.

Fixes 14338e631afd ("LoongArch: Adjust system call for 32BIT/64BIT")
---
 arch/loongarch/include/asm/unistd.h | 3 +++
 1 file changed, 3 insertions(+)
arch/loongarch/include/asm/unistd.h +3 -0
index e2c0f3d86c7b..4a7e4a6b6627 100644
@@ -8,7 +8,10 @@
 
 #include <uapi/asm/unistd.h>
 
+#if defined(__LP64__) && !defined(__SYSCALL_COMPAT)
 #define __ARCH_WANT_NEW_STAT
+#endif
+
 #define __ARCH_WANT_SYS_CLONE
 
 #define NR_syscalls (__NR_syscalls)
Signature · 1 line
2.52.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Xi Ruoyao

While on LA64 we had added __ARCH_WANT_NEW_STAT back for technological aesthetics reason, on LA32 the newstat family suffers Y2038 issue and it should not be used at all, as the commit 82b355d161c9 ("y2038: Remove newstat family from default syscall set") has already pointed out.

Fixes 14338e631afd ("LoongArch: Adjust system call for 32BIT/64BIT")

That makes sense, we certainly don't want any y2038 syscall.

Thanks!

Quoted 22 lines
---
 arch/loongarch/include/asm/unistd.h | 3 +++
 1 file changed, 3 insertions(+)
arch/loongarch/include/asm/unistd.h +3 -0
index e2c0f3d86c7b..4a7e4a6b6627 100644
@@ -8,7 +8,10 @@
 
 #include <uapi/asm/unistd.h>
 
+#if defined(__LP64__) && !defined(__SYSCALL_COMPAT)
 #define __ARCH_WANT_NEW_STAT
+#endif
+
 #define __ARCH_WANT_SYS_CLONE
 
 #define NR_syscalls (__NR_syscalls)
Signature · 1 line
2.52.0
Signature · 1 line
- Jiaxun
#2 lore raw
In reply to Xi Ruoyao
Quoted 7 lines · Xi Ruoyao

While on LA64 we had added __ARCH_WANT_NEW_STAT back for technological aesthetics reason, on LA32 the newstat family suffers Y2038 issue and it should not be used at all, as the commit 82b355d161c9 ("y2038: Remove newstat family from default syscall set") has already pointed out.

Fixes 14338e631afd ("LoongArch: Adjust system call for 32BIT/64BIT")

The patch looks good to me.

Note that unlike the referenced 82b355d161c9 patch, this is no longer needed for correctness, since modern kernels generate the asm/unistd.h from the syscall.tbl based on arch/loongarch/kernel/Makefile.syscalls, which leaves out the references to newstat.

The patch is still useful of course, but only to slightly reduce the size of the kernel image by eliminating dead code.

Arnd

author
#3 lore raw

Ping: [PATCH] LoongArch: Don't define __ARCH_WANT_NEW_STAT for LA32

In reply to Xi Ruoyao

Ping.

Quoted 26 lines · Xi Ruoyao

While on LA64 we had added __ARCH_WANT_NEW_STAT back for technological aesthetics reason, on LA32 the newstat family suffers Y2038 issue and it should not be used at all, as the commit 82b355d161c9 ("y2038: Remove newstat family from default syscall set") has already pointed out.

Fixes 14338e631afd ("LoongArch: Adjust system call for 32BIT/64BIT")

---
 arch/loongarch/include/asm/unistd.h | 3 +++

 1 file changed, 3 insertions(+)
arch/loongarch/include/asm/unistd.h +0 -0
index e2c0f3d86c7b..4a7e4a6b6627 100644
@@ -8,7 +8,10 @@


 #include <uapi/asm/unistd.h>

+#if defined(__LP64__) && !defined(__SYSCALL_COMPAT) #define __ARCH_WANT_NEW_STAT

arch/loongarch/include/asm/unistd.h +2 -0
+#endif
+

 #define __ARCH_WANT_SYS_CLONE

 #define NR_syscalls (__NR_syscalls)

Signature · 1 line
Xi Ruoyao <[email protected]>