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.
112 * Deallocate and clear the sb->s_security field.
113 * @sb contains the super_block structure to be modified.
119 * Check permission before obtaining filesystem statistics for the @mnt
121 * @dentry is a handle on the superblock for the filesystem.
125 * the mount point named by @nd. For an ordinary mount, @dev_name
126 * identifies a device if the file system type requires a device. For a
128 * loopback/bind mount (@flags & MS_BIND), @dev_name identifies the
129 * pathname of the object being mounted.
130 * @dev_name contains the name for object being mounted.
131 * @path contains the path for mount point object.
132 * @type contains the filesystem type.
133 * @flags contains the mount flags.
134 * @data contains the filesystem-specific data.
137 * Allow mount option data to be copied prior to parsing by the filesystem,
138 * so that the security module can extract security-specific mount
139 * options cleanly (a filesystem may modify the data e.g. with strsep()).
140 * This also allows the original mount data to be stripped of security-
142 * @orig the original mount data copied from userspace.
143 * @copy copied data which will be passed to the security module.
144 * Returns 0 if the copy was successful.
149 * @data contains the filesystem-specific data.
156 * Check permission before the @mnt file system is unmounted.
157 * @mnt contains the mounted file system.
158 * @flags contains the unmount flags, e.g. MNT_FORCE.
161 * Check permission before pivoting the root filesystem.
162 * @old_path contains the path for the new location of the
164 * @new_path contains the path for the new root (new_root).
167 * Set the security relevant mount options used for a superblock
168 * @sb the superblock to set security mount options for
177 * Parse a string of security data filling in the opts structure
178 * @options string containing all mount options known by the LSM
179 * @opts binary data structure usable by the LSM
182 * @from_path indicates the mount that is going to be moved.
183 * @to_path indicates the mountpoint that will be mounted upon.
185 * Compute a context for a dentry as the inode is not yet available
187 * @dentry dentry to use in calculating the context.
189 * @name name of the last path component used to create file
190 * @ctx pointer to place the pointer to the resulting context in.
191 * @ctxlen point to place the length of the resulting context.
193 * Compute a context for a dentry as the inode is not yet available
195 * created using that context. Context is calculated using the
196 * passed in creds and not the creds of the caller.
197 * @dentry dentry to use in calculating the context.
199 * @name name of the last path component used to create file
207 * Allocate and attach a security structure to @inode->i_security. The
208 * i_security field is initialized to NULL when the inode structure is
210 * @inode contains the inode structure.
213 * @inode contains the inode structure.
214 * Deallocate the inode security structure and set @inode->i_security to
217 * Obtain the security attribute name suffix and value to set on a newly
218 * created inode and set up the incore security field for the new inode.
219 * This hook is called by the fs code as part of the inode creation
220 * transaction and provides for atomic labeling of the inode, unlike
221 * the post_create/mkdir/... hooks called by the VFS. The hook function
222 * is expected to allocate the name and value via kmalloc, with the caller
224 * If the security module does not use security attributes or does
227 * @inode contains the inode structure of the newly created inode.
228 * @dir contains the inode structure of the parent directory.
229 * @qstr contains the last path component of the new object
230 * @name will be set to the allocated name suffix (e.g. selinux).
231 * @value will be set to the allocated attribute value.
232 * @len will be set to the length of the value.
238 * @dir contains inode structure of the parent of the new file.
239 * @dentry contains the dentry structure for the file to be created.
240 * @mode contains the file mode of the file to be created.
244 * @old_dentry contains the dentry structure for an existing
245 * link to the file.
246 * @dir contains the inode structure of the parent directory
247 * of the new link.
248 * @new_dentry contains the dentry structure for the new link.
252 * @old_dentry contains the dentry structure for an existing link
253 * to the file.
254 * @new_dir contains the path structure of the parent directory of
255 * the new link.
256 * @new_dentry contains the dentry structure for the new link.
259 * Check the permission to remove a hard link to a file.
260 * @dir contains the inode structure of parent directory of the file.
261 * @dentry contains the dentry structure for file to be unlinked.
264 * Check the permission to remove a hard link to a file.
265 * @dir contains the path structure of parent directory of the file.
266 * @dentry contains the dentry structure for file to be unlinked.
269 * Check the permission to create a symbolic link to a file.
270 * @dir contains the inode structure of parent directory of
271 * the symbolic link.
272 * @dentry contains the dentry structure of the symbolic link.
273 * @old_name contains the pathname of file.
276 * Check the permission to create a symbolic link to a file.
277 * @dir contains the path structure of parent directory of
278 * the symbolic link.
279 * @dentry contains the dentry structure of the symbolic link.
280 * @old_name contains the pathname of file.
283 * Check permissions to create a new directory in the existing directory
285 * @dir contains the inode structure of parent of the directory
287 * @dentry contains the dentry structure of new directory.
288 * @mode contains the mode of new directory.
291 * Check permissions to create a new directory in the existing directory
293 * @dir contains the path structure of parent of the directory
295 * @dentry contains the dentry structure of new directory.
296 * @mode contains the mode of new directory.
299 * Check the permission to remove a directory.
300 * @dir contains the inode structure of parent of the directory
302 * @dentry contains the dentry structure of directory to be removed.
305 * Check the permission to remove a directory.
306 * @dir contains the path structure of parent of the directory to be
308 * @dentry contains the dentry structure of directory to be removed.
312 * file created via the mknod system call). Note that if mknod operation
313 * is being done for a regular file, then the create hook will be called
315 * @dir contains the inode structure of parent of the new file.
316 * @dentry contains the dentry structure of the new file.
317 * @mode contains the mode of the new file.
318 * @dev contains the device number.
323 * @dir contains the path structure of parent of the new file.
324 * @dentry contains the dentry structure of the new file.
325 * @mode contains the mode of the new file.
326 * @dev contains the undecoded device number. Use new_decode_dev() to get
327 * the decoded device number.
331 * @old_dir contains the inode structure for parent of the old link.
332 * @old_dentry contains the dentry structure of the old link.
333 * @new_dir contains the inode structure for parent of the new link.
334 * @new_dentry contains the dentry structure of the new link.
338 * @old_dir contains the path structure for parent of the old link.
339 * @old_dentry contains the dentry structure of the old link.
340 * @new_dir contains the path structure for parent of the new link.
341 * @new_dentry contains the dentry structure of the new link.
344 * Check for permission to change a mode of the file @path. The new
346 * @path contains the path structure of the file to change the mode.
347 * @mode contains the new DAC's permission, which is a bitmask of
352 * @path contains the path structure.
358 * @path contains the path structure.
364 * Check the permission to read the symbolic link.
365 * @dentry contains the dentry structure for the file link.
369 * @dentry contains the dentry structure for the link.
370 * @inode contains the inode, which itself is not stable in RCU-walk
374 * Check permission before accessing an inode. This hook is called by the
378 * other operations), whereas the file_security_ops permission hook is
379 * called when the actual read/write operations are performed.
380 * @inode contains the inode structure to check.
381 * @mask contains the permission mask.
384 * Check permission before setting file attributes. Note that the kernel
388 * @dentry contains the dentry structure for the file.
389 * @attr is the iattr structure containing the new file attributes.
393 * @path contains the path structure for the file.
397 * @path contains the path structure for the file.
400 * Check permission before setting the extended attributes
407 * Check permission before obtaining the extended attributes
411 * Check permission before obtaining the list of extended attribute
415 * Check permission before removing the extended attribute
419 * Retrieve a copy of the extended attribute representation of the
421 * @name is the remainder of the attribute name after the security prefix
422 * has been removed. @alloc is used to specify of the call should return a
423 * value via the buffer or just the value length Return size of buffer on
426 * Set the security label associated with @name for @inode from the
427 * extended attribute value @value. @size indicates the size of the
429 * Note that @name is the remainder of the attribute name after the
433 * Copy the extended attribute names for the security labels
434 * associated with @inode into @buffer. The maximum size of @buffer
436 * the size of the buffer required.
440 * @dentry is the dentry being changed.
441 * Return <0 on error to abort the inode change operation.
445 * The setuid bit is being removed. Remove similar security labels.
446 * Called with the dentry->d_inode->i_mutex held.
447 * @dentry is the dentry being changed.
448 * Return 0 on success. If error is returned, then the operation
451 * Get the secid associated with the node.
452 * @inode contains a pointer to the inode.
453 * @secid contains a pointer to the location where result will be saved.
461 * @src indicates the union dentry of file that is being copied up.
465 * Filter the xattrs being copied up when a unioned file is copied
466 * up from a lower layer to the union/overlay layer.
467 * @name indicates the name of the xattr.
468 * Returns 0 to accept the xattr, 1 to discard the xattr, -EOPNOTSUPP if
470 * to abort the copy up. Note that the caller is responsible for reading
471 * and writing the xattrs as this hook is merely a filter.
482 * Initialize the security context of a newly created kernfs node based
485 * @kn_dir the parent kernfs node
486 * @kn the new child kernfs node
495 * bracketing or policy changes. Notice that this hook is used when the
496 * actual read/write operations are performed, whereas the
501 * address the revalidation of permissions for memory-mapped files.
504 * @file contains the file structure being accessed.
505 * @mask contains the requested permissions.
508 * Allocate and attach a security structure to the file->f_security field.
509 * The security field is initialized to NULL when the structure is first
511 * @file contains the file structure to secure.
512 * Return 0 if the hook is successful and permission is granted.
515 * @file contains the file structure being modified.
517 * @file contains the file structure.
518 * @cmd contains the operation to perform.
519 * @arg contains the operational arguments.
523 * should never be used by the security module.
527 * @addr contains virtual address that will be used for the operation.
530 * Check permissions for a mmap operation. The @file may be NULL, e.g.
532 * @file contains the file structure for file to map (may be NULL).
533 * @reqprot contains the protection requested by the application.
534 * @prot contains the protection that will be applied by the kernel.
535 * @flags contains the operational flags.
539 * @vma contains the memory region to modify.
540 * @reqprot contains the protection requested by the application.
541 * @prot contains the protection that will be applied by the kernel.
545 * Note the hook mediates both flock and fcntl style locks.
546 * @file contains the file structure.
547 * @cmd contains the posix-translated lock operation to perform
551 * Check permission before allowing the file operation specified by @cmd
552 * from being performed on the file @file. Note that @arg sometimes
555 * never be used by the security module.
556 * @file contains the file structure.
557 * @cmd contains the operation to be performed.
558 * @arg contains the operational arguments.
562 * file->f_security for later use by the send_sigiotask hook.
563 * @file contains the file structure to update.
566 * Check permission for the file owner @fown to send SIGIO or SIGURG to the
568 * Note that the fown_struct, @fown, is never outside the context of a
569 * struct file, so the file structure (and associated security information)
571 * @tsk contains the structure of task receiving signal.
572 * @fown contains the file owner information.
573 * @sig is the signal that will be sent. When 0, kernel sends SIGIO.
576 * This hook allows security modules to control the ability of a process
578 * @file contains the file structure being received.
589 * @clone_flags contains the flags indicating what should be shared.
597 * @cred points to the credentials.
598 * @gfp indicates the atomicity of any memory allocations.
602 * @cred points to the credentials.
603 * Deallocate and clear the cred->security field in a set of credentials.
605 * @new points to the new credentials.
606 * @old points to the original credentials.
607 * @gfp indicates the atomicity of any memory allocations.
608 * Prepare a new set of credentials by copying the data from the old set.
610 * @new points to the new credentials.
611 * @old points to the original credentials.
614 * Retrieve the security identifier of the cred structure @c
615 * @c contains the credentials, secid will be placed into @secid.
618 * Set the credentials for a kernel service to act as (subjective context).
619 * @new points to the credentials to be modified.
620 * @secid specifies the security ID to be set
621 * The current task must be the one that nominated @secid.
624 * Set the file creation context in a set of credentials to be the same as
625 * the objective context of the specified inode.
626 * @new points to the credentials to be modified.
627 * @inode points to the inode to use as a reference.
628 * The current task must be the one that nominated @inode.
631 * Ability to trigger the kernel to automatically upcall to userspace for
632 * userspace to load a kernel module with the given name.
633 * @kmod_name name of the module requested by the kernel
642 * @buf pointer to buffer containing the data contents.
643 * @size length of the data contents.
651 * @file contains the file structure pointing to the file being read
652 * by the kernel.
658 * @file contains the file structure pointing to the file being read
659 * by the kernel.
660 * @buf pointer to buffer containing the file contents.
661 * @size length of the file contents.
667 * Update the module's state after setting one or more of the user
668 * identity attributes of the current process. The @flags parameter
669 * indicates which of the set*uid system calls invoked this hook. If
670 * @new is the set of credentials that will be installed. Modifications
672 * @old is the set of credentials that are being replaces
673 * @flags contains one of the LSM_SETID_* values.
676 * Update the module's state after setting one or more of the group
677 * identity attributes of the current process. The @flags parameter
678 * indicates which of the set*gid system calls invoked this hook.
679 * @new is the set of credentials that will be installed. Modifications
681 * @old is the set of credentials that are being replaced.
682 * @flags contains one of the LSM_SETID_* values.
685 * Check permission before setting the process group identifier of the
687 * @p contains the task_struct for process being modified.
688 * @pgid contains the new pgid.
691 * Check permission before getting the process group identifier of the
693 * @p contains the task_struct for the process.
696 * Check permission before getting the session identifier of the process
698 * @p contains the task_struct for the process.
701 * Retrieve the security identifier of the process @p.
702 * @p contains the task_struct for the process and place is into @secid.
706 * Check permission before setting the nice value of @p to @nice.
707 * @p contains the task_struct of process.
708 * @nice contains the new nice value.
711 * Check permission before setting the ioprio value of @p to @ioprio.
712 * @p contains the task_struct of process.
713 * @ioprio contains the new ioprio value
716 * Check permission before getting the ioprio value of @p.
717 * @p contains the task_struct of process.
720 * Check permission before getting and/or setting the resource limits of
722 * @cred points to the cred structure for the current task.
723 * @tcred points to the cred structure for the target task.
724 * @flags contains the LSM_PRLIMIT_* flag bits indicating whether the
728 * Check permission before setting the resource limits of process @p
729 * for @resource to @new_rlim. The old resource limit values can
731 * @p points to the task_struct for the target task's group leader.
732 * @resource contains the resource whose limit is being set.
733 * @new_rlim contains the new limits for @resource.
738 * @p contains the task_struct for process.
743 * @p contains the task_struct for process.
747 * @p contains the task_struct for process.
751 * the constant 1, or a pointer to a kernel_siginfo structure. If @info is 1 or
752 * SI_FROMKERNEL(info) is true, then the signal should be viewed as coming
753 * from the kernel and should typically be permitted.
754 * SIGIO signals are handled separately by the send_sigiotask hook in
756 * @p contains the task_struct for process.
757 * @info contains the signal information.
758 * @sig contains the signal value.
759 * @cred contains the cred of the process where the signal originated, or
760 * NULL if the current task is the originator.
763 * Check permission before performing a process control operation on the
765 * @option contains the operation.
773 * Set the security attributes for an inode based on an associated task's
775 * @p contains the task_struct for the task.
776 * @inode contains the inode structure for the inode.
782 * checking can be performed when the message is processed. The security
783 * information can be saved using the eff_cap field of the
786 * @sk associated sock of task sending the message.
787 * @skb contains the sk_buff structure for the netlink message.
788 * Return 0 if the information was successfully saved and message
796 * @sock contains the sock structure.
797 * @other contains the peer sock structure.
798 * @newsk contains the new sock structure.
803 * @sock contains the socket structure.
804 * @other contains the peer socket structure.
807 * The @unix_stream_connect and @unix_may_send hooks were necessary because
808 * Linux provides an alternative to the conventional file name space for Unix
809 * domain sockets. Whereas binding and connecting to sockets in the file name
810 * space is mediated by the typical file permissions (and caught by the mknod
812 * sockets in the abstract name space is completely unmediated. Sufficient
813 * control of Unix domain sockets in the abstract name space isn't possible
814 * using only the socket layer hooks, since we need to know the actual target
815 * socket, which is not looked up until we are inside the af_unix code.
821 * @family contains the requested protocol family.
822 * @type contains the requested communications type.
823 * @protocol contains the requested protocol.
828 * structure. Note that the security field was not added directly to the
829 * socket structure, but rather, the socket security information is stored
830 * in the associated inode. Typically, the inode alloc_security hook will
832 * SOCK_INODE(sock)->i_security. This hook may be used to update the
834 * wasn't available when the inode was allocated.
835 * @sock contains the newly created socket structure.
836 * @family contains the requested protocol family.
837 * @type contains the requested communications type.
838 * @protocol contains the requested protocol.
842 * @socka contains the first socket structure.
843 * @sockb contains the second socket structure.
844 * Return 0 if permission is granted and the connection was established.
847 * performed and the socket @sock is bound to the address specified in the
849 * @sock contains the socket structure.
850 * @address contains the address to bind to.
851 * @addrlen contains the length of address.
856 * @sock contains the socket structure.
857 * @address contains the address of remote endpoint.
858 * @addrlen contains the length of address.
862 * @sock contains the socket structure.
863 * @backlog contains the maximum length for the pending connection queue.
866 * Check permission before accepting a new connection. Note that the new
868 * but the accept operation has not actually been performed.
869 * @sock contains the listening socket structure.
870 * @newsock contains the newly created server socket for connection.
874 * @sock contains the socket structure.
875 * @msg contains the message to be transmitted.
876 * @size contains the size of message.
880 * @sock contains the socket structure.
881 * @msg contains the message structure.
882 * @size contains the size of message structure.
883 * @flags contains the operational flags.
886 * Check permission before the local address (name) of the socket object
888 * @sock contains the socket structure.
891 * Check permission before the remote address (name) of a socket object
893 * @sock contains the socket structure.
896 * Check permissions before retrieving the options associated with socket
898 * @sock contains the socket structure.
899 * @level contains the protocol level to retrieve option from.
900 * @optname contains the name of option to retrieve.
903 * Check permissions before setting the options associated with socket
905 * @sock contains the socket structure.
906 * @level contains the protocol level to set options for.
907 * @optname contains the name of the option to set.
910 * Checks permission before all or part of a connection on the socket
912 * @sock contains the socket structure.
913 * @how contains the flag indicating how future sends and receives
918 * from Netfilter's IP input hooks since it is the first time that the
921 * @sk contains the sock (not socket) associated with the incoming sk_buff.
922 * @skb contains the incoming network data.
924 * This hook allows the security module to provide peer socket security
926 * SO_GETPEERSEC. For tcp sockets this can be meaningful if the
928 * @sock is the local socket.
929 * @optval userspace memory where the security state is to be copied.
930 * @optlen userspace int where the module should copy the actual length
931 * of the security state.
932 * @len as input is the maximum length to copy to userspace provided
933 * by the caller.
937 * This hook allows the security module to provide peer socket security
939 * getsockopt SO_GETPEERSEC. The application must first have indicated
940 * the IP_PASSSEC option via getsockopt. It can then retrieve the
941 * security state returned by this hook for a packet via the SCM_SECURITY
943 * @sock contains the peer socket. May be NULL.
944 * @skb is the sk_buff for the packet being queried. May be NULL.
945 * @secid pointer to store the secid of the packet.
948 * Allocate and attach a security structure to the sk->sk_security field,
955 * Retrieve the LSM-specific secid for the sock to enable caching
958 * Sets the socket's isec sid to the sock's sid.
960 * Sets the openreq's sid to socket's sid with MLS portion taken
963 * Sets the new child socket's sid to the openreq sid.
965 * Sets the connection's peersid to the secmark on skb.
967 * check if the process should be allowed to relabel packets to
968 * the given secid
970 * tells the LSM to increment the number of secmark labeling rules loaded
972 * tells the LSM to decrement the number of secmark labeling rules loaded
974 * Sets the flow's sid to the openreq sid.
981 * This hook allows a module to free the security structure for a TUN
983 * @security pointer to the TUN device's security structure
988 * @security pointer to the TUN device's security structure.
990 * This hook can be used by the module to update any security state
991 * associated with the TUN device's sock structure.
992 * @sk contains the existing sock structure.
993 * @security pointer to the TUN device's security structure.
995 * This hook can be used by the module to update any security state
996 * associated with the TUN device's security structure.
997 * @security pointer to the TUN devices's security structure.
1002 * Passes the @ep and @chunk->skb of the association INIT packet to
1003 * the security module.
1009 * @sk. Depending on @optname, the addresses will be treated as either
1010 * for a connect or bind service. The @addrlen is calculated on each
1014 * @optname name of the option to validate.
1030 * @subnet_prefix the subnet prefix of the port being used.
1031 * @pkey the pkey to be accessed.
1035 * @dev_name the IB device name (i.e. mlx4_0).
1036 * @port_num the port number.
1044 * @sec contains the security structure to be freed.
1049 * @ctxp is a pointer to the xfrm_sec_ctx being added to Security Policy
1050 * Database used by the XFRM system.
1051 * @sec_ctx contains the security context information being provided by
1052 * the user-level policy update program (e.g., setkey).
1053 * Allocate a security structure to the xp->security field; the security
1054 * field is initialized to NULL when the xfrm_policy is allocated.
1056 * @gfp is to specify the context for the allocation
1060 * Allocate a security structure in new_ctxp that contains the
1061 * information from the old_ctx structure.
1064 * @ctx contains the xfrm_sec_ctx
1067 * @ctx contains the xfrm_sec_ctx.
1070 * @x contains the xfrm_state being added to the Security Association
1071 * Database by the XFRM system.
1072 * @sec_ctx contains the security context information being provided by
1073 * the user-level SA generation program (e.g., setkey or racoon).
1074 * Allocate a security structure to the x->security field; the security
1075 * field is initialized to NULL when the xfrm_state is allocated. Set the
1079 * @x contains the xfrm_state being added to the Security Association
1080 * Database by the XFRM system.
1081 * @polsec contains the policy's security context.
1082 * @secid contains the secid from which to take the mls portion of the
1084 * Allocate a security structure to the x->security field; the security
1085 * field is initialized to NULL when the xfrm_state is allocated. Set the
1089 * @x contains the xfrm_state.
1092 * @x contains the xfrm_state.
1095 * @ctx contains the xfrm_sec_ctx for which the access control is being
1097 * @fl_secid contains the flow security label that is used to authorize
1098 * access to the policy xp.
1099 * @dir contains the direction of the flow (input or output).
1101 * XFRMs on a packet. The hook is called when selecting either a
1106 * @x contains the state to match.
1107 * @xp contains the policy to check for a match.
1108 * @fl contains the flow to check for a match.
1112 * @secid points to the flow key secid to set.
1114 * Return 0 if ckall is zero or all xfrms used have the same secid.
1121 * @key points to the key.
1122 * @flags is the allocation flags
1126 * @key points to the key.
1131 * @key_ref refers to the key (key pointer + possession attribute bit).
1132 * @cred points to the credentials to provide the context against which to
1133 * evaluate the security data on the key.
1134 * @perm describes the combination of permissions required of this key.
1137 * Get a textual representation of the security context attached to a key
1138 * for the purposes of honouring KEYCTL_GETSECURITY. This function
1139 * allocates the storage for the NUL-terminated string and the caller
1141 * @key points to the key to be queried.
1142 * @_buffer points to a pointer that should be set to point to the
1144 * Return the length of the string (including terminating NUL) or -ve if
1152 * @ipcp contains the kernel IPC permission structure
1153 * @flag contains the desired (requested) permission set
1156 * Get the secid associated with the ipc object.
1157 * @ipcp contains the kernel IPC permission structure.
1158 * @secid contains a pointer to the location where result will be saved.
1164 * Allocate and attach a security structure to the msg->security field.
1165 * The security field is initialized to NULL when the structure is first
1167 * @msg contains the message structure to be modified.
1170 * Deallocate the security structure for this message.
1171 * @msg contains the message structure to be modified.
1176 * Allocate and attach a security structure to the
1177 * @perm->security field. The security field is initialized to
1178 * NULL when the structure is first created.
1179 * @perm contains the IPC permissions of the message queue.
1182 * Deallocate security field @perm->security for the message queue.
1183 * @perm contains the IPC permissions of the message queue.
1185 * Check permission when a message queue is requested through the
1186 * msgget system call. This hook is only called when returning the
1189 * @perm contains the IPC permissions of the message queue.
1190 * @msqflg contains the operation control flags.
1194 * is to be performed on the message queue with permissions @perm.
1195 * The @perm may be NULL, e.g. for IPC_INFO or MSG_INFO.
1196 * @perm contains the IPC permissions of the msg queue. May be NULL.
1197 * @cmd contains the operation to be performed.
1200 * Check permission before a message, @msg, is enqueued on the message
1202 * @perm contains the IPC permissions of the message queue.
1203 * @msg contains the message to be enqueued.
1207 * Check permission before a message, @msg, is removed from the message
1208 * queue. The @target task structure contains a pointer to the
1209 * process that will be receiving the message (not equal to the current
1211 * @perm contains the IPC permissions of the message queue.
1212 * @msg contains the message destination.
1213 * @target contains the task structure for recipient process.
1214 * @type contains the type of message requested.
1215 * @mode contains the operational flags.
1221 * Allocate and attach a security structure to the @perm->security
1222 * field. The security field is initialized to NULL when the structure is
1224 * @perm contains the IPC permissions of the shared memory structure.
1227 * Deallocate the security structure @perm->security for the memory segment.
1228 * @perm contains the IPC permissions of the shared memory structure.
1230 * Check permission when a shared memory region is requested through the
1231 * shmget system call. This hook is only called when returning the shared
1234 * @perm contains the IPC permissions of the shared memory structure.
1235 * @shmflg contains the operation control flags.
1239 * @cmd is to be performed on the shared memory region with permissions @perm.
1240 * The @perm may be NULL, e.g. for IPC_INFO or SHM_INFO.
1241 * @perm contains the IPC permissions of the shared memory structure.
1242 * @cmd contains the operation to be performed.
1245 * Check permissions prior to allowing the shmat system call to attach the
1246 * shared memory segment with permissions @perm to the data segment of the
1247 * calling process. The attaching address is specified by @shmaddr.
1248 * @perm contains the IPC permissions of the shared memory structure.
1249 * @shmaddr contains the address to attach memory region to.
1250 * @shmflg contains the operational flags.
1256 * Allocate and attach a security structure to the @perm->security
1257 * field. The security field is initialized to NULL when the structure is
1259 * @perm contains the IPC permissions of the semaphore.
1262 * Deallocate security structure @perm->security for the semaphore.
1263 * @perm contains the IPC permissions of the semaphore.
1265 * Check permission when a semaphore is requested through the semget
1266 * system call. This hook is only called when returning the semaphore
1269 * @perm contains the IPC permissions of the semaphore.
1270 * @semflg contains the operation control flags.
1274 * performed on the semaphore. The @perm may be NULL, e.g. for
1276 * @perm contains the IPC permissions of the semaphore. May be NULL.
1277 * @cmd contains the operation to be performed.
1280 * Check permissions before performing operations on members of the
1281 * semaphore set. If the @alter flag is nonzero, the semaphore set
1283 * @perm contains the IPC permissions of the semaphore.
1284 * @sops contains the operations to perform.
1285 * @nsops contains the number of operations to perform.
1286 * @alter contains the flag indicating whether changes are to be made.
1290 * Check whether @mgr is allowed to be the binder context manager.
1291 * @mgr contains the task_struct for the task being registered.
1296 * @from contains the task_struct for the sending task.
1297 * @to contains the task_struct for the receiving task.
1300 * @from contains the task_struct for the sending task.
1301 * @to contains the task_struct for the receiving task.
1304 * @from contains the task_struct for the sending task.
1305 * @file contains the struct file being transferred.
1306 * @to contains the task_struct for the receiving task.
1309 * Check permission before allowing the current process to trace the
1312 * during an execve in the set_security or apply_creds hooks of
1313 * tracing check during an execve in the bprm_set_creds hook of
1314 * binprm_security_ops if the process is being traced and its security
1315 * attributes would be changed by the execve.
1316 * @child contains the task_struct structure for the target process.
1317 * @mode contains the PTRACE_MODE flags indicating the form of access.
1320 * Check that the @parent process has sufficient permission to trace the
1321 * current process before allowing the current process to present itself
1322 * to the @parent process for tracing.
1323 * @parent contains the task_struct structure for debugger process.
1326 * Get the @effective, @inheritable, and @permitted capability sets for
1327 * the @target process. The hook may also perform permission checking to
1328 * determine if the current process is allowed to see the capability sets
1329 * of the @target process.
1330 * @target contains the task_struct structure for target process.
1331 * @effective contains the effective capability set.
1332 * @inheritable contains the inheritable capability set.
1333 * @permitted contains the permitted capability set.
1334 * Return 0 if the capability sets were successfully obtained.
1336 * Set the @effective, @inheritable, and @permitted capability sets for
1337 * the current process.
1338 * @new contains the new credentials structure for target process.
1339 * @old contains the current credentials structure for target process.
1340 * @effective contains the effective capability set.
1341 * @inheritable contains the inheritable capability set.
1342 * @permitted contains the permitted capability set.
1345 * Check whether the @tsk process has the @cap capability in the indicated
1347 * @cred contains the credentials to use.
1348 * @ns contains the user namespace we want the capability in
1349 * @cap contains the capability <include/linux/capability.h>.
1350 * @opts contains options for the capable check <include/linux/security.h>
1351 * Return 0 if the capability is granted for @tsk.
1353 * Check whether the quotactl syscall is allowed for this @sb.
1357 * Check permission before accessing the kernel message ring or changing
1358 * logging to the console.
1359 * See the syslog(2) manual page for an explanation of the @type values.
1360 * @type contains the SYSLOG_ACTION_* constant from <include/linux/syslog.h>
1363 * Check permission to change the system time.
1371 * @mm contains the mm struct it is being added to.
1372 * @pages contains the number of pages.
1376 * Check if the extended attribute specified by @name
1383 * Convert secid to security context. If secdata is NULL the length of
1384 * the result will be returned in seclen, but no secdata will be returned.
1385 * This does mean that the length could change between calls to check the
1386 * length and the next call which actually allocates and returns the
1388 * @secid contains the security ID.
1389 * @secdata contains the pointer that stores the converted security
1391 * @seclen pointer which contains the length of the data
1394 * @secid contains the pointer to the generated security ID.
1395 * @secdata contains the security context.
1398 * Release the security context.
1399 * @secdata contains the security context.
1400 * @seclen contains the length of the security context.
1406 * @field contains the required Audit action.
1408 * @op contains the operator the rule uses.
1409 * @rulestr contains the context where the rule will be applied to.
1410 * @lsmrule contains a pointer to receive the result.
1417 * @krule contains the audit rule of interest.
1423 * @secid contains the security id in question.
1424 * @field contains the field which relates to current LSM.
1425 * @op contains the operator that will be used for matching.
1426 * @lrule points to the audit rule that will be checked against.
1427 * Return 1 if secid matches the rule, 0 if it does not, -ERRNO on failure.
1430 * Deallocate the LSM audit rule structure previously allocated by
1432 * @lsmrule contains the allocated rule
1435 * Notify the security module that it must revalidate the security context
1439 * Notify the security module of what the security context of an inode
1440 * should be. Initializes the incore security context managed by the
1442 * this hook to initialize the security context in its incore inode to the
1443 * value provided by the server for the file when the server returned the
1444 * file's attributes to the client.
1446 * @inode we wish to set the security context of.
1447 * @ctx contains the string which we wish to set in the inode.
1448 * @ctxlen contains the length of @ctx.
1451 * Change the security context of an inode. Updates the
1452 * incore security context managed by the security module and invokes the
1454 * xattrs that represent the context. Example usage: NFS server invokes
1455 * this hook to change the security context in its incore inode and on the
1456 * backing filesystem to a value provided by the client on a SETATTR
1459 * @dentry contains the inode we wish to set the security context of.
1460 * @ctx contains the string which we wish to set in the inode.
1461 * @ctxlen contains the length of @ctx.
1464 * On success, returns 0 and fills out @ctx and @ctxlen with the security
1465 * context for the given @inode.
1466 * @inode we wish to get the security context of.
1467 * @ctx is a pointer in which to place the allocated security context.
1468 * @ctxlen points to the place to put the length of @ctx.
1470 * Security hooks for the general notification queue:
1475 * @w_cred: The credentials of the whoever set the watch.
1476 * @cred: The event-triggerer's credentials
1477 * @n: The notification being posted
1482 * @key: The key to watch.
1484 * Security hooks for using the eBPF maps and programs functionalities through
1488 * Do a initial check for all bpf syscalls after the attribute is copied
1489 * into the kernel. The actual security module can implement their own
1490 * rules to check the specific cmd they need.
1493 * Do a check when the kernel generate and return a file descriptor for
1497 * @mask: the access flags
1500 * Do a check when the kernel generate and return a file descriptor for
1506 * Initialize the security field inside bpf map.
1509 * Clean up the security information stored inside bpf map.
1512 * Initialize the security field inside bpf program.
1515 * Clean up the security information stored inside bpf prog.
1526 * Check whether the @type of perf_event_open syscall is allowed.
1572 * LSM_RET_VOID is used as the default value in LSM_HOOK definitions for void
1580 * care of the common case and reduces the amount of
1624 * Assuring the safety of deleting a security module is up to
1625 * the security module involved. This may entail ordering the
1627 * the module once a policy is loaded or any number of other
1630 * The name of the configuration option reflects the only module
1631 * that currently uses the mechanism. Any developer who thinks
1633 * careful as the SELinux team.