Skip to content

Commit e261301

Browse files
committed
lsm: move the remaining LSM 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 1cd2aca commit e261301

2 files changed

Lines changed: 231 additions & 168 deletions

File tree

include/linux/lsm_hooks.h

Lines changed: 0 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -29,174 +29,6 @@
2929
#include <linux/init.h>
3030
#include <linux/rculist.h>
3131

32-
/**
33-
* union security_list_options - Linux Security Module hook function list
34-
*
35-
* @ptrace_access_check:
36-
* Check permission before allowing the current process to trace the
37-
* @child process.
38-
* Security modules may also want to perform a process tracing check
39-
* during an execve in the set_security or apply_creds hooks of
40-
* tracing check during an execve in the bprm_set_creds hook of
41-
* binprm_security_ops if the process is being traced and its security
42-
* attributes would be changed by the execve.
43-
* @child contains the task_struct structure for the target process.
44-
* @mode contains the PTRACE_MODE flags indicating the form of access.
45-
* Return 0 if permission is granted.
46-
* @ptrace_traceme:
47-
* Check that the @parent process has sufficient permission to trace the
48-
* current process before allowing the current process to present itself
49-
* to the @parent process for tracing.
50-
* @parent contains the task_struct structure for debugger process.
51-
* Return 0 if permission is granted.
52-
* @capget:
53-
* Get the @effective, @inheritable, and @permitted capability sets for
54-
* the @target process. The hook may also perform permission checking to
55-
* determine if the current process is allowed to see the capability sets
56-
* of the @target process.
57-
* @target contains the task_struct structure for target process.
58-
* @effective contains the effective capability set.
59-
* @inheritable contains the inheritable capability set.
60-
* @permitted contains the permitted capability set.
61-
* Return 0 if the capability sets were successfully obtained.
62-
* @capset:
63-
* Set the @effective, @inheritable, and @permitted capability sets for
64-
* the current process.
65-
* @new contains the new credentials structure for target process.
66-
* @old contains the current credentials structure for target process.
67-
* @effective contains the effective capability set.
68-
* @inheritable contains the inheritable capability set.
69-
* @permitted contains the permitted capability set.
70-
* Return 0 and update @new if permission is granted.
71-
* @capable:
72-
* Check whether the @tsk process has the @cap capability in the indicated
73-
* credentials.
74-
* @cred contains the credentials to use.
75-
* @ns contains the user namespace we want the capability in.
76-
* @cap contains the capability <include/linux/capability.h>.
77-
* @opts contains options for the capable check <include/linux/security.h>.
78-
* Return 0 if the capability is granted for @tsk.
79-
* @quotactl:
80-
* Check whether the quotactl syscall is allowed for this @sb.
81-
* Return 0 if permission is granted.
82-
* @quota_on:
83-
* Check whether QUOTAON is allowed for this @dentry.
84-
* Return 0 if permission is granted.
85-
* @syslog:
86-
* Check permission before accessing the kernel message ring or changing
87-
* logging to the console.
88-
* See the syslog(2) manual page for an explanation of the @type values.
89-
* @type contains the SYSLOG_ACTION_* constant from
90-
* <include/linux/syslog.h>.
91-
* Return 0 if permission is granted.
92-
* @settime:
93-
* Check permission to change the system time.
94-
* struct timespec64 is defined in <include/linux/time64.h> and timezone
95-
* is defined in <include/linux/time.h>
96-
* @ts contains new time.
97-
* @tz contains new timezone.
98-
* Return 0 if permission is granted.
99-
* @vm_enough_memory:
100-
* Check permissions for allocating a new virtual mapping.
101-
* @mm contains the mm struct it is being added to.
102-
* @pages contains the number of pages.
103-
* Return 0 if permission is granted by the LSM infrastructure to the
104-
* caller. If all LSMs return a positive value, __vm_enough_memory() will
105-
* be called with cap_sys_admin set. If at least one LSM returns 0 or
106-
* negative, __vm_enough_memory() will be called with cap_sys_admin
107-
* cleared.
108-
*
109-
* @ismaclabel:
110-
* Check if the extended attribute specified by @name
111-
* represents a MAC label. Returns 1 if name is a MAC
112-
* attribute otherwise returns 0.
113-
* @name full extended attribute name to check against
114-
* LSM as a MAC label.
115-
*
116-
* @secid_to_secctx:
117-
* Convert secid to security context. If secdata is NULL the length of
118-
* the result will be returned in seclen, but no secdata will be returned.
119-
* This does mean that the length could change between calls to check the
120-
* length and the next call which actually allocates and returns the
121-
* secdata.
122-
* @secid contains the security ID.
123-
* @secdata contains the pointer that stores the converted security
124-
* context.
125-
* @seclen pointer which contains the length of the data.
126-
* Return 0 on success, error on failure.
127-
* @secctx_to_secid:
128-
* Convert security context to secid.
129-
* @secid contains the pointer to the generated security ID.
130-
* @secdata contains the security context.
131-
* Return 0 on success, error on failure.
132-
*
133-
* @release_secctx:
134-
* Release the security context.
135-
* @secdata contains the security context.
136-
* @seclen contains the length of the security context.
137-
*
138-
* @inode_invalidate_secctx:
139-
* Notify the security module that it must revalidate the security context
140-
* of an inode.
141-
*
142-
* @inode_notifysecctx:
143-
* Notify the security module of what the security context of an inode
144-
* should be. Initializes the incore security context managed by the
145-
* security module for this inode. Example usage: NFS client invokes
146-
* this hook to initialize the security context in its incore inode to the
147-
* value provided by the server for the file when the server returned the
148-
* file's attributes to the client.
149-
* Must be called with inode->i_mutex locked.
150-
* @inode we wish to set the security context of.
151-
* @ctx contains the string which we wish to set in the inode.
152-
* @ctxlen contains the length of @ctx.
153-
* Return 0 on success, error on failure.
154-
*
155-
* @inode_setsecctx:
156-
* Change the security context of an inode. Updates the
157-
* incore security context managed by the security module and invokes the
158-
* fs code as needed (via __vfs_setxattr_noperm) to update any backing
159-
* xattrs that represent the context. Example usage: NFS server invokes
160-
* this hook to change the security context in its incore inode and on the
161-
* backing filesystem to a value provided by the client on a SETATTR
162-
* operation.
163-
* Must be called with inode->i_mutex locked.
164-
* @dentry contains the inode we wish to set the security context of.
165-
* @ctx contains the string which we wish to set in the inode.
166-
* @ctxlen contains the length of @ctx.
167-
* Return 0 on success, error on failure.
168-
*
169-
* @inode_getsecctx:
170-
* On success, returns 0 and fills out @ctx and @ctxlen with the security
171-
* context for the given @inode.
172-
* @inode we wish to get the security context of.
173-
* @ctx is a pointer in which to place the allocated security context.
174-
* @ctxlen points to the place to put the length of @ctx.
175-
* Return 0 on success, error on failure.
176-
*
177-
* Security hooks for the general notification queue:
178-
*
179-
* @post_notification:
180-
* Check to see if a watch notification can be posted to a particular
181-
* queue.
182-
* @w_cred: The credentials of the whoever set the watch.
183-
* @cred: The event-triggerer's credentials.
184-
* @n: The notification being posted.
185-
* Return 0 if permission is granted.
186-
*
187-
* @watch_key:
188-
* Check to see if a process is allowed to watch for event notifications
189-
* from a key or keyring.
190-
* @key: The key to watch.
191-
* Return 0 if permission is granted.
192-
*
193-
* @locked_down:
194-
* Determine whether a kernel feature that potentially enables arbitrary
195-
* code execution in kernel space should be permitted.
196-
* @what: kernel feature being accessed.
197-
* Return 0 if permission is granted.
198-
*
199-
*/
20032
union security_list_options {
20133
#define LSM_HOOK(RET, DEFAULT, NAME, ...) RET (*NAME)(__VA_ARGS__);
20234
#include "lsm_hook_defs.h"

0 commit comments

Comments
 (0)