From: Arnd Bergmann <arnd@arndb.de>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@ozlabs.org, Firoz Khan <firoz.khan@linaro.org>
Subject: Re: [RFC PATCH v2 5/5] powerpc/syscalls: Allow none instead of sys_ni_syscall
Date: Wed, 16 Jan 2019 14:53:32 +0100 [thread overview]
Message-ID: <CAK8P3a2EmiT+hEmj40i1ihZM1ecK2Q42zknWNLRbgYeuOyJgrg@mail.gmail.com> (raw)
In-Reply-To: <20190116132714.20094-5-mpe@ellerman.id.au>
On Wed, Jan 16, 2019 at 2:27 PM Michael Ellerman <mpe@ellerman.id.au> wrote:
>
> sys_ni_syscall is the "not-implemented" syscall syscall, which just
> returns -ENOSYS.
>
> But unless you know that it's not obvious what it does, and even if
> you do know what it means it doesn't stand out that well from other
> real syscalls.
>
> So teach the scripts to treat "none" as a synonym for
> "sys_ni_syscall". This makes the table more readable.
Hmm, this actually breaks the proposed script to find bugs
in the compat handling, i.e. detecting those that have no
compat handler but only a native one.
> diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl
> index c5907a2dbc86..988a7e29245f 100644
> --- a/arch/powerpc/kernel/syscalls/syscall.tbl
> +++ b/arch/powerpc/kernel/syscalls/syscall.tbl
> @@ -24,28 +24,28 @@
> 14 common mknod sys_mknod
> 15 common chmod sys_chmod
> 16 common lchown sys_lchown
> -17 common break sys_ni_syscall
> -18 32 oldstat sys_stat sys_ni_syscall
> -18 64 oldstat sys_ni_syscall
> +17 common break none
> +18 32 oldstat sys_stat none
> +18 64 oldstat none
The '64 oldstat' line can simply get dropped here, it has no value
(I failed to notice this earlier).
For break, i.e. a syscall number without any implementation,
we use a different syntax on x86 (leaving out the sys_* entirely),
and on s390 (using '-', which is visually better than 'none' IMHO).
We might also just remove those entirely across all architectures.
Some have already done this, and some have done it partially.
I can only see a couple of syscalls that got removed in the entire
git history (set_zone_reclaim, nfsservctl, vm86, timerfd), any other
ones are now literally pre-historic, and presumably nobody would
miss the macros when building a program that has no chance to
run on any kernel since at least 2.6.12.
For 32-bit oldstat, I'd argue that this should actually get fixed by adding
the compat syscall logic. I think this was discussed when Firoz
first posted his patches. Something like this:
diff --git a/arch/powerpc/include/asm/unistd.h
b/arch/powerpc/include/asm/unistd.h
index f44dbc65e38e..d954c2fc4e2f 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -41,9 +41,7 @@
#define __ARCH_WANT_SYS_OLDUMOUNT
#define __ARCH_WANT_SYS_SIGPENDING
#define __ARCH_WANT_SYS_SIGPROCMASK
-#ifdef CONFIG_PPC32
#define __ARCH_WANT_OLD_STAT
-#endif
#ifdef CONFIG_PPC64
#define __ARCH_WANT_SYS_TIME
#define __ARCH_WANT_SYS_UTIME
diff --git a/arch/powerpc/include/uapi/asm/stat.h
b/arch/powerpc/include/uapi/asm/stat.h
index afd25f2ff4e8..8331b350c12b 100644
--- a/arch/powerpc/include/uapi/asm/stat.h
+++ b/arch/powerpc/include/uapi/asm/stat.h
@@ -11,7 +11,7 @@
#define STAT_HAVE_NSEC 1
-#ifndef __powerpc64__
+#if defined(__KERNEL__) || !defined(__powerpc64__)
struct __old_kernel_stat {
unsigned short st_dev;
unsigned short st_ino;
@@ -25,7 +25,7 @@ struct __old_kernel_stat {
unsigned long st_mtime;
unsigned long st_ctime;
};
-#endif /* !__powerpc64__ */
+#endif /* __KERNEL__ || !__powerpc64__ */
struct stat {
unsigned long st_dev;
diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl
b/arch/powerpc/kernel/syscalls/syscall.tbl
index 740dc9dbf689..cd85718c7039 100644
--- a/arch/powerpc/kernel/syscalls/syscall.tbl
+++ b/arch/powerpc/kernel/syscalls/syscall.tbl
@@ -27,7 +27,7 @@
15 common chmod sys_chmod
16 common lchown sys_lchown
17 common break sys_ni_syscall
-18 32 oldstat sys_stat
sys_ni_syscall
+18 32 oldstat sys_stat
18 64 oldstat sys_ni_syscall
18 spu oldstat sys_ni_syscall
19 common lseek sys_lseek
compat_sys_lseek
@@ -43,7 +43,7 @@
25 spu stime sys_stime
26 nospu ptrace sys_ptrace
compat_sys_ptrace
27 common alarm sys_alarm
-28 32 oldfstat sys_fstat
sys_ni_syscall
+28 32 oldfstat sys_fstat
28 64 oldfstat sys_ni_syscall
28 spu oldfstat sys_ni_syscall
29 nospu pause sys_pause
@@ -114,7 +114,7 @@
82 64 select sys_ni_syscall
82 spu select sys_ni_syscall
83 common symlink sys_symlink
-84 32 oldlstat sys_lstat
sys_ni_syscall
+84 32 oldlstat sys_lstat
84 64 oldlstat sys_ni_syscall
84 spu oldlstat sys_ni_syscall
85 common readlink sys_readlink
next prev parent reply other threads:[~2019-01-16 14:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-16 13:27 [RFC PATCH v2 1/5] powerpc/syscalls: Use the number when building SPU syscall table Michael Ellerman
2019-01-16 13:27 ` [RFC PATCH v2 2/5] powerpc/syscalls: Remove unused offset parameter Michael Ellerman
2019-01-18 6:33 ` Firoz Khan
2019-01-16 13:27 ` [RFC PATCH v2 3/5] powerpc/syscalls: Remove unused prefix parameter Michael Ellerman
2019-01-16 13:27 ` [RFC PATCH v2 4/5] powerpc/syscalls: Split SPU-ness out of ABI Michael Ellerman
2019-01-16 13:27 ` [RFC PATCH v2 5/5] powerpc/syscalls: Allow none instead of sys_ni_syscall Michael Ellerman
2019-01-16 13:53 ` Arnd Bergmann [this message]
2019-01-17 10:35 ` Michael Ellerman
2019-01-17 12:21 ` Arnd Bergmann
2019-01-18 6:40 ` Firoz Khan
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=CAK8P3a2EmiT+hEmj40i1ihZM1ecK2Q42zknWNLRbgYeuOyJgrg@mail.gmail.com \
--to=arnd@arndb.de \
--cc=firoz.khan@linaro.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=mpe@ellerman.id.au \
/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;
as well as URLs for NNTP newsgroup(s).