2005-01-23 05:06:13

by Anton Blanchard

[permalink] [raw]
Subject: [PATCH] Problems disabling SYSCTL


Create a cond_syscall for sys32_sysctl and make all architectures use
it. Also fix the architectures that dont wrap their 32bit compat sysctl
code.

Signed-off-by: Anton Blanchard <[email protected]>

diff -puN arch/ia64/ia32/sys_ia32.c~sysctl_fixup2 arch/ia64/ia32/sys_ia32.c
--- foobar2/arch/ia64/ia32/sys_ia32.c~sysctl_fixup2 2005-01-13 10:40:35.995198406 +1100
+++ foobar2-anton/arch/ia64/ia32/sys_ia32.c 2005-01-13 10:40:36.058193579 +1100
@@ -1973,10 +1973,10 @@ struct sysctl32 {
unsigned int __unused[4];
};

+#ifdef CONFIG_SYSCTL
asmlinkage long
sys32_sysctl (struct sysctl32 __user *args)
{
-#ifdef CONFIG_SYSCTL
struct sysctl32 a32;
mm_segment_t old_fs = get_fs ();
void __user *oldvalp, *newvalp;
@@ -2015,10 +2015,8 @@ sys32_sysctl (struct sysctl32 __user *ar
return -EFAULT;

return ret;
-#else
- return -ENOSYS;
-#endif
}
+#endif

asmlinkage long
sys32_newuname (struct new_utsname __user *name)
diff -puN arch/mips/kernel/linux32.c~sysctl_fixup2 arch/mips/kernel/linux32.c
--- foobar2/arch/mips/kernel/linux32.c~sysctl_fixup2 2005-01-13 10:40:36.000198023 +1100
+++ foobar2-anton/arch/mips/kernel/linux32.c 2005-01-13 10:40:36.051194115 +1100
@@ -1194,13 +1194,6 @@ asmlinkage long sys32_sysctl(struct sysc
return error;
}

-#else /* CONFIG_SYSCTL */
-
-asmlinkage long sys32_sysctl(struct sysctl_args32 *args)
-{
- return -ENOSYS;
-}
-
#endif /* CONFIG_SYSCTL */

asmlinkage long sys32_newuname(struct new_utsname * name)
diff -puN arch/parisc/kernel/sys_parisc32.c~sysctl_fixup2 arch/parisc/kernel/sys_parisc32.c
--- foobar2/arch/parisc/kernel/sys_parisc32.c~sysctl_fixup2 2005-01-13 10:40:36.005197640 +1100
+++ foobar2-anton/arch/parisc/kernel/sys_parisc32.c 2005-01-13 10:40:36.060193425 +1100
@@ -165,12 +165,6 @@ asmlinkage long sys32_sysctl(struct __sy
return error;
}

-#else /* CONFIG_SYSCTL */
-
-asmlinkage long sys32_sysctl(struct __sysctl_args *args)
-{
- return -ENOSYS;
-}
#endif /* CONFIG_SYSCTL */

asmlinkage long sys32_sched_rr_get_interval(pid_t pid,
diff -puN arch/ppc64/kernel/sys_ppc32.c~sysctl_fixup2 arch/ppc64/kernel/sys_ppc32.c
--- foobar2/arch/ppc64/kernel/sys_ppc32.c~sysctl_fixup2 2005-01-13 10:40:36.011197180 +1100
+++ foobar2-anton/arch/ppc64/kernel/sys_ppc32.c 2005-01-13 10:40:36.046194498 +1100
@@ -1106,6 +1106,7 @@ asmlinkage long sys32_umask(u32 mask)
return sys_umask((int)mask);
}

+#ifdef CONFIG_SYSCTL
struct __sysctl_args32 {
u32 name;
int nlen;
@@ -1155,6 +1156,7 @@ asmlinkage long sys32_sysctl(struct __sy
}
return error;
}
+#endif

asmlinkage int sys32_olduname(struct oldold_utsname __user * name)
{
diff -puN arch/s390/kernel/compat_linux.c~sysctl_fixup2 arch/s390/kernel/compat_linux.c
--- foobar2/arch/s390/kernel/compat_linux.c~sysctl_fixup2 2005-01-13 10:40:36.016196797 +1100
+++ foobar2-anton/arch/s390/kernel/compat_linux.c 2005-01-13 10:40:36.063193195 +1100
@@ -906,6 +906,7 @@ asmlinkage long sys32_adjtimex(struct ti
return ret;
}

+#ifdef CONFIG_SYSCTL
struct __sysctl_args32 {
u32 name;
int nlen;
@@ -953,6 +954,7 @@ asmlinkage long sys32_sysctl(struct __sy
}
return error;
}
+#endif

struct stat64_emu31 {
unsigned long long st_dev;
diff -puN arch/x86_64/ia32/sys_ia32.c~sysctl_fixup2 arch/x86_64/ia32/sys_ia32.c
--- foobar2/arch/x86_64/ia32/sys_ia32.c~sysctl_fixup2 2005-01-13 10:40:36.021196414 +1100
+++ foobar2-anton/arch/x86_64/ia32/sys_ia32.c 2005-01-13 10:40:36.066192966 +1100
@@ -653,6 +653,7 @@ sys32_pause(void)
}


+#ifdef CONFIG_SYSCTL
struct sysctl_ia32 {
unsigned int name;
int nlen;
@@ -667,9 +668,6 @@ struct sysctl_ia32 {
asmlinkage long
sys32_sysctl(struct sysctl_ia32 __user *args32)
{
-#ifndef CONFIG_SYSCTL
- return -ENOSYS;
-#else
struct sysctl_ia32 a32;
mm_segment_t old_fs = get_fs ();
void *oldvalp, *newvalp;
@@ -710,8 +708,8 @@ sys32_sysctl(struct sysctl_ia32 __user *
return -EFAULT;

return ret;
-#endif
}
+#endif

/* warning: next two assume little endian */
asmlinkage long
diff -puN kernel/sys_ni.c~sysctl_fixup2 kernel/sys_ni.c
--- foobar2/kernel/sys_ni.c~sysctl_fixup2 2005-01-13 10:40:36.026196031 +1100
+++ foobar2-anton/kernel/sys_ni.c 2005-01-13 10:40:36.047194422 +1100
@@ -82,3 +82,4 @@ cond_syscall(sys_pciconfig_read)
cond_syscall(sys_pciconfig_write)
cond_syscall(sys_pciconfig_iobase)
cond_syscall(sys32_ipc)
+cond_syscall(sys32_sysctl)
_


2005-01-23 14:35:09

by Matthew Wilcox

[permalink] [raw]
Subject: Re: [PATCH] Problems disabling SYSCTL

On Sun, Jan 23, 2005 at 04:01:02PM +1100, Anton Blanchard wrote:
> Create a cond_syscall for sys32_sysctl and make all architectures use
> it. Also fix the architectures that dont wrap their 32bit compat sysctl
> code.

Is there any reason to not move the sys32_sysctl code to kernel/sysctl.c?

--
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain

2005-01-23 19:17:57

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] Problems disabling SYSCTL

On Sun, Jan 23, 2005 at 02:35:00PM +0000, Matthew Wilcox wrote:
> On Sun, Jan 23, 2005 at 04:01:02PM +1100, Anton Blanchard wrote:
> > Create a cond_syscall for sys32_sysctl and make all architectures use
> > it. Also fix the architectures that dont wrap their 32bit compat sysctl
> > code.
>
> Is there any reason to not move the sys32_sysctl code to kernel/sysctl.c?

iirc it relies on a unified address space (= user pointers still
work in KERNEL_DS)

-Andi

2005-01-24 14:19:27

by Anton Blanchard

[permalink] [raw]
Subject: Re: [PATCH] Problems disabling SYSCTL


> > Is there any reason to not move the sys32_sysctl code to kernel/sysctl.c?
>
> iirc it relies on a unified address space (= user pointers still
> work in KERNEL_DS)

Yeah the sys32_sysctl code is pretty awful, perhaps we could do a better
job now we have compat_alloc_userspace.

Anton

2005-01-24 16:01:35

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] Problems disabling SYSCTL

On Tue, Jan 25, 2005 at 12:50:01AM +1100, Anton Blanchard wrote:
>
> > > Is there any reason to not move the sys32_sysctl code to kernel/sysctl.c?
> >
> > iirc it relies on a unified address space (= user pointers still
> > work in KERNEL_DS)
>
> Yeah the sys32_sysctl code is pretty awful, perhaps we could do a better
> job now we have compat_alloc_userspace.

It also mishandles array of longs.

But seriously I wouldn't bother - the syscall interface is deprecated anyways
and has been for a long time. The only sysctl that needs to be handled
is (CTL_KERN,KERN_VERSION) [used by glibc], the others are not needed
and I hoep to eventually remove them even natively.

-Andi

P.S.: Andrew I just discovered you removed the printk code for this.
That's not good, how are users supposed to know it's deprecated?

2005-01-24 16:15:10

by Matthew Wilcox

[permalink] [raw]
Subject: Re: [PATCH] Problems disabling SYSCTL

On Mon, Jan 24, 2005 at 05:00:53PM +0100, Andi Kleen wrote:
> But seriously I wouldn't bother - the syscall interface is deprecated anyways
> and has been for a long time. The only sysctl that needs to be handled
> is (CTL_KERN,KERN_VERSION) [used by glibc], the others are not needed
> and I hoep to eventually remove them even natively.
>
> -Andi
>
> P.S.: Andrew I just discovered you removed the printk code for this.
> That's not good, how are users supposed to know it's deprecated?

How are kernel hackers to know it's been deprecated? ;-)

Index: Documentation/feature-removal-schedule.txt
===================================================================
RCS file: /var/cvs/linux-2.6/Documentation/feature-removal-schedule.txt,v
retrieving revision 1.2
diff -u -p -r1.2 feature-removal-schedule.txt
--- Documentation/feature-removal-schedule.txt 12 Jan 2005 20:14:53 -0000 1.2
+++ Documentation/feature-removal-schedule.txt 24 Jan 2005 16:13:54 -0000
@@ -32,3 +32,11 @@ Why: /proc/sys/cpu/* has been deprecated
/sys/devices/system/cpu/cpu%n/cpufreq/.
Who: Dominik Brodowski <[email protected]>

+---------------------------
+
+What: The sysctl() syscall
+When: January 2006
+Files: kernel/sysctl.c
+Why: Dunno.
+Who: Andi Kleen <[email protected]>
+

Want to finish it off and send it to Andrew? ;-)

--
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain

2005-01-24 16:21:38

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] Problems disabling SYSCTL

> How are kernel hackers to know it's been deprecated? ;-)

Good idea, yes.

-Andi