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
184 * Parse a string of security data filling in the opts structure
185 * @options string containing all mount options known by the LSM
186 * @opts binary data structure usable by the LSM
189 * @from_path indicates the mount that is going to be moved.
190 * @to_path indicates the mountpoint that will be mounted upon.
192 * Compute a context for a dentry as the inode is not yet available
194 * @dentry dentry to use in calculating the context.
196 * @name name of the last path component used to create file
197 * @xattr_name pointer to place the pointer to security xattr name.
198 * Caller does not have to free the resulting pointer. Its
200 * @ctx pointer to place the pointer to the resulting context in.
201 * @ctxlen point to place the length of the resulting context.
203 * Compute a context for a dentry as the inode is not yet available
205 * created using that context. Context is calculated using the
206 * passed in creds and not the creds of the caller.
207 * @dentry dentry to use in calculating the context.
209 * @name name of the last path component used to create file
217 * Allocate and attach a security structure to @inode->i_security. The
218 * i_security field is initialized to NULL when the inode structure is
220 * @inode contains the inode structure.
223 * @inode contains the inode structure.
224 * Deallocate the inode security structure and set @inode->i_security to
227 * Obtain the security attribute name suffix and value to set on a newly
228 * created inode and set up the incore security field for the new inode.
229 * This hook is called by the fs code as part of the inode creation
230 * transaction and provides for atomic labeling of the inode, unlike
231 * the post_create/mkdir/... hooks called by the VFS. The hook function
232 * is expected to allocate the name and value via kmalloc, with the caller
234 * If the security module does not use security attributes or does
237 * @inode contains the inode structure of the newly created inode.
238 * @dir contains the inode structure of the parent directory.
239 * @qstr contains the last path component of the new object
240 * @name will be set to the allocated name suffix (e.g. selinux).
241 * @value will be set to the allocated attribute value.
242 * @len will be set to the length of the value.
247 * Set up the incore security field for the new anonymous inode
248 * and return whether the inode creation is permitted by the security
250 * @inode contains the inode structure
251 * @name name of the anonymous inode class
253 * Returns 0 on success, -EACCES if the security module denies the
257 * @dir contains inode structure of the parent of the new file.
258 * @dentry contains the dentry structure for the file to be created.
259 * @mode contains the file mode of the file to be created.
263 * @old_dentry contains the dentry structure for an existing
264 * link to the file.
265 * @dir contains the inode structure of the parent directory
266 * of the new link.
267 * @new_dentry contains the dentry structure for the new link.
271 * @old_dentry contains the dentry structure for an existing link
272 * to the file.
273 * @new_dir contains the path structure of the parent directory of
274 * the new link.
275 * @new_dentry contains the dentry structure for the new link.
278 * Check the permission to remove a hard link to a file.
279 * @dir contains the inode structure of parent directory of the file.
280 * @dentry contains the dentry structure for file to be unlinked.
283 * Check the permission to remove a hard link to a file.
284 * @dir contains the path structure of parent directory of the file.
285 * @dentry contains the dentry structure for file to be unlinked.
288 * Check the permission to create a symbolic link to a file.
289 * @dir contains the inode structure of parent directory of
290 * the symbolic link.
291 * @dentry contains the dentry structure of the symbolic link.
292 * @old_name contains the pathname of file.
295 * Check the permission to create a symbolic link to a file.
296 * @dir contains the path structure of parent directory of
297 * the symbolic link.
298 * @dentry contains the dentry structure of the symbolic link.
299 * @old_name contains the pathname of file.
302 * Check permissions to create a new directory in the existing directory
304 * @dir contains the inode structure of parent of the directory
306 * @dentry contains the dentry structure of new directory.
307 * @mode contains the mode of new directory.
310 * Check permissions to create a new directory in the existing directory
312 * @dir contains the path structure of parent of the directory
314 * @dentry contains the dentry structure of new directory.
315 * @mode contains the mode of new directory.
318 * Check the permission to remove a directory.
319 * @dir contains the inode structure of parent of the directory
321 * @dentry contains the dentry structure of directory to be removed.
324 * Check the permission to remove a directory.
325 * @dir contains the path structure of parent of the directory to be
327 * @dentry contains the dentry structure of directory to be removed.
331 * file created via the mknod system call). Note that if mknod operation
332 * is being done for a regular file, then the create hook will be called
334 * @dir contains the inode structure of parent of the new file.
335 * @dentry contains the dentry structure of the new file.
336 * @mode contains the mode of the new file.
337 * @dev contains the device number.
342 * @dir contains the path structure of parent of the new file.
343 * @dentry contains the dentry structure of the new file.
344 * @mode contains the mode of the new file.
345 * @dev contains the undecoded device number. Use new_decode_dev() to get
346 * the decoded device number.
350 * @old_dir contains the inode structure for parent of the old link.
351 * @old_dentry contains the dentry structure of the old link.
352 * @new_dir contains the inode structure for parent of the new link.
353 * @new_dentry contains the dentry structure of the new link.
357 * @old_dir contains the path structure for parent of the old link.
358 * @old_dentry contains the dentry structure of the old link.
359 * @new_dir contains the path structure for parent of the new link.
360 * @new_dentry contains the dentry structure of the new link.
364 * Check for permission to change a mode of the file @path. The new
366 * @path contains the path structure of the file to change the mode.
367 * @mode contains the new DAC's permission, which is a bitmask of
372 * @path contains the path structure.
378 * @path contains the path structure.
384 * Check the permission to read the symbolic link.
385 * @dentry contains the dentry structure for the file link.
389 * @dentry contains the dentry structure for the link.
390 * @inode contains the inode, which itself is not stable in RCU-walk
394 * Check permission before accessing an inode. This hook is called by the
398 * other operations), whereas the file_security_ops permission hook is
399 * called when the actual read/write operations are performed.
400 * @inode contains the inode structure to check.
401 * @mask contains the permission mask.
404 * Check permission before setting file attributes. Note that the kernel
408 * @dentry contains the dentry structure for the file.
409 * @attr is the iattr structure containing the new file attributes.
413 * @path contains the path structure for the file.
417 * @path contains the path structure for the file.
420 * Check permission before setting the extended attributes
427 * Check permission before obtaining the extended attributes
431 * Check permission before obtaining the list of extended attribute
435 * Check permission before removing the extended attribute
439 * Retrieve a copy of the extended attribute representation of the
441 * @name is the remainder of the attribute name after the security prefix
442 * has been removed. @alloc is used to specify of the call should return a
443 * value via the buffer or just the value length Return size of buffer on
446 * Set the security label associated with @name for @inode from the
447 * extended attribute value @value. @size indicates the size of the
449 * Note that @name is the remainder of the attribute name after the
453 * Copy the extended attribute names for the security labels
454 * associated with @inode into @buffer. The maximum size of @buffer
456 * the size of the buffer required.
460 * @dentry is the dentry being changed.
461 * Return <0 on error to abort the inode change operation.
465 * The setuid bit is being removed. Remove similar security labels.
466 * Called with the dentry->d_inode->i_mutex held.
467 * @mnt_userns: user namespace of the mount
468 * @dentry is the dentry being changed.
469 * Return 0 on success. If error is returned, then the operation
472 * Get the secid associated with the node.
473 * @inode contains a pointer to the inode.
474 * @secid contains a pointer to the location where result will be saved.
482 * @src indicates the union dentry of file that is being copied up.
486 * Filter the xattrs being copied up when a unioned file is copied
487 * up from a lower layer to the union/overlay layer.
488 * @name indicates the name of the xattr.
489 * Returns 0 to accept the xattr, 1 to discard the xattr, -EOPNOTSUPP if
491 * to abort the copy up. Note that the caller is responsible for reading
492 * and writing the xattrs as this hook is merely a filter.
503 * Initialize the security context of a newly created kernfs node based
506 * @kn_dir the parent kernfs node
507 * @kn the new child kernfs node
516 * bracketing or policy changes. Notice that this hook is used when the
517 * actual read/write operations are performed, whereas the
522 * address the revalidation of permissions for memory-mapped files.
525 * @file contains the file structure being accessed.
526 * @mask contains the requested permissions.
529 * Allocate and attach a security structure to the file->f_security field.
530 * The security field is initialized to NULL when the structure is first
532 * @file contains the file structure to secure.
533 * Return 0 if the hook is successful and permission is granted.
536 * @file contains the file structure being modified.
538 * @file contains the file structure.
539 * @cmd contains the operation to perform.
540 * @arg contains the operational arguments.
544 * should never be used by the security module.
548 * @addr contains virtual address that will be used for the operation.
551 * Check permissions for a mmap operation. The @file may be NULL, e.g.
553 * @file contains the file structure for file to map (may be NULL).
554 * @reqprot contains the protection requested by the application.
555 * @prot contains the protection that will be applied by the kernel.
556 * @flags contains the operational flags.
560 * @vma contains the memory region to modify.
561 * @reqprot contains the protection requested by the application.
562 * @prot contains the protection that will be applied by the kernel.
566 * Note the hook mediates both flock and fcntl style locks.
567 * @file contains the file structure.
568 * @cmd contains the posix-translated lock operation to perform
572 * Check permission before allowing the file operation specified by @cmd
573 * from being performed on the file @file. Note that @arg sometimes
576 * never be used by the security module.
577 * @file contains the file structure.
578 * @cmd contains the operation to be performed.
579 * @arg contains the operational arguments.
583 * file->f_security for later use by the send_sigiotask hook.
584 * @file contains the file structure to update.
587 * Check permission for the file owner @fown to send SIGIO or SIGURG to the
589 * Note that the fown_struct, @fown, is never outside the context of a
590 * struct file, so the file structure (and associated security information)
592 * @tsk contains the structure of task receiving signal.
593 * @fown contains the file owner information.
594 * @sig is the signal that will be sent. When 0, kernel sends SIGIO.
597 * This hook allows security modules to control the ability of a process
599 * @file contains the file structure being received.
610 * @clone_flags contains the flags indicating what should be shared.
618 * @cred points to the credentials.
619 * @gfp indicates the atomicity of any memory allocations.
623 * @cred points to the credentials.
624 * Deallocate and clear the cred->security field in a set of credentials.
626 * @new points to the new credentials.
627 * @old points to the original credentials.
628 * @gfp indicates the atomicity of any memory allocations.
629 * Prepare a new set of credentials by copying the data from the old set.
631 * @new points to the new credentials.
632 * @old points to the original credentials.
635 * Retrieve the security identifier of the cred structure @c
636 * @c contains the credentials, secid will be placed into @secid.
639 * Set the credentials for a kernel service to act as (subjective context).
640 * @new points to the credentials to be modified.
641 * @secid specifies the security ID to be set
642 * The current task must be the one that nominated @secid.
645 * Set the file creation context in a set of credentials to be the same as
646 * the objective context of the specified inode.
647 * @new points to the credentials to be modified.
648 * @inode points to the inode to use as a reference.
649 * The current task must be the one that nominated @inode.
652 * Ability to trigger the kernel to automatically upcall to userspace for
653 * userspace to load a kernel module with the given name.
654 * @kmod_name name of the module requested by the kernel
663 * @buf pointer to buffer containing the data contents.
664 * @size length of the data contents.
672 * @file contains the file structure pointing to the file being read
673 * by the kernel.
679 * @file contains the file structure pointing to the file being read
680 * by the kernel.
681 * @buf pointer to buffer containing the file contents.
682 * @size length of the file contents.
688 * Update the module's state after setting one or more of the user
689 * identity attributes of the current process. The @flags parameter
690 * indicates which of the set*uid system calls invoked this hook. If
691 * @new is the set of credentials that will be installed. Modifications
693 * @old is the set of credentials that are being replaces
694 * @flags contains one of the LSM_SETID_* values.
697 * Update the module's state after setting one or more of the group
698 * identity attributes of the current process. The @flags parameter
699 * indicates which of the set*gid system calls invoked this hook.
700 * @new is the set of credentials that will be installed. Modifications
702 * @old is the set of credentials that are being replaced.
703 * @flags contains one of the LSM_SETID_* values.
706 * Update the module's state after setting the supplementary group
707 * identity attributes of the current process.
708 * @new is the set of credentials that will be installed. Modifications
710 * @old is the set of credentials that are being replaced.
713 * Check permission before setting the process group identifier of the
715 * @p contains the task_struct for process being modified.
716 * @pgid contains the new pgid.
719 * Check permission before getting the process group identifier of the
721 * @p contains the task_struct for the process.
724 * Check permission before getting the session identifier of the process
726 * @p contains the task_struct for the process.
729 * Retrieve the subjective security identifier of the current task and
733 * Retrieve the objective security identifier of the task_struct in @p
738 * Check permission before setting the nice value of @p to @nice.
739 * @p contains the task_struct of process.
740 * @nice contains the new nice value.
743 * Check permission before setting the ioprio value of @p to @ioprio.
744 * @p contains the task_struct of process.
745 * @ioprio contains the new ioprio value
748 * Check permission before getting the ioprio value of @p.
749 * @p contains the task_struct of process.
752 * Check permission before getting and/or setting the resource limits of
754 * @cred points to the cred structure for the current task.
755 * @tcred points to the cred structure for the target task.
756 * @flags contains the LSM_PRLIMIT_* flag bits indicating whether the
760 * Check permission before setting the resource limits of process @p
761 * for @resource to @new_rlim. The old resource limit values can
763 * @p points to the task_struct for the target task's group leader.
764 * @resource contains the resource whose limit is being set.
765 * @new_rlim contains the new limits for @resource.
770 * @p contains the task_struct for process.
775 * @p contains the task_struct for process.
779 * @p contains the task_struct for process.
783 * the constant 1, or a pointer to a kernel_siginfo structure. If @info is 1 or
784 * SI_FROMKERNEL(info) is true, then the signal should be viewed as coming
785 * from the kernel and should typically be permitted.
786 * SIGIO signals are handled separately by the send_sigiotask hook in
788 * @p contains the task_struct for process.
789 * @info contains the signal information.
790 * @sig contains the signal value.
791 * @cred contains the cred of the process where the signal originated, or
792 * NULL if the current task is the originator.
795 * Check permission before performing a process control operation on the
797 * @option contains the operation.
805 * Set the security attributes for an inode based on an associated task's
807 * @p contains the task_struct for the task.
808 * @inode contains the inode structure for the inode.
818 * checking can be performed when the message is processed. The security
819 * information can be saved using the eff_cap field of the
822 * @sk associated sock of task sending the message.
823 * @skb contains the sk_buff structure for the netlink message.
824 * Return 0 if the information was successfully saved and message
832 * @sock contains the sock structure.
833 * @other contains the peer sock structure.
834 * @newsk contains the new sock structure.
839 * @sock contains the socket structure.
840 * @other contains the peer socket structure.
843 * The @unix_stream_connect and @unix_may_send hooks were necessary because
844 * Linux provides an alternative to the conventional file name space for Unix
845 * domain sockets. Whereas binding and connecting to sockets in the file name
846 * space is mediated by the typical file permissions (and caught by the mknod
848 * sockets in the abstract name space is completely unmediated. Sufficient
849 * control of Unix domain sockets in the abstract name space isn't possible
850 * using only the socket layer hooks, since we need to know the actual target
851 * socket, which is not looked up until we are inside the af_unix code.
857 * @family contains the requested protocol family.
858 * @type contains the requested communications type.
859 * @protocol contains the requested protocol.
864 * structure. Note that the security field was not added directly to the
865 * socket structure, but rather, the socket security information is stored
866 * in the associated inode. Typically, the inode alloc_security hook will
868 * SOCK_INODE(sock)->i_security. This hook may be used to update the
870 * wasn't available when the inode was allocated.
871 * @sock contains the newly created socket structure.
872 * @family contains the requested protocol family.
873 * @type contains the requested communications type.
874 * @protocol contains the requested protocol.
878 * @socka contains the first socket structure.
879 * @sockb contains the second socket structure.
880 * Return 0 if permission is granted and the connection was established.
883 * performed and the socket @sock is bound to the address specified in the
885 * @sock contains the socket structure.
886 * @address contains the address to bind to.
887 * @addrlen contains the length of address.
892 * @sock contains the socket structure.
893 * @address contains the address of remote endpoint.
894 * @addrlen contains the length of address.
898 * @sock contains the socket structure.
899 * @backlog contains the maximum length for the pending connection queue.
902 * Check permission before accepting a new connection. Note that the new
904 * but the accept operation has not actually been performed.
905 * @sock contains the listening socket structure.
906 * @newsock contains the newly created server socket for connection.
910 * @sock contains the socket structure.
911 * @msg contains the message to be transmitted.
912 * @size contains the size of message.
916 * @sock contains the socket structure.
917 * @msg contains the message structure.
918 * @size contains the size of message structure.
919 * @flags contains the operational flags.
922 * Check permission before the local address (name) of the socket object
924 * @sock contains the socket structure.
927 * Check permission before the remote address (name) of a socket object
929 * @sock contains the socket structure.
932 * Check permissions before retrieving the options associated with socket
934 * @sock contains the socket structure.
935 * @level contains the protocol level to retrieve option from.
936 * @optname contains the name of option to retrieve.
939 * Check permissions before setting the options associated with socket
941 * @sock contains the socket structure.
942 * @level contains the protocol level to set options for.
943 * @optname contains the name of the option to set.
946 * Checks permission before all or part of a connection on the socket
948 * @sock contains the socket structure.
949 * @how contains the flag indicating how future sends and receives
954 * from Netfilter's IP input hooks since it is the first time that the
957 * @sk contains the sock (not socket) associated with the incoming sk_buff.
958 * @skb contains the incoming network data.
960 * This hook allows the security module to provide peer socket security
962 * SO_GETPEERSEC. For tcp sockets this can be meaningful if the
964 * @sock is the local socket.
965 * @optval userspace memory where the security state is to be copied.
966 * @optlen userspace int where the module should copy the actual length
967 * of the security state.
968 * @len as input is the maximum length to copy to userspace provided
969 * by the caller.
973 * This hook allows the security module to provide peer socket security
975 * getsockopt SO_GETPEERSEC. The application must first have indicated
976 * the IP_PASSSEC option via getsockopt. It can then retrieve the
977 * security state returned by this hook for a packet via the SCM_SECURITY
979 * @sock contains the peer socket. May be NULL.
980 * @skb is the sk_buff for the packet being queried. May be NULL.
981 * @secid pointer to store the secid of the packet.
984 * Allocate and attach a security structure to the sk->sk_security field,
991 * Retrieve the LSM-specific secid for the sock to enable caching
994 * Sets the socket's isec sid to the sock's sid.
996 * Sets the openreq's sid to socket's sid with MLS portion taken
999 * Sets the new child socket's sid to the openreq sid.
1001 * Sets the connection's peersid to the secmark on skb.
1003 * check if the process should be allowed to relabel packets to
1004 * the given secid
1006 * tells the LSM to increment the number of secmark labeling rules loaded
1008 * tells the LSM to decrement the number of secmark labeling rules loaded
1010 * Sets the flow's sid to the openreq sid.
1017 * This hook allows a module to free the security structure for a TUN
1019 * @security pointer to the TUN device's security structure
1024 * @security pointer to the TUN device's security structure.
1026 * This hook can be used by the module to update any security state
1027 * associated with the TUN device's sock structure.
1028 * @sk contains the existing sock structure.
1029 * @security pointer to the TUN device's security structure.
1031 * This hook can be used by the module to update any security state
1032 * associated with the TUN device's security structure.
1033 * @security pointer to the TUN devices's security structure.
1038 * Passes the @asoc and @chunk->skb of the association INIT packet to
1039 * the security module.
1045 * @sk. Depending on @optname, the addresses will be treated as either
1046 * for a connect or bind service. The @addrlen is calculated on each
1050 * @optname name of the option to validate.
1062 * Passes the @asoc and @chunk->skb of the association COOKIE_ACK packet
1063 * to the security module.
1071 * @subnet_prefix the subnet prefix of the port being used.
1072 * @pkey the pkey to be accessed.
1076 * @dev_name the IB device name (i.e. mlx4_0).
1077 * @port_num the port number.
1085 * @sec contains the security structure to be freed.
1090 * @ctxp is a pointer to the xfrm_sec_ctx being added to Security Policy
1091 * Database used by the XFRM system.
1092 * @sec_ctx contains the security context information being provided by
1093 * the user-level policy update program (e.g., setkey).
1094 * Allocate a security structure to the xp->security field; the security
1095 * field is initialized to NULL when the xfrm_policy is allocated.
1097 * @gfp is to specify the context for the allocation
1101 * Allocate a security structure in new_ctxp that contains the
1102 * information from the old_ctx structure.
1105 * @ctx contains the xfrm_sec_ctx
1108 * @ctx contains the xfrm_sec_ctx.
1111 * @x contains the xfrm_state being added to the Security Association
1112 * Database by the XFRM system.
1113 * @sec_ctx contains the security context information being provided by
1114 * the user-level SA generation program (e.g., setkey or racoon).
1115 * Allocate a security structure to the x->security field; the security
1116 * field is initialized to NULL when the xfrm_state is allocated. Set the
1120 * @x contains the xfrm_state being added to the Security Association
1121 * Database by the XFRM system.
1122 * @polsec contains the policy's security context.
1123 * @secid contains the secid from which to take the mls portion of the
1125 * Allocate a security structure to the x->security field; the security
1126 * field is initialized to NULL when the xfrm_state is allocated. Set the
1130 * @x contains the xfrm_state.
1133 * @x contains the xfrm_state.
1136 * @ctx contains the xfrm_sec_ctx for which the access control is being
1138 * @fl_secid contains the flow security label that is used to authorize
1139 * access to the policy xp.
1140 * @dir contains the direction of the flow (input or output).
1142 * XFRMs on a packet. The hook is called when selecting either a
1147 * @x contains the state to match.
1148 * @xp contains the policy to check for a match.
1149 * @flic contains the flowi_common struct to check for a match.
1153 * @secid points to the flow key secid to set.
1155 * Return 0 if ckall is zero or all xfrms used have the same secid.
1162 * @key points to the key.
1163 * @flags is the allocation flags
1167 * @key points to the key.
1172 * @key_ref refers to the key (key pointer + possession attribute bit).
1173 * @cred points to the credentials to provide the context against which to
1174 * evaluate the security data on the key.
1175 * @perm describes the combination of permissions required of this key.
1178 * Get a textual representation of the security context attached to a key
1179 * for the purposes of honouring KEYCTL_GETSECURITY. This function
1180 * allocates the storage for the NUL-terminated string and the caller
1182 * @key points to the key to be queried.
1183 * @_buffer points to a pointer that should be set to point to the
1185 * Return the length of the string (including terminating NUL) or -ve if
1193 * @ipcp contains the kernel IPC permission structure
1194 * @flag contains the desired (requested) permission set
1197 * Get the secid associated with the ipc object.
1198 * @ipcp contains the kernel IPC permission structure.
1199 * @secid contains a pointer to the location where result will be saved.
1205 * Allocate and attach a security structure to the msg->security field.
1206 * The security field is initialized to NULL when the structure is first
1208 * @msg contains the message structure to be modified.
1211 * Deallocate the security structure for this message.
1212 * @msg contains the message structure to be modified.
1217 * Allocate and attach a security structure to the
1218 * @perm->security field. The security field is initialized to
1219 * NULL when the structure is first created.
1220 * @perm contains the IPC permissions of the message queue.
1223 * Deallocate security field @perm->security for the message queue.
1224 * @perm contains the IPC permissions of the message queue.
1226 * Check permission when a message queue is requested through the
1227 * msgget system call. This hook is only called when returning the
1230 * @perm contains the IPC permissions of the message queue.
1231 * @msqflg contains the operation control flags.
1235 * is to be performed on the message queue with permissions @perm.
1236 * The @perm may be NULL, e.g. for IPC_INFO or MSG_INFO.
1237 * @perm contains the IPC permissions of the msg queue. May be NULL.
1238 * @cmd contains the operation to be performed.
1241 * Check permission before a message, @msg, is enqueued on the message
1243 * @perm contains the IPC permissions of the message queue.
1244 * @msg contains the message to be enqueued.
1248 * Check permission before a message, @msg, is removed from the message
1249 * queue. The @target task structure contains a pointer to the
1250 * process that will be receiving the message (not equal to the current
1252 * @perm contains the IPC permissions of the message queue.
1253 * @msg contains the message destination.
1254 * @target contains the task structure for recipient process.
1255 * @type contains the type of message requested.
1256 * @mode contains the operational flags.
1262 * Allocate and attach a security structure to the @perm->security
1263 * field. The security field is initialized to NULL when the structure is
1265 * @perm contains the IPC permissions of the shared memory structure.
1268 * Deallocate the security structure @perm->security for the memory segment.
1269 * @perm contains the IPC permissions of the shared memory structure.
1271 * Check permission when a shared memory region is requested through the
1272 * shmget system call. This hook is only called when returning the shared
1275 * @perm contains the IPC permissions of the shared memory structure.
1276 * @shmflg contains the operation control flags.
1280 * @cmd is to be performed on the shared memory region with permissions @perm.
1281 * The @perm may be NULL, e.g. for IPC_INFO or SHM_INFO.
1282 * @perm contains the IPC permissions of the shared memory structure.
1283 * @cmd contains the operation to be performed.
1286 * Check permissions prior to allowing the shmat system call to attach the
1287 * shared memory segment with permissions @perm to the data segment of the
1288 * calling process. The attaching address is specified by @shmaddr.
1289 * @perm contains the IPC permissions of the shared memory structure.
1290 * @shmaddr contains the address to attach memory region to.
1291 * @shmflg contains the operational flags.
1297 * Allocate and attach a security structure to the @perm->security
1298 * field. The security field is initialized to NULL when the structure is
1300 * @perm contains the IPC permissions of the semaphore.
1303 * Deallocate security structure @perm->security for the semaphore.
1304 * @perm contains the IPC permissions of the semaphore.
1306 * Check permission when a semaphore is requested through the semget
1307 * system call. This hook is only called when returning the semaphore
1310 * @perm contains the IPC permissions of the semaphore.
1311 * @semflg contains the operation control flags.
1315 * performed on the semaphore. The @perm may be NULL, e.g. for
1317 * @perm contains the IPC permissions of the semaphore. May be NULL.
1318 * @cmd contains the operation to be performed.
1321 * Check permissions before performing operations on members of the
1322 * semaphore set. If the @alter flag is nonzero, the semaphore set
1324 * @perm contains the IPC permissions of the semaphore.
1325 * @sops contains the operations to perform.
1326 * @nsops contains the number of operations to perform.
1327 * @alter contains the flag indicating whether changes are to be made.
1331 * Check whether @mgr is allowed to be the binder context manager.
1332 * @mgr contains the struct cred for the current binder process.
1337 * @from contains the struct cred for the sending process.
1338 * @to contains the struct cred for the receiving process.
1341 * @from contains the struct cred for the sending process.
1342 * @to contains the struct cred for the receiving process.
1345 * @from contains the struct cred for the sending process.
1346 * @file contains the struct file being transferred.
1347 * @to contains the struct cred for the receiving process.
1350 * Check permission before allowing the current process to trace the
1353 * during an execve in the set_security or apply_creds hooks of
1354 * tracing check during an execve in the bprm_set_creds hook of
1355 * binprm_security_ops if the process is being traced and its security
1356 * attributes would be changed by the execve.
1357 * @child contains the task_struct structure for the target process.
1358 * @mode contains the PTRACE_MODE flags indicating the form of access.
1361 * Check that the @parent process has sufficient permission to trace the
1362 * current process before allowing the current process to present itself
1363 * to the @parent process for tracing.
1364 * @parent contains the task_struct structure for debugger process.
1367 * Get the @effective, @inheritable, and @permitted capability sets for
1368 * the @target process. The hook may also perform permission checking to
1369 * determine if the current process is allowed to see the capability sets
1370 * of the @target process.
1371 * @target contains the task_struct structure for target process.
1372 * @effective contains the effective capability set.
1373 * @inheritable contains the inheritable capability set.
1374 * @permitted contains the permitted capability set.
1375 * Return 0 if the capability sets were successfully obtained.
1377 * Set the @effective, @inheritable, and @permitted capability sets for
1378 * the current process.
1379 * @new contains the new credentials structure for target process.
1380 * @old contains the current credentials structure for target process.
1381 * @effective contains the effective capability set.
1382 * @inheritable contains the inheritable capability set.
1383 * @permitted contains the permitted capability set.
1386 * Check whether the @tsk process has the @cap capability in the indicated
1388 * @cred contains the credentials to use.
1389 * @ns contains the user namespace we want the capability in
1390 * @cap contains the capability <include/linux/capability.h>.
1391 * @opts contains options for the capable check <include/linux/security.h>
1392 * Return 0 if the capability is granted for @tsk.
1394 * Check whether the quotactl syscall is allowed for this @sb.
1398 * Check permission before accessing the kernel message ring or changing
1399 * logging to the console.
1400 * See the syslog(2) manual page for an explanation of the @type values.
1401 * @type contains the SYSLOG_ACTION_* constant from <include/linux/syslog.h>
1404 * Check permission to change the system time.
1412 * @mm contains the mm struct it is being added to.
1413 * @pages contains the number of pages.
1417 * Check if the extended attribute specified by @name
1424 * Convert secid to security context. If secdata is NULL the length of
1425 * the result will be returned in seclen, but no secdata will be returned.
1426 * This does mean that the length could change between calls to check the
1427 * length and the next call which actually allocates and returns the
1429 * @secid contains the security ID.
1430 * @secdata contains the pointer that stores the converted security
1432 * @seclen pointer which contains the length of the data
1435 * @secid contains the pointer to the generated security ID.
1436 * @secdata contains the security context.
1439 * Release the security context.
1440 * @secdata contains the security context.
1441 * @seclen contains the length of the security context.
1447 * @field contains the required Audit action.
1449 * @op contains the operator the rule uses.
1450 * @rulestr contains the context where the rule will be applied to.
1451 * @lsmrule contains a pointer to receive the result.
1458 * @krule contains the audit rule of interest.
1464 * @secid contains the security id in question.
1465 * @field contains the field which relates to current LSM.
1466 * @op contains the operator that will be used for matching.
1467 * @lrule points to the audit rule that will be checked against.
1468 * Return 1 if secid matches the rule, 0 if it does not, -ERRNO on failure.
1471 * Deallocate the LSM audit rule structure previously allocated by
1473 * @lsmrule contains the allocated rule
1476 * Notify the security module that it must revalidate the security context
1480 * Notify the security module of what the security context of an inode
1481 * should be. Initializes the incore security context managed by the
1483 * this hook to initialize the security context in its incore inode to the
1484 * value provided by the server for the file when the server returned the
1485 * file's attributes to the client.
1487 * @inode we wish to set the security context of.
1488 * @ctx contains the string which we wish to set in the inode.
1489 * @ctxlen contains the length of @ctx.
1492 * Change the security context of an inode. Updates the
1493 * incore security context managed by the security module and invokes the
1495 * xattrs that represent the context. Example usage: NFS server invokes
1496 * this hook to change the security context in its incore inode and on the
1497 * backing filesystem to a value provided by the client on a SETATTR
1500 * @dentry contains the inode we wish to set the security context of.
1501 * @ctx contains the string which we wish to set in the inode.
1502 * @ctxlen contains the length of @ctx.
1505 * On success, returns 0 and fills out @ctx and @ctxlen with the security
1506 * context for the given @inode.
1507 * @inode we wish to get the security context of.
1508 * @ctx is a pointer in which to place the allocated security context.
1509 * @ctxlen points to the place to put the length of @ctx.
1511 * Security hooks for the general notification queue:
1516 * @w_cred: The credentials of the whoever set the watch.
1517 * @cred: The event-triggerer's credentials
1518 * @n: The notification being posted
1523 * @key: The key to watch.
1525 * Security hooks for using the eBPF maps and programs functionalities through
1529 * Do a initial check for all bpf syscalls after the attribute is copied
1530 * into the kernel. The actual security module can implement their own
1531 * rules to check the specific cmd they need.
1534 * Do a check when the kernel generate and return a file descriptor for
1538 * @mask: the access flags
1541 * Do a check when the kernel generate and return a file descriptor for
1547 * Initialize the security field inside bpf map.
1550 * Clean up the security information stored inside bpf map.
1553 * Initialize the security field inside bpf program.
1556 * Clean up the security information stored inside bpf prog.
1567 * Check whether the @type of perf_event_open syscall is allowed.
1580 * Check if the current task, executing an io_uring operation, is allowed
1583 * @new: the new creds to use
1586 * Check whether the current task is allowed to spawn a io_uring polling
1590 * Check whether the file_operations uring_cmd is allowed to run.
1630 * LSM_RET_VOID is used as the default value in LSM_HOOK definitions for void
1638 * care of the common case and reduces the amount of
1682 * Assuring the safety of deleting a security module is up to
1683 * the security module involved. This may entail ordering the
1685 * the module once a policy is loaded or any number of other
1688 * The name of the configuration option reflects the only module
1689 * that currently uses the mechanism. Any developer who thinks
1691 * careful as the SELinux team.