2 |
|
|
3 |
Source code for this patch is http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.37.tar.bz2 |
Source code for this patch is http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.37.tar.bz2 |
4 |
--- |
--- |
5 |
Documentation/Configure.help | 86 ++++++++++++++++++++++++++++++++ |
Documentation/Configure.help | 86 +++++++++++++++++++++++++++++++++++++++++++ |
6 |
arch/alpha/kernel/ptrace.c | 7 ++ |
arch/alpha/kernel/ptrace.c | 7 +++ |
7 |
arch/arm/kernel/ptrace.c | 7 ++ |
arch/arm/kernel/ptrace.c | 7 +++ |
8 |
arch/cris/kernel/ptrace.c | 7 ++ |
arch/cris/kernel/ptrace.c | 7 +++ |
9 |
arch/i386/kernel/ptrace.c | 7 ++ |
arch/i386/kernel/ptrace.c | 7 +++ |
10 |
arch/ia64/ia32/sys_ia32.c | 7 ++ |
arch/ia64/ia32/sys_ia32.c | 7 +++ |
11 |
arch/ia64/kernel/ptrace.c | 7 ++ |
arch/ia64/kernel/ptrace.c | 7 +++ |
12 |
arch/m68k/kernel/ptrace.c | 7 ++ |
arch/m68k/kernel/ptrace.c | 7 +++ |
13 |
arch/mips/kernel/ptrace.c | 7 ++ |
arch/mips/kernel/ptrace.c | 7 +++ |
14 |
arch/mips64/kernel/ptrace.c | 11 ++++ |
arch/mips64/kernel/ptrace.c | 11 +++++ |
15 |
arch/parisc/kernel/ptrace.c | 7 ++ |
arch/parisc/kernel/ptrace.c | 7 +++ |
16 |
arch/ppc/kernel/ptrace.c | 7 ++ |
arch/ppc/kernel/ptrace.c | 7 +++ |
17 |
arch/ppc64/kernel/ptrace.c | 7 ++ |
arch/ppc64/kernel/ptrace.c | 7 +++ |
18 |
arch/ppc64/kernel/ptrace32.c | 7 ++ |
arch/ppc64/kernel/ptrace32.c | 7 +++ |
19 |
arch/s390/kernel/ptrace.c | 7 ++ |
arch/s390/kernel/ptrace.c | 7 +++ |
20 |
arch/s390x/kernel/ptrace.c | 7 ++ |
arch/s390x/kernel/ptrace.c | 7 +++ |
21 |
arch/sh/kernel/ptrace.c | 7 ++ |
arch/sh/kernel/ptrace.c | 7 +++ |
22 |
arch/sh64/kernel/ptrace.c | 7 ++ |
arch/sh64/kernel/ptrace.c | 7 +++ |
23 |
arch/sparc/kernel/ptrace.c | 9 +++ |
arch/sparc/kernel/ptrace.c | 9 ++++ |
24 |
arch/sparc64/kernel/ptrace.c | 9 +++ |
arch/sparc64/kernel/ptrace.c | 9 ++++ |
25 |
arch/x86_64/ia32/ptrace32.c | 7 ++ |
arch/x86_64/ia32/ptrace32.c | 7 +++ |
26 |
arch/x86_64/kernel/ptrace.c | 7 ++ |
arch/x86_64/kernel/ptrace.c | 7 +++ |
27 |
fs/Config.in | 3 + |
fs/Config.in | 3 + |
28 |
fs/Makefile | 2 |
fs/Makefile | 2 - |
29 |
fs/attr.c | 10 +++ |
fs/attr.c | 10 +++++ |
30 |
fs/exec.c | 21 +++++++ |
fs/exec.c | 21 ++++++++++ |
31 |
fs/fcntl.c | 8 +++ |
fs/fcntl.c | 8 ++++ |
32 |
fs/ioctl.c | 16 ++++++ |
fs/ioctl.c | 16 ++++++++ |
33 |
fs/namei.c | 71 +++++++++++++++++++++++++++ |
fs/namei.c | 71 +++++++++++++++++++++++++++++++++++ |
34 |
fs/namespace.c | 58 +++++++++++++++++++++- |
fs/namespace.c | 58 ++++++++++++++++++++++++++++- |
35 |
fs/open.c | 30 +++++++++++ |
fs/open.c | 30 +++++++++++++++ |
36 |
fs/proc/Makefile | 4 + |
fs/proc/Makefile | 4 ++ |
37 |
fs/proc/proc_misc.c | 5 + |
fs/proc/proc_misc.c | 5 ++ |
38 |
include/linux/sched.h | 12 ++++ |
include/linux/sched.h | 12 ++++++ |
39 |
kernel/kmod.c | 5 + |
kernel/kmod.c | 5 ++ |
40 |
kernel/module.c | 15 +++++ |
kernel/module.c | 15 +++++++ |
41 |
kernel/sched.c | 7 ++ |
kernel/sched.c | 7 +++ |
42 |
kernel/signal.c | 15 +++++ |
kernel/signal.c | 15 +++++++ |
43 |
kernel/sys.c | 19 +++++++ |
kernel/sys.c | 19 +++++++++ |
44 |
kernel/sysctl.c | 113 ++++++++++++++++++++++++++++++++++++++++++- |
kernel/sysctl.c | 19 +++++++++ |
45 |
kernel/time.c | 15 +++++ |
kernel/time.c | 15 +++++++ |
46 |
net/core/datagram.c | 10 +++ |
net/core/datagram.c | 10 +++++ |
47 |
net/ipv4/tcp_ipv4.c | 11 ++++ |
net/ipv4/tcp_ipv4.c | 11 +++++ |
48 |
net/ipv4/udp.c | 11 ++++ |
net/ipv4/udp.c | 11 +++++ |
49 |
net/ipv6/tcp_ipv6.c | 7 ++ |
net/ipv6/tcp_ipv6.c | 7 +++ |
50 |
net/ipv6/udp.c | 11 ++++ |
net/ipv6/udp.c | 11 +++++ |
51 |
net/socket.c | 40 ++++++++++++++- |
net/socket.c | 40 +++++++++++++++++++- |
52 |
net/unix/af_unix.c | 8 +++ |
net/unix/af_unix.c | 8 ++++ |
53 |
48 files changed, 762 insertions(+), 6 deletions(-) |
48 files changed, 668 insertions(+), 6 deletions(-) |
54 |
|
|
55 |
--- linux-2.4.37.orig/Documentation/Configure.help |
--- linux-2.4.37.orig/Documentation/Configure.help |
56 |
+++ linux-2.4.37/Documentation/Configure.help |
+++ linux-2.4.37/Documentation/Configure.help |
1417 |
|
|
1418 |
#ifdef CONFIG_ROOT_NFS |
#ifdef CONFIG_ROOT_NFS |
1419 |
#include <linux/nfs_fs.h> |
#include <linux/nfs_fs.h> |
1420 |
@@ -411,6 +414,100 @@ void __init sysctl_init(void) |
@@ -439,6 +442,11 @@ int do_sysctl(int *name, int nlen, void |
|
#endif |
|
|
} |
|
|
|
|
|
+/***** TOMOYO Linux start. *****/ |
|
|
+static int try_parse_table(int __user *name, int nlen, void __user *oldval, |
|
|
+ void __user *newval, ctl_table *table) |
|
|
+{ |
|
|
+ int n; |
|
|
+ int error = -ENOMEM; |
|
|
+ int op = 0; |
|
|
+ char *buffer = kmalloc(PAGE_SIZE, GFP_KERNEL); |
|
|
+ if (oldval) |
|
|
+ op |= 004; |
|
|
+ if (newval) |
|
|
+ op |= 002; |
|
|
+ if (!op) { /* Neither read nor write */ |
|
|
+ error = 0; |
|
|
+ goto out; |
|
|
+ } |
|
|
+ if (!buffer) |
|
|
+ goto out; |
|
|
+ memset(buffer, 0, PAGE_SIZE); |
|
|
+ snprintf(buffer, PAGE_SIZE - 1, "/proc/sys"); |
|
|
+ repeat: |
|
|
+ if (!nlen) { |
|
|
+ error = -ENOTDIR; |
|
|
+ goto out; |
|
|
+ } |
|
|
+ if (get_user(n, name)) { |
|
|
+ error = -EFAULT; |
|
|
+ goto out; |
|
|
+ } |
|
|
+ for ( ; table->ctl_name; table++) { |
|
|
+ if (n == table->ctl_name || table->ctl_name == CTL_ANY) { |
|
|
+ int pos = strlen(buffer); |
|
|
+ const char *cp = table->procname; |
|
|
+ error = -ENOMEM; |
|
|
+ if (cp) { |
|
|
+ if (pos + 1 >= PAGE_SIZE - 1) |
|
|
+ goto out; |
|
|
+ buffer[pos++] = '/'; |
|
|
+ while (*cp) { |
|
|
+ const unsigned char c |
|
|
+ = *(const unsigned char *) cp; |
|
|
+ if (c == '\\') { |
|
|
+ if (pos + 2 >= PAGE_SIZE - 1) |
|
|
+ goto out; |
|
|
+ buffer[pos++] = '\\'; |
|
|
+ buffer[pos++] = '\\'; |
|
|
+ } else if (c > ' ' && c < 127) { |
|
|
+ if (pos + 1 >= PAGE_SIZE - 1) |
|
|
+ goto out; |
|
|
+ buffer[pos++] = c; |
|
|
+ } else { |
|
|
+ if (pos + 4 >= PAGE_SIZE - 1) |
|
|
+ goto out; |
|
|
+ buffer[pos++] = '\\'; |
|
|
+ buffer[pos++] = (c >> 6) + '0'; |
|
|
+ buffer[pos++] = ((c >> 3) & 7) |
|
|
+ + '0'; |
|
|
+ buffer[pos++] = (c & 7) + '0'; |
|
|
+ } |
|
|
+ cp++; |
|
|
+ } |
|
|
+ } else { |
|
|
+ /* Assume nobody assigns "=\$=" for procname. */ |
|
|
+ snprintf(buffer + pos, PAGE_SIZE - pos - 1, |
|
|
+ "/=%d=", table->ctl_name); |
|
|
+ if (!memchr(buffer, '\0', PAGE_SIZE - 2)) |
|
|
+ goto out; |
|
|
+ } |
|
|
+ if (table->child) { |
|
|
+ if (table->strategy) { |
|
|
+ /* printk("sysctl='%s'\n", buffer); */ |
|
|
+ if (ccs_check_file_perm(buffer, op, |
|
|
+ "sysctl")) { |
|
|
+ error = -EPERM; |
|
|
+ goto out; |
|
|
+ } |
|
|
+ } |
|
|
+ name++; |
|
|
+ nlen--; |
|
|
+ table = table->child; |
|
|
+ goto repeat; |
|
|
+ } |
|
|
+ /* printk("sysctl='%s'\n", buffer); */ |
|
|
+ error = ccs_check_file_perm(buffer, op, "sysctl"); |
|
|
+ goto out; |
|
|
+ } |
|
|
+ } |
|
|
+ error = -ENOTDIR; |
|
|
+ out: |
|
|
+ kfree(buffer); |
|
|
+ return error; |
|
|
+} |
|
|
+/***** TOMOYO Linux end. *****/ |
|
|
+ |
|
|
int do_sysctl(int *name, int nlen, void *oldval, size_t *oldlenp, |
|
|
void *newval, size_t newlen) |
|
|
{ |
|
|
@@ -439,6 +536,11 @@ int do_sysctl(int *name, int nlen, void |
|
1421 |
|
|
1422 |
spin_unlock(&sysctl_lock); |
spin_unlock(&sysctl_lock); |
1423 |
|
|
1424 |
+ /***** TOMOYO Linux start. *****/ |
+ /***** TOMOYO Linux start. *****/ |
1425 |
+ error = try_parse_table(name, nlen, oldval, newval, |
+ error = ccs_parse_table(name, nlen, oldval, newval, |
1426 |
+ head->ctl_table); |
+ head->ctl_table); |
1427 |
+ if (!error) |
+ if (!error) |
1428 |
+ /***** TOMOYO Linux end. *****/ |
+ /***** TOMOYO Linux end. *****/ |
1429 |
error = parse_table(name, nlen, oldval, oldlenp, |
error = parse_table(name, nlen, oldval, oldlenp, |
1430 |
newval, newlen, head->ctl_table, |
newval, newlen, head->ctl_table, |
1431 |
&context); |
&context); |
1432 |
@@ -508,6 +610,15 @@ repeat: |
@@ -508,6 +516,15 @@ repeat: |
1433 |
if (ctl_perm(table, 001)) |
if (ctl_perm(table, 001)) |
1434 |
return -EPERM; |
return -EPERM; |
1435 |
if (table->strategy) { |
if (table->strategy) { |
1445 |
error = table->strategy( |
error = table->strategy( |
1446 |
table, name, nlen, |
table, name, nlen, |
1447 |
oldval, oldlenp, |
oldval, oldlenp, |
1448 |
@@ -1456,7 +1567,7 @@ int sysctl_string(ctl_table *table, int |
@@ -1456,7 +1473,7 @@ int sysctl_string(ctl_table *table, int |
1449 |
len--; |
len--; |
1450 |
((char *) table->data)[len] = 0; |
((char *) table->data)[len] = 0; |
1451 |
} |
} |