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 |
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 | 142 ++++++++++++++++++++++++++++++++++++++-------- |
security/security.c | 134 +++++++++++++++++++++++++++++++++++++--------- |
30 |
25 files changed, 256 insertions(+), 50 deletions(-) |
25 files changed, 242 insertions(+), 50 deletions(-) |
31 |
|
|
32 |
--- linux-2.6.39.1.orig/fs/compat.c |
--- linux-2.6.39.1.orig/fs/compat.c |
33 |
+++ linux-2.6.39.1/fs/compat.c |
+++ linux-2.6.39.1/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.39.1 2011/06/03\n"); |
+ printk(KERN_INFO "Hook version: 2.6.39.1 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 |
@@ -2862,42 +2866,46 @@ int security_path_chroot(struct path *pa |
@@ -2862,42 +2866,42 @@ 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) |
static inline int security_path_truncate(struct path *path) |
281 |
const char *old_name) |
const char *old_name) |
282 |
{ |
{ |
283 |
- return 0; |
- return 0; |
284 |
+ return ccs_symlink_permission(dir->dentry->d_inode, dentry, dir->mnt, |
+ return ccs_symlink_permission(dentry, dir->mnt, old_name); |
|
+ old_name); |
|
285 |
} |
} |
286 |
|
|
287 |
static inline int security_path_link(struct dentry *old_dentry, |
static inline int security_path_link(struct dentry *old_dentry, |
289 |
struct dentry *new_dentry) |
struct dentry *new_dentry) |
290 |
{ |
{ |
291 |
- return 0; |
- return 0; |
292 |
+ 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); |
|
293 |
} |
} |
294 |
|
|
295 |
static inline int security_path_rename(struct path *old_dir, |
static inline int security_path_rename(struct path *old_dir, |
296 |
@@ -2905,24 +2913,26 @@ static inline int security_path_rename(s |
@@ -2905,24 +2909,24 @@ static inline int security_path_rename(s |
297 |
struct path *new_dir, |
struct path *new_dir, |
298 |
struct dentry *new_dentry) |
struct dentry *new_dentry) |
299 |
{ |
{ |
300 |
- return 0; |
- return 0; |
301 |
+ 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); |
|
302 |
} |
} |
303 |
|
|
304 |
static inline int security_path_chmod(struct dentry *dentry, |
static inline int security_path_chmod(struct dentry *dentry, |
703 |
} |
} |
704 |
|
|
705 |
int security_sb_set_mnt_opts(struct super_block *sb, |
int security_sb_set_mnt_opts(struct super_block *sb, |
706 |
@@ -353,87 +366,141 @@ EXPORT_SYMBOL(security_inode_init_securi |
@@ -353,87 +366,133 @@ EXPORT_SYMBOL(security_inode_init_securi |
707 |
int security_path_mknod(struct path *dir, struct dentry *dentry, int mode, |
int security_path_mknod(struct path *dir, struct dentry *dentry, int mode, |
708 |
unsigned int dev) |
unsigned int dev) |
709 |
{ |
{ |
713 |
- return security_ops->path_mknod(dir, dentry, mode, dev); |
- return security_ops->path_mknod(dir, dentry, mode, dev); |
714 |
+ error = security_ops->path_mknod(dir, dentry, mode, dev); |
+ error = security_ops->path_mknod(dir, dentry, mode, dev); |
715 |
+ if (!error) |
+ if (!error) |
716 |
+ error = ccs_mknod_permission(dir->dentry->d_inode, dentry, |
+ error = ccs_mknod_permission(dentry, dir->mnt, mode, dev); |
|
+ dir->mnt, mode, dev); |
|
717 |
+ return error; |
+ return error; |
718 |
} |
} |
719 |
EXPORT_SYMBOL(security_path_mknod); |
EXPORT_SYMBOL(security_path_mknod); |
726 |
- return security_ops->path_mkdir(dir, dentry, mode); |
- return security_ops->path_mkdir(dir, dentry, mode); |
727 |
+ error = security_ops->path_mkdir(dir, dentry, mode); |
+ error = security_ops->path_mkdir(dir, dentry, mode); |
728 |
+ if (!error) |
+ if (!error) |
729 |
+ error = ccs_mkdir_permission(dir->dentry->d_inode, dentry, |
+ error = ccs_mkdir_permission(dentry, dir->mnt, mode); |
|
+ dir->mnt, mode); |
|
730 |
+ return error; |
+ return error; |
731 |
} |
} |
732 |
EXPORT_SYMBOL(security_path_mkdir); |
EXPORT_SYMBOL(security_path_mkdir); |
739 |
- return security_ops->path_rmdir(dir, dentry); |
- return security_ops->path_rmdir(dir, dentry); |
740 |
+ error = security_ops->path_rmdir(dir, dentry); |
+ error = security_ops->path_rmdir(dir, dentry); |
741 |
+ if (!error) |
+ if (!error) |
742 |
+ error = ccs_rmdir_permission(dir->dentry->d_inode, dentry, |
+ error = ccs_rmdir_permission(dentry, dir->mnt); |
|
+ dir->mnt); |
|
743 |
+ return error; |
+ return error; |
744 |
} |
} |
745 |
|
|
751 |
- return security_ops->path_unlink(dir, dentry); |
- return security_ops->path_unlink(dir, dentry); |
752 |
+ error = security_ops->path_unlink(dir, dentry); |
+ error = security_ops->path_unlink(dir, dentry); |
753 |
+ if (!error) |
+ if (!error) |
754 |
+ error = ccs_unlink_permission(dir->dentry->d_inode, dentry, |
+ error = ccs_unlink_permission(dentry, dir->mnt); |
|
+ dir->mnt); |
|
755 |
+ return error; |
+ return error; |
756 |
} |
} |
757 |
EXPORT_SYMBOL(security_path_unlink); |
EXPORT_SYMBOL(security_path_unlink); |
765 |
- return security_ops->path_symlink(dir, dentry, old_name); |
- return security_ops->path_symlink(dir, dentry, old_name); |
766 |
+ error = security_ops->path_symlink(dir, dentry, old_name); |
+ error = security_ops->path_symlink(dir, dentry, old_name); |
767 |
+ if (!error) |
+ if (!error) |
768 |
+ error = ccs_symlink_permission(dir->dentry->d_inode, dentry, |
+ error = ccs_symlink_permission(dentry, dir->mnt, old_name); |
|
+ dir->mnt, old_name); |
|
769 |
+ return error; |
+ return error; |
770 |
} |
} |
771 |
|
|
778 |
- return security_ops->path_link(old_dentry, new_dir, new_dentry); |
- return security_ops->path_link(old_dentry, new_dir, new_dentry); |
779 |
+ error = security_ops->path_link(old_dentry, new_dir, new_dentry); |
+ error = security_ops->path_link(old_dentry, new_dir, new_dentry); |
780 |
+ if (!error) |
+ if (!error) |
781 |
+ error = ccs_link_permission(old_dentry, |
+ error = ccs_link_permission(old_dentry, new_dentry, |
782 |
+ new_dir->dentry->d_inode, |
+ new_dir->mnt); |
|
+ new_dentry, new_dir->mnt); |
|
783 |
+ return error; |
+ return error; |
784 |
} |
} |
785 |
|
|
795 |
+ error = security_ops->path_rename(old_dir, old_dentry, new_dir, |
+ error = security_ops->path_rename(old_dir, old_dentry, new_dir, |
796 |
+ new_dentry); |
+ new_dentry); |
797 |
+ if (!error) |
+ if (!error) |
798 |
+ error = ccs_rename_permission(old_dir->dentry->d_inode, |
+ error = ccs_rename_permission(old_dentry, new_dentry, |
799 |
+ old_dentry, |
+ new_dir->mnt); |
|
+ new_dir->dentry->d_inode, |
|
|
+ new_dentry, new_dir->mnt); |
|
800 |
+ return error; |
+ return error; |
801 |
} |
} |
802 |
EXPORT_SYMBOL(security_path_rename); |
EXPORT_SYMBOL(security_path_rename); |
849 |
} |
} |
850 |
#endif |
#endif |
851 |
|
|
852 |
@@ -538,9 +605,13 @@ EXPORT_SYMBOL_GPL(security_inode_setattr |
@@ -538,9 +597,13 @@ EXPORT_SYMBOL_GPL(security_inode_setattr |
853 |
|
|
854 |
int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry) |
int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry) |
855 |
{ |
{ |
864 |
} |
} |
865 |
|
|
866 |
int security_inode_setxattr(struct dentry *dentry, const char *name, |
int security_inode_setxattr(struct dentry *dentry, const char *name, |
867 |
@@ -639,7 +710,10 @@ void security_file_free(struct file *fil |
@@ -639,7 +702,10 @@ void security_file_free(struct file *fil |
868 |
|
|
869 |
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) |
870 |
{ |
{ |
876 |
} |
} |
877 |
|
|
878 |
int security_file_mmap(struct file *file, unsigned long reqprot, |
int security_file_mmap(struct file *file, unsigned long reqprot, |
879 |
@@ -667,7 +741,10 @@ int security_file_lock(struct file *file |
@@ -667,7 +733,10 @@ int security_file_lock(struct file *file |
880 |
|
|
881 |
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) |
882 |
{ |
{ |
888 |
} |
} |
889 |
|
|
890 |
int security_file_set_fowner(struct file *file) |
int security_file_set_fowner(struct file *file) |
891 |
@@ -691,6 +768,8 @@ int security_dentry_open(struct file *fi |
@@ -691,6 +760,8 @@ int security_dentry_open(struct file *fi |
892 |
int ret; |
int ret; |
893 |
|
|
894 |
ret = security_ops->dentry_open(file, cred); |
ret = security_ops->dentry_open(file, cred); |
897 |
if (ret) |
if (ret) |
898 |
return ret; |
return ret; |
899 |
|
|
900 |
@@ -1006,7 +1085,10 @@ EXPORT_SYMBOL(security_unix_may_send); |
@@ -1006,7 +1077,10 @@ EXPORT_SYMBOL(security_unix_may_send); |
901 |
|
|
902 |
int security_socket_create(int family, int type, int protocol, int kern) |
int security_socket_create(int family, int type, int protocol, int kern) |
903 |
{ |
{ |
909 |
} |
} |
910 |
|
|
911 |
int security_socket_post_create(struct socket *sock, int family, |
int security_socket_post_create(struct socket *sock, int family, |
912 |
@@ -1018,17 +1100,26 @@ int security_socket_post_create(struct s |
@@ -1018,17 +1092,26 @@ int security_socket_post_create(struct s |
913 |
|
|
914 |
int security_socket_bind(struct socket *sock, struct sockaddr *address, int addrlen) |
int security_socket_bind(struct socket *sock, struct sockaddr *address, int addrlen) |
915 |
{ |
{ |
939 |
} |
} |
940 |
|
|
941 |
int security_socket_accept(struct socket *sock, struct socket *newsock) |
int security_socket_accept(struct socket *sock, struct socket *newsock) |
942 |
@@ -1038,7 +1129,10 @@ int security_socket_accept(struct socket |
@@ -1038,7 +1121,10 @@ int security_socket_accept(struct socket |
943 |
|
|
944 |
int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size) |
int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size) |
945 |
{ |
{ |