[03/20] asm-generic: Drop getrlimit and setrlimit syscalls from default list

Submitted by James Hogan on June 19, 2017, 9:42 p.m.

Details

Message ID 20170619214223.GS6973@jhogan-linux.le.imgtec.org
State New
Headers show

Commit Message

James Hogan June 19, 2017, 9:42 p.m.
Hi Yury,

On Mon, Jun 19, 2017 at 06:49:46PM +0300, Yury Norov wrote:
> The newer prlimit64 syscall provides all the functionality provided by
> the getrlimit and setrlimit syscalls and adds the pid of target process,
> so future architectures won't need to include getrlimit and setrlimit.
> 
> Therefore drop getrlimit and setrlimit syscalls from the generic syscall
> list unless __ARCH_WANT_SET_GET_RLIMIT is defined by the architecture's
> unistd.h prior to including asm-generic/unistd.h, and adjust all architectures
> using the generic syscall list to define it so that no in-tree architectures
> are affected.

I have a similar experimental patch lying around for the stat system
calls which are superseded by statx (see below). If it looks acceptable
maybe you'd like to incorporate it (or something similar) into your
series.

Cheers
James

---
From: James Hogan <james.hogan@imgtec.com>
Date: Fri, 2 Jun 2017 13:07:27 +0100
Subject: [PATCH] Deprecate stat syscalls superseded by statx

Various stat system calls can now be implemented as userland wrappers
around the new statx system call, so allow them to be removed from the
kernel by default for new architectures / ABIs.

This involves adding __ARCH_WANT_SYSCALL_UNXSTAT to each existing
architecture, which enables the relevant stat system calls in the
generic system call list (if used). It also conditionally defines the
syscalls in fs/stat.c and struct stat / struct stat64 in
asm-generic/stat.h.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-arch@vger.kernel.org
Cc: linux-api@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 arch/alpha/include/asm/unistd.h          | 1 +
 arch/arc/include/uapi/asm/unistd.h       | 1 +
 arch/arm/include/asm/unistd.h            | 1 +
 arch/arm64/include/uapi/asm/unistd.h     | 1 +
 arch/blackfin/include/asm/unistd.h       | 1 +
 arch/c6x/include/uapi/asm/unistd.h       | 1 +
 arch/cris/include/asm/unistd.h           | 1 +
 arch/frv/include/asm/unistd.h            | 1 +
 arch/h8300/include/uapi/asm/unistd.h     | 1 +
 arch/hexagon/include/uapi/asm/unistd.h   | 1 +
 arch/ia64/include/asm/unistd.h           | 2 ++
 arch/m32r/include/asm/unistd.h           | 1 +
 arch/m68k/include/asm/unistd.h           | 1 +
 arch/metag/include/uapi/asm/unistd.h     | 1 +
 arch/microblaze/include/asm/unistd.h     | 1 +
 arch/mips/include/asm/unistd.h           | 1 +
 arch/mn10300/include/asm/unistd.h        | 1 +
 arch/nios2/include/uapi/asm/unistd.h     | 1 +
 arch/openrisc/include/uapi/asm/unistd.h  | 1 +
 arch/parisc/include/asm/unistd.h         | 1 +
 arch/powerpc/include/asm/unistd.h        | 1 +
 arch/s390/include/asm/unistd.h           | 1 +
 arch/score/include/uapi/asm/unistd.h     | 1 +
 arch/sh/include/asm/unistd.h             | 1 +
 arch/sparc/include/asm/unistd.h          | 1 +
 arch/tile/include/uapi/asm/unistd.h      | 1 +
 arch/unicore32/include/uapi/asm/unistd.h | 1 +
 arch/x86/include/asm/unistd.h            | 2 ++
 arch/xtensa/include/asm/unistd.h         | 1 +
 fs/stat.c                                | 4 ++++
 include/asm-generic/unistd.h             | 2 ++
 include/uapi/asm-generic/stat.h          | 7 +++++++
 include/uapi/asm-generic/unistd.h        | 6 ++++++
 scripts/checksyscalls.sh                 | 9 +++++++++
 34 files changed, 59 insertions(+)

Comments

Arnd Bergmann June 19, 2017, 9:58 p.m.
On Mon, Jun 19, 2017 at 11:42 PM, James Hogan <james.hogan@imgtec.com> wrote:
> Hi Yury,
>
> On Mon, Jun 19, 2017 at 06:49:46PM +0300, Yury Norov wrote:
>> The newer prlimit64 syscall provides all the functionality provided by
>> the getrlimit and setrlimit syscalls and adds the pid of target process,
>> so future architectures won't need to include getrlimit and setrlimit.
>>
>> Therefore drop getrlimit and setrlimit syscalls from the generic syscall
>> list unless __ARCH_WANT_SET_GET_RLIMIT is defined by the architecture's
>> unistd.h prior to including asm-generic/unistd.h, and adjust all architectures
>> using the generic syscall list to define it so that no in-tree architectures
>> are affected.
>
> I have a similar experimental patch lying around for the stat system
> calls which are superseded by statx (see below). If it looks acceptable
> maybe you'd like to incorporate it (or something similar) into your
> series.
>
> Cheers
> James
>
> ---
> From: James Hogan <james.hogan@imgtec.com>
> Date: Fri, 2 Jun 2017 13:07:27 +0100
> Subject: [PATCH] Deprecate stat syscalls superseded by statx
>
> Various stat system calls can now be implemented as userland wrappers
> around the new statx system call, so allow them to be removed from the
> kernel by default for new architectures / ABIs.
>
> This involves adding __ARCH_WANT_SYSCALL_UNXSTAT to each existing
> architecture, which enables the relevant stat system calls in the
> generic system call list (if used). It also conditionally defines the
> syscalls in fs/stat.c and struct stat / struct stat64 in
> asm-generic/stat.h.
>
> Signed-off-by: James Hogan <james.hogan@imgtec.com>
> Cc: David Howells <dhowells@redhat.com>
> Cc: Alexander Viro <viro@zeniv.linux.org.uk>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: linux-fsdevel@vger.kernel.org
> Cc: linux-arch@vger.kernel.org
> Cc: linux-api@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org

Good idea:

Acked-by:  Arnd Bergmann <arnd@arndb.de>

> +/* statx deprecates the un-extended stat syscalls which use struct stat[64] */
> +#ifdef __ARCH_WANT_SYSCALL_UNXSTAT

I'm glad you explain what 'UNXSTAT' means here, since I would not
have otherwise guessed it, but I also can't think of anything more
intuitive.

         Arnd
James Hogan June 19, 2017, 10:10 p.m.
On Mon, Jun 19, 2017 at 11:58:41PM +0200, Arnd Bergmann wrote:
> On Mon, Jun 19, 2017 at 11:42 PM, James Hogan <james.hogan@imgtec.com> wrote:
> > On Mon, Jun 19, 2017 at 06:49:46PM +0300, Yury Norov wrote:
> > Subject: [PATCH] Deprecate stat syscalls superseded by statx
> >
> > Various stat system calls can now be implemented as userland wrappers
> > around the new statx system call, so allow them to be removed from the
> > kernel by default for new architectures / ABIs.
> >
> > This involves adding __ARCH_WANT_SYSCALL_UNXSTAT to each existing
> > architecture, which enables the relevant stat system calls in the
> > generic system call list (if used). It also conditionally defines the
> > syscalls in fs/stat.c and struct stat / struct stat64 in
> > asm-generic/stat.h.
> >
> > Signed-off-by: James Hogan <james.hogan@imgtec.com>
> > Cc: David Howells <dhowells@redhat.com>
> > Cc: Alexander Viro <viro@zeniv.linux.org.uk>
> > Cc: Arnd Bergmann <arnd@arndb.de>
> > Cc: linux-fsdevel@vger.kernel.org
> > Cc: linux-arch@vger.kernel.org
> > Cc: linux-api@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org
> 
> Good idea:
> 
> Acked-by:  Arnd Bergmann <arnd@arndb.de>

Thanks,

> 
> > +/* statx deprecates the un-extended stat syscalls which use struct stat[64] */
> > +#ifdef __ARCH_WANT_SYSCALL_UNXSTAT
> 
> I'm glad you explain what 'UNXSTAT' means here, since I would not
> have otherwise guessed it, but I also can't think of anything more
> intuitive.

Yeh, I renamed that several times while playing around with this :-).

The stat syscalls remind me a bit of the Vicar of Dibley episode where
the new road named "New Road" necessitates the renaming of the existing
"New Road" to "Quite Old Road" and "Quite Old Road" to "Really Quite Old
Road" and "Old Road" to "Very Old Road"!

Cheers
James
Yury Norov June 20, 2017, 1:37 p.m.
On Mon, Jun 19, 2017 at 11:10:23PM +0100, James Hogan wrote:
> On Mon, Jun 19, 2017 at 11:58:41PM +0200, Arnd Bergmann wrote:
> > On Mon, Jun 19, 2017 at 11:42 PM, James Hogan <james.hogan@imgtec.com> wrote:
> > > On Mon, Jun 19, 2017 at 06:49:46PM +0300, Yury Norov wrote:
> > > Subject: [PATCH] Deprecate stat syscalls superseded by statx
> > >
> > > Various stat system calls can now be implemented as userland wrappers
> > > around the new statx system call, so allow them to be removed from the
> > > kernel by default for new architectures / ABIs.
> > >
> > > This involves adding __ARCH_WANT_SYSCALL_UNXSTAT to each existing
> > > architecture, which enables the relevant stat system calls in the
> > > generic system call list (if used). It also conditionally defines the
> > > syscalls in fs/stat.c and struct stat / struct stat64 in
> > > asm-generic/stat.h.
> > >
> > > Signed-off-by: James Hogan <james.hogan@imgtec.com>
> > > Cc: David Howells <dhowells@redhat.com>
> > > Cc: Alexander Viro <viro@zeniv.linux.org.uk>
> > > Cc: Arnd Bergmann <arnd@arndb.de>
> > > Cc: linux-fsdevel@vger.kernel.org
> > > Cc: linux-arch@vger.kernel.org
> > > Cc: linux-api@vger.kernel.org
> > > Cc: linux-kernel@vger.kernel.org
> > 
> > Good idea:
> > 
> > Acked-by:  Arnd Bergmann <arnd@arndb.de>
> 
> Thanks,
> 
> > 
> > > +/* statx deprecates the un-extended stat syscalls which use struct stat[64] */
> > > +#ifdef __ARCH_WANT_SYSCALL_UNXSTAT
> > 
> > I'm glad you explain what 'UNXSTAT' means here, since I would not
> > have otherwise guessed it, but I also can't think of anything more
> > intuitive.
> 
> Yeh, I renamed that several times while playing around with this :-).
> 
> The stat syscalls remind me a bit of the Vicar of Dibley episode where
> the new road named "New Road" necessitates the renaming of the existing
> "New Road" to "Quite Old Road" and "Quite Old Road" to "Really Quite Old
> Road" and "Old Road" to "Very Old Road"!
> 
> Cheers
> James

(Add Palmer Dabbelt <palmer@dabbelt.com>)

The stat syscalls are full of hacks, and we have to pull that hacks
even to new architectures to deal with stat. So I'll be happy to drop
it in arm64/ilp32. But it means that I need some time to integrate
your patch and fix glibc accordingly. And it also means that we need
round 9 for ilp32... :(

Arnd, once before you told that generic unistd has some duplications
and legacy syscalls, and one day we'll have to deal with it. Do you
have the list or something on it?

I would also notice riscv people and welcome to the discussion.  

As there is more than 1 arch that goes to be added to linux soon,
maybe it's better to upstream my ans James' patches separately
from other ilp32 patches? Arnd?

Yury
Arnd Bergmann June 20, 2017, 2:20 p.m.
On Tue, Jun 20, 2017 at 3:37 PM, Yury Norov <ynorov@caviumnetworks.com> wrote:
> On Mon, Jun 19, 2017 at 11:10:23PM +0100, James Hogan wrote:
>> On Mon, Jun 19, 2017 at 11:58:41PM +0200, Arnd Bergmann wrote:
>> > On Mon, Jun 19, 2017 at 11:42 PM, James Hogan <james.hogan@imgtec.com> wrote:
>> > > On Mon, Jun 19, 2017 at 06:49:46PM +0300, Yury Norov wrote:
>> > > Subject: [PATCH] Deprecate stat syscalls superseded by statx
>> > >
>> > > Various stat system calls can now be implemented as userland wrappers
>> > > around the new statx system call, so allow them to be removed from the
>> > > kernel by default for new architectures / ABIs.
>> > >
>> > > This involves adding __ARCH_WANT_SYSCALL_UNXSTAT to each existing
>> > > architecture, which enables the relevant stat system calls in the
>> > > generic system call list (if used). It also conditionally defines the
>> > > syscalls in fs/stat.c and struct stat / struct stat64 in
>> > > asm-generic/stat.h.
>> > >
>> > > Signed-off-by: James Hogan <james.hogan@imgtec.com>
>> > > Cc: David Howells <dhowells@redhat.com>
>> > > Cc: Alexander Viro <viro@zeniv.linux.org.uk>
>> > > Cc: Arnd Bergmann <arnd@arndb.de>
>> > > Cc: linux-fsdevel@vger.kernel.org
>> > > Cc: linux-arch@vger.kernel.org
>> > > Cc: linux-api@vger.kernel.org
>> > > Cc: linux-kernel@vger.kernel.org
>> >
>> > Good idea:
>> >
>> > Acked-by:  Arnd Bergmann <arnd@arndb.de>
>> > > +/* statx deprecates the un-extended stat syscalls which use struct stat[64] */
>> > > +#ifdef __ARCH_WANT_SYSCALL_UNXSTAT
>> >
>> > I'm glad you explain what 'UNXSTAT' means here, since I would not
>> > have otherwise guessed it, but I also can't think of anything more
>> > intuitive.
>>
>> Yeh, I renamed that several times while playing around with this :-).
>>
>> The stat syscalls remind me a bit of the Vicar of Dibley episode where
>> the new road named "New Road" necessitates the renaming of the existing
>> "New Road" to "Quite Old Road" and "Quite Old Road" to "Really Quite Old
>> Road" and "Old Road" to "Very Old Road"!
>
> (Add Palmer Dabbelt <palmer@dabbelt.com>)
>
> The stat syscalls are full of hacks, and we have to pull that hacks
> even to new architectures to deal with stat. So I'll be happy to drop
> it in arm64/ilp32. But it means that I need some time to integrate
> your patch and fix glibc accordingly. And it also means that we need
> round 9 for ilp32... :(
>
> Arnd, once before you told that generic unistd has some duplications
> and legacy syscalls, and one day we'll have to deal with it. Do you
> have the list or something on it?

No, I'd have to do some research for that.

> I would also notice riscv people and welcome to the discussion.
>
> As there is more than 1 arch that goes to be added to linux soon,
> maybe it's better to upstream my ans James' patches separately
> from other ilp32 patches? Arnd?

Do you mean upstream those two patches slightly later? That's
fine with me, I don't care much whether the old new stat is part
of the syscall table for arm64-ilp32 or not, I'd leave that up to
you, depending on whether you want to do the rework or not.

I suppose the arm64-ilp32 could benefit from not having to support
the old arm32 stat structure, but doing the new syscalls based on
statx could delay the glibc port some more, as there are some open
questions about how that would best be integrated.

       Arnd
Yury Norov June 20, 2017, 2:36 p.m.
On Mon, Jun 19, 2017 at 11:10:23PM +0100, James Hogan wrote:
> On Mon, Jun 19, 2017 at 11:58:41PM +0200, Arnd Bergmann wrote:
> > On Mon, Jun 19, 2017 at 11:42 PM, James Hogan <james.hogan@imgtec.com> wrote:
> > > On Mon, Jun 19, 2017 at 06:49:46PM +0300, Yury Norov wrote:
> > > Subject: [PATCH] Deprecate stat syscalls superseded by statx
> > >
> > > Various stat system calls can now be implemented as userland wrappers
> > > around the new statx system call, so allow them to be removed from the
> > > kernel by default for new architectures / ABIs.
> > >
> > > This involves adding __ARCH_WANT_SYSCALL_UNXSTAT to each existing
> > > architecture, which enables the relevant stat system calls in the
> > > generic system call list (if used). It also conditionally defines the
> > > syscalls in fs/stat.c and struct stat / struct stat64 in
> > > asm-generic/stat.h.
> > >
> > > Signed-off-by: James Hogan <james.hogan@imgtec.com>
> > > Cc: David Howells <dhowells@redhat.com>
> > > Cc: Alexander Viro <viro@zeniv.linux.org.uk>
> > > Cc: Arnd Bergmann <arnd@arndb.de>
> > > Cc: linux-fsdevel@vger.kernel.org
> > > Cc: linux-arch@vger.kernel.org
> > > Cc: linux-api@vger.kernel.org
> > > Cc: linux-kernel@vger.kernel.org
> > 
> > Good idea:
> > 
> > Acked-by:  Arnd Bergmann <arnd@arndb.de>
> 
> Thanks,
> 
> > 
> > > +/* statx deprecates the un-extended stat syscalls which use struct stat[64] */
> > > +#ifdef __ARCH_WANT_SYSCALL_UNXSTAT
> > 
> > I'm glad you explain what 'UNXSTAT' means here, since I would not
> > have otherwise guessed it, but I also can't think of anything more
> > intuitive.
> 
> Yeh, I renamed that several times while playing around with this :-).
> 
> The stat syscalls remind me a bit of the Vicar of Dibley episode where
> the new road named "New Road" necessitates the renaming of the existing
> "New Road" to "Quite Old Road" and "Quite Old Road" to "Really Quite Old
> Road" and "Old Road" to "Very Old Road"!
> 
> Cheers
> James

(Add Palmer Dabbelt <palmer@dabbelt.com>)

The stat syscalls are full of hacks, and we have to pull that hacks
even to new architectures to deal with stat. So I'll be happy to drop
it in arm64/ilp32. But it means that I need some time to integrate
your patch and fix glibc accordingly. And it also means that we need
round 9 for ilp32... :(

Arnd, once before you told that generic unistd has some duplications
and legacy syscalls, and one day we'll have to deal with it. Do you
have the list or something on it?

I would also notice riscv people and welcome to the discussion.  

As there is more than 1 arch that goes to be added to linux soon,
maybe it's better to upstream my ans James' patches separately
from other ilp32 patches? Arnd?

Yury
Yury Norov June 20, 2017, 2:42 p.m.
On Mon, Jun 19, 2017 at 11:10:23PM +0100, James Hogan wrote:
> On Mon, Jun 19, 2017 at 11:58:41PM +0200, Arnd Bergmann wrote:
> > On Mon, Jun 19, 2017 at 11:42 PM, James Hogan <james.hogan@imgtec.com> wrote:
> > > On Mon, Jun 19, 2017 at 06:49:46PM +0300, Yury Norov wrote:
> > > Subject: [PATCH] Deprecate stat syscalls superseded by statx
> > >
> > > Various stat system calls can now be implemented as userland wrappers
> > > around the new statx system call, so allow them to be removed from the
> > > kernel by default for new architectures / ABIs.
> > >
> > > This involves adding __ARCH_WANT_SYSCALL_UNXSTAT to each existing
> > > architecture, which enables the relevant stat system calls in the
> > > generic system call list (if used). It also conditionally defines the
> > > syscalls in fs/stat.c and struct stat / struct stat64 in
> > > asm-generic/stat.h.
> > >
> > > Signed-off-by: James Hogan <james.hogan@imgtec.com>
> > > Cc: David Howells <dhowells@redhat.com>
> > > Cc: Alexander Viro <viro@zeniv.linux.org.uk>
> > > Cc: Arnd Bergmann <arnd@arndb.de>
> > > Cc: linux-fsdevel@vger.kernel.org
> > > Cc: linux-arch@vger.kernel.org
> > > Cc: linux-api@vger.kernel.org
> > > Cc: linux-kernel@vger.kernel.org
> > 
> > Good idea:
> > 
> > Acked-by:  Arnd Bergmann <arnd@arndb.de>
> 
> Thanks,
> 
> > 
> > > +/* statx deprecates the un-extended stat syscalls which use struct stat[64] */
> > > +#ifdef __ARCH_WANT_SYSCALL_UNXSTAT
> > 
> > I'm glad you explain what 'UNXSTAT' means here, since I would not
> > have otherwise guessed it, but I also can't think of anything more
> > intuitive.
> 
> Yeh, I renamed that several times while playing around with this :-).
> 
> The stat syscalls remind me a bit of the Vicar of Dibley episode where
> the new road named "New Road" necessitates the renaming of the existing
> "New Road" to "Quite Old Road" and "Quite Old Road" to "Really Quite Old
> Road" and "Old Road" to "Very Old Road"!
> 
> Cheers
> James

(Add Palmer Dabbelt <palmer@dabbelt.com>)

The stat syscalls are full of hacks, and we have to pull that hacks
even to new architectures to deal with stat. So I'll be happy to drop
it in arm64/ilp32. But it means that I need some time to integrate
your patch and fix glibc accordingly. And it also means that we need
round 9 for ilp32... :(

Arnd, once before you told that generic unistd has some duplications
and legacy syscalls, and one day we'll have to deal with it. Do you
have the list or something on it?

I would also like to notice riscv people and welcome to the discussion.  

As there is more than 1 arch that goes to be added to linux soon,
maybe it's better to upstream my ans James' patches separately
from other ilp32 patches? Arnd?

Yury
Yury Norov June 20, 2017, 2:54 p.m.
On Tue, Jun 20, 2017 at 04:20:43PM +0200, Arnd Bergmann wrote:
> On Tue, Jun 20, 2017 at 3:37 PM, Yury Norov <ynorov@caviumnetworks.com> wrote:
> > On Mon, Jun 19, 2017 at 11:10:23PM +0100, James Hogan wrote:
> >> On Mon, Jun 19, 2017 at 11:58:41PM +0200, Arnd Bergmann wrote:
> >> > On Mon, Jun 19, 2017 at 11:42 PM, James Hogan <james.hogan@imgtec.com> wrote:
> >> > > On Mon, Jun 19, 2017 at 06:49:46PM +0300, Yury Norov wrote:
> >> > > Subject: [PATCH] Deprecate stat syscalls superseded by statx
> >> > >
> >> > > Various stat system calls can now be implemented as userland wrappers
> >> > > around the new statx system call, so allow them to be removed from the
> >> > > kernel by default for new architectures / ABIs.
> >> > >
> >> > > This involves adding __ARCH_WANT_SYSCALL_UNXSTAT to each existing
> >> > > architecture, which enables the relevant stat system calls in the
> >> > > generic system call list (if used). It also conditionally defines the
> >> > > syscalls in fs/stat.c and struct stat / struct stat64 in
> >> > > asm-generic/stat.h.
> >> > >
> >> > > Signed-off-by: James Hogan <james.hogan@imgtec.com>
> >> > > Cc: David Howells <dhowells@redhat.com>
> >> > > Cc: Alexander Viro <viro@zeniv.linux.org.uk>
> >> > > Cc: Arnd Bergmann <arnd@arndb.de>
> >> > > Cc: linux-fsdevel@vger.kernel.org
> >> > > Cc: linux-arch@vger.kernel.org
> >> > > Cc: linux-api@vger.kernel.org
> >> > > Cc: linux-kernel@vger.kernel.org
> >> >
> >> > Good idea:
> >> >
> >> > Acked-by:  Arnd Bergmann <arnd@arndb.de>
> >> > > +/* statx deprecates the un-extended stat syscalls which use struct stat[64] */
> >> > > +#ifdef __ARCH_WANT_SYSCALL_UNXSTAT
> >> >
> >> > I'm glad you explain what 'UNXSTAT' means here, since I would not
> >> > have otherwise guessed it, but I also can't think of anything more
> >> > intuitive.
> >>
> >> Yeh, I renamed that several times while playing around with this :-).
> >>
> >> The stat syscalls remind me a bit of the Vicar of Dibley episode where
> >> the new road named "New Road" necessitates the renaming of the existing
> >> "New Road" to "Quite Old Road" and "Quite Old Road" to "Really Quite Old
> >> Road" and "Old Road" to "Very Old Road"!
> >
> > (Add Palmer Dabbelt <palmer@dabbelt.com>)
> >
> > The stat syscalls are full of hacks, and we have to pull that hacks
> > even to new architectures to deal with stat. So I'll be happy to drop
> > it in arm64/ilp32. But it means that I need some time to integrate
> > your patch and fix glibc accordingly. And it also means that we need
> > round 9 for ilp32... :(
> >
> > Arnd, once before you told that generic unistd has some duplications
> > and legacy syscalls, and one day we'll have to deal with it. Do you
> > have the list or something on it?
> 
> No, I'd have to do some research for that.
> 
> > I would also notice riscv people and welcome to the discussion.
> >
> > As there is more than 1 arch that goes to be added to linux soon,
> > maybe it's better to upstream my ans James' patches separately
> > from other ilp32 patches? Arnd?
> 
> Do you mean upstream those two patches slightly later? That's
> fine with me, I don't care much whether the old new stat is part
> of the syscall table for arm64-ilp32 or not, I'd leave that up to
> you, depending on whether you want to do the rework or not.
 
I mean that if we want to deprecate rlimit and stat syscalls for
architectures that are under development now, it's better to upstream
patches that actually deprecate it as early as possible. 

> I suppose the arm64-ilp32 could benefit from not having to support
> the old arm32 stat structure, but doing the new syscalls based on
> statx could delay the glibc port some more, as there are some open
> questions about how that would best be integrated.

OK. Let's leave things as is. But then I don't see any reason to
add unxstat patch to ilp32 series if ilp32 will not disable it.

Yury
Arnd Bergmann June 20, 2017, 3:27 p.m.
On Tue, Jun 20, 2017 at 4:54 PM, Yury Norov <ynorov@caviumnetworks.com> wrote:
> On Tue, Jun 20, 2017 at 04:20:43PM +0200, Arnd Bergmann wrote:
>> On Tue, Jun 20, 2017 at 3:37 PM, Yury Norov <ynorov@caviumnetworks.com> wrote:
>> > On Mon, Jun 19, 2017 at 11:10:23PM +0100, James Hogan wrote:
>> >> On Mon, Jun 19, 2017 at 11:58:41PM +0200, Arnd Bergmann wrote:

>> > I would also notice riscv people and welcome to the discussion.
>> >
>> > As there is more than 1 arch that goes to be added to linux soon,
>> > maybe it's better to upstream my ans James' patches separately
>> > from other ilp32 patches? Arnd?
>>
>> Do you mean upstream those two patches slightly later? That's
>> fine with me, I don't care much whether the old new stat is part
>> of the syscall table for arm64-ilp32 or not, I'd leave that up to
>> you, depending on whether you want to do the rework or not.
>
> I mean that if we want to deprecate rlimit and stat syscalls for
> architectures that are under development now, it's better to upstream
> patches that actually deprecate it as early as possible.

Makes sense.

>> I suppose the arm64-ilp32 could benefit from not having to support
>> the old arm32 stat structure, but doing the new syscalls based on
>> statx could delay the glibc port some more, as there are some open
>> questions about how that would best be integrated.
>
> OK. Let's leave things as is. But then I don't see any reason to
> add unxstat patch to ilp32 series if ilp32 will not disable it.

Right, that's what I meant: let's leave the rlimit patch in your series
as it matches the work you have already done, and is the right
thing to do, and let's do the unxstat patch separately so it doesn't
cause you extra work.

        Arnd

Patch hide | download patch | download mbox

diff --git a/arch/alpha/include/asm/unistd.h b/arch/alpha/include/asm/unistd.h
index a56e608db2f9..5ad9d35b1bfb 100644
--- a/arch/alpha/include/asm/unistd.h
+++ b/arch/alpha/include/asm/unistd.h
@@ -7,6 +7,7 @@ 
 
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 #define __ARCH_WANT_SYS_GETHOSTNAME
 #define __ARCH_WANT_SYS_FADVISE64
 #define __ARCH_WANT_SYS_GETPGRP
diff --git a/arch/arc/include/uapi/asm/unistd.h b/arch/arc/include/uapi/asm/unistd.h
index ac6496527ad6..e68bdb8c6f58 100644
--- a/arch/arc/include/uapi/asm/unistd.h
+++ b/arch/arc/include/uapi/asm/unistd.h
@@ -17,6 +17,7 @@ 
 
 #define __ARCH_WANT_RENAMEAT
 #define __ARCH_WANT_SET_GET_RLIMIT
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 #define __ARCH_WANT_SYS_EXECVE
 #define __ARCH_WANT_SYS_CLONE
 #define __ARCH_WANT_SYS_VFORK
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
index 076090d2dbf5..68bc0b5e58a4 100644
--- a/arch/arm/include/asm/unistd.h
+++ b/arch/arm/include/asm/unistd.h
@@ -17,6 +17,7 @@ 
 #include <asm/unistd-nr.h>
 
 #define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 #define __ARCH_WANT_SYS_GETHOSTNAME
 #define __ARCH_WANT_SYS_PAUSE
 #define __ARCH_WANT_SYS_GETPGRP
diff --git a/arch/arm64/include/uapi/asm/unistd.h b/arch/arm64/include/uapi/asm/unistd.h
index 48355a683e25..d066041b53e7 100644
--- a/arch/arm64/include/uapi/asm/unistd.h
+++ b/arch/arm64/include/uapi/asm/unistd.h
@@ -16,5 +16,6 @@ 
 
 #define __ARCH_WANT_RENAMEAT
 #define __ARCH_WANT_SET_GET_RLIMIT
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 
 #include <asm-generic/unistd.h>
diff --git a/arch/blackfin/include/asm/unistd.h b/arch/blackfin/include/asm/unistd.h
index c8c8ff9eff61..eb0e20e02006 100644
--- a/arch/blackfin/include/asm/unistd.h
+++ b/arch/blackfin/include/asm/unistd.h
@@ -9,6 +9,7 @@ 
 #include <uapi/asm/unistd.h>
 
 #define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_GETHOSTNAME
 #define __ARCH_WANT_SYS_PAUSE
diff --git a/arch/c6x/include/uapi/asm/unistd.h b/arch/c6x/include/uapi/asm/unistd.h
index f67623137853..6e38fa29637c 100644
--- a/arch/c6x/include/uapi/asm/unistd.h
+++ b/arch/c6x/include/uapi/asm/unistd.h
@@ -16,6 +16,7 @@ 
 
 #define __ARCH_WANT_RENAMEAT
 #define __ARCH_WANT_SET_GET_RLIMIT
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 #define __ARCH_WANT_SYS_CLONE
 
 /* Use the standard ABI for syscalls. */
diff --git a/arch/cris/include/asm/unistd.h b/arch/cris/include/asm/unistd.h
index 9c23535821c0..84e6a0cac8a7 100644
--- a/arch/cris/include/asm/unistd.h
+++ b/arch/cris/include/asm/unistd.h
@@ -11,6 +11,7 @@ 
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_OLD_STAT
 #define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_GETHOSTNAME
 #define __ARCH_WANT_SYS_IPC
diff --git a/arch/frv/include/asm/unistd.h b/arch/frv/include/asm/unistd.h
index 17b5df8fc28a..4023d0a9f7a4 100644
--- a/arch/frv/include/asm/unistd.h
+++ b/arch/frv/include/asm/unistd.h
@@ -9,6 +9,7 @@ 
 /* #define __ARCH_WANT_OLD_READDIR */
 #define __ARCH_WANT_OLD_STAT
 #define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 #define __ARCH_WANT_SYS_ALARM
 /* #define __ARCH_WANT_SYS_GETHOSTNAME */
 #define __ARCH_WANT_SYS_IPC
diff --git a/arch/h8300/include/uapi/asm/unistd.h b/arch/h8300/include/uapi/asm/unistd.h
index 2f98394b77d4..8109fb2856b3 100644
--- a/arch/h8300/include/uapi/asm/unistd.h
+++ b/arch/h8300/include/uapi/asm/unistd.h
@@ -2,5 +2,6 @@ 
 
 #define __ARCH_WANT_RENAMEAT
 #define __ARCH_WANT_SET_GET_RLIMIT
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 
 #include <asm-generic/unistd.h>
diff --git a/arch/hexagon/include/uapi/asm/unistd.h b/arch/hexagon/include/uapi/asm/unistd.h
index 52d585c5cdb2..a45f8f9a9544 100644
--- a/arch/hexagon/include/uapi/asm/unistd.h
+++ b/arch/hexagon/include/uapi/asm/unistd.h
@@ -29,6 +29,7 @@ 
 #define sys_mmap2 sys_mmap_pgoff
 #define __ARCH_WANT_RENAMEAT
 #define __ARCH_WANT_SET_GET_RLIMIT
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 #define __ARCH_WANT_SYS_EXECVE
 #define __ARCH_WANT_SYS_CLONE
 #define __ARCH_WANT_SYS_VFORK
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
index 8c85209753ab..c1cfe1c98e6c 100644
--- a/arch/ia64/include/asm/unistd.h
+++ b/arch/ia64/include/asm/unistd.h
@@ -13,6 +13,8 @@ 
 
 #define NR_syscalls			326 /* length of syscall table */
 
+#define __ARCH_WANT_SYSCALL_UNXSTAT
+
 /*
  * The following defines stop scripts/checksyscalls.sh from complaining about
  * unimplemented system calls.  Glibc provides for each of these by using
diff --git a/arch/m32r/include/asm/unistd.h b/arch/m32r/include/asm/unistd.h
index 59db80193454..adde7a9b9e8b 100644
--- a/arch/m32r/include/asm/unistd.h
+++ b/arch/m32r/include/asm/unistd.h
@@ -7,6 +7,7 @@ 
 #define NR_syscalls 326
 
 #define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_GETHOSTNAME
 #define __ARCH_WANT_SYS_IPC
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h
index aab1edd0d4ba..0d9dee1f8e38 100644
--- a/arch/m68k/include/asm/unistd.h
+++ b/arch/m68k/include/asm/unistd.h
@@ -9,6 +9,7 @@ 
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_OLD_STAT
 #define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_GETHOSTNAME
 #define __ARCH_WANT_SYS_IPC
diff --git a/arch/metag/include/uapi/asm/unistd.h b/arch/metag/include/uapi/asm/unistd.h
index 16b5cb32ec21..11f5267da973 100644
--- a/arch/metag/include/uapi/asm/unistd.h
+++ b/arch/metag/include/uapi/asm/unistd.h
@@ -9,6 +9,7 @@ 
 
 #define __ARCH_WANT_RENAMEAT
 #define __ARCH_WANT_SET_GET_RLIMIT
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 
 /* Use the standard ABI for syscalls. */
 #include <asm-generic/unistd.h>
diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h
index 032fed71223f..183caf9398fd 100644
--- a/arch/microblaze/include/asm/unistd.h
+++ b/arch/microblaze/include/asm/unistd.h
@@ -16,6 +16,7 @@ 
 /* #define __ARCH_WANT_OLD_READDIR */
 /* #define __ARCH_WANT_OLD_STAT */
 #define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_GETHOSTNAME
 #define __ARCH_WANT_SYS_PAUSE
diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h
index 11fa291ec25a..6cc6206b501b 100644
--- a/arch/mips/include/asm/unistd.h
+++ b/arch/mips/include/asm/unistd.h
@@ -30,6 +30,7 @@ 
 #ifndef __ASSEMBLY__
 
 #define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_GETHOSTNAME
 #define __ARCH_WANT_SYS_IPC
diff --git a/arch/mn10300/include/asm/unistd.h b/arch/mn10300/include/asm/unistd.h
index 0522468f488b..0e0c645b85b9 100644
--- a/arch/mn10300/include/asm/unistd.h
+++ b/arch/mn10300/include/asm/unistd.h
@@ -22,6 +22,7 @@ 
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_OLD_STAT
 #define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_GETHOSTNAME
 #define __ARCH_WANT_SYS_IPC
diff --git a/arch/nios2/include/uapi/asm/unistd.h b/arch/nios2/include/uapi/asm/unistd.h
index b0dda4de2bc7..803241364fa1 100644
--- a/arch/nios2/include/uapi/asm/unistd.h
+++ b/arch/nios2/include/uapi/asm/unistd.h
@@ -19,6 +19,7 @@ 
 
 #define __ARCH_WANT_RENAMEAT
 #define __ARCH_WANT_SET_GET_RLIMIT
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 
 /* Use the standard ABI for syscalls */
 #include <asm-generic/unistd.h>
diff --git a/arch/openrisc/include/uapi/asm/unistd.h b/arch/openrisc/include/uapi/asm/unistd.h
index 6812d81b3c6c..ae91c8ef72dd 100644
--- a/arch/openrisc/include/uapi/asm/unistd.h
+++ b/arch/openrisc/include/uapi/asm/unistd.h
@@ -22,6 +22,7 @@ 
 
 #define __ARCH_WANT_RENAMEAT
 #define __ARCH_WANT_SET_GET_RLIMIT
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 #define __ARCH_WANT_SYS_FORK
 #define __ARCH_WANT_SYS_CLONE
 
diff --git a/arch/parisc/include/asm/unistd.h b/arch/parisc/include/asm/unistd.h
index 5f4c68daa261..8299302eee31 100644
--- a/arch/parisc/include/asm/unistd.h
+++ b/arch/parisc/include/asm/unistd.h
@@ -142,6 +142,7 @@  type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5)	\
 
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_GETHOSTNAME
 #define __ARCH_WANT_SYS_PAUSE
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index 9ba11dbcaca9..8fb678b94f3f 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -28,6 +28,7 @@ 
 
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_GETHOSTNAME
 #define __ARCH_WANT_SYS_IPC
diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h
index 3066031a73fe..5e260f0b41ec 100644
--- a/arch/s390/include/asm/unistd.h
+++ b/arch/s390/include/asm/unistd.h
@@ -14,6 +14,7 @@ 
 #define __IGNORE_pkey_free
 
 #define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_GETHOSTNAME
 #define __ARCH_WANT_SYS_PAUSE
diff --git a/arch/score/include/uapi/asm/unistd.h b/arch/score/include/uapi/asm/unistd.h
index 7ad1bdcb8615..0532e4e7ee75 100644
--- a/arch/score/include/uapi/asm/unistd.h
+++ b/arch/score/include/uapi/asm/unistd.h
@@ -6,6 +6,7 @@ 
 #define __ARCH_WANT_SYSCALL_NO_FLAGS
 #define __ARCH_WANT_SYSCALL_OFF_T
 #define __ARCH_WANT_SYSCALL_DEPRECATED
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 #define __ARCH_WANT_SYS_CLONE
 #define __ARCH_WANT_SYS_FORK
 #define __ARCH_WANT_SYS_VFORK
diff --git a/arch/sh/include/asm/unistd.h b/arch/sh/include/asm/unistd.h
index 126fe8340b22..e44c78720f37 100644
--- a/arch/sh/include/asm/unistd.h
+++ b/arch/sh/include/asm/unistd.h
@@ -7,6 +7,7 @@ 
 # define __ARCH_WANT_OLD_READDIR
 # define __ARCH_WANT_OLD_STAT
 # define __ARCH_WANT_STAT64
+# define __ARCH_WANT_SYSCALL_UNXSTAT
 # define __ARCH_WANT_SYS_ALARM
 # define __ARCH_WANT_SYS_GETHOSTNAME
 # define __ARCH_WANT_SYS_IPC
diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h
index 0aac1e8f2968..23e28bd8e0b4 100644
--- a/arch/sparc/include/asm/unistd.h
+++ b/arch/sparc/include/asm/unistd.h
@@ -22,6 +22,7 @@ 
 #endif
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_GETHOSTNAME
 #define __ARCH_WANT_SYS_PAUSE
diff --git a/arch/tile/include/uapi/asm/unistd.h b/arch/tile/include/uapi/asm/unistd.h
index cf0505fe4b9c..210747e7aa5b 100644
--- a/arch/tile/include/uapi/asm/unistd.h
+++ b/arch/tile/include/uapi/asm/unistd.h
@@ -18,6 +18,7 @@ 
 /* Use the flavor of this syscall that matches the 32-bit API better. */
 #define __ARCH_WANT_SYNC_FILE_RANGE2
 #endif
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 
 /* Use the standard ABI for syscalls. */
 #include <asm-generic/unistd.h>
diff --git a/arch/unicore32/include/uapi/asm/unistd.h b/arch/unicore32/include/uapi/asm/unistd.h
index ef25aec1d440..00b869fe907f 100644
--- a/arch/unicore32/include/uapi/asm/unistd.h
+++ b/arch/unicore32/include/uapi/asm/unistd.h
@@ -12,6 +12,7 @@ 
 
 #define __ARCH_WANT_RENAMEAT
 #define __ARCH_WANT_SET_GET_RLIMIT
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 
 /* Use the standard ABI for syscalls. */
 #include <asm-generic/unistd.h>
diff --git a/arch/x86/include/asm/unistd.h b/arch/x86/include/asm/unistd.h
index 1ba1536f627e..fa06083f723c 100644
--- a/arch/x86/include/asm/unistd.h
+++ b/arch/x86/include/asm/unistd.h
@@ -10,6 +10,8 @@ 
 #  define __SYSCALL_MASK (~0)
 # endif
 
+#define __ARCH_WANT_SYSCALL_UNXSTAT
+
 # ifdef CONFIG_X86_32
 
 #  include <asm/unistd_32.h>
diff --git a/arch/xtensa/include/asm/unistd.h b/arch/xtensa/include/asm/unistd.h
index cb4c2ce8d447..4440601477ba 100644
--- a/arch/xtensa/include/asm/unistd.h
+++ b/arch/xtensa/include/asm/unistd.h
@@ -5,6 +5,7 @@ 
 #include <uapi/asm/unistd.h>
 
 #define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYSCALL_UNXSTAT
 #define __ARCH_WANT_SYS_UTIME
 #define __ARCH_WANT_SYS_LLSEEK
 #define __ARCH_WANT_SYS_GETPGRP
diff --git a/fs/stat.c b/fs/stat.c
index f494b182c7c7..f3c7292cf138 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -292,6 +292,8 @@  SYSCALL_DEFINE2(fstat, unsigned int, fd, struct __old_kernel_stat __user *, stat
 #  define INIT_STRUCT_STAT_PADDING(st) memset(&st, 0, sizeof(st))
 #endif
 
+#ifdef __ARCH_WANT_SYSCALL_UNXSTAT
+
 static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf)
 {
 	struct stat tmp;
@@ -378,6 +380,8 @@  SYSCALL_DEFINE2(newfstat, unsigned int, fd, struct stat __user *, statbuf)
 	return error;
 }
 
+#endif /* __ARCH_WANT_SYSCALL_UNXSTAT */
+
 SYSCALL_DEFINE4(readlinkat, int, dfd, const char __user *, pathname,
 		char __user *, buf, int, bufsiz)
 {
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
index cccc86ecfeaa..5ea721d393db 100644
--- a/include/asm-generic/unistd.h
+++ b/include/asm-generic/unistd.h
@@ -7,6 +7,8 @@ 
  * be selected by default.
  */
 #if __BITS_PER_LONG == 32
+#ifdef __ARCH_WANT_SYSCALL_UNXSTAT
 #define __ARCH_WANT_STAT64
+#endif
 #define __ARCH_WANT_SYS_LLSEEK
 #endif
diff --git a/include/uapi/asm-generic/stat.h b/include/uapi/asm-generic/stat.h
index bd8cad21998e..bcf335581980 100644
--- a/include/uapi/asm-generic/stat.h
+++ b/include/uapi/asm-generic/stat.h
@@ -1,6 +1,11 @@ 
 #ifndef __ASM_GENERIC_STAT_H
 #define __ASM_GENERIC_STAT_H
 
+#include <asm/unistd.h>
+
+/* statx deprecates the un-extended stat syscalls which use struct stat[64] */
+#ifdef __ARCH_WANT_SYSCALL_UNXSTAT
+
 /*
  * Everybody gets this wrong and has to stick with it for all
  * eternity. Hopefully, this version gets used by new architectures
@@ -69,4 +74,6 @@  struct stat64 {
 };
 #endif
 
+#endif /* __ARCH_WANT_SYSCALL_UNXSTAT */
+
 #endif /* __ASM_GENERIC_STAT_H */
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index ffc30294103b..d6291b38092e 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -241,10 +241,12 @@  __SYSCALL(__NR_tee, sys_tee)
 /* fs/stat.c */
 #define __NR_readlinkat 78
 __SYSCALL(__NR_readlinkat, sys_readlinkat)
+#ifdef __ARCH_WANT_SYSCALL_UNXSTAT
 #define __NR3264_fstatat 79
 __SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat)
 #define __NR3264_fstat 80
 __SC_3264(__NR3264_fstat, sys_fstat64, sys_newfstat)
+#endif /* __ARCH_WANT_SYSCALL_UNXSTAT */
 
 /* fs/sync.c */
 #define __NR_sync 81
@@ -925,8 +927,10 @@  __SYSCALL(__NR_fork, sys_ni_syscall)
 #define __NR_ftruncate __NR3264_ftruncate
 #define __NR_lseek __NR3264_lseek
 #define __NR_sendfile __NR3264_sendfile
+#ifdef __NR3264_fstat
 #define __NR_newfstatat __NR3264_fstatat
 #define __NR_fstat __NR3264_fstat
+#endif
 #define __NR_mmap __NR3264_mmap
 #define __NR_fadvise64 __NR3264_fadvise64
 #ifdef __NR3264_stat
@@ -941,8 +945,10 @@  __SYSCALL(__NR_fork, sys_ni_syscall)
 #define __NR_ftruncate64 __NR3264_ftruncate
 #define __NR_llseek __NR3264_lseek
 #define __NR_sendfile64 __NR3264_sendfile
+#ifdef __NR3264_fstat
 #define __NR_fstatat64 __NR3264_fstatat
 #define __NR_fstat64 __NR3264_fstat
+#endif
 #define __NR_mmap2 __NR3264_mmap
 #define __NR_fadvise64_64 __NR3264_fadvise64
 #ifdef __NR3264_stat
diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
index a5a0a341aa17..ef14cab988a9 100755
--- a/scripts/checksyscalls.sh
+++ b/scripts/checksyscalls.sh
@@ -37,6 +37,15 @@  cat << EOF
 #define __IGNORE_lstat64	/* fstatat64 */
 #endif
 
+/* statx */
+#if BITS_PER_LONG == 64
+#define __IGNORE_newfstatat	/* statx */
+#define __IGNORE_newfstat	/* statx */
+#else
+#define __IGNORE_fstatat64	/* statx */
+#define __IGNORE_fstat64	/* statx */
+#endif
+
 /* Missing flags argument */
 #define __IGNORE_renameat	/* renameat2 */