]>
Commit | Line | Data |
---|---|---|
a464038f JB |
1 | Don't register empty sysctl dirs in /proc/sys. |
2 | They would be removed after registering some other sysctl(s) in the | |
3 | same directory (e.g. rtc in /proc/sys/dev) and unregistering all of | |
4 | them (then initially empty e.g. /proc/sys/dev disappears). | |
5 | After disappearing of directory topdir ->de (for "dev") points to | |
6 | structure which has been freed. | |
7 | It's harmless in vanilla 2.4, but with grsecurity causes an Oops | |
8 | on numeric sysctls referring to removed directory (even with all | |
9 | grsecurity features disabled, only patch applied). | |
10 | ||
11 | The same issue seems to exist in 2.6, and _probably_ can cause similar | |
12 | problems in selinux. | |
13 | ||
14 | -- Jakub Bogusz <qboosh@pld-linux.org> | |
15 | ||
16 | --- linux-2.4.20/kernel/sysctl.c.orig Mon Dec 15 11:05:08 2003 | |
17 | +++ linux-2.4.20/kernel/sysctl.c Mon Dec 15 15:48:46 2003 | |
18 | @@ -124,10 +124,8 @@ | |
19 | #ifdef CONFIG_NET | |
20 | extern ctl_table net_table[]; | |
21 | #endif | |
22 | -static ctl_table proc_table[]; | |
23 | static ctl_table fs_table[]; | |
24 | static ctl_table debug_table[]; | |
25 | -static ctl_table dev_table[]; | |
26 | extern ctl_table random_table[]; | |
27 | ||
28 | static ctl_table grsecurity_table[]; | |
29 | @@ -163,10 +161,8 @@ | |
30 | #ifdef CONFIG_NET | |
31 | {CTL_NET, "net", NULL, 0, 0555, net_table}, | |
32 | #endif | |
33 | - {CTL_PROC, "proc", NULL, 0, 0555, proc_table}, | |
34 | {CTL_FS, "fs", NULL, 0, 0555, fs_table}, | |
35 | {CTL_DEBUG, "debug", NULL, 0, 0555, debug_table}, | |
36 | - {CTL_DEV, "dev", NULL, 0, 0555, dev_table}, | |
37 | {0} | |
38 | }; | |
39 | ||
40 | @@ -488,10 +484,6 @@ | |
41 | {0} | |
42 | }; | |
43 | ||
44 | -static ctl_table proc_table[] = { | |
45 | - {0} | |
46 | -}; | |
47 | - | |
48 | static ctl_table fs_table[] = { | |
49 | {FS_NRINODE, "inode-nr", &inodes_stat, 2*sizeof(int), | |
50 | 0444, NULL, &proc_dointvec}, | |
51 | @@ -526,10 +518,6 @@ | |
52 | {0} | |
53 | }; | |
54 | ||
55 | -static ctl_table dev_table[] = { | |
56 | - {0} | |
57 | -}; | |
58 | - | |
59 | extern void init_irq_proc (void); | |
60 | ||
61 | void __init sysctl_init(void) |