* [RFC 2/2] Arch: Kconfig: Disable obsolete syscalls
@ 2014-02-12 13:04 Fabian Frederick
2014-02-12 21:13 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Fabian Frederick @ 2014-02-12 13:04 UTC (permalink / raw)
To: linux-kernel; +Cc: akpm, rdunlap
fs: sysfs syscall: Disable if DISABLE_OBSOLETE_SYSCALLS
sysfs syscall is obsolete (cf man sysfs).
Don't define fs_index, fs_name, fs_maxindex functions when
DISABLE_OBSOLETE_SYSCALLS is defined.
In that case, SYSCALL_DEFINE3(sysfs...) returns automatically -EINVAL.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
fs/filesystems.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/fs/filesystems.c b/fs/filesystems.c
index 92567d9..079626d 100644
--- a/fs/filesystems.c
+++ b/fs/filesystems.c
@@ -121,6 +121,7 @@ int unregister_filesystem(struct file_system_type * fs)
EXPORT_SYMBOL(unregister_filesystem);
+#ifndef CONFIG_DISABLE_OBSOLETE_SYSCALLS
static int fs_index(const char __user * __name)
{
struct file_system_type * tmp;
@@ -199,6 +200,12 @@ SYSCALL_DEFINE3(sysfs, int, option, unsigned long, arg1, unsigned long, arg2)
}
return retval;
}
+#else
+SYSCALL_DEFINE3(sysfs, int, option, unsigned long, arg1, unsigned long, arg2)
+{
+ return -EINVAL;
+}
+#endif /*CONFIG_DISABLE_OBSOLETE_SYSCALLS*/
int __init get_filesystem_list(char *buf)
{
--
1.8.1.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC 2/2] Arch: Kconfig: Disable obsolete syscalls
2014-02-12 21:13 ` Andrew Morton
@ 2014-02-12 13:23 ` Fabian Frederick
0 siblings, 0 replies; 3+ messages in thread
From: Fabian Frederick @ 2014-02-12 13:23 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, rdunlap
On Wed, 12 Feb 2014 13:13:14 -0800
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Wed, 12 Feb 2014 21:04:40 +0800 Fabian Frederick <fabf@skynet.be> wrote:
>
> > fs: sysfs syscall: Disable if DISABLE_OBSOLETE_SYSCALLS
> >
> > sysfs syscall is obsolete (cf man sysfs).
> >
> > Don't define fs_index, fs_name, fs_maxindex functions when
> > DISABLE_OBSOLETE_SYSCALLS is defined.
> > In that case, SYSCALL_DEFINE3(sysfs...) returns automatically -EINVAL.
> >
>
> Are there any other syscalls which will fall under
> CONFIG_DISABLE_OBSOLETE_SYSCALLS?
>
> There are plenty of other syscalls which can be disabled via Kconfig.
> As far as I recall, they each use their own CONFIG_foo.
>
> So I'm thinking it would be better to add a CONFIG_SYS_SYSFS or
> whatever which enables this syscall only. It defaults to y.
I thought it would be interesting to directly disable all of its but
honestly I don't know if there are a lot so your solution seems interesting :)
Thanks for your help !
>
> > --- a/fs/filesystems.c
> > +++ b/fs/filesystems.c
> > @@ -121,6 +121,7 @@ int unregister_filesystem(struct file_system_type * fs)
> >
> > EXPORT_SYMBOL(unregister_filesystem);
> >
> > +#ifndef CONFIG_DISABLE_OBSOLETE_SYSCALLS
> > static int fs_index(const char __user * __name)
> > {
> > struct file_system_type * tmp;
> > @@ -199,6 +200,12 @@ SYSCALL_DEFINE3(sysfs, int, option, unsigned long, arg1, unsigned long, arg2)
> > }
> > return retval;
> > }
> > +#else
> > +SYSCALL_DEFINE3(sysfs, int, option, unsigned long, arg1, unsigned long, arg2)
> > +{
> > + return -EINVAL;
> > +}
> > +#endif /*CONFIG_DISABLE_OBSOLETE_SYSCALLS*/
>
> And this should be done in kernel/sys_ni.c along with all the others.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC 2/2] Arch: Kconfig: Disable obsolete syscalls
2014-02-12 13:04 [RFC 2/2] Arch: Kconfig: Disable obsolete syscalls Fabian Frederick
@ 2014-02-12 21:13 ` Andrew Morton
2014-02-12 13:23 ` Fabian Frederick
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2014-02-12 21:13 UTC (permalink / raw)
To: Fabian Frederick; +Cc: linux-kernel, rdunlap
On Wed, 12 Feb 2014 21:04:40 +0800 Fabian Frederick <fabf@skynet.be> wrote:
> fs: sysfs syscall: Disable if DISABLE_OBSOLETE_SYSCALLS
>
> sysfs syscall is obsolete (cf man sysfs).
>
> Don't define fs_index, fs_name, fs_maxindex functions when
> DISABLE_OBSOLETE_SYSCALLS is defined.
> In that case, SYSCALL_DEFINE3(sysfs...) returns automatically -EINVAL.
>
Are there any other syscalls which will fall under
CONFIG_DISABLE_OBSOLETE_SYSCALLS?
There are plenty of other syscalls which can be disabled via Kconfig.
As far as I recall, they each use their own CONFIG_foo.
So I'm thinking it would be better to add a CONFIG_SYS_SYSFS or
whatever which enables this syscall only. It defaults to y.
> --- a/fs/filesystems.c
> +++ b/fs/filesystems.c
> @@ -121,6 +121,7 @@ int unregister_filesystem(struct file_system_type * fs)
>
> EXPORT_SYMBOL(unregister_filesystem);
>
> +#ifndef CONFIG_DISABLE_OBSOLETE_SYSCALLS
> static int fs_index(const char __user * __name)
> {
> struct file_system_type * tmp;
> @@ -199,6 +200,12 @@ SYSCALL_DEFINE3(sysfs, int, option, unsigned long, arg1, unsigned long, arg2)
> }
> return retval;
> }
> +#else
> +SYSCALL_DEFINE3(sysfs, int, option, unsigned long, arg1, unsigned long, arg2)
> +{
> + return -EINVAL;
> +}
> +#endif /*CONFIG_DISABLE_OBSOLETE_SYSCALLS*/
And this should be done in kernel/sys_ni.c along with all the others.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-02-12 21:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-12 13:04 [RFC 2/2] Arch: Kconfig: Disable obsolete syscalls Fabian Frederick
2014-02-12 21:13 ` Andrew Morton
2014-02-12 13:23 ` Fabian Frederick
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®