diff options
| author | James Morris <jmorris@namei.org> | 2010-02-28 17:36:31 -0500 |
|---|---|---|
| committer | James Morris <jmorris@namei.org> | 2010-02-28 17:36:31 -0500 |
| commit | b4ccebdd37ff70d349321a198f416ba737a5e833 (patch) | |
| tree | 275d717070346722c3aacd8355fb4f743216e03b /security | |
| parent | 30ff056c42c665b9ea535d8515890857ae382540 (diff) | |
| parent | ef57471a73b67a7b65fd8708fd55c77cb7c619af (diff) | |
Merge branch 'next' into for-linus
Diffstat (limited to 'security')
| -rw-r--r-- | security/capability.c | 4 | ||||
| -rw-r--r-- | security/commoncap.c | 9 | ||||
| -rw-r--r-- | security/security.c | 49 | ||||
| -rw-r--r-- | security/selinux/avc.c | 22 | ||||
| -rw-r--r-- | security/selinux/hooks.c | 41 | ||||
| -rw-r--r-- | security/selinux/include/security.h | 13 | ||||
| -rw-r--r-- | security/selinux/selinuxfs.c | 12 | ||||
| -rw-r--r-- | security/selinux/ss/context.h | 12 | ||||
| -rw-r--r-- | security/selinux/ss/mls.c | 48 | ||||
| -rw-r--r-- | security/selinux/ss/mls.h | 2 | ||||
| -rw-r--r-- | security/selinux/ss/mls_types.h | 7 | ||||
| -rw-r--r-- | security/selinux/ss/policydb.c | 127 | ||||
| -rw-r--r-- | security/selinux/ss/policydb.h | 10 | ||||
| -rw-r--r-- | security/selinux/ss/services.c | 273 | ||||
| -rw-r--r-- | security/smack/smack_lsm.c | 4 | ||||
| -rw-r--r-- | security/tomoyo/Makefile | 2 | ||||
| -rw-r--r-- | security/tomoyo/common.c | 374 | ||||
| -rw-r--r-- | security/tomoyo/common.h | 530 | ||||
| -rw-r--r-- | security/tomoyo/domain.c | 391 | ||||
| -rw-r--r-- | security/tomoyo/file.c | 731 | ||||
| -rw-r--r-- | security/tomoyo/gc.c | 370 | ||||
| -rw-r--r-- | security/tomoyo/realpath.c | 269 | ||||
| -rw-r--r-- | security/tomoyo/realpath.h | 66 | ||||
| -rw-r--r-- | security/tomoyo/tomoyo.c | 142 | ||||
| -rw-r--r-- | security/tomoyo/tomoyo.h | 94 |
25 files changed, 1937 insertions, 1665 deletions
diff --git a/security/capability.c b/security/capability.c index 5c700e1a4fd3..4875142b858d 100644 --- a/security/capability.c +++ b/security/capability.c | |||
| @@ -906,10 +906,6 @@ static void cap_audit_rule_free(void *lsmrule) | |||
| 906 | } | 906 | } |
| 907 | #endif /* CONFIG_AUDIT */ | 907 | #endif /* CONFIG_AUDIT */ |
| 908 | 908 | ||
| 909 | struct security_operations default_security_ops = { | ||
| 910 | .name = "default", | ||
| 911 | }; | ||
| 912 | |||
| 913 | #define set_to_cap_if_null(ops, function) \ | 909 | #define set_to_cap_if_null(ops, function) \ |
| 914 | do { \ | 910 | do { \ |
| 915 | if (!ops->function) { \ | 911 | if (!ops->function) { \ |
diff --git a/security/commoncap.c b/security/commoncap.c index f800fdb3de94..61669730da98 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #include <linux/sched.h> | 27 | #include <linux/sched.h> |
| 28 | #include <linux/prctl.h> | 28 | #include <linux/prctl.h> |
| 29 | #include <linux/securebits.h> | 29 | #include <linux/securebits.h> |
| 30 | #include <linux/syslog.h> | ||
| 30 | 31 | ||
| 31 | /* | 32 | /* |
| 32 | * If a non-root user executes a setuid-root binary in | 33 | * If a non-root user executes a setuid-root binary in |
| @@ -888,13 +889,17 @@ error: | |||
| 888 | /** | 889 | /** |
| 889 | * cap_syslog - Determine whether syslog function is permitted | 890 | * cap_syslog - Determine whether syslog function is permitted |
| 890 | * @type: Function requested | 891 | * @type: Function requested |
| 892 | * @from_file: Whether this request came from an open file (i.e. /proc) | ||
| 891 | * | 893 | * |
| 892 | * Determine whether the current process is permitted to use a particular | 894 | * Determine whether the current process is permitted to use a particular |
| 893 | * syslog function, returning 0 if permission is granted, -ve if not. | 895 | * syslog function, returning 0 if permission is granted, -ve if not. |
| 894 | */ | 896 | */ |
| 895 | int cap_syslog(int type) | 897 | int cap_syslog(int type, bool from_file) |
| 896 | { | 898 | { |
| 897 | if ((type != 3 && type != 10) && !capable(CAP_SYS_ADMIN)) | 899 | if (type != SYSLOG_ACTION_OPEN && from_file) |
| 900 | return 0; | ||
| 901 | if ((type != SYSLOG_ACTION_READ_ALL && | ||
| 902 | type != SYSLOG_ACTION_SIZE_BUFFER) && !capable(CAP_SYS_ADMIN)) | ||
| 898 | return -EPERM; | 903 | return -EPERM; |
| 899 | return 0; | 904 | return 0; |
| 900 | } | 905 | } |
diff --git a/security/security.c b/security/security.c index 122b748d0f4c..687c6fd14bb6 100644 --- a/security/security.c +++ b/security/security.c | |||
| @@ -23,10 +23,12 @@ static __initdata char chosen_lsm[SECURITY_NAME_MAX + 1] = | |||
| 23 | CONFIG_DEFAULT_SECURITY; | 23 | CONFIG_DEFAULT_SECURITY; |
| 24 | 24 | ||
| 25 | /* things that live in capability.c */ | 25 | /* things that live in capability.c */ |
| 26 | extern struct security_operations default_security_ops; | ||
| 27 | extern void security_fixup_ops(struct security_operations *ops); | 26 | extern void security_fixup_ops(struct security_operations *ops); |
| 28 | 27 | ||
| 29 | struct security_operations *security_ops; /* Initialized to NULL */ | 28 | static struct security_operations *security_ops; |
| 29 | static struct security_operations default_security_ops = { | ||
| 30 | .name = "default", | ||
| 31 | }; | ||
| 30 | 32 | ||
| 31 | static inline int verify(struct security_operations *ops) | 33 | static inline int verify(struct security_operations *ops) |
| 32 | { | 34 | { |
| @@ -63,6 +65,11 @@ int __init security_init(void) | |||
| 63 | return 0; | 65 | return 0; |
| 64 | } | 66 | } |
| 65 | 67 | ||
| 68 | void reset_security_ops(void) | ||
| 69 | { | ||
| 70 | security_ops = &default_security_ops; | ||
| 71 | } | ||
| 72 | |||
| 66 | /* Save user chosen LSM */ | 73 | /* Save user chosen LSM */ |
| 67 | static int __init choose_lsm(char *str) | 74 | static int __init choose_lsm(char *str) |
| 68 | { | 75 | { |
| @@ -203,9 +210,9 @@ int security_quota_on(struct dentry *dentry) | |||
| 203 | return security_ops->quota_on(dentry); | 210 | return security_ops->quota_on(dentry); |
| 204 | } | 211 | } |
| 205 | 212 | ||
| 206 | int security_syslog(int type) | 213 | int security_syslog(int type, bool from_file) |
| 207 | { | 214 | { |
| 208 | return security_ops->syslog(type); | 215 | return security_ops->syslog(type, from_file); |
| 209 | } | 216 | } |
| 210 | 217 | ||
| 211 | int security_settime(struct timespec *ts, struct timezone *tz) | 218 | int security_settime(struct timespec *ts, struct timezone *tz) |
| @@ -389,42 +396,42 @@ int security_inode_init_security(struct inode *inode, struct inode *dir, | |||
| 389 | EXPORT_SYMBOL(security_inode_init_security); | 396 | EXPORT_SYMBOL(security_inode_init_security); |
| 390 | 397 | ||
| 391 | #ifdef CONFIG_SECURITY_PATH | 398 | #ifdef CONFIG_SECURITY_PATH |
| 392 | int security_path_mknod(struct path *path, struct dentry *dentry, int mode, | 399 | int security_path_mknod(struct path *dir, struct dentry *dentry, int mode, |
| 393 | unsigned int dev) | 400 | unsigned int dev) |
| 394 | { | 401 | { |
| 395 | if (unlikely(IS_PRIVATE(path->dentry->d_inode))) | 402 | if (unlikely(IS_PRIVATE(dir->dentry->d_inode))) |
| 396 | return 0; | 403 | return 0; |
| 397 | return security_ops->path_mknod(path, dentry, mode, dev); | 404 | return security_ops->path_mknod(dir, dentry, mode, dev); |
| 398 | } | 405 | } |
| 399 | EXPORT_SYMBOL(security_path_mknod); | 406 | EXPORT_SYMBOL(security_path_mknod); |
| 400 | 407 | ||
| 401 | int security_path_mkdir(struct path *path, struct dentry *dentry, int mode) | 408 | int security_path_mkdir(struct path *dir, struct dentry *dentry, int mode) |
| 402 | { | 409 | { |
| 403 | if (unlikely(IS_PRIVATE(path->dentry->d_inode))) | 410 | if (unlikely(IS_PRIVATE(dir->dentry->d_inode))) |
| 404 | return 0; | 411 | return 0; |
| 405 | return security_ops->path_mkdir(path, dentry, mode); | 412 | return security_ops->path_mkdir(dir, dentry, mode); |
| 406 | } | 413 | } |
| 407 | 414 | ||
| 408 | int security_path_rmdir(struct path *path, struct dentry *dentry) | 415 | int security_path_rmdir(struct path *dir, struct dentry *dentry) |
| 409 | { | 416 | { |
| 410 | if (unlikely(IS_PRIVATE(path->dentry->d_inode))) | 417 | if (unlikely(IS_PRIVATE(dir->dentry->d_inode))) |
| 411 | return 0; | 418 | return 0; |
| 412 | return security_ops->path_rmdir(path, dentry); | 419 | return security_ops->path_rmdir(dir, dentry); |
| 413 | } | 420 | } |
| 414 | 421 | ||
| 415 | int security_path_unlink(struct path *path, struct dentry *dentry) | 422 | int security_path_unlink(struct path *dir, struct dentry *dentry) |
| 416 | { | 423 | { |
| 417 | if (unlikely(IS_PRIVATE(path->dentry->d_inode))) | 424 | if (unlikely(IS_PRIVATE(dir->dentry->d_inode))) |
| 418 | return 0; | 425 | return 0; |
| 419 | return security_ops->path_unlink(path, dentry); | 426 | return security_ops->path_unlink(dir, dentry); |
| 420 | } | 427 | } |
| 421 | 428 | ||
| 422 | int security_path_symlink(struct path *path, struct dentry *dentry, | 429 | int security_path_symlink(struct path *dir, struct dentry *dentry, |
| 423 | const char *old_name) | 430 | const char *old_name) |
| 424 | { | 431 | { |
| 425 | if (unlikely(IS_PRIVATE(path->dentry->d_inode))) | ||
