diff options
Diffstat (limited to 'kernel/sysctl.c')
| -rw-r--r-- | kernel/sysctl.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 8020fb273c4f..09e569f4792b 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
| @@ -136,8 +136,10 @@ static int parse_table(int __user *, int, void __user *, size_t __user *, | |||
| 136 | static int proc_do_uts_string(ctl_table *table, int write, struct file *filp, | 136 | static int proc_do_uts_string(ctl_table *table, int write, struct file *filp, |
| 137 | void __user *buffer, size_t *lenp, loff_t *ppos); | 137 | void __user *buffer, size_t *lenp, loff_t *ppos); |
| 138 | 138 | ||
| 139 | #ifdef CONFIG_PROC_SYSCTL | ||
| 139 | static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp, | 140 | static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp, |
| 140 | void __user *buffer, size_t *lenp, loff_t *ppos); | 141 | void __user *buffer, size_t *lenp, loff_t *ppos); |
| 142 | #endif | ||
| 141 | 143 | ||
| 142 | static ctl_table root_table[]; | 144 | static ctl_table root_table[]; |
| 143 | static struct ctl_table_header root_table_header = | 145 | static struct ctl_table_header root_table_header = |
| @@ -542,6 +544,7 @@ static ctl_table kern_table[] = { | |||
| 542 | .proc_handler = &proc_dointvec, | 544 | .proc_handler = &proc_dointvec, |
| 543 | }, | 545 | }, |
| 544 | #endif | 546 | #endif |
| 547 | #ifdef CONFIG_PROC_SYSCTL | ||
| 545 | { | 548 | { |
| 546 | .ctl_name = KERN_CADPID, | 549 | .ctl_name = KERN_CADPID, |
| 547 | .procname = "cad_pid", | 550 | .procname = "cad_pid", |
| @@ -550,6 +553,7 @@ static ctl_table kern_table[] = { | |||
| 550 | .mode = 0600, | 553 | .mode = 0600, |
| 551 | .proc_handler = &proc_do_cad_pid, | 554 | .proc_handler = &proc_do_cad_pid, |
| 552 | }, | 555 | }, |
| 556 | #endif | ||
| 553 | { | 557 | { |
| 554 | .ctl_name = KERN_MAX_THREADS, | 558 | .ctl_name = KERN_MAX_THREADS, |
| 555 | .procname = "threads-max", | 559 | .procname = "threads-max", |
| @@ -1311,7 +1315,9 @@ repeat: | |||
| 1311 | return -ENOTDIR; | 1315 | return -ENOTDIR; |
| 1312 | if (get_user(n, name)) | 1316 | if (get_user(n, name)) |
| 1313 | return -EFAULT; | 1317 | return -EFAULT; |
| 1314 | for ( ; table->ctl_name; table++) { | 1318 | for ( ; table->ctl_name || table->procname; table++) { |
| 1319 | if (!table->ctl_name) | ||
| 1320 | continue; | ||
| 1315 | if (n == table->ctl_name || table->ctl_name == CTL_ANY) { | 1321 | if (n == table->ctl_name || table->ctl_name == CTL_ANY) { |
| 1316 | int error; | 1322 | int error; |
| 1317 | if (table->child) { | 1323 | if (table->child) { |
| @@ -1528,7 +1534,7 @@ static void register_proc_table(ctl_table * table, struct proc_dir_entry *root, | |||
| 1528 | int len; | 1534 | int len; |
| 1529 | mode_t mode; | 1535 | mode_t mode; |
| 1530 | 1536 | ||
| 1531 | for (; table->ctl_name; table++) { | 1537 | for (; table->ctl_name || table->procname; table++) { |
| 1532 | /* Can't do anything without a proc name. */ | 1538 | /* Can't do anything without a proc name. */ |
| 1533 | if (!table->procname) | 1539 | if (!table->procname) |
| 1534 | continue; | 1540 | continue; |
| @@ -1575,7 +1581,7 @@ static void register_proc_table(ctl_table * table, struct proc_dir_entry *root, | |||
| 1575 | static void unregister_proc_table(ctl_table * table, struct proc_dir_entry *root) | 1581 | static void unregister_proc_table(ctl_table * table, struct proc_dir_entry *root) |
| 1576 | { | 1582 | { |
| 1577 | struct proc_dir_entry *de; | 1583 | struct proc_dir_entry *de; |
| 1578 | for (; table->ctl_name; table++) { | 1584 | for (; table->ctl_name || table->procname; table++) { |
| 1579 | if (!(de = table->de)) | 1585 | if (!(de = table->de)) |
| 1580 | continue; | 1586 | continue; |
| 1581 | if (de->mode & S_IFDIR) { | 1587 | if (de->mode & S_IFDIR) { |
| @@ -2676,13 +2682,33 @@ int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen, | |||
| 2676 | asmlinkage long sys_sysctl(struct __sysctl_args __user *args) | 2682 | asmlinkage long sys_sysctl(struct __sysctl_args __user *args) |
| 2677 | { | 2683 | { |
| 2678 | static int msg_count; | 2684 | static int msg_count; |
| 2685 | struct __sysctl_args tmp; | ||
| 2686 | int name[CTL_MAXNAME]; | ||
| 2687 | int i; | ||
| 2688 | |||
| 2689 | /* Read in the sysctl name for better debug message logging */ | ||
| 2690 | if (copy_from_user(&tmp, args, sizeof(tmp))) | ||
| 2691 | return -EFAULT; | ||
| 2692 | if (tmp.nlen <= 0 || tmp.nlen >= CTL_MAXNAME) | ||
| 2693 | return -ENOTDIR; | ||
| 2694 | for (i = 0; i < tmp.nlen; i++) | ||
| 2695 | if (get_user(name[i], tmp.name + i)) | ||
| 2696 | return -EFAULT; | ||
| 2697 | |||
| 2698 | /* Ignore accesses to kernel.version */ | ||
| 2699 | if ((tmp.nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION)) | ||
| 2700 | goto out; | ||
| 2679 | 2701 | ||
| 2680 | if (msg_count < 5) { | 2702 | if (msg_count < 5) { |
| 2681 | msg_count++; | 2703 | msg_count++; |
| 2682 | printk(KERN_INFO | 2704 | printk(KERN_INFO |
| 2683 | "warning: process `%s' used the removed sysctl " | 2705 | "warning: process `%s' used the removed sysctl " |
| 2684 | "system call\n", current->comm); | 2706 | "system call with ", current->comm); |
| 2707 | for (i = 0; i < tmp.nlen; i++) | ||
| 2708 | printk("%d.", name[i]); | ||
| 2709 | printk("\n"); | ||
| 2685 | } | 2710 | } |
| 2711 | out: | ||
| 2686 | return -ENOSYS; | 2712 | return -ENOSYS; |
| 2687 | } | 2713 | } |
| 2688 | 2714 | ||
