aboutsummaryrefslogtreecommitdiffstats
path: root/security/smack/smack_lsm.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-03-26 14:03:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-26 14:03:39 -0400
commit8d80ce80e1d58ba9cd3e3972b112cccd6b4008f4 (patch)
tree16d3cca8d260c731d02a4e5e1ea5b9817c9c3626 /security/smack/smack_lsm.c
parent1646df40bb111715a90ce0b86448dabbcc5b3f3d (diff)
parent703a3cd72817e99201cef84a8a7aecc60b2b3581 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6: (71 commits) SELinux: inode_doinit_with_dentry drop no dentry printk SELinux: new permission between tty audit and audit socket SELinux: open perm for sock files smack: fixes for unlabeled host support keys: make procfiles per-user-namespace keys: skip keys from another user namespace keys: consider user namespace in key_permission keys: distinguish per-uid keys in different namespaces integrity: ima iint radix_tree_lookup locking fix TOMOYO: Do not call tomoyo_realpath_init unless registered. integrity: ima scatterlist bug fix smack: fix lots of kernel-doc notation TOMOYO: Don't create securityfs entries unless registered. TOMOYO: Fix exception policy read failure. SELinux: convert the avc cache hash list to an hlist SELinux: code readability with avc_cache SELinux: remove unused av.decided field SELinux: more careful use of avd in avc_has_perm_noaudit SELinux: remove the unused ae.used SELinux: check seqno when updating an avc_node ...
Diffstat (limited to 'security/smack/smack_lsm.c')
-rw-r--r--security/smack/smack_lsm.c52
1 files changed, 24 insertions, 28 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index e7ded1326b0f..84b62b5e9e2c 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -91,6 +91,7 @@ struct inode_smack *new_inode_smack(char *smack)
91/** 91/**
92 * smack_ptrace_may_access - Smack approval on PTRACE_ATTACH 92 * smack_ptrace_may_access - Smack approval on PTRACE_ATTACH
93 * @ctp: child task pointer 93 * @ctp: child task pointer
94 * @mode: ptrace attachment mode
94 * 95 *
95 * Returns 0 if access is OK, an error code otherwise 96 * Returns 0 if access is OK, an error code otherwise
96 * 97 *
@@ -203,9 +204,8 @@ static void smack_sb_free_security(struct super_block *sb)
203 204
204/** 205/**
205 * smack_sb_copy_data - copy mount options data for processing 206 * smack_sb_copy_data - copy mount options data for processing
206 * @type: file system type
207 * @orig: where to start 207 * @orig: where to start
208 * @smackopts 208 * @smackopts: mount options string
209 * 209 *
210 * Returns 0 on success or -ENOMEM on error. 210 * Returns 0 on success or -ENOMEM on error.
211 * 211 *
@@ -331,7 +331,7 @@ static int smack_sb_statfs(struct dentry *dentry)
331/** 331/**
332 * smack_sb_mount - Smack check for mounting 332 * smack_sb_mount - Smack check for mounting
333 * @dev_name: unused 333 * @dev_name: unused
334 * @nd: mount point 334 * @path: mount point
335 * @type: unused 335 * @type: unused
336 * @flags: unused 336 * @flags: unused
337 * @data: unused 337 * @data: unused
@@ -370,7 +370,7 @@ static int smack_sb_umount(struct vfsmount *mnt, int flags)
370 370
371/** 371/**
372 * smack_inode_alloc_security - allocate an inode blob 372 * smack_inode_alloc_security - allocate an inode blob
373 * @inode - the inode in need of a blob 373 * @inode: the inode in need of a blob
374 * 374 *
375 * Returns 0 if it gets a blob, -ENOMEM otherwise 375 * Returns 0 if it gets a blob, -ENOMEM otherwise
376 */ 376 */
@@ -384,7 +384,7 @@ static int smack_inode_alloc_security(struct inode *inode)
384 384
385/** 385/**
386 * smack_inode_free_security - free an inode blob 386 * smack_inode_free_security - free an inode blob
387 * @inode - the inode with a blob 387 * @inode: the inode with a blob
388 * 388 *
389 * Clears the blob pointer in inode 389 * Clears the blob pointer in inode
390 */ 390 */
@@ -538,7 +538,6 @@ static int smack_inode_rename(struct inode *old_inode,
538 * smack_inode_permission - Smack version of permission() 538 * smack_inode_permission - Smack version of permission()
539 * @inode: the inode in question 539 * @inode: the inode in question
540 * @mask: the access requested 540 * @mask: the access requested
541 * @nd: unused
542 * 541 *
543 * This is the important Smack hook. 542 * This is the important Smack hook.
544 * 543 *
@@ -701,8 +700,7 @@ static int smack_inode_removexattr(struct dentry *dentry, const char *name)
701 * @inode: the object 700 * @inode: the object
702 * @name: attribute name 701 * @name: attribute name
703 * @buffer: where to put the result 702 * @buffer: where to put the result
704 * @size: size of the buffer 703 * @alloc: unused
705 * @err: unused
706 * 704 *
707 * Returns the size of the attribute or an error code 705 * Returns the size of the attribute or an error code
708 */ 706 */
@@ -864,7 +862,7 @@ static int smack_file_ioctl(struct file *file, unsigned int cmd,
864/** 862/**
865 * smack_file_lock - Smack check on file locking 863 * smack_file_lock - Smack check on file locking
866 * @file: the object 864 * @file: the object
867 * @cmd unused 865 * @cmd: unused
868 * 866 *
869 * Returns 0 if current has write access, error code otherwise 867 * Returns 0 if current has write access, error code otherwise
870 */ 868 */
@@ -1003,8 +1001,8 @@ static int smack_cred_prepare(struct cred *new, const struct cred *old,
1003 return 0; 1001 return 0;
1004} 1002}
1005 1003
1006/* 1004/**
1007 * commit new credentials 1005 * smack_cred_commit - commit new credentials
1008 * @new: the new credentials 1006 * @new: the new credentials
1009 * @old: the original credentials 1007 * @old: the original credentials
1010 */ 1008 */
@@ -1014,8 +1012,8 @@ static void smack_cred_commit(struct cred *new, const struct cred *old)
1014 1012
1015/** 1013/**
1016 * smack_kernel_act_as - Set the subjective context in a set of credentials 1014 * smack_kernel_act_as - Set the subjective context in a set of credentials
1017 * @new points to the set of credentials to be modified. 1015 * @new: points to the set of credentials to be modified.
1018 * @secid specifies the security ID to be set 1016 * @secid: specifies the security ID to be set
1019 * 1017 *
1020 * Set the security data for a kernel service. 1018 * Set the security data for a kernel service.
1021 */ 1019 */
@@ -1032,8 +1030,8 @@ static int smack_kernel_act_as(struct cred *new, u32 secid)
1032 1030
1033/** 1031/**
1034 * smack_kernel_create_files_as - Set the file creation label in a set of creds 1032 * smack_kernel_create_files_as - Set the file creation label in a set of creds
1035 * @new points to the set of credentials to be modified 1033 * @new: points to the set of credentials to be modified
1036 * @inode points to the inode to use as a reference 1034 * @inode: points to the inode to use as a reference
1037 * 1035 *
1038 * Set the file creation context in a set of credentials to the same 1036 * Set the file creation context in a set of credentials to the same
1039 * as the objective context of the specified inode 1037 * as the objective context of the specified inode
@@ -1242,7 +1240,7 @@ static int smack_task_wait(struct task_struct *p)
1242/** 1240/**
1243 * smack_task_to_inode - copy task smack into the inode blob 1241 * smack_task_to_inode - copy task smack into the inode blob
1244 * @p: task to copy from 1242 * @p: task to copy from
1245 * inode: inode to copy to 1243 * @inode: inode to copy to
1246 * 1244 *
1247 * Sets the smack pointer in the inode security blob 1245 * Sets the smack pointer in the inode security blob
1248 */ 1246 */
@@ -1260,7 +1258,7 @@ static void smack_task_to_inode(struct task_struct *p, struct inode *inode)
1260 * smack_sk_alloc_security - Allocate a socket blob 1258 * smack_sk_alloc_security - Allocate a socket blob
1261 * @sk: the socket 1259 * @sk: the socket
1262 * @family: unused 1260 * @family: unused
1263 * @priority: memory allocation priority 1261 * @gfp_flags: memory allocation flags
1264 * 1262 *
1265 * Assign Smack pointers to current 1263 * Assign Smack pointers to current
1266 * 1264 *
@@ -1974,7 +1972,7 @@ static int smack_ipc_permission(struct kern_ipc_perm *ipp, short flag)
1974 1972
1975/** 1973/**
1976 * smack_ipc_getsecid - Extract smack security id 1974 * smack_ipc_getsecid - Extract smack security id
1977 * @ipcp: the object permissions 1975 * @ipp: the object permissions
1978 * @secid: where result will be saved 1976 * @secid: where result will be saved
1979 */ 1977 */
1980static void smack_ipc_getsecid(struct kern_ipc_perm *ipp, u32 *secid) 1978static void smack_ipc_getsecid(struct kern_ipc_perm *ipp, u32 *secid)
@@ -2251,7 +2249,7 @@ static int smack_unix_may_send(struct socket *sock, struct socket *other)
2251/** 2249/**
2252 * smack_socket_sendmsg - Smack check based on destination host 2250 * smack_socket_sendmsg - Smack check based on destination host
2253 * @sock: the socket 2251 * @sock: the socket
2254 * @msghdr: the message 2252 * @msg: the message
2255 * @size: the size of the message 2253 * @size: the size of the message
2256 * 2254 *
2257 * Return 0 if the current subject can write to the destination 2255 * Return 0 if the current subject can write to the destination
@@ -2292,8 +2290,7 @@ static int smack_socket_sendmsg(struct socket *sock, struct msghdr *msg,
2292 2290
2293 2291
2294/** 2292/**
2295 * smack_from_secattr - Convert a netlabel attr.mls.lvl/attr.mls.cat 2293 * smack_from_secattr - Convert a netlabel attr.mls.lvl/attr.mls.cat pair to smack
2296 * pair to smack
2297 * @sap: netlabel secattr 2294 * @sap: netlabel secattr
2298 * @sip: where to put the result 2295 * @sip: where to put the result
2299 * 2296 *
@@ -2414,7 +2411,7 @@ static int smack_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
2414 * @sock: the socket 2411 * @sock: the socket
2415 * @optval: user's destination 2412 * @optval: user's destination
2416 * @optlen: size thereof 2413 * @optlen: size thereof
2417 * @len: max thereoe 2414 * @len: max thereof
2418 * 2415 *
2419 * returns zero on success, an error code otherwise 2416 * returns zero on success, an error code otherwise
2420 */ 2417 */
@@ -2749,7 +2746,7 @@ static void smack_audit_rule_free(void *vrule)
2749 2746
2750#endif /* CONFIG_AUDIT */ 2747#endif /* CONFIG_AUDIT */
2751 2748
2752/* 2749/**
2753 * smack_secid_to_secctx - return the smack label for a secid 2750 * smack_secid_to_secctx - return the smack label for a secid
2754 * @secid: incoming integer 2751 * @secid: incoming integer
2755 * @secdata: destination 2752 * @secdata: destination
@@ -2766,7 +2763,7 @@ static int smack_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
2766 return 0; 2763 return 0;
2767} 2764}
2768 2765
2769/* 2766/**
2770 * smack_secctx_to_secid - return the secid for a smack label 2767 * smack_secctx_to_secid - return the secid for a smack label
2771 * @secdata: smack label 2768 * @secdata: smack label
2772 * @seclen: how long result is 2769 * @seclen: how long result is
@@ -2780,11 +2777,10 @@ static int smack_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid)
2780 return 0; 2777 return 0;
2781} 2778}
2782 2779
2783/* 2780/**
2784 * smack_release_secctx - don't do anything. 2781 * smack_release_secctx - don't do anything.
2785 * @key_ref: unused 2782 * @secdata: unused
2786 * @context: unused 2783 * @seclen: unused
2787 * @perm: unused
2788 * 2784 *
2789 * Exists to make sure nothing gets done, and properly 2785 * Exists to make sure nothing gets done, and properly
2790 */ 2786 */