Lines Matching full:the
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
18 * Due to this file being licensed under the GPL there is controversy over
20 * without placing your module under the GPL. Please consult a lawyer for
38 * If the setup in prepare_exec_creds did not setup @bprm->cred->security
39 * properly for executing @bprm->file, update the LSM's portion of
40 * @bprm->cred->security to be what commit_creds needs to install for the
43 * The hook must set @bprm->secureexec to 1 if AT_SECURE should be set to
45 * @bprm contains the linux_binprm structure.
46 * Return 0 if the hook is successful and permission is granted.
50 * This is called after finding the binary that will be executed.
51 * without an interpreter. This ensures that the credentials will not
52 * be derived from a script that the binary will need to reopen, which
56 * The hook must set @bprm->secureexec to 1 if AT_SECURE should be set to
58 * The hook must add to @bprm->per_clear any personality flags that
60 * @bprm contains the linux_binprm structure.
61 * Return 0 if the hook is successful and permission is granted.
63 * This hook mediates the point when a search for a binary handler will
64 * begin. It allows a check against the @bprm->cred->security value
65 * which was set in the preceding creds_for_exec call. The argv list and
68 * @bprm contains the linux_binprm structure.
69 * Return 0 if the hook is successful and permission is granted.
71 * Prepare to install the new security attributes of a process being
72 * transformed by an execve operation, based on the old credentials
73 * pointed to by @current->cred and the information set in @bprm->cred by
74 * the bprm_creds_for_exec hook. @bprm points to the linux_binprm
75 * structure. This hook is a good place to perform state changes on the
77 * longer be granted when the attributes are changed. This is called
80 * Tidy up after the installation of the new security attributes of a
81 * process being transformed by an execve operation. The new credentials
82 * have, by this point, been set to @current->cred. @bprm points to the
84 * changes on the process such as clearing out non-inheritable signal
92 * is initialised to NULL by the caller.
93 * @fc indicates the new filesystem context.
94 * @src_fc indicates the original filesystem context.
96 * Userspace provided a parameter to configure a superblock. The LSM may
99 * the filesystem.
100 * @fc indicates the filesystem context.
101 * @param The parameter
106 * Allocate and attach a security structure to the sb->s_security field.
107 * The s_security field is initialized to NULL when the structure is
109 * @sb contains the super_block structure to be modified.
113 * @sb contains the super_block structure being released.
115 * Deallocate and clear the sb->s_security field.
116 * @sb contains the super_block structure to be modified.
122 * Check permission before obtaining filesystem statistics for the @mnt
124 * @dentry is a handle on the superblock for the filesystem.
128 * the mount point named by @nd. For an ordinary mount, @dev_name
129 * identifies a device if the file system type requires a device. For a
131 * loopback/bind mount (@flags & MS_BIND), @dev_name identifies the
132 * pathname of the object being mounted.
133 * @dev_name contains the name for object being mounted.
134 * @path contains the path for mount point object.
135 * @type contains the filesystem type.
136 * @flags contains the mount flags.
137 * @data contains the filesystem-specific data.
140 * Allow mount option data to be copied prior to parsing by the filesystem,
141 * so that the security module can extract security-specific mount
142 * options cleanly (a filesystem may modify the data e.g. with strsep()).
143 * This also allows the original mount data to be stripped of security-
145 * @orig the original mount data copied from userspace.
146 * @copy copied data which will be passed to the security module.
147 * Returns 0 if the copy was successful.
149 * Determine if the new mount options in @mnt_opts are allowed given
150 * the existing mounted filesystem at @sb.
158 * @data contains the filesystem-specific data.
165 * Check permission before the @mnt file system is unmounted.
166 * @mnt contains the mounted file system.
167 * @flags contains the unmount flags, e.g. MNT_FORCE.
170 * Check permission before pivoting the root filesystem.
171 * @old_path contains the path for the new location of the
173 * @new_path contains the path for the new root (new_root).
176 * Set the security relevant mount options used for a superblock
177 * @sb the superblock to set security mount options for
186 * Parse a string of security data filling in the opts structure
187 * @options string containing all mount options known by the LSM
188 * @opts binary data structure usable by the LSM
191 * @from_path indicates the mount that is going to be moved.
192 * @to_path indicates the mountpoint that will be mounted upon.
194 * Compute a context for a dentry as the inode is not yet available
196 * @dentry dentry to use in calculating the context.
198 * @name name of the last path component used to create file
199 * @ctx pointer to place the pointer to the resulting context in.
200 * @ctxlen point to place the length of the resulting context.
202 * Compute a context for a dentry as the inode is not yet available
204 * created using that context. Context is calculated using the
205 * passed in creds and not the creds of the caller.
206 * @dentry dentry to use in calculating the context.
208 * @name name of the last path component used to create file
216 * Allocate and attach a security structure to @inode->i_security. The
217 * i_security field is initialized to NULL when the inode structure is
219 * @inode contains the inode structure.
222 * @inode contains the inode structure.
223 * Deallocate the inode security structure and set @inode->i_security to
226 * Obtain the security attribute name suffix and value to set on a newly
227 * created inode and set up the incore security field for the new inode.
228 * This hook is called by the fs code as part of the inode creation
229 * transaction and provides for atomic labeling of the inode, unlike
230 * the post_create/mkdir/... hooks called by the VFS. The hook function
231 * is expected to allocate the name and value via kmalloc, with the caller
233 * If the security module does not use security attributes or does
236 * @inode contains the inode structure of the newly created inode.
237 * @dir contains the inode structure of the parent directory.
238 * @qstr contains the last path component of the new object
239 * @name will be set to the allocated name suffix (e.g. selinux).
240 * @value will be set to the allocated attribute value.
241 * @len will be set to the length of the value.
246 * Set up the incore security field for the new anonymous inode
247 * and return whether the inode creation is permitted by the security
249 * @inode contains the inode structure
250 * @name name of the anonymous inode class
252 * Returns 0 on success, -EACCES if the security module denies the
256 * @dir contains inode structure of the parent of the new file.
257 * @dentry contains the dentry structure for the file to be created.
258 * @mode contains the file mode of the file to be created.
262 * @old_dentry contains the dentry structure for an existing
263 * link to the file.
264 * @dir contains the inode structure of the parent directory
265 * of the new link.
266 * @new_dentry contains the dentry structure for the new link.
270 * @old_dentry contains the dentry structure for an existing link
271 * to the file.
272 * @new_dir contains the path structure of the parent directory of
273 * the new link.
274 * @new_dentry contains the dentry structure for the new link.
277 * Check the permission to remove a hard link to a file.
278 * @dir contains the inode structure of parent directory of the file.
279 * @dentry contains the dentry structure for file to be unlinked.
282 * Check the permission to remove a hard link to a file.
283 * @dir contains the path structure of parent directory of the file.
284 * @dentry contains the dentry structure for file to be unlinked.
287 * Check the permission to create a symbolic link to a file.
288 * @dir contains the inode structure of parent directory of
289 * the symbolic link.
290 * @dentry contains the dentry structure of the symbolic link.
291 * @old_name contains the pathname of file.
294 * Check the permission to create a symbolic link to a file.
295 * @dir contains the path structure of parent directory of
296 * the symbolic link.
297 * @dentry contains the dentry structure of the symbolic link.
298 * @old_name contains the pathname of file.
301 * Check permissions to create a new directory in the existing directory
303 * @dir contains the inode structure of parent of the directory
305 * @dentry contains the dentry structure of new directory.
306 * @mode contains the mode of new directory.
309 * Check permissions to create a new directory in the existing directory
311 * @dir contains the path structure of parent of the directory
313 * @dentry contains the dentry structure of new directory.
314 * @mode contains the mode of new directory.
317 * Check the permission to remove a directory.
318 * @dir contains the inode structure of parent of the directory
320 * @dentry contains the dentry structure of directory to be removed.
323 * Check the permission to remove a directory.
324 * @dir contains the path structure of parent of the directory to be
326 * @dentry contains the dentry structure of directory to be removed.
330 * file created via the mknod system call). Note that if mknod operation
331 * is being done for a regular file, then the create hook will be called
333 * @dir contains the inode structure of parent of the new file.
334 * @dentry contains the dentry structure of the new file.
335 * @mode contains the mode of the new file.
336 * @dev contains the device number.
341 * @dir contains the path structure of parent of the new file.
342 * @dentry contains the dentry structure of the new file.
343 * @mode contains the mode of the new file.
344 * @dev contains the undecoded device number. Use new_decode_dev() to get
345 * the decoded device number.
349 * @old_dir contains the inode structure for parent of the old link.
350 * @old_dentry contains the dentry structure of the old link.
351 * @new_dir contains the inode structure for parent of the new link.
352 * @new_dentry contains the dentry structure of the new link.
356 * @old_dir contains the path structure for parent of the old link.
357 * @old_dentry contains the dentry structure of the old link.
358 * @new_dir contains the path structure for parent of the new link.
359 * @new_dentry contains the dentry structure of the new link.
362 * Check for permission to change a mode of the file @path. The new
364 * @path contains the path structure of the file to change the mode.
365 * @mode contains the new DAC's permission, which is a bitmask of
370 * @path contains the path structure.
376 * @path contains the path structure.
382 * Check the permission to read the symbolic link.
383 * @dentry contains the dentry structure for the file link.
387 * @dentry contains the dentry structure for the link.
388 * @inode contains the inode, which itself is not stable in RCU-walk
392 * Check permission before accessing an inode. This hook is called by the
396 * other operations), whereas the file_security_ops permission hook is
397 * called when the actual read/write operations are performed.
398 * @inode contains the inode structure to check.
399 * @mask contains the permission mask.
402 * Check permission before setting file attributes. Note that the kernel
406 * @dentry contains the dentry structure for the file.
407 * @attr is the iattr structure containing the new file attributes.
411 * @path contains the path structure for the file.
415 * @path contains the path structure for the file.
418 * Check permission before setting the extended attributes
425 * Check permission before obtaining the extended attributes
429 * Check permission before obtaining the list of extended attribute
433 * Check permission before removing the extended attribute
437 * Retrieve a copy of the extended attribute representation of the
439 * @name is the remainder of the attribute name after the security prefix
440 * has been removed. @alloc is used to specify of the call should return a
441 * value via the buffer or just the value length Return size of buffer on
444 * Set the security label associated with @name for @inode from the
445 * extended attribute value @value. @size indicates the size of the
447 * Note that @name is the remainder of the attribute name after the
451 * Copy the extended attribute names for the security labels
452 * associated with @inode into @buffer. The maximum size of @buffer
454 * the size of the buffer required.
458 * @dentry is the dentry being changed.
459 * Return <0 on error to abort the inode change operation.
463 * The setuid bit is being removed. Remove similar security labels.
464 * Called with the dentry->d_inode->i_mutex held.
465 * @mnt_userns: user namespace of the mount
466 * @dentry is the dentry being changed.
467 * Return 0 on success. If error is returned, then the operation
470 * Get the secid associated with the node.
471 * @inode contains a pointer to the inode.
472 * @secid contains a pointer to the location where result will be saved.
480 * @src indicates the union dentry of file that is being copied up.
484 * Filter the xattrs being copied up when a unioned file is copied
485 * up from a lower layer to the union/overlay layer.
486 * @name indicates the name of the xattr.
487 * Returns 0 to accept the xattr, 1 to discard the xattr, -EOPNOTSUPP if
489 * to abort the copy up. Note that the caller is responsible for reading
490 * and writing the xattrs as this hook is merely a filter.
501 * Initialize the security context of a newly created kernfs node based
504 * @kn_dir the parent kernfs node
505 * @kn the new child kernfs node
514 * bracketing or policy changes. Notice that this hook is used when the
515 * actual read/write operations are performed, whereas the
520 * address the revalidation of permissions for memory-mapped files.
523 * @file contains the file structure being accessed.
524 * @mask contains the requested permissions.
527 * Allocate and attach a security structure to the file->f_security field.
528 * The security field is initialized to NULL when the structure is first
530 * @file contains the file structure to secure.
531 * Return 0 if the hook is successful and permission is granted.
534 * @file contains the file structure being modified.
536 * @file contains the file structure.
537 * @cmd contains the operation to perform.
538 * @arg contains the operational arguments.
542 * should never be used by the security module.
546 * @addr contains virtual address that will be used for the operation.
549 * Check permissions for a mmap operation. The @file may be NULL, e.g.
551 * @file contains the file structure for file to map (may be NULL).
552 * @reqprot contains the protection requested by the application.
553 * @prot contains the protection that will be applied by the kernel.
554 * @flags contains the operational flags.
558 * @vma contains the memory region to modify.
559 * @reqprot contains the protection requested by the application.
560 * @prot contains the protection that will be applied by the kernel.
564 * Note the hook mediates both flock and fcntl style locks.
565 * @file contains the file structure.
566 * @cmd contains the posix-translated lock operation to perform
570 * Check permission before allowing the file operation specified by @cmd
571 * from being performed on the file @file. Note that @arg sometimes
574 * never be used by the security module.
575 * @file contains the file structure.
576 * @cmd contains the operation to be performed.
577 * @arg contains the operational arguments.
581 * file->f_security for later use by the send_sigiotask hook.
582 * @file contains the file structure to update.
585 * Check permission for the file owner @fown to send SIGIO or SIGURG to the
587 * Note that the fown_struct, @fown, is never outside the context of a
588 * struct file, so the file structure (and associated security information)
590 * @tsk contains the structure of task receiving signal.
591 * @fown contains the file owner information.
592 * @sig is the signal that will be sent. When 0, kernel sends SIGIO.
595 * This hook allows security modules to control the ability of a process
597 * @file contains the file structure being received.
608 * @clone_flags contains the flags indicating what should be shared.
616 * @cred points to the credentials.
617 * @gfp indicates the atomicity of any memory allocations.
621 * @cred points to the credentials.
622 * Deallocate and clear the cred->security field in a set of credentials.
624 * @new points to the new credentials.
625 * @old points to the original credentials.
626 * @gfp indicates the atomicity of any memory allocations.
627 * Prepare a new set of credentials by copying the data from the old set.
629 * @new points to the new credentials.
630 * @old points to the original credentials.
633 * Retrieve the security identifier of the cred structure @c
634 * @c contains the credentials, secid will be placed into @secid.
637 * Set the credentials for a kernel service to act as (subjective context).
638 * @new points to the credentials to be modified.
639 * @secid specifies the security ID to be set
640 * The current task must be the one that nominated @secid.
643 * Set the file creation context in a set of credentials to be the same as
644 * the objective context of the specified inode.
645 * @new points to the credentials to be modified.
646 * @inode points to the inode to use as a reference.
647 * The current task must be the one that nominated @inode.
650 * Ability to trigger the kernel to automatically upcall to userspace for
651 * userspace to load a kernel module with the given name.
652 * @kmod_name name of the module requested by the kernel
661 * @buf pointer to buffer containing the data contents.
662 * @size length of the data contents.
670 * @file contains the file structure pointing to the file being read
671 * by the kernel.
677 * @file contains the file structure pointing to the file being read
678 * by the kernel.
679 * @buf pointer to buffer containing the file contents.
680 * @size length of the file contents.
686 * Update the module's state after setting one or more of the user
687 * identity attributes of the current process. The @flags parameter
688 * indicates which of the set*uid system calls invoked this hook. If
689 * @new is the set of credentials that will be installed. Modifications
691 * @old is the set of credentials that are being replaces
692 * @flags contains one of the LSM_SETID_* values.
695 * Update the module's state after setting one or more of the group
696 * identity attributes of the current process. The @flags parameter
697 * indicates which of the set*gid system calls invoked this hook.
698 * @new is the set of credentials that will be installed. Modifications
700 * @old is the set of credentials that are being replaced.
701 * @flags contains one of the LSM_SETID_* values.
704 * Check permission before setting the process group identifier of the
706 * @p contains the task_struct for process being modified.
707 * @pgid contains the new pgid.
710 * Check permission before getting the process group identifier of the
712 * @p contains the task_struct for the process.
715 * Check permission before getting the session identifier of the process
717 * @p contains the task_struct for the process.
720 * Retrieve the subjective security identifier of the task_struct in @p
722 * is the either the "current" task, or the caller has exclusive access
726 * Retrieve the objective security identifier of the task_struct in @p
731 * Check permission before setting the nice value of @p to @nice.
732 * @p contains the task_struct of process.
733 * @nice contains the new nice value.
736 * Check permission before setting the ioprio value of @p to @ioprio.
737 * @p contains the task_struct of process.
738 * @ioprio contains the new ioprio value
741 * Check permission before getting the ioprio value of @p.
742 * @p contains the task_struct of process.
745 * Check permission before getting and/or setting the resource limits of
747 * @cred points to the cred structure for the current task.
748 * @tcred points to the cred structure for the target task.
749 * @flags contains the LSM_PRLIMIT_* flag bits indicating whether the
753 * Check permission before setting the resource limits of process @p
754 * for @resource to @new_rlim. The old resource limit values can
756 * @p points to the task_struct for the target task's group leader.
757 * @resource contains the resource whose limit is being set.
758 * @new_rlim contains the new limits for @resource.
763 * @p contains the task_struct for process.
768 * @p contains the task_struct for process.
772 * @p contains the task_struct for process.
776 * the constant 1, or a pointer to a kernel_siginfo structure. If @info is 1 or
777 * SI_FROMKERNEL(info) is true, then the signal should be viewed as coming
778 * from the kernel and should typically be permitted.
779 * SIGIO signals are handled separately by the send_sigiotask hook in
781 * @p contains the task_struct for process.
782 * @info contains the signal information.
783 * @sig contains the signal value.
784 * @cred contains the cred of the process where the signal originated, or
785 * NULL if the current task is the originator.
788 * Check permission before performing a process control operation on the
790 * @option contains the operation.
798 * Set the security attributes for an inode based on an associated task's
800 * @p contains the task_struct for the task.
801 * @inode contains the inode structure for the inode.
807 * checking can be performed when the message is processed. The security
808 * information can be saved using the eff_cap field of the
811 * @sk associated sock of task sending the message.
812 * @skb contains the sk_buff structure for the netlink message.
813 * Return 0 if the information was successfully saved and message
821 * @sock contains the sock structure.
822 * @other contains the peer sock structure.
823 * @newsk contains the new sock structure.
828 * @sock contains the socket structure.
829 * @other contains the peer socket structure.
832 * The @unix_stream_connect and @unix_may_send hooks were necessary because
833 * Linux provides an alternative to the conventional file name space for Unix
834 * domain sockets. Whereas binding and connecting to sockets in the file name
835 * space is mediated by the typical file permissions (and caught by the mknod
837 * sockets in the abstract name space is completely unmediated. Sufficient
838 * control of Unix domain sockets in the abstract name space isn't possible
839 * using only the socket layer hooks, since we need to know the actual target
840 * socket, which is not looked up until we are inside the af_unix code.
846 * @family contains the requested protocol family.
847 * @type contains the requested communications type.
848 * @protocol contains the requested protocol.
853 * structure. Note that the security field was not added directly to the
854 * socket structure, but rather, the socket security information is stored
855 * in the associated inode. Typically, the inode alloc_security hook will
857 * SOCK_INODE(sock)->i_security. This hook may be used to update the
859 * wasn't available when the inode was allocated.
860 * @sock contains the newly created socket structure.
861 * @family contains the requested protocol family.
862 * @type contains the requested communications type.
863 * @protocol contains the requested protocol.
867 * @socka contains the first socket structure.
868 * @sockb contains the second socket structure.
869 * Return 0 if permission is granted and the connection was established.
872 * performed and the socket @sock is bound to the address specified in the
874 * @sock contains the socket structure.
875 * @address contains the address to bind to.
876 * @addrlen contains the length of address.
881 * @sock contains the socket structure.
882 * @address contains the address of remote endpoint.
883 * @addrlen contains the length of address.
887 * @sock contains the socket structure.
888 * @backlog contains the maximum length for the pending connection queue.
891 * Check permission before accepting a new connection. Note that the new
893 * but the accept operation has not actually been performed.
894 * @sock contains the listening socket structure.
895 * @newsock contains the newly created server socket for connection.
899 * @sock contains the socket structure.
900 * @msg contains the message to be transmitted.
901 * @size contains the size of message.
905 * @sock contains the socket structure.
906 * @msg contains the message structure.
907 * @size contains the size of message structure.
908 * @flags contains the operational flags.
911 * Check permission before the local address (name) of the socket object
913 * @sock contains the socket structure.
916 * Check permission before the remote address (name) of a socket object
918 * @sock contains the socket structure.
921 * Check permissions before retrieving the options associated with socket
923 * @sock contains the socket structure.
924 * @level contains the protocol level to retrieve option from.
925 * @optname contains the name of option to retrieve.
928 * Check permissions before setting the options associated with socket
930 * @sock contains the socket structure.
931 * @level contains the protocol level to set options for.
932 * @optname contains the name of the option to set.
935 * Checks permission before all or part of a connection on the socket
937 * @sock contains the socket structure.
938 * @how contains the flag indicating how future sends and receives
943 * from Netfilter's IP input hooks since it is the first time that the
946 * @sk contains the sock (not socket) associated with the incoming sk_buff.
947 * @skb contains the incoming network data.
949 * This hook allows the security module to provide peer socket security
951 * SO_GETPEERSEC. For tcp sockets this can be meaningful if the
953 * @sock is the local socket.
954 * @optval userspace memory where the security state is to be copied.
955 * @optlen userspace int where the module should copy the actual length
956 * of the security state.
957 * @len as input is the maximum length to copy to userspace provided
958 * by the caller.
962 * This hook allows the security module to provide peer socket security
964 * getsockopt SO_GETPEERSEC. The application must first have indicated
965 * the IP_PASSSEC option via getsockopt. It can then retrieve the
966 * security state returned by this hook for a packet via the SCM_SECURITY
968 * @sock contains the peer socket. May be NULL.
969 * @skb is the sk_buff for the packet being queried. May be NULL.
970 * @secid pointer to store the secid of the packet.
973 * Allocate and attach a security structure to the sk->sk_security field,
980 * Retrieve the LSM-specific secid for the sock to enable caching
983 * Sets the socket's isec sid to the sock's sid.
985 * Sets the openreq's sid to socket's sid with MLS portion taken
988 * Sets the new child socket's sid to the openreq sid.
990 * Sets the connection's peersid to the secmark on skb.
992 * check if the process should be allowed to relabel packets to
993 * the given secid
995 * tells the LSM to increment the number of secmark labeling rules loaded
997 * tells the LSM to decrement the number of secmark labeling rules loaded
999 * Sets the flow's sid to the openreq sid.
1006 * This hook allows a module to free the security structure for a TUN
1008 * @security pointer to the TUN device's security structure
1013 * @security pointer to the TUN device's security structure.
1015 * This hook can be used by the module to update any security state
1016 * associated with the TUN device's sock structure.
1017 * @sk contains the existing sock structure.
1018 * @security pointer to the TUN device's security structure.
1020 * This hook can be used by the module to update any security state
1021 * associated with the TUN device's security structure.
1022 * @security pointer to the TUN devices's security structure.
1027 * Passes the @ep and @chunk->skb of the association INIT packet to
1028 * the security module.
1034 * @sk. Depending on @optname, the addresses will be treated as either
1035 * for a connect or bind service. The @addrlen is calculated on each
1039 * @optname name of the option to validate.
1055 * @subnet_prefix the subnet prefix of the port being used.
1056 * @pkey the pkey to be accessed.
1060 * @dev_name the IB device name (i.e. mlx4_0).
1061 * @port_num the port number.
1069 * @sec contains the security structure to be freed.
1074 * @ctxp is a pointer to the xfrm_sec_ctx being added to Security Policy
1075 * Database used by the XFRM system.
1076 * @sec_ctx contains the security context information being provided by
1077 * the user-level policy update program (e.g., setkey).
1078 * Allocate a security structure to the xp->security field; the security
1079 * field is initialized to NULL when the xfrm_policy is allocated.
1081 * @gfp is to specify the context for the allocation
1085 * Allocate a security structure in new_ctxp that contains the
1086 * information from the old_ctx structure.
1089 * @ctx contains the xfrm_sec_ctx
1092 * @ctx contains the xfrm_sec_ctx.
1095 * @x contains the xfrm_state being added to the Security Association
1096 * Database by the XFRM system.
1097 * @sec_ctx contains the security context information being provided by
1098 * the user-level SA generation program (e.g., setkey or racoon).
1099 * Allocate a security structure to the x->security field; the security
1100 * field is initialized to NULL when the xfrm_state is allocated. Set the
1104 * @x contains the xfrm_state being added to the Security Association
1105 * Database by the XFRM system.
1106 * @polsec contains the policy's security context.
1107 * @secid contains the secid from which to take the mls portion of the
1109 * Allocate a security structure to the x->security field; the security
1110 * field is initialized to NULL when the xfrm_state is allocated. Set the
1114 * @x contains the xfrm_state.
1117 * @x contains the xfrm_state.
1120 * @ctx contains the xfrm_sec_ctx for which the access control is being
1122 * @fl_secid contains the flow security label that is used to authorize
1123 * access to the policy xp.
1124 * @dir contains the direction of the flow (input or output).
1126 * XFRMs on a packet. The hook is called when selecting either a
1131 * @x contains the state to match.
1132 * @xp contains the policy to check for a match.
1133 * @flic contains the flowi_common struct to check for a match.
1137 * @secid points to the flow key secid to set.
1139 * Return 0 if ckall is zero or all xfrms used have the same secid.
1146 * @key points to the key.
1147 * @flags is the allocation flags
1151 * @key points to the key.
1156 * @key_ref refers to the key (key pointer + possession attribute bit).
1157 * @cred points to the credentials to provide the context against which to
1158 * evaluate the security data on the key.
1159 * @perm describes the combination of permissions required of this key.
1162 * Get a textual representation of the security context attached to a key
1163 * for the purposes of honouring KEYCTL_GETSECURITY. This function
1164 * allocates the storage for the NUL-terminated string and the caller
1166 * @key points to the key to be queried.
1167 * @_buffer points to a pointer that should be set to point to the
1169 * Return the length of the string (including terminating NUL) or -ve if
1177 * @ipcp contains the kernel IPC permission structure
1178 * @flag contains the desired (requested) permission set
1181 * Get the secid associated with the ipc object.
1182 * @ipcp contains the kernel IPC permission structure.
1183 * @secid contains a pointer to the location where result will be saved.
1189 * Allocate and attach a security structure to the msg->security field.
1190 * The security field is initialized to NULL when the structure is first
1192 * @msg contains the message structure to be modified.
1195 * Deallocate the security structure for this message.
1196 * @msg contains the message structure to be modified.
1201 * Allocate and attach a security structure to the
1202 * @perm->security field. The security field is initialized to
1203 * NULL when the structure is first created.
1204 * @perm contains the IPC permissions of the message queue.
1207 * Deallocate security field @perm->security for the message queue.
1208 * @perm contains the IPC permissions of the message queue.
1210 * Check permission when a message queue is requested through the
1211 * msgget system call. This hook is only called when returning the
1214 * @perm contains the IPC permissions of the message queue.
1215 * @msqflg contains the operation control flags.
1219 * is to be performed on the message queue with permissions @perm.
1220 * The @perm may be NULL, e.g. for IPC_INFO or MSG_INFO.
1221 * @perm contains the IPC permissions of the msg queue. May be NULL.
1222 * @cmd contains the operation to be performed.
1225 * Check permission before a message, @msg, is enqueued on the message
1227 * @perm contains the IPC permissions of the message queue.
1228 * @msg contains the message to be enqueued.
1232 * Check permission before a message, @msg, is removed from the message
1233 * queue. The @target task structure contains a pointer to the
1234 * process that will be receiving the message (not equal to the current
1236 * @perm contains the IPC permissions of the message queue.
1237 * @msg contains the message destination.
1238 * @target contains the task structure for recipient process.
1239 * @type contains the type of message requested.
1240 * @mode contains the operational flags.
1246 * Allocate and attach a security structure to the @perm->security
1247 * field. The security field is initialized to NULL when the structure is
1249 * @perm contains the IPC permissions of the shared memory structure.
1252 * Deallocate the security structure @perm->security for the memory segment.
1253 * @perm contains the IPC permissions of the shared memory structure.
1255 * Check permission when a shared memory region is requested through the
1256 * shmget system call. This hook is only called when returning the shared
1259 * @perm contains the IPC permissions of the shared memory structure.
1260 * @shmflg contains the operation control flags.
1264 * @cmd is to be performed on the shared memory region with permissions @perm.
1265 * The @perm may be NULL, e.g. for IPC_INFO or SHM_INFO.
1266 * @perm contains the IPC permissions of the shared memory structure.
1267 * @cmd contains the operation to be performed.
1270 * Check permissions prior to allowing the shmat system call to attach the
1271 * shared memory segment with permissions @perm to the data segment of the
1272 * calling process. The attaching address is specified by @shmaddr.
1273 * @perm contains the IPC permissions of the shared memory structure.
1274 * @shmaddr contains the address to attach memory region to.
1275 * @shmflg contains the operational flags.
1281 * Allocate and attach a security structure to the @perm->security
1282 * field. The security field is initialized to NULL when the structure is
1284 * @perm contains the IPC permissions of the semaphore.
1287 * Deallocate security structure @perm->security for the semaphore.
1288 * @perm contains the IPC permissions of the semaphore.
1290 * Check permission when a semaphore is requested through the semget
1291 * system call. This hook is only called when returning the semaphore
1294 * @perm contains the IPC permissions of the semaphore.
1295 * @semflg contains the operation control flags.
1299 * performed on the semaphore. The @perm may be NULL, e.g. for
1301 * @perm contains the IPC permissions of the semaphore. May be NULL.
1302 * @cmd contains the operation to be performed.
1305 * Check permissions before performing operations on members of the
1306 * semaphore set. If the @alter flag is nonzero, the semaphore set
1308 * @perm contains the IPC permissions of the semaphore.
1309 * @sops contains the operations to perform.
1310 * @nsops contains the number of operations to perform.
1311 * @alter contains the flag indicating whether changes are to be made.
1315 * Check whether @mgr is allowed to be the binder context manager.
1316 * @mgr contains the task_struct for the task being registered.
1321 * @from contains the task_struct for the sending task.
1322 * @to contains the task_struct for the receiving task.
1325 * @from contains the task_struct for the sending task.
1326 * @to contains the task_struct for the receiving task.
1329 * @from contains the task_struct for the sending task.
1330 * @file contains the struct file being transferred.
1331 * @to contains the task_struct for the receiving task.
1334 * Check permission before allowing the current process to trace the
1337 * during an execve in the set_security or apply_creds hooks of
1338 * tracing check during an execve in the bprm_set_creds hook of
1339 * binprm_security_ops if the process is being traced and its security
1340 * attributes would be changed by the execve.
1341 * @child contains the task_struct structure for the target process.
1342 * @mode contains the PTRACE_MODE flags indicating the form of access.
1345 * Check that the @parent process has sufficient permission to trace the
1346 * current process before allowing the current process to present itself
1347 * to the @parent process for tracing.
1348 * @parent contains the task_struct structure for debugger process.
1351 * Get the @effective, @inheritable, and @permitted capability sets for
1352 * the @target process. The hook may also perform permission checking to
1353 * determine if the current process is allowed to see the capability sets
1354 * of the @target process.
1355 * @target contains the task_struct structure for target process.
1356 * @effective contains the effective capability set.
1357 * @inheritable contains the inheritable capability set.
1358 * @permitted contains the permitted capability set.
1359 * Return 0 if the capability sets were successfully obtained.
1361 * Set the @effective, @inheritable, and @permitted capability sets for
1362 * the current process.
1363 * @new contains the new credentials structure for target process.
1364 * @old contains the current credentials structure for target process.
1365 * @effective contains the effective capability set.
1366 * @inheritable contains the inheritable capability set.
1367 * @permitted contains the permitted capability set.
1370 * Check whether the @tsk process has the @cap capability in the indicated
1372 * @cred contains the credentials to use.
1373 * @ns contains the user namespace we want the capability in
1374 * @cap contains the capability <include/linux/capability.h>.
1375 * @opts contains options for the capable check <include/linux/security.h>
1376 * Return 0 if the capability is granted for @tsk.
1378 * Check whether the quotactl syscall is allowed for this @sb.
1382 * Check permission before accessing the kernel message ring or changing
1383 * logging to the console.
1384 * See the syslog(2) manual page for an explanation of the @type values.
1385 * @type contains the SYSLOG_ACTION_* constant from <include/linux/syslog.h>
1388 * Check permission to change the system time.
1396 * @mm contains the mm struct it is being added to.
1397 * @pages contains the number of pages.
1401 * Check if the extended attribute specified by @name
1408 * Convert secid to security context. If secdata is NULL the length of
1409 * the result will be returned in seclen, but no secdata will be returned.
1410 * This does mean that the length could change between calls to check the
1411 * length and the next call which actually allocates and returns the
1413 * @secid contains the security ID.
1414 * @secdata contains the pointer that stores the converted security
1416 * @seclen pointer which contains the length of the data
1419 * @secid contains the pointer to the generated security ID.
1420 * @secdata contains the security context.
1423 * Release the security context.
1424 * @secdata contains the security context.
1425 * @seclen contains the length of the security context.
1431 * @field contains the required Audit action.
1433 * @op contains the operator the rule uses.
1434 * @rulestr contains the context where the rule will be applied to.
1435 * @lsmrule contains a pointer to receive the result.
1442 * @krule contains the audit rule of interest.
1448 * @secid contains the security id in question.
1449 * @field contains the field which relates to current LSM.
1450 * @op contains the operator that will be used for matching.
1451 * @lrule points to the audit rule that will be checked against.
1452 * Return 1 if secid matches the rule, 0 if it does not, -ERRNO on failure.
1455 * Deallocate the LSM audit rule structure previously allocated by
1457 * @lsmrule contains the allocated rule
1460 * Notify the security module that it must revalidate the security context
1464 * Notify the security module of what the security context of an inode
1465 * should be. Initializes the incore security context managed by the
1467 * this hook to initialize the security context in its incore inode to the
1468 * value provided by the server for the file when the server returned the
1469 * file's attributes to the client.
1471 * @inode we wish to set the security context of.
1472 * @ctx contains the string which we wish to set in the inode.
1473 * @ctxlen contains the length of @ctx.
1476 * Change the security context of an inode. Updates the
1477 * incore security context managed by the security module and invokes the
1479 * xattrs that represent the context. Example usage: NFS server invokes
1480 * this hook to change the security context in its incore inode and on the
1481 * backing filesystem to a value provided by the client on a SETATTR
1484 * @dentry contains the inode we wish to set the security context of.
1485 * @ctx contains the string which we wish to set in the inode.
1486 * @ctxlen contains the length of @ctx.
1489 * On success, returns 0 and fills out @ctx and @ctxlen with the security
1490 * context for the given @inode.
1491 * @inode we wish to get the security context of.
1492 * @ctx is a pointer in which to place the allocated security context.
1493 * @ctxlen points to the place to put the length of @ctx.
1495 * Security hooks for the general notification queue:
1500 * @w_cred: The credentials of the whoever set the watch.
1501 * @cred: The event-triggerer's credentials
1502 * @n: The notification being posted
1507 * @key: The key to watch.
1509 * Security hooks for using the eBPF maps and programs functionalities through
1513 * Do a initial check for all bpf syscalls after the attribute is copied
1514 * into the kernel. The actual security module can implement their own
1515 * rules to check the specific cmd they need.
1518 * Do a check when the kernel generate and return a file descriptor for
1522 * @mask: the access flags
1525 * Do a check when the kernel generate and return a file descriptor for
1531 * Initialize the security field inside bpf map.
1534 * Clean up the security information stored inside bpf map.
1537 * Initialize the security field inside bpf program.
1540 * Clean up the security information stored inside bpf prog.
1551 * Check whether the @type of perf_event_open syscall is allowed.
1598 * LSM_RET_VOID is used as the default value in LSM_HOOK definitions for void
1606 * care of the common case and reduces the amount of
1650 * Assuring the safety of deleting a security module is up to
1651 * the security module involved. This may entail ordering the
1653 * the module once a policy is loaded or any number of other
1656 * The name of the configuration option reflects the only module
1657 * that currently uses the mechanism. Any developer who thinks
1659 * careful as the SELinux team.