Skip to content

Commit 1427ddb

Browse files
committed
lsm: move the binder hook comments to security/security.c
This patch relocates the LSM hook function comments to the function definitions, in keeping with the current kernel conventions. This should make the hook descriptions more easily discoverable and easier to maintain. While formatting changes have been done to better fit the kernel-doc style, content changes have been kept to a minimum and limited to text which was obviously incorrect and/or outdated. It is expected the future patches will improve the quality of the function header comments. Acked-by: Casey Schaufler <casey@schaufler-ca.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent 43fad28 commit 1427ddb

2 files changed

Lines changed: 36 additions & 22 deletions

File tree

include/linux/lsm_hooks.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,6 @@
3232
/**
3333
* union security_list_options - Linux Security Module hook function list
3434
*
35-
* @binder_set_context_mgr:
36-
* Check whether @mgr is allowed to be the binder context manager.
37-
* @mgr contains the struct cred for the current binder process.
38-
* Return 0 if permission is granted.
39-
* @binder_transaction:
40-
* Check whether @from is allowed to invoke a binder transaction call
41-
* to @to.
42-
* @from contains the struct cred for the sending process.
43-
* @to contains the struct cred for the receiving process.
44-
* Return 0 if permission is granted.
45-
* @binder_transfer_binder:
46-
* Check whether @from is allowed to transfer a binder reference to @to.
47-
* @from contains the struct cred for the sending process.
48-
* @to contains the struct cred for the receiving process.
49-
* Return 0 if permission is granted.
50-
* @binder_transfer_file:
51-
* Check whether @from is allowed to transfer @file to @to.
52-
* @from contains the struct cred for the sending process.
53-
* @file contains the struct file being transferred.
54-
* @to contains the struct cred for the receiving process.
55-
* Return 0 if permission is granted.
56-
*
5735
* @ptrace_access_check:
5836
* Check permission before allowing the current process to trace the
5937
* @child process.

security/security.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,23 +779,59 @@ static int lsm_superblock_alloc(struct super_block *sb)
779779

780780
/* Security operations */
781781

782+
/**
783+
* security_binder_set_context_mgr() - Check if becoming binder ctx mgr is ok
784+
* @mgr: task credentials of current binder process
785+
*
786+
* Check whether @mgr is allowed to be the binder context manager.
787+
*
788+
* Return: Return 0 if permission is granted.
789+
*/
782790
int security_binder_set_context_mgr(const struct cred *mgr)
783791
{
784792
return call_int_hook(binder_set_context_mgr, 0, mgr);
785793
}
786794

795+
/**
796+
* security_binder_transaction() - Check if a binder transaction is allowed
797+
* @from: sending process
798+
* @to: receiving process
799+
*
800+
* Check whether @from is allowed to invoke a binder transaction call to @to.
801+
*
802+
* Return: Returns 0 if permission is granted.
803+
*/
787804
int security_binder_transaction(const struct cred *from,
788805
const struct cred *to)
789806
{
790807
return call_int_hook(binder_transaction, 0, from, to);
791808
}
792809

810+
/**
811+
* security_binder_transfer_binder() - Check if a binder transfer is allowed
812+
* @from: sending process
813+
* @to: receiving process
814+
*
815+
* Check whether @from is allowed to transfer a binder reference to @to.
816+
*
817+
* Return: Returns 0 if permission is granted.
818+
*/
793819
int security_binder_transfer_binder(const struct cred *from,
794820
const struct cred *to)
795821
{
796822
return call_int_hook(binder_transfer_binder, 0, from, to);
797823
}
798824

825+
/**
826+
* security_binder_transfer_file() - Check if a binder file xfer is allowed
827+
* @from: sending process
828+
* @to: receiving process
829+
* @file: file being transferred
830+
*
831+
* Check whether @from is allowed to transfer @file to @to.
832+
*
833+
* Return: Returns 0 if permission is granted.
834+
*/
799835
int security_binder_transfer_file(const struct cred *from,
800836
const struct cred *to, struct file *file)
801837
{

0 commit comments

Comments
 (0)