diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-25 11:44:29 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-25 11:44:29 -0500 |
| commit | b47711bfbcd4eb77ca61ef0162487b20e023ae55 (patch) | |
| tree | b2a695dbd40f7ca2333664cf946ef34eda7b7dba /security | |
| parent | 7556afa0e0e436cad4f560ee83e5fbd5dac9359a (diff) | |
| parent | 2e08c0c1c3977a5ddc88887dd3af1b26c433e9d0 (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/selinux-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/selinux-2.6:
selinux: make mls_compute_sid always polyinstantiate
security/selinux: constify function pointer tables and fields
security: add a secctx_to_secid() hook
security: call security_file_permission from rw_verify_area
security: remove security_sb_post_mountroot hook
Security: remove security.h include from mm.h
Security: remove security_file_mmap hook sparse-warnings (NULL as 0).
Security: add get, set, and cloning of superblock security information
security/selinux: Add missing "space"
Diffstat (limited to 'security')
| -rw-r--r-- | security/dummy.c | 36 | ||||
| -rw-r--r-- | security/keys/proc.c | 4 | ||||
| -rw-r--r-- | security/security.c | 31 | ||||
| -rw-r--r-- | security/selinux/hooks.c | 754 | ||||
| -rw-r--r-- | security/selinux/include/objsec.h | 1 | ||||
| -rw-r--r-- | security/selinux/selinuxfs.c | 2 | ||||
| -rw-r--r-- | security/selinux/ss/avtab.c | 2 | ||||
| -rw-r--r-- | security/selinux/ss/mls.c | 11 |
8 files changed, 564 insertions, 277 deletions
diff --git a/security/dummy.c b/security/dummy.c index 3ccfbbe973b..48d4b0a5273 100644 --- a/security/dummy.c +++ b/security/dummy.c | |||
| @@ -225,22 +225,40 @@ static void dummy_sb_post_remount (struct vfsmount *mnt, unsigned long flags, | |||
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | 227 | ||
| 228 | static void dummy_sb_post_mountroot (void) | 228 | static void dummy_sb_post_addmount (struct vfsmount *mnt, struct nameidata *nd) |
| 229 | { | 229 | { |
| 230 | return; | 230 | return; |
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | static void dummy_sb_post_addmount (struct vfsmount *mnt, struct nameidata *nd) | 233 | static int dummy_sb_pivotroot (struct nameidata *old_nd, struct nameidata *new_nd) |
| 234 | { | ||
| 235 | return 0; | ||
| 236 | } | ||
| 237 | |||
| 238 | static void dummy_sb_post_pivotroot (struct nameidata *old_nd, struct nameidata *new_nd) | ||
| 234 | { | 239 | { |
| 235 | return; | 240 | return; |
| 236 | } | 241 | } |
| 237 | 242 | ||
| 238 | static int dummy_sb_pivotroot (struct nameidata *old_nd, struct nameidata *new_nd) | 243 | static int dummy_sb_get_mnt_opts(const struct super_block *sb, char ***mount_options, |
| 244 | int **flags, int *num_opts) | ||
| 239 | { | 245 | { |
| 246 | *mount_options = NULL; | ||
| 247 | *flags = NULL; | ||
| 248 | *num_opts = 0; | ||
| 240 | return 0; | 249 | return 0; |
| 241 | } | 250 | } |
| 242 | 251 | ||
| 243 | static void dummy_sb_post_pivotroot (struct nameidata *old_nd, struct nameidata *new_nd) | 252 | static int dummy_sb_set_mnt_opts(struct super_block *sb, char **mount_options, |
| 253 | int *flags, int num_opts) | ||
| 254 | { | ||
| 255 | if (unlikely(num_opts)) | ||
| 256 | return -EOPNOTSUPP; | ||
| 257 | return 0; | ||
| 258 | } | ||
| 259 | |||
| 260 | static void dummy_sb_clone_mnt_opts(const struct super_block *oldsb, | ||
| 261 | struct super_block *newsb) | ||
| 244 | { | 262 | { |
| 245 | return; | 263 | return; |
| 246 | } | 264 | } |
| @@ -928,6 +946,11 @@ static int dummy_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) | |||
| 928 | return -EOPNOTSUPP; | 946 | return -EOPNOTSUPP; |
| 929 | } | 947 | } |
| 930 | 948 | ||
| 949 | static int dummy_secctx_to_secid(char *secdata, u32 seclen, u32 *secid) | ||
| 950 | { | ||
| 951 | return -EOPNOTSUPP; | ||
| 952 | } | ||
| 953 | |||
| 931 | static void dummy_release_secctx(char *secdata, u32 seclen) | 954 | static void dummy_release_secctx(char *secdata, u32 seclen) |
| 932 | { | 955 | { |
| 933 | } | 956 | } |
| @@ -994,10 +1017,12 @@ void security_fixup_ops (struct security_operations *ops) | |||
| 994 | set_to_dummy_if_null(ops, sb_umount_close); | 1017 | set_to_dummy_if_null(ops, sb_umount_close); |
| 995 | set_to_dummy_if_null(ops, sb_umount_busy); | 1018 | set_to_dummy_if_null(ops, sb_umount_busy); |
| 996 | set_to_dummy_if_null(ops, sb_post_remount); | 1019 | set_to_dummy_if_null(ops, sb_post_remount); |
| 997 | set_to_dummy_if_null(ops, sb_post_mountroot); | ||
| 998 | set_to_dummy_if_null(ops, sb_post_addmount); | 1020 | set_to_dummy_if_null(ops, sb_post_addmount); |
| 999 | set_to_dummy_if_null(ops, sb_pivotroot); | 1021 | set_to_dummy_if_null(ops, sb_pivotroot); |
| 1000 | set_to_dummy_if_null(ops, sb_post_pivotroot); | 1022 | set_to_dummy_if_null(ops, sb_post_pivotroot); |
| 1023 | set_to_dummy_if_null(ops, sb_get_mnt_opts); | ||
| 1024 | set_to_dummy_if_null(ops, sb_set_mnt_opts); | ||
| 1025 | set_to_dummy_if_null(ops, sb_clone_mnt_opts); | ||
| 1001 | set_to_dummy_if_null(ops, inode_alloc_security); | 1026 | set_to_dummy_if_null(ops, inode_alloc_security); |
| 1002 | set_to_dummy_if_null(ops, inode_free_security); | 1027 | set_to_dummy_if_null(ops, inode_free_security); |
| 1003 | set_to_dummy_if_null(ops, inode_init_security); | 1028 | set_to_dummy_if_null(ops, inode_init_security); |
| @@ -1086,6 +1111,7 @@ void security_fixup_ops (struct security_operations *ops) | |||
| 1086 | set_to_dummy_if_null(ops, getprocattr); | 1111 | set_to_dummy_if_null(ops, getprocattr); |
| 1087 | set_to_dummy_if_null(ops, setprocattr); | 1112 | set_to_dummy_if_null(ops, setprocattr); |
| 1088 | set_to_dummy_if_null(ops, secid_to_secctx); | 1113 | set_to_dummy_if_null(ops, secid_to_secctx); |
| 1114 | set_to_dummy_if_null(ops, secctx_to_secid); | ||
| 1089 | set_to_dummy_if_null(ops, release_secctx); | 1115 | set_to_dummy_if_null(ops, release_secctx); |
| 1090 | #ifdef CONFIG_SECURITY_NETWORK | 1116 | #ifdef CONFIG_SECURITY_NETWORK |
| 1091 | set_to_dummy_if_null(ops, unix_stream_connect); | 1117 | set_to_dummy_if_null(ops, unix_stream_connect); |
diff --git a/security/keys/proc.c b/security/keys/proc.c index 3e0d0a6e224..694126003ed 100644 --- a/security/keys/proc.c +++ b/security/keys/proc.c | |||
| @@ -26,7 +26,7 @@ static void *proc_keys_next(struct seq_file *p, void *v, loff_t *_pos); | |||
| 26 | static void proc_keys_stop(struct seq_file *p, void *v); | 26 | static void proc_keys_stop(struct seq_file *p, void *v); |
| 27 | static int proc_keys_show(struct seq_file *m, void *v); | 27 | static int proc_keys_show(struct seq_file *m, void *v); |
| 28 | 28 | ||
| 29 | static struct seq_operations proc_keys_ops = { | 29 | static const struct seq_operations proc_keys_ops = { |
| 30 | .start = proc_keys_start, | 30 | .start = proc_keys_start, |
| 31 | .next = proc_keys_next, | 31 | .next = proc_keys_next, |
| 32 | .stop = proc_keys_stop, | 32 | .stop = proc_keys_stop, |
| @@ -47,7 +47,7 @@ static void *proc_key_users_next(struct seq_file *p, void *v, loff_t *_pos); | |||
| 47 | static void proc_key_users_stop(struct seq_file *p, void *v); | 47 | static void proc_key_users_stop(struct seq_file *p, void *v); |
| 48 | static int proc_key_users_show(struct seq_file *m, void *v); | 48 | static int proc_key_users_show(struct seq_file *m, void *v); |
| 49 | 49 | ||
| 50 | static struct seq_operations proc_key_users_ops = { | 50 | static const struct seq_operations proc_key_users_ops = { |
| 51 | .start = proc_key_users_start, | 51 | .start = proc_key_users_start, |
| 52 | .next = proc_key_users_next, | 52 | .next = proc_key_users_next, |
| 53 | .stop = proc_key_users_stop, | 53 | .stop = proc_key_users_stop, |
diff --git a/security/security.c b/security/security.c index 0e1f1f12436..ca475ca206e 100644 --- a/security/security.c +++ b/security/security.c | |||
| @@ -288,11 +288,6 @@ void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *d | |||
| 288 | security_ops->sb_post_remount(mnt, flags, data); | 288 | security_ops->sb_post_remount(mnt, flags, data); |
| 289 | } | 289 | } |
| 290 | 290 | ||
| 291 | void security_sb_post_mountroot(void) | ||
| 292 | { | ||
| 293 | security_ops->sb_post_mountroot(); | ||
| 294 | } | ||
| 295 | |||
| 296 | void security_sb_post_addmount(struct vfsmount *mnt, struct nameidata *mountpoint_nd) | 291 | void security_sb_post_addmount(struct vfsmount *mnt, struct nameidata *mountpoint_nd) |
| 297 | { | 292 | { |
| 298 | security_ops->sb_post_addmount(mnt, mountpoint_nd); | 293 | security_ops->sb_post_addmount(mnt, mountpoint_nd); |
| @@ -308,6 +303,26 @@ void security_sb_post_pivotroot(struct nameidata *old_nd, struct nameidata *new_ | |||
| 308 | security_ops->sb_post_pivotroot(old_nd, new_nd); | 303 | security_ops->sb_post_pivotroot(old_nd, new_nd); |
| 309 | } | 304 | } |
| 310 | 305 | ||
| 306 | int security_sb_get_mnt_opts(const struct super_block *sb, | ||
| 307 | char ***mount_options, | ||
| 308 | int **flags, int *num_opts) | ||
| 309 | { | ||
| 310 | return security_ops->sb_get_mnt_opts(sb, mount_options, flags, num_opts); | ||
| 311 | } | ||
| 312 | |||
| 313 | int security_sb_set_mnt_opts(struct super_block *sb, | ||
| 314 | char **mount_options, | ||
| 315 | int *flags, int num_opts) | ||
| 316 | { | ||
| 317 | return security_ops->sb_set_mnt_opts(sb, mount_options, flags, num_opts); | ||
| 318 | } | ||
| 319 | |||
| 320 | void security_sb_clone_mnt_opts(const struct super_block *oldsb, | ||
| 321 | struct super_block *newsb) | ||
| 322 | { | ||
| 323 | security_ops->sb_clone_mnt_opts(oldsb, newsb); | ||
| 324 | } | ||
| 325 | |||
| 311 | int security_inode_alloc(struct inode *inode) | 326 | int security_inode_alloc(struct inode *inode) |
| 312 | { | 327 | { |
| 313 | inode->i_security = NULL; | 328 | inode->i_security = NULL; |
| @@ -816,6 +831,12 @@ int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) | |||
| 816 | } | 831 | } |
| 817 | EXPORT_SYMBOL(security_secid_to_secctx); | 832 | EXPORT_SYMBOL(security_secid_to_secctx); |
| 818 | 833 | ||
| 834 | int security_secctx_to_secid(char *secdata, u32 seclen, u32 *secid) | ||
| 835 | { | ||
| 836 | return security_ops->secctx_to_secid(secdata, seclen, secid); | ||
| 837 | } | ||
| 838 | EXPORT_SYMBOL(security_secctx_to_secid); | ||
| 839 | |||
| 819 | void security_release_secctx(char *secdata, u32 seclen) | 840 | void security_release_secctx(char *secdata, u32 seclen) |
| 820 | { | 841 | { |
| 821 | return security_ops->release_secctx(secdata, seclen); | 842 | return security_ops->release_secctx(secdata, seclen); |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 9f3124b0886..0396354fff9 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
| @@ -82,6 +82,8 @@ | |||
| 82 | #define XATTR_SELINUX_SUFFIX "selinux" | 82 | #define XATTR_SELINUX_SUFFIX "selinux" |
| 83 | #define XATTR_NAME_SELINUX XATTR_SECURITY_PREFIX XATTR_SELINUX_SUFFIX | 83 | #define XATTR_NAME_SELINUX XATTR_SECURITY_PREFIX XATTR_SELINUX_SUFFIX |
| 84 | 84 | ||
| 85 | #define NUM_SEL_MNT_OPTS 4 | ||
| 86 | |||
| 85 | extern unsigned int policydb_loaded_version; | 87 | extern unsigned int policydb_loaded_version; |
| 86 | extern int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm); | 88 | extern int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm); |
| 87 | extern int selinux_compat_net; | 89 | extern int selinux_compat_net; |
| @@ -321,8 +323,8 @@ enum { | |||
| 321 | Opt_error = -1, | 323 | Opt_error = -1, |
| 322 | Opt_context = 1, | 324 | Opt_context = 1, |
| 323 | Opt_fscontext = 2, | ||
