Skip to contentSkip to conversation

Problems disabling SYSCTL

PATCH In review Anton Blanchard 3 participants 7 messages Jan 23, 2005 – Jan 24, 2005

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

arch/ia64/ia32/sys_ia32.c renamed from arch/ia64/ia32/sys_ia32.c~sysctl_fixup2 +2 -4
diff -puN arch/ia64/ia32/sys_ia32.c~sysctl_fixup2 arch/ia64/ia32/sys_ia32.c
@@ -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)
arch/mips/kernel/linux32.c renamed from arch/mips/kernel/linux32.c~sysctl_fixup2 +0 -7
diff -puN arch/mips/kernel/linux32.c~sysctl_fixup2 arch/mips/kernel/linux32.c
@@ -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)
arch/parisc/kernel/sys_parisc32.c renamed from arch/parisc/kernel/sys_parisc32.c~sysctl_fixup2 +0 -6
diff -puN arch/parisc/kernel/sys_parisc32.c~sysctl_fixup2 arch/parisc/kernel/sys_parisc32.c
@@ -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,
arch/ppc64/kernel/sys_ppc32.c renamed from arch/ppc64/kernel/sys_ppc32.c~sysctl_fixup2 +2 -0
diff -puN arch/ppc64/kernel/sys_ppc32.c~sysctl_fixup2 arch/ppc64/kernel/sys_ppc32.c
@@ -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)
 {
arch/s390/kernel/compat_linux.c renamed from arch/s390/kernel/compat_linux.c~sysctl_fixup2 +2 -0
diff -puN arch/s390/kernel/compat_linux.c~sysctl_fixup2 arch/s390/kernel/compat_linux.c
@@ -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;
arch/x86_64/ia32/sys_ia32.c renamed from arch/x86_64/ia32/sys_ia32.c~sysctl_fixup2 +2 -4
diff -puN arch/x86_64/ia32/sys_ia32.c~sysctl_fixup2 arch/x86_64/ia32/sys_ia32.c
@@ -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
kernel/sys_ni.c renamed from kernel/sys_ni.c~sysctl_fixup2 +1 -0
diff -puN kernel/sys_ni.c~sysctl_fixup2 kernel/sys_ni.c
@@ -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)

_

#1 lore raw
Quoted 3 lines · Anton Blanchard

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?

Signature · 6 lines
"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
#2 lore raw
Quoted 6 lines · Matthew Wilcox
Quoted 3 lines · Anton Blanchard

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

#3 lore raw
Quoted 5 lines
Quoted 2 lines

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

#4 lore raw
Quoted 8 lines · Anton Blanchard
Quoted 5 lines
Quoted 2 lines

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?

#5 lore raw
Quoted 9 lines · Andi Kleen

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

feature-removal-schedule.txt 24 Jan 2005 16:13:54 -0000 renamed from feature-removal-schedule.txt 12 Jan 2005 20:14:53 -0000 1.2 +8 -0
diff -u -p -r1.2 feature-removal-schedule.txt
@@ -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? ;-)

Signature · 6 lines
"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
#6 lore raw
Quoted 1 line

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

Good idea, yes.

-Andi