2014-02-13 22:08:24

by Fabian Frédérick

[permalink] [raw]
Subject: [PATCH 1/1] sys_sysfs: Add CONFIG_SYSFS_SYSCALL

sys_sysfs is an obsolete system call no longer supported by libc ...
-This patch adds a default CONFIG_SYSFS_SYSCALL=y
-Option can be turned off in expert mode.
-cond_syscall added to kernel/sys_ni.c

Signed-off-by: Fabian Frederick <[email protected]>
---
fs/filesystems.c | 2 ++
init/Kconfig | 10 ++++++++++
kernel/sys_ni.c | 1 +
3 files changed, 13 insertions(+)

diff --git a/fs/filesystems.c b/fs/filesystems.c
index 92567d9..5797d45 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);

+#ifdef CONFIG_SYSFS_SYSCALL
static int fs_index(const char __user * __name)
{
struct file_system_type * tmp;
@@ -199,6 +200,7 @@ SYSCALL_DEFINE3(sysfs, int, option, unsigned long, arg1, unsigned long, arg2)
}
return retval;
}
+#endif

int __init get_filesystem_list(char *buf)
{
diff --git a/init/Kconfig b/init/Kconfig
index 009a797..013d13c 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1290,6 +1290,16 @@ config UID16
help
This enables the legacy 16-bit UID syscall wrappers.

+config SYSFS_SYSCALL
+ bool "Sysfs syscall support" if EXPERT
+ default y
+ ---help---
+ sys_sysfs is an obsolete system call no longer supported in
+ libc.Note that disabling this option while being more secure breaks
+ compatibility with other systems.
+
+ If unsure say Y here.
+
config SYSCTL_SYSCALL
bool "Sysctl syscall support" if EXPERT
depends on PROC_SYSCTL
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 7078052..74395a9 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -146,6 +146,7 @@ cond_syscall(sys_io_destroy);
cond_syscall(sys_io_submit);
cond_syscall(sys_io_cancel);
cond_syscall(sys_io_getevents);
+cond_syscall(sys_sysfs);
cond_syscall(sys_syslog);
cond_syscall(sys_process_vm_readv);
cond_syscall(sys_process_vm_writev);
--
1.8.1.4


2014-02-13 22:32:21

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH 1/1] sys_sysfs: Add CONFIG_SYSFS_SYSCALL

On Thu, Feb 13, 2014 at 10:09:42PM +0800, Fabian Frederick wrote:
> sys_sysfs is an obsolete system call no longer supported by libc ...
> -This patch adds a default CONFIG_SYSFS_SYSCALL=y
> -Option can be turned off in expert mode.
> -cond_syscall added to kernel/sys_ni.c
>
> Signed-off-by: Fabian Frederick <[email protected]>
> ---
> fs/filesystems.c | 2 ++
> init/Kconfig | 10 ++++++++++
> kernel/sys_ni.c | 1 +
> 3 files changed, 13 insertions(+)

did anyone ever ship userspace that actually used that syscall ?
Some ancient version of udev that probably doesn't work on a modern kernel anyway maybe ?

I wonder if it's something we can make -ENOSYS unconditionally at some point,
and remove all that code entirely.

Dave

2014-02-13 22:37:16

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 1/1] sys_sysfs: Add CONFIG_SYSFS_SYSCALL

On Thu, Feb 13, 2014 at 05:31:41PM -0500, Dave Jones wrote:
> On Thu, Feb 13, 2014 at 10:09:42PM +0800, Fabian Frederick wrote:
> > sys_sysfs is an obsolete system call no longer supported by libc ...
> > -This patch adds a default CONFIG_SYSFS_SYSCALL=y
> > -Option can be turned off in expert mode.
> > -cond_syscall added to kernel/sys_ni.c
> >
> > Signed-off-by: Fabian Frederick <[email protected]>
> > ---
> > fs/filesystems.c | 2 ++
> > init/Kconfig | 10 ++++++++++
> > kernel/sys_ni.c | 1 +
> > 3 files changed, 13 insertions(+)
>
> did anyone ever ship userspace that actually used that syscall ?
> Some ancient version of udev that probably doesn't work on a modern kernel anyway maybe ?

sys_sysfs doesn't have anything to do with /sys/ and udev in any way
that I know of, it's a much older thing, a sysv syscall that can return
the index, name, or max index of a filesystem.

And yes, I got confused by it all the time when creating sysfs :)

thanks,

greg k-h

2014-02-13 22:42:26

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH 1/1] sys_sysfs: Add CONFIG_SYSFS_SYSCALL

On Thu, Feb 13, 2014 at 02:38:32PM -0800, Greg KH wrote:
> On Thu, Feb 13, 2014 at 05:31:41PM -0500, Dave Jones wrote:
> > On Thu, Feb 13, 2014 at 10:09:42PM +0800, Fabian Frederick wrote:
> > > sys_sysfs is an obsolete system call no longer supported by libc ...
> > > -This patch adds a default CONFIG_SYSFS_SYSCALL=y
> > > -Option can be turned off in expert mode.
> > > -cond_syscall added to kernel/sys_ni.c
> > >
> > > Signed-off-by: Fabian Frederick <[email protected]>
> > > ---
> > > fs/filesystems.c | 2 ++
> > > init/Kconfig | 10 ++++++++++
> > > kernel/sys_ni.c | 1 +
> > > 3 files changed, 13 insertions(+)
> >
> > did anyone ever ship userspace that actually used that syscall ?
> > Some ancient version of udev that probably doesn't work on a modern kernel anyway maybe ?
>
> sys_sysfs doesn't have anything to do with /sys/ and udev in any way
> that I know of, it's a much older thing, a sysv syscall that can return
> the index, name, or max index of a filesystem.
>
> And yes, I got confused by it all the time when creating sysfs :)

ah, Now I realise I've also made this mistake before. Tricky.

I wonder if anything does still use it though..
*goes to grep all of Fedora source*

Dave

2014-02-13 22:43:22

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 1/1] sys_sysfs: Add CONFIG_SYSFS_SYSCALL

On Thu, 13 Feb 2014 17:31:41 -0500 Dave Jones <[email protected]> wrote:

> On Thu, Feb 13, 2014 at 10:09:42PM +0800, Fabian Frederick wrote:
> > sys_sysfs is an obsolete system call no longer supported by libc ...
> > -This patch adds a default CONFIG_SYSFS_SYSCALL=y
> > -Option can be turned off in expert mode.
> > -cond_syscall added to kernel/sys_ni.c
> >
> > Signed-off-by: Fabian Frederick <[email protected]>
> > ---
> > fs/filesystems.c | 2 ++
> > init/Kconfig | 10 ++++++++++
> > kernel/sys_ni.c | 1 +
> > 3 files changed, 13 insertions(+)
>
> did anyone ever ship userspace that actually used that syscall ?
> Some ancient version of udev that probably doesn't work on a modern kernel anyway maybe ?
>
> I wonder if it's something we can make -ENOSYS unconditionally at some point,
> and remove all that code entirely.

Perhaps we could make it `default n' now and see if we receive nastygrams?

2014-02-19 20:48:29

by Fabian Frédérick

[permalink] [raw]
Subject: Re: [PATCH 1/1] sys_sysfs: Add CONFIG_SYSFS_SYSCALL

On Thu, 13 Feb 2014 14:43:19 -0800
Andrew Morton <[email protected]> wrote:

> On Thu, 13 Feb 2014 17:31:41 -0500 Dave Jones <[email protected]> wrote:
>
> > On Thu, Feb 13, 2014 at 10:09:42PM +0800, Fabian Frederick wrote:
> > > sys_sysfs is an obsolete system call no longer supported by libc ...
> > > -This patch adds a default CONFIG_SYSFS_SYSCALL=y
> > > -Option can be turned off in expert mode.
> > > -cond_syscall added to kernel/sys_ni.c
> > >
> > > Signed-off-by: Fabian Frederick <[email protected]>
> > > ---
> > > fs/filesystems.c | 2 ++
> > > init/Kconfig | 10 ++++++++++
> > > kernel/sys_ni.c | 1 +
> > > 3 files changed, 13 insertions(+)
> >
> > did anyone ever ship userspace that actually used that syscall ?
> > Some ancient version of udev that probably doesn't work on a modern kernel anyway maybe ?
> >
> > I wonder if it's something we can make -ENOSYS unconditionally at some point,
> > and remove all that code entirely.
>
> Perhaps we could make it `default n' now and see if we receive nastygrams?

As it seems very old, maybe we wouldn't have any trouble for users in linux-next but it could break something when going in stable (?).Having that patch with functions enabled by default will give us time to test it and have a pointer to it to remove later...

Fabian