This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / kernel / sysctl.c
index 3905df6..3d06840 100644 (file)
@@ -39,8 +39,6 @@
 #include <linux/initrd.h>
 #include <linux/times.h>
 #include <linux/limits.h>
-#include <linux/dcache.h>
-
 #include <asm/uaccess.h>
 
 #ifdef CONFIG_ROOT_NFS
@@ -65,6 +63,29 @@ extern int min_free_kbytes;
 extern int printk_ratelimit_jiffies;
 extern int printk_ratelimit_burst;
 
+extern unsigned int vdso_enabled;
+
+int exec_shield = 1;
+int exec_shield_randomize = 1;
+
+static int __init setup_exec_shield(char *str)
+{
+        get_option (&str, &exec_shield);
+
+        return 1;
+}
+
+__setup("exec-shield=", setup_exec_shield);
+
+static int __init setup_exec_shield_randomize(char *str)
+{
+        get_option (&str, &exec_shield_randomize);
+
+        return 1;
+}
+
+__setup("exec-shield-randomize=", setup_exec_shield_randomize);
+
 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
 static int maxolduid = 65535;
 static int minolduid;
@@ -77,6 +98,7 @@ extern char modprobe_path[];
 #ifdef CONFIG_HOTPLUG
 extern char hotplug_path[];
 #endif
+extern char vshelper_path[];
 #ifdef CONFIG_CHR_DEV_SG
 extern int sg_big_buff;
 #endif
@@ -113,7 +135,7 @@ extern int sysctl_hz_timer;
 #if defined(CONFIG_PPC32) && defined(CONFIG_6xx)
 extern unsigned long powersave_nap;
 int proc_dol2crvec(ctl_table *table, int write, struct file *filp,
-                 void __user *buffer, size_t *lenp, loff_t *ppos);
+                 void *buffer, size_t *lenp);
 #endif
 
 #ifdef CONFIG_BSD_PROCESS_ACCT
@@ -123,7 +145,7 @@ extern int acct_parm[];
 static int parse_table(int __user *, int, void __user *, size_t __user *, void __user *, size_t,
                       ctl_table *, void **);
 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
-                 void __user *buffer, size_t *lenp, loff_t *ppos);
+                 void __user *buffer, size_t *lenp);
 
 static ctl_table root_table[];
 static struct ctl_table_header root_table_header =
@@ -267,6 +289,40 @@ static ctl_table kern_table[] = {
                .mode           = 0644,
                .proc_handler   = &proc_dointvec,
        },
+       {
+               .ctl_name       = KERN_PANIC,
+               .procname       = "exec-shield",
+               .data           = &exec_shield,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec,
+       },
+       {
+               .ctl_name       = KERN_PANIC,
+               .procname       = "exec-shield-randomize",
+               .data           = &exec_shield_randomize,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec,
+       },
+       {
+               .ctl_name       = KERN_PANIC,
+               .procname       = "print-fatal-signals",
+               .data           = &print_fatal_signals,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec,
+       },
+#if __i386__
+       {
+               .ctl_name       = KERN_PANIC,
+               .procname       = "vdso",
+               .data           = &vdso_enabled,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec,
+       },
+#endif
        {
                .ctl_name       = KERN_CORE_USES_PID,
                .procname       = "core_uses_pid",
@@ -409,6 +465,15 @@ static ctl_table kern_table[] = {
                .strategy       = &sysctl_string,
        },
 #endif
+       {
+               .ctl_name       = KERN_VSHELPER,
+               .procname       = "vshelper",
+               .data           = &vshelper_path,
+               .maxlen         = 256,
+               .mode           = 0644,
+               .proc_handler   = &proc_dostring,
+               .strategy       = &sysctl_string,
+       },
 #ifdef CONFIG_CHR_DEV_SG
        {
                .ctl_name       = KERN_SG_BIG_BUFF,
@@ -722,14 +787,6 @@ static ctl_table vm_table[] = {
                .extra1         = (void *)&hugetlb_zero,
                .extra2         = (void *)&hugetlb_infinity,
         },
-        {
-               .ctl_name       = VM_HUGETLB_GROUP,
-               .procname       = "hugetlb_shm_group",
-               .data           = &sysctl_hugetlb_shm_group,
-               .maxlen         = sizeof(gid_t),
-               .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
-        },
 #endif
        {
                .ctl_name       = VM_LOWER_ZONE_PROTECTION,
@@ -779,16 +836,6 @@ static ctl_table vm_table[] = {
                .strategy       = &sysctl_intvec,
                .extra1         = &zero,
        },
-       {
-               .ctl_name       = VM_VFS_CACHE_PRESSURE,
-               .procname       = "vfs_cache_pressure",
-               .data           = &sysctl_vfs_cache_pressure,
-               .maxlen         = sizeof(sysctl_vfs_cache_pressure),
-               .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
-               .strategy       = &sysctl_intvec,
-               .extra1         = &zero,
-       },
        { .ctl_name = 0 }
 };
 
@@ -1287,7 +1334,11 @@ static ssize_t do_rw_proc(int write, struct file * file, char __user * buf,
        
        res = count;
 
-       error = (*table->proc_handler) (table, write, file, buf, &res, ppos);
+       /*
+        * FIXME: we need to pass on ppos to the handler.
+        */
+
+       error = (*table->proc_handler) (table, write, file, buf, &res);
        if (error)
                return error;
        return res;
@@ -1337,14 +1388,14 @@ static ssize_t proc_writesys(struct file * file, const char __user * buf,
  * Returns 0 on success.
  */
 int proc_dostring(ctl_table *table, int write, struct file *filp,
-                 void __user *buffer, size_t *lenp, loff_t *ppos)
+                 void __user *buffer, size_t *lenp)
 {
        size_t len;
        char __user *p;
        char c;
        
        if (!table->data || !table->maxlen || !*lenp ||
-           (*ppos && !write)) {
+           (filp->f_pos && !write)) {
                *lenp = 0;
                return 0;
        }
@@ -1364,7 +1415,7 @@ int proc_dostring(ctl_table *table, int write, struct file *filp,
                if(copy_from_user(table->data, buffer, len))
                        return -EFAULT;
                ((char *) table->data)[len] = 0;
-               *ppos += *lenp;
+               filp->f_pos += *lenp;
        } else {
                len = strlen(table->data);
                if (len > table->maxlen)
@@ -1380,7 +1431,7 @@ int proc_dostring(ctl_table *table, int write, struct file *filp,
                        len++;
                }
                *lenp = len;
-               *ppos += len;
+               filp->f_pos += len;
        }
        return 0;
 }
@@ -1391,17 +1442,17 @@ int proc_dostring(ctl_table *table, int write, struct file *filp,
  */
  
 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
-                 void __user *buffer, size_t *lenp, loff_t *ppos)
+                 void __user *buffer, size_t *lenp)
 {
        int r;
 
        if (!write) {
                down_read(&uts_sem);
-               r=proc_dostring(table,0,filp,buffer,lenp, ppos);
+               r=proc_dostring(table,0,filp,buffer,lenp);
                up_read(&uts_sem);
        } else {
                down_write(&uts_sem);
-               r=proc_dostring(table,1,filp,buffer,lenp, ppos);
+               r=proc_dostring(table,1,filp,buffer,lenp);
                up_write(&uts_sem);
        }
        return r;
@@ -1427,12 +1478,12 @@ static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
 }
 
 static int do_proc_dointvec(ctl_table *table, int write, struct file *filp,
-                 void __user *buffer, size_t *lenp, loff_t *ppos,
+                 void __user *buffer, size_t *lenp, 
                  int (*conv)(int *negp, unsigned long *lvalp, int *valp,
                              int write, void *data),
                  void *data)
 {
-#define TMPBUFLEN 21
+#define TMPBUFLEN 20
        int *i, vleft, first=1, neg, val;
        unsigned long lval;
        size_t left, len;
@@ -1441,7 +1492,7 @@ static int do_proc_dointvec(ctl_table *table, int write, struct file *filp,
        char __user *s = buffer;
        
        if (!table->data || !table->maxlen || !*lenp ||
-           (*ppos && !write)) {
+           (filp->f_pos && !write)) {
                *lenp = 0;
                return 0;
        }
@@ -1530,7 +1581,7 @@ static int do_proc_dointvec(ctl_table *table, int write, struct file *filp,
        if (write && first)
                return -EINVAL;
        *lenp -= left;
-       *ppos += *lenp;
+       filp->f_pos += *lenp;
        return 0;
 #undef TMPBUFLEN
 }
@@ -1549,9 +1600,9 @@ static int do_proc_dointvec(ctl_table *table, int write, struct file *filp,
  * Returns 0 on success.
  */
 int proc_dointvec(ctl_table *table, int write, struct file *filp,
-                    void __user *buffer, size_t *lenp, loff_t *ppos)
+                    void __user *buffer, size_t *lenp)
 {
-    return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
+    return do_proc_dointvec(table,write,filp,buffer,lenp,
                            NULL,NULL);
 }
 
@@ -1597,7 +1648,7 @@ static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp,
  */
  
 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
-                       void __user *buffer, size_t *lenp, loff_t *ppos)
+                       void __user *buffer, size_t *lenp)
 {
        int op;
 
@@ -1606,7 +1657,7 @@ int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
        }
 
        op = (current->pid == 1) ? OP_SET : OP_AND;
-       return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
+       return do_proc_dointvec(table,write,filp,buffer,lenp,
                                do_proc_dointvec_bset_conv,&op);
 }
 
@@ -1656,24 +1707,23 @@ static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
  * Returns 0 on success.
  */
 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
-                 void __user *buffer, size_t *lenp, loff_t *ppos)
+                 void __user *buffer, size_t *lenp)
 {
        struct do_proc_dointvec_minmax_conv_param param = {
                .min = (int *) table->extra1,
                .max = (int *) table->extra2,
        };
-       return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
+       return do_proc_dointvec(table, write, filp, buffer, lenp,
                                do_proc_dointvec_minmax_conv, &param);
 }
 
 static int do_proc_doulongvec_minmax(ctl_table *table, int write,
                                     struct file *filp,
-                                    void __user *buffer,
-                                    size_t *lenp, loff_t *ppos,
+                                    void __user *buffer, size_t *lenp,
                                     unsigned long convmul,
                                     unsigned long convdiv)
 {
-#define TMPBUFLEN 21
+#define TMPBUFLEN 20
        unsigned long *i, *min, *max, val;
        int vleft, first=1, neg;
        size_t len, left;
@@ -1681,7 +1731,7 @@ static int do_proc_doulongvec_minmax(ctl_table *table, int write,
        char __user *s = buffer;
        
        if (!table->data || !table->maxlen || !*lenp ||
-           (*ppos && !write)) {
+           (filp->f_pos && !write)) {
                *lenp = 0;
                return 0;
        }
@@ -1766,7 +1816,7 @@ static int do_proc_doulongvec_minmax(ctl_table *table, int write,
        if (write && first)
                return -EINVAL;
        *lenp -= left;
-       *ppos += *lenp;
+       filp->f_pos += *lenp;
        return 0;
 #undef TMPBUFLEN
 }
@@ -1788,9 +1838,9 @@ static int do_proc_doulongvec_minmax(ctl_table *table, int write,
  * Returns 0 on success.
  */
 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
-                          void __user *buffer, size_t *lenp, loff_t *ppos)
+                          void __user *buffer, size_t *lenp)
 {
-    return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos, 1l, 1l);
+    return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, 1l, 1l);
 }
 
 /**
@@ -1812,11 +1862,10 @@ int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
  */
 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
                                      struct file *filp,
-                                     void __user *buffer,
-                                     size_t *lenp, loff_t *ppos)
+                                     void __user *buffer, size_t *lenp)
 {
     return do_proc_doulongvec_minmax(table, write, filp, buffer,
-                                    lenp, ppos, HZ, 1000l);
+                                    lenp, HZ, 1000l);
 }
 
 
@@ -1878,9 +1927,9 @@ static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp,
  * Returns 0 on success.
  */
 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
-                         void __user *buffer, size_t *lenp, loff_t *ppos)
+                         void __user *buffer, size_t *lenp)
 {
-    return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
+    return do_proc_dointvec(table,write,filp,buffer,lenp,
                            do_proc_dointvec_jiffies_conv,NULL);
 }
 
@@ -1900,66 +1949,65 @@ int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
  * Returns 0 on success.
  */
 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
-                                void __user *buffer, size_t *lenp, loff_t *ppos)
+                                void __user *buffer, size_t *lenp)
 {
-    return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
+    return do_proc_dointvec(table,write,filp,buffer,lenp,
                            do_proc_dointvec_userhz_jiffies_conv,NULL);
 }
 
 #else /* CONFIG_PROC_FS */
 
 int proc_dostring(ctl_table *table, int write, struct file *filp,
-                 void __user *buffer, size_t *lenp, loff_t *ppos)
+                 void __user *buffer, size_t *lenp)
 {
        return -ENOSYS;
 }
 
 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
-                           void __user *buffer, size_t *lenp, loff_t *ppos)
+                           void __user *buffer, size_t *lenp)
 {
        return -ENOSYS;
 }
 
 int proc_dointvec(ctl_table *table, int write, struct file *filp,
-                 void __user *buffer, size_t *lenp, loff_t *ppos)
+                 void __user *buffer, size_t *lenp)
 {
        return -ENOSYS;
 }
 
 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
-                       void __user *buffer, size_t *lenp, loff_t *ppos)
+                       void __user *buffer, size_t *lenp)
 {
        return -ENOSYS;
 }
 
 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
-                   void __user *buffer, size_t *lenp, loff_t *ppos)
+                   void __user *buffer, size_t *lenp)
 {
        return -ENOSYS;
 }
 
 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
-                   void __user *buffer, size_t *lenp, loff_t *ppos)
+                   void __user *buffer, size_t *lenp)
 {
        return -ENOSYS;
 }
 
 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
-                   void __user *buffer, size_t *lenp, loff_t *ppos)
+                   void __user *buffer, size_t *lenp)
 {
        return -ENOSYS;
 }
 
 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
-                   void __user *buffer, size_t *lenp, loff_t *ppos)
+                   void __user *buffer, size_t *lenp)
 {
        return -ENOSYS;
 }
 
 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
                                      struct file *filp,
-                                     void __user *buffer,
-                                     size_t *lenp, loff_t *ppos)
+                                     void __user *buffer, size_t *lenp)
 {
     return -ENOSYS;
 }
@@ -2110,51 +2158,50 @@ int sysctl_jiffies(ctl_table *table, int __user *name, int nlen,
 }
 
 int proc_dostring(ctl_table *table, int write, struct file *filp,
-                 void __user *buffer, size_t *lenp, loff_t *ppos)
+                 void __user *buffer, size_t *lenp)
 {
        return -ENOSYS;
 }
 
 int proc_dointvec(ctl_table *table, int write, struct file *filp,
-                 void __user *buffer, size_t *lenp, loff_t *ppos)
+                 void __user *buffer, size_t *lenp)
 {
        return -ENOSYS;
 }
 
 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
-                       void __user *buffer, size_t *lenp, loff_t *ppos)
+                       void __user *buffer, size_t *lenp)
 {
        return -ENOSYS;
 }
 
 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
-                   void __user *buffer, size_t *lenp, loff_t *ppos)
+                   void __user *buffer, size_t *lenp)
 {
        return -ENOSYS;
 }
 
 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
-                         void __user *buffer, size_t *lenp, loff_t *ppos)
+                         void __user *buffer, size_t *lenp)
 {
        return -ENOSYS;
 }
 
 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
-                         void __user *buffer, size_t *lenp, loff_t *ppos)
+                         void __user *buffer, size_t *lenp)
 {
        return -ENOSYS;
 }
 
 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
-                   void __user *buffer, size_t *lenp, loff_t *ppos)
+                   void __user *buffer, size_t *lenp)
 {
        return -ENOSYS;
 }
 
 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
                                      struct file *filp,
-                                     void __user *buffer,
-                                     size_t *lenp, loff_t *ppos)
+                                     void __user *buffer, size_t *lenp)
 {
     return -ENOSYS;
 }
@@ -2162,7 +2209,7 @@ int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
 struct ctl_table_header * register_sysctl_table(ctl_table * table, 
                                                int insert_at_head)
 {
-       return NULL;
+       return 0;
 }
 
 void unregister_sysctl_table(struct ctl_table_header * table)