6 |
fs/exec.c | 2 |
fs/exec.c | 2 |
7 |
fs/open.c | 2 |
fs/open.c | 2 |
8 |
fs/proc/version.c | 7 ++ |
fs/proc/version.c | 7 ++ |
9 |
include/linux/init_task.h | 9 ++ |
include/linux/init_task.h | 9 +++ |
10 |
include/linux/sched.h | 6 + |
include/linux/sched.h | 6 ++ |
11 |
include/linux/security.h | 58 ++++++++++-------- |
include/linux/security.h | 52 +++++++++-------- |
12 |
include/net/ip.h | 2 |
include/net/ip.h | 2 |
13 |
kernel/fork.c | 5 + |
kernel/fork.c | 5 + |
14 |
kernel/kexec.c | 3 |
kernel/kexec.c | 3 + |
15 |
kernel/module.c | 5 + |
kernel/module.c | 5 + |
16 |
kernel/ptrace.c | 4 + |
kernel/ptrace.c | 4 + |
17 |
kernel/sched.c | 2 |
kernel/sched.c | 2 |
18 |
kernel/signal.c | 10 +++ |
kernel/signal.c | 10 +++ |
19 |
kernel/sys.c | 10 +++ |
kernel/sys.c | 10 +++ |
20 |
kernel/time/ntp.c | 6 + |
kernel/time/ntp.c | 6 ++ |
21 |
net/ipv4/raw.c | 4 + |
net/ipv4/raw.c | 4 + |
22 |
net/ipv4/udp.c | 4 + |
net/ipv4/udp.c | 4 + |
23 |
net/ipv6/raw.c | 4 + |
net/ipv6/raw.c | 4 + |
25 |
net/socket.c | 4 + |
net/socket.c | 4 + |
26 |
net/unix/af_unix.c | 4 + |
net/unix/af_unix.c | 4 + |
27 |
security/Kconfig | 2 |
security/Kconfig | 2 |
28 |
security/Makefile | 3 |
security/Makefile | 3 + |
29 |
security/security.c | 145 ++++++++++++++++++++++++++++++++++++++-------- |
security/security.c | 137 +++++++++++++++++++++++++++++++++++++--------- |
30 |
25 files changed, 256 insertions(+), 51 deletions(-) |
25 files changed, 242 insertions(+), 51 deletions(-) |
31 |
|
|
32 |
--- linux-2.6.35.13.orig/fs/compat.c |
--- linux-2.6.35.13.orig/fs/compat.c |
33 |
+++ linux-2.6.35.13/fs/compat.c |
+++ linux-2.6.35.13/fs/compat.c |
71 |
+ |
+ |
72 |
+static int __init ccs_show_version(void) |
+static int __init ccs_show_version(void) |
73 |
+{ |
+{ |
74 |
+ printk(KERN_INFO "Hook version: 2.6.35.13 2011/04/29\n"); |
+ printk(KERN_INFO "Hook version: 2.6.35.13 2011/06/14\n"); |
75 |
+ return 0; |
+ return 0; |
76 |
+} |
+} |
77 |
+module_init(ccs_show_version); |
+module_init(ccs_show_version); |
243 |
} |
} |
244 |
|
|
245 |
static inline int security_socket_recvmsg(struct socket *sock, |
static inline int security_socket_recvmsg(struct socket *sock, |
246 |
@@ -2821,43 +2825,47 @@ int security_path_chroot(struct path *pa |
@@ -2821,43 +2825,43 @@ int security_path_chroot(struct path *pa |
247 |
#else /* CONFIG_SECURITY_PATH */ |
#else /* CONFIG_SECURITY_PATH */ |
248 |
static inline int security_path_unlink(struct path *dir, struct dentry *dentry) |
static inline int security_path_unlink(struct path *dir, struct dentry *dentry) |
249 |
{ |
{ |
250 |
- return 0; |
- return 0; |
251 |
+ return ccs_unlink_permission(dir->dentry->d_inode, dentry, dir->mnt); |
+ return ccs_unlink_permission(dentry, dir->mnt); |
252 |
} |
} |
253 |
|
|
254 |
static inline int security_path_mkdir(struct path *dir, struct dentry *dentry, |
static inline int security_path_mkdir(struct path *dir, struct dentry *dentry, |
255 |
int mode) |
int mode) |
256 |
{ |
{ |
257 |
- return 0; |
- return 0; |
258 |
+ return ccs_mkdir_permission(dir->dentry->d_inode, dentry, dir->mnt, |
+ return ccs_mkdir_permission(dentry, dir->mnt, mode); |
|
+ mode); |
|
259 |
} |
} |
260 |
|
|
261 |
static inline int security_path_rmdir(struct path *dir, struct dentry *dentry) |
static inline int security_path_rmdir(struct path *dir, struct dentry *dentry) |
262 |
{ |
{ |
263 |
- return 0; |
- return 0; |
264 |
+ return ccs_rmdir_permission(dir->dentry->d_inode, dentry, dir->mnt); |
+ return ccs_rmdir_permission(dentry, dir->mnt); |
265 |
} |
} |
266 |
|
|
267 |
static inline int security_path_mknod(struct path *dir, struct dentry *dentry, |
static inline int security_path_mknod(struct path *dir, struct dentry *dentry, |
268 |
int mode, unsigned int dev) |
int mode, unsigned int dev) |
269 |
{ |
{ |
270 |
- return 0; |
- return 0; |
271 |
+ return ccs_mknod_permission(dir->dentry->d_inode, dentry, dir->mnt, |
+ return ccs_mknod_permission(dentry, dir->mnt, mode, dev); |
|
+ mode, dev); |
|
272 |
} |
} |
273 |
|
|
274 |
static inline int security_path_truncate(struct path *path, loff_t length, |
static inline int security_path_truncate(struct path *path, loff_t length, |
282 |
const char *old_name) |
const char *old_name) |
283 |
{ |
{ |
284 |
- return 0; |
- return 0; |
285 |
+ return ccs_symlink_permission(dir->dentry->d_inode, dentry, dir->mnt, |
+ return ccs_symlink_permission(dentry, dir->mnt, old_name); |
|
+ old_name); |
|
286 |
} |
} |
287 |
|
|
288 |
static inline int security_path_link(struct dentry *old_dentry, |
static inline int security_path_link(struct dentry *old_dentry, |
290 |
struct dentry *new_dentry) |
struct dentry *new_dentry) |
291 |
{ |
{ |
292 |
- return 0; |
- return 0; |
293 |
+ return ccs_link_permission(old_dentry, new_dir->dentry->d_inode, |
+ return ccs_link_permission(old_dentry, new_dentry, new_dir->mnt); |
|
+ new_dentry, new_dir->mnt); |
|
294 |
} |
} |
295 |
|
|
296 |
static inline int security_path_rename(struct path *old_dir, |
static inline int security_path_rename(struct path *old_dir, |
297 |
@@ -2865,24 +2873,26 @@ static inline int security_path_rename(s |
@@ -2865,24 +2869,24 @@ static inline int security_path_rename(s |
298 |
struct path *new_dir, |
struct path *new_dir, |
299 |
struct dentry *new_dentry) |
struct dentry *new_dentry) |
300 |
{ |
{ |
301 |
- return 0; |
- return 0; |
302 |
+ return ccs_rename_permission(old_dir->dentry->d_inode, old_dentry, |
+ return ccs_rename_permission(old_dentry, new_dentry, new_dir->mnt); |
|
+ new_dir->dentry->d_inode, new_dentry, |
|
|
+ new_dir->mnt); |
|
303 |
} |
} |
304 |
|
|
305 |
static inline int security_path_chmod(struct dentry *dentry, |
static inline int security_path_chmod(struct dentry *dentry, |
695 |
} |
} |
696 |
|
|
697 |
int security_sb_set_mnt_opts(struct super_block *sb, |
int security_sb_set_mnt_opts(struct super_block *sb, |
698 |
@@ -364,85 +377,139 @@ EXPORT_SYMBOL(security_inode_init_securi |
@@ -364,85 +377,131 @@ EXPORT_SYMBOL(security_inode_init_securi |
699 |
int security_path_mknod(struct path *dir, struct dentry *dentry, int mode, |
int security_path_mknod(struct path *dir, struct dentry *dentry, int mode, |
700 |
unsigned int dev) |
unsigned int dev) |
701 |
{ |
{ |
705 |
- return security_ops->path_mknod(dir, dentry, mode, dev); |
- return security_ops->path_mknod(dir, dentry, mode, dev); |
706 |
+ error = security_ops->path_mknod(dir, dentry, mode, dev); |
+ error = security_ops->path_mknod(dir, dentry, mode, dev); |
707 |
+ if (!error) |
+ if (!error) |
708 |
+ error = ccs_mknod_permission(dir->dentry->d_inode, dentry, |
+ error = ccs_mknod_permission(dentry, dir->mnt, mode, dev); |
|
+ dir->mnt, mode, dev); |
|
709 |
+ return error; |
+ return error; |
710 |
} |
} |
711 |
EXPORT_SYMBOL(security_path_mknod); |
EXPORT_SYMBOL(security_path_mknod); |
718 |
- return security_ops->path_mkdir(dir, dentry, mode); |
- return security_ops->path_mkdir(dir, dentry, mode); |
719 |
+ error = security_ops->path_mkdir(dir, dentry, mode); |
+ error = security_ops->path_mkdir(dir, dentry, mode); |
720 |
+ if (!error) |
+ if (!error) |
721 |
+ error = ccs_mkdir_permission(dir->dentry->d_inode, dentry, |
+ error = ccs_mkdir_permission(dentry, dir->mnt, mode); |
|
+ dir->mnt, mode); |
|
722 |
+ return error; |
+ return error; |
723 |
} |
} |
724 |
|
|
730 |
- return security_ops->path_rmdir(dir, dentry); |
- return security_ops->path_rmdir(dir, dentry); |
731 |
+ error = security_ops->path_rmdir(dir, dentry); |
+ error = security_ops->path_rmdir(dir, dentry); |
732 |
+ if (!error) |
+ if (!error) |
733 |
+ error = ccs_rmdir_permission(dir->dentry->d_inode, dentry, |
+ error = ccs_rmdir_permission(dentry, dir->mnt); |
|
+ dir->mnt); |
|
734 |
+ return error; |
+ return error; |
735 |
} |
} |
736 |
|
|
742 |
- return security_ops->path_unlink(dir, dentry); |
- return security_ops->path_unlink(dir, dentry); |
743 |
+ error = security_ops->path_unlink(dir, dentry); |
+ error = security_ops->path_unlink(dir, dentry); |
744 |
+ if (!error) |
+ if (!error) |
745 |
+ error = ccs_unlink_permission(dir->dentry->d_inode, dentry, |
+ error = ccs_unlink_permission(dentry, dir->mnt); |
|
+ dir->mnt); |
|
746 |
+ return error; |
+ return error; |
747 |
} |
} |
748 |
|
|
755 |
- return security_ops->path_symlink(dir, dentry, old_name); |
- return security_ops->path_symlink(dir, dentry, old_name); |
756 |
+ error = security_ops->path_symlink(dir, dentry, old_name); |
+ error = security_ops->path_symlink(dir, dentry, old_name); |
757 |
+ if (!error) |
+ if (!error) |
758 |
+ error = ccs_symlink_permission(dir->dentry->d_inode, dentry, |
+ error = ccs_symlink_permission(dentry, dir->mnt, old_name); |
|
+ dir->mnt, old_name); |
|
759 |
+ return error; |
+ return error; |
760 |
} |
} |
761 |
|
|
768 |
- return security_ops->path_link(old_dentry, new_dir, new_dentry); |
- return security_ops->path_link(old_dentry, new_dir, new_dentry); |
769 |
+ error = security_ops->path_link(old_dentry, new_dir, new_dentry); |
+ error = security_ops->path_link(old_dentry, new_dir, new_dentry); |
770 |
+ if (!error) |
+ if (!error) |
771 |
+ error = ccs_link_permission(old_dentry, |
+ error = ccs_link_permission(old_dentry, new_dentry, |
772 |
+ new_dir->dentry->d_inode, |
+ new_dir->mnt); |
|
+ new_dentry, new_dir->mnt); |
|
773 |
+ return error; |
+ return error; |
774 |
} |
} |
775 |
|
|
785 |
+ error = security_ops->path_rename(old_dir, old_dentry, new_dir, |
+ error = security_ops->path_rename(old_dir, old_dentry, new_dir, |
786 |
+ new_dentry); |
+ new_dentry); |
787 |
+ if (!error) |
+ if (!error) |
788 |
+ error = ccs_rename_permission(old_dir->dentry->d_inode, |
+ error = ccs_rename_permission(old_dentry, new_dentry, |
789 |
+ old_dentry, |
+ new_dir->mnt); |
|
+ new_dir->dentry->d_inode, |
|
|
+ new_dentry, new_dir->mnt); |
|
790 |
+ return error; |
+ return error; |
791 |
} |
} |
792 |
|
|
839 |
} |
} |
840 |
#endif |
#endif |
841 |
|
|
842 |
@@ -540,9 +607,13 @@ EXPORT_SYMBOL_GPL(security_inode_setattr |
@@ -540,9 +599,13 @@ EXPORT_SYMBOL_GPL(security_inode_setattr |
843 |
|
|
844 |
int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry) |
int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry) |
845 |
{ |
{ |
854 |
} |
} |
855 |
|
|
856 |
int security_inode_setxattr(struct dentry *dentry, const char *name, |
int security_inode_setxattr(struct dentry *dentry, const char *name, |
857 |
@@ -635,7 +706,10 @@ void security_file_free(struct file *fil |
@@ -635,7 +698,10 @@ void security_file_free(struct file *fil |
858 |
|
|
859 |
int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
860 |
{ |
{ |
866 |
} |
} |
867 |
|
|
868 |
int security_file_mmap(struct file *file, unsigned long reqprot, |
int security_file_mmap(struct file *file, unsigned long reqprot, |
869 |
@@ -663,7 +737,10 @@ int security_file_lock(struct file *file |
@@ -663,7 +729,10 @@ int security_file_lock(struct file *file |
870 |
|
|
871 |
int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg) |
int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg) |
872 |
{ |
{ |
878 |
} |
} |
879 |
|
|
880 |
int security_file_set_fowner(struct file *file) |
int security_file_set_fowner(struct file *file) |
881 |
@@ -684,7 +761,10 @@ int security_file_receive(struct file *f |
@@ -684,7 +753,10 @@ int security_file_receive(struct file *f |
882 |
|
|
883 |
int security_dentry_open(struct file *file, const struct cred *cred) |
int security_dentry_open(struct file *file, const struct cred *cred) |
884 |
{ |
{ |
890 |
} |
} |
891 |
|
|
892 |
int security_task_create(unsigned long clone_flags) |
int security_task_create(unsigned long clone_flags) |
893 |
@@ -997,7 +1077,10 @@ EXPORT_SYMBOL(security_unix_may_send); |
@@ -997,7 +1069,10 @@ EXPORT_SYMBOL(security_unix_may_send); |
894 |
|
|
895 |
int security_socket_create(int family, int type, int protocol, int kern) |
int security_socket_create(int family, int type, int protocol, int kern) |
896 |
{ |
{ |
902 |
} |
} |
903 |
|
|
904 |
int security_socket_post_create(struct socket *sock, int family, |
int security_socket_post_create(struct socket *sock, int family, |
905 |
@@ -1009,17 +1092,26 @@ int security_socket_post_create(struct s |
@@ -1009,17 +1084,26 @@ int security_socket_post_create(struct s |
906 |
|
|
907 |
int security_socket_bind(struct socket *sock, struct sockaddr *address, int addrlen) |
int security_socket_bind(struct socket *sock, struct sockaddr *address, int addrlen) |
908 |
{ |
{ |
932 |
} |
} |
933 |
|
|
934 |
int security_socket_accept(struct socket *sock, struct socket *newsock) |
int security_socket_accept(struct socket *sock, struct socket *newsock) |
935 |
@@ -1029,7 +1121,10 @@ int security_socket_accept(struct socket |
@@ -1029,7 +1113,10 @@ int security_socket_accept(struct socket |
936 |
|
|
937 |
int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size) |
int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size) |
938 |
{ |
{ |