mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Eric W. Biederman" <ebiederm@xmission.com>
To: linux-kernel@vger.kernel.org
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Subject: [PATCH 04/23] sysctl: Neuter the generic sysctl strategy routines.
Date: Sun,  8 Nov 2009 04:21:51 -0800	[thread overview]
Message-ID: <1257682930-31401-4-git-send-email-ebiederm@xmission.com> (raw)
In-Reply-To: <m14op5jjo4.fsf@fess.ebiederm.org>

From: Eric W. Biederman <ebiederm@xmission.com>

Now that sys_sysctl is a compatibility layer on top of /proc/sys
these routines are never called but are still put in sysctl
tables so I have reduced them to stubs until they can be
removed entirely.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 kernel/sysctl.c |  198 -------------------------------------------------------
 1 files changed, 0 insertions(+), 198 deletions(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 6a642d7..f82e955 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2835,201 +2835,6 @@ int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
 
 #endif /* CONFIG_PROC_FS */
 
-
-#ifdef CONFIG_SYSCTL_SYSCALL
-/*
- * General sysctl support routines 
- */
-
-/* The generic sysctl data routine (used if no strategy routine supplied) */
-int sysctl_data(struct ctl_table *table,
-		void __user *oldval, size_t __user *oldlenp,
-		void __user *newval, size_t newlen)
-{
-	size_t len;
-
-	/* Get out of I don't have a variable */
-	if (!table->data || !table->maxlen)
-		return -ENOTDIR;
-
-	if (oldval && oldlenp) {
-		if (get_user(len, oldlenp))
-			return -EFAULT;
-		if (len) {
-			if (len > table->maxlen)
-				len = table->maxlen;
-			if (copy_to_user(oldval, table->data, len))
-				return -EFAULT;
-			if (put_user(len, oldlenp))
-				return -EFAULT;
-		}
-	}
-
-	if (newval && newlen) {
-		if (newlen > table->maxlen)
-			newlen = table->maxlen;
-
-		if (copy_from_user(table->data, newval, newlen))
-			return -EFAULT;
-	}
-	return 1;
-}
-
-/* The generic string strategy routine: */
-int sysctl_string(struct ctl_table *table,
-		  void __user *oldval, size_t __user *oldlenp,
-		  void __user *newval, size_t newlen)
-{
-	if (!table->data || !table->maxlen) 
-		return -ENOTDIR;
-	
-	if (oldval && oldlenp) {
-		size_t bufsize;
-		if (get_user(bufsize, oldlenp))
-			return -EFAULT;
-		if (bufsize) {
-			size_t len = strlen(table->data), copied;
-
-			/* This shouldn't trigger for a well-formed sysctl */
-			if (len > table->maxlen)
-				len = table->maxlen;
-
-			/* Copy up to a max of bufsize-1 bytes of the string */
-			copied = (len >= bufsize) ? bufsize - 1 : len;
-
-			if (copy_to_user(oldval, table->data, copied) ||
-			    put_user(0, (char __user *)(oldval + copied)))
-				return -EFAULT;
-			if (put_user(len, oldlenp))
-				return -EFAULT;
-		}
-	}
-	if (newval && newlen) {
-		size_t len = newlen;
-		if (len > table->maxlen)
-			len = table->maxlen;
-		if(copy_from_user(table->data, newval, len))
-			return -EFAULT;
-		if (len == table->maxlen)
-			len--;
-		((char *) table->data)[len] = 0;
-	}
-	return 1;
-}
-
-/*
- * This function makes sure that all of the integers in the vector
- * are between the minimum and maximum values given in the arrays
- * table->extra1 and table->extra2, respectively.
- */
-int sysctl_intvec(struct ctl_table *table,
-		void __user *oldval, size_t __user *oldlenp,
-		void __user *newval, size_t newlen)
-{
-
-	if (newval && newlen) {
-		int __user *vec = (int __user *) newval;
-		int *min = (int *) table->extra1;
-		int *max = (int *) table->extra2;
-		size_t length;
-		int i;
-
-		if (newlen % sizeof(int) != 0)
-			return -EINVAL;
-
-		if (!table->extra1 && !table->extra2)
-			return 0;
-
-		if (newlen > table->maxlen)
-			newlen = table->maxlen;
-		length = newlen / sizeof(int);
-
-		for (i = 0; i < length; i++) {
-			int value;
-			if (get_user(value, vec + i))
-				return -EFAULT;
-			if (min && value < min[i])
-				return -EINVAL;
-			if (max && value > max[i])
-				return -EINVAL;
-		}
-	}
-	return 0;
-}
-
-/* Strategy function to convert jiffies to seconds */ 
-int sysctl_jiffies(struct ctl_table *table,
-		void __user *oldval, size_t __user *oldlenp,
-		void __user *newval, size_t newlen)
-{
-	if (oldval && oldlenp) {
-		size_t olen;
-
-		if (get_user(olen, oldlenp))
-			return -EFAULT;
-		if (olen) {
-			int val;
-
-			if (olen < sizeof(int))
-				return -EINVAL;
-
-			val = *(int *)(table->data) / HZ;
-			if (put_user(val, (int __user *)oldval))
-				return -EFAULT;
-			if (put_user(sizeof(int), oldlenp))
-				return -EFAULT;
-		}
-	}
-	if (newval && newlen) { 
-		int new;
-		if (newlen != sizeof(int))
-			return -EINVAL; 
-		if (get_user(new, (int __user *)newval))
-			return -EFAULT;
-		*(int *)(table->data) = new*HZ; 
-	}
-	return 1;
-}
-
-/* Strategy function to convert jiffies to seconds */ 
-int sysctl_ms_jiffies(struct ctl_table *table,
-		void __user *oldval, size_t __user *oldlenp,
-		void __user *newval, size_t newlen)
-{
-	if (oldval && oldlenp) {
-		size_t olen;
-
-		if (get_user(olen, oldlenp))
-			return -EFAULT;
-		if (olen) {
-			int val;
-
-			if (olen < sizeof(int))
-				return -EINVAL;
-
-			val = jiffies_to_msecs(*(int *)(table->data));
-			if (put_user(val, (int __user *)oldval))
-				return -EFAULT;
-			if (put_user(sizeof(int), oldlenp))
-				return -EFAULT;
-		}
-	}
-	if (newval && newlen) { 
-		int new;
-		if (newlen != sizeof(int))
-			return -EINVAL; 
-		if (get_user(new, (int __user *)newval))
-			return -EFAULT;
-		*(int *)(table->data) = msecs_to_jiffies(new);
-	}
-	return 1;
-}
-
-
-
-#else /* CONFIG_SYSCTL_SYSCALL */
-
-
 int sysctl_data(struct ctl_table *table,
 		  void __user *oldval, size_t __user *oldlenp,
 		  void __user *newval, size_t newlen)
@@ -3065,9 +2870,6 @@ int sysctl_ms_jiffies(struct ctl_table *table,
 	return -ENOSYS;
 }
 
-#endif /* CONFIG_SYSCTL_SYSCALL */
-
-
 /*
  * No sense putting this after each symbol definition, twice,
  * exception granted :-)
-- 
1.6.5.2.143.g8cc62


  parent reply	other threads:[~2009-11-08 12:22 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-08 12:16 [PATCH 00/23] Removal of binary sysctl support Eric W. Biederman
2009-11-08 12:21 ` [PATCH 01/23] sysctl: Remove the unused frv sysctl unumbers Eric W. Biederman
2009-11-08 12:21 ` [PATCH 02/23] sysctl: Stop using binary sysctl numbers in arlan Eric W. Biederman
2009-11-11 21:07   ` John W. Linville
2009-11-08 12:21 ` [PATCH 03/23] sysctl: Reduce sys_sysctl to a compatibility wrapper around /proc/sys Eric W. Biederman
2009-11-08 12:21 ` Eric W. Biederman [this message]
2009-11-08 12:21 ` [PATCH 05/23] sysctl: Remove dead code from sysctl_check Eric W. Biederman
2009-11-08 12:21 ` [PATCH 06/23] sysctl: Remove references to ctl_name and strategy from the generic sysctl table Eric W. Biederman
2009-11-08 12:21 ` [PATCH 07/23] sysctl: Don't look at ctl_name and strategy in the generic code Eric W. Biederman
2009-11-08 12:21 ` [PATCH 08/23] sysctl ipc: Remove dead binary sysctl support code Eric W. Biederman
2009-11-08 12:21 ` [PATCH 09/23] sysctl net: Remove unused binary sysctl code Eric W. Biederman
2009-11-08 12:21 ` [PATCH 10/23] sysctl fs: Remove dead binary sysctl support Eric W. Biederman
2009-11-08 12:21 ` [PATCH 11/23] sysctl kernel: Remove binary sysctl logic Eric W. Biederman
2009-11-08 12:21 ` [PATCH 12/23] sysctl security/keys: Remove dead binary sysctl support Eric W. Biederman
2009-11-08 12:22 ` [PATCH 13/23] sysctl crypto: " Eric W. Biederman
2009-11-08 15:44   ` Herbert Xu
2009-11-08 12:22 ` [PATCH 14/23] sysctl drivers: " Eric W. Biederman
2009-11-09  8:17   ` Clemens Ladisch
2009-11-08 12:22 ` [PATCH 15/23] sysctl mips/lasat: " Eric W. Biederman
2009-11-09 14:10   ` Ralf Baechle
2009-11-08 12:22 ` [PATCH 16/23] sysctl frv: " Eric W. Biederman
2009-11-08 12:22 ` [PATCH 17/23] sysctl s390: Remove dead sysctl binary support Eric W. Biederman
2009-11-08 12:22 ` [PATCH 18/23] sysctl ia64: Remove dead binary sysctl support Eric W. Biederman
2009-11-08 12:22 ` [PATCH 19/23] sysctl powerpc: " Eric W. Biederman
2009-11-08 20:44   ` Benjamin Herrenschmidt
2009-11-08 12:22 ` [PATCH 20/23] sysctl sh: " Eric W. Biederman
2009-11-08 12:22 ` [PATCH 21/23] sysctl x86: " Eric W. Biederman
2009-11-08 12:22 ` [PATCH 22/23] sysctl arm: Remove " Eric W. Biederman
2009-11-08 12:34   ` Russell King
2009-11-08 22:45     ` Eric W. Biederman
2009-11-08 22:56       ` Russell King
2009-11-08 23:31         ` Eric W. Biederman
2009-11-08 23:34           ` Russell King
2009-11-08 23:05       ` Eric W. Biederman
2009-11-09  0:48         ` Arjan van de Ven
2009-11-09  3:27           ` Eric W. Biederman
2009-11-09  4:57             ` Arjan van de Ven
2009-11-09  5:37               ` Eric W. Biederman
2009-11-09  9:38                 ` Andi Kleen
2009-11-09 11:45                   ` Eric W. Biederman
2009-11-09 12:04                     ` Andi Kleen
2009-11-09 12:41                       ` Eric W. Biederman
2009-11-09 13:28                         ` Andi Kleen
2009-11-09 15:28                           ` Arnd Bergmann
2009-11-09 15:46                             ` Andi Kleen
2009-11-09 16:23                               ` Arnd Bergmann
2009-11-10  4:42                                 ` Eric W. Biederman
2009-11-10  8:01                               ` Eric W. Biederman
2009-11-11  2:31                               ` Eric W. Biederman
2009-11-09 12:42                       ` Eric W. Biederman
2009-11-08 12:22 ` [PATCH 23/23] sysctl: Remove the last of the generic " Eric W. Biederman
2009-11-08 13:06 ` [PATCH 00/23] Removal of " Arnd Bergmann
2009-11-09  3:44   ` Eric W. Biederman

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=1257682930-31401-4-git-send-email-ebiederm@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®