|
127 | 127 | * options cleanly (a filesystem may modify the data e.g. with strsep()). |
128 | 128 | * This also allows the original mount data to be stripped of security- |
129 | 129 | * specific options to avoid having to make filesystems aware of them. |
130 | | - * @type the type of filesystem being mounted. |
131 | 130 | * @orig the original mount data copied from userspace. |
132 | 131 | * @copy copied data which will be passed to the security module. |
133 | 132 | * Returns 0 if the copy was successful. |
|
320 | 319 | * @new_dentry contains the dentry structure of the new link. |
321 | 320 | * Return 0 if permission is granted. |
322 | 321 | * @path_chmod: |
323 | | - * Check for permission to change DAC's permission of a file or directory. |
324 | | - * @dentry contains the dentry structure. |
325 | | - * @mnt contains the vfsmnt structure. |
326 | | - * @mode contains DAC's mode. |
| 322 | + * Check for permission to change a mode of the file @path. The new |
| 323 | + * mode is specified in @mode. |
| 324 | + * @path contains the path structure of the file to change the mode. |
| 325 | + * @mode contains the new DAC's permission, which is a bitmask of |
| 326 | + * constants from <include/uapi/linux/stat.h> |
327 | 327 | * Return 0 if permission is granted. |
328 | 328 | * @path_chown: |
329 | 329 | * Check for permission to change owner/group of a file or directory. |
|
502 | 502 | * Return 0 if permission is granted. |
503 | 503 | * @file_lock: |
504 | 504 | * Check permission before performing file locking operations. |
505 | | - * Note: this hook mediates both flock and fcntl style locks. |
| 505 | + * Note the hook mediates both flock and fcntl style locks. |
506 | 506 | * @file contains the file structure. |
507 | 507 | * @cmd contains the posix-translated lock operation to perform |
508 | 508 | * (e.g. F_RDLCK, F_WRLCK). |
|
645 | 645 | * @p contains the task_struct of process. |
646 | 646 | * @nice contains the new nice value. |
647 | 647 | * Return 0 if permission is granted. |
648 | | - * @task_setioprio |
| 648 | + * @task_setioprio: |
649 | 649 | * Check permission before setting the ioprio value of @p to @ioprio. |
650 | 650 | * @p contains the task_struct of process. |
651 | 651 | * @ioprio contains the new ioprio value |
652 | 652 | * Return 0 if permission is granted. |
653 | | - * @task_getioprio |
| 653 | + * @task_getioprio: |
654 | 654 | * Check permission before getting the ioprio value of @p. |
655 | 655 | * @p contains the task_struct of process. |
656 | 656 | * Return 0 if permission is granted. |
|
672 | 672 | * Return 0 if permission is granted. |
673 | 673 | * @task_setscheduler: |
674 | 674 | * Check permission before setting scheduling policy and/or parameters of |
675 | | - * process @p based on @policy and @lp. |
| 675 | + * process @p. |
676 | 676 | * @p contains the task_struct for process. |
677 | | - * @policy contains the scheduling policy. |
678 | | - * @lp contains the scheduling parameters. |
679 | 677 | * Return 0 if permission is granted. |
680 | 678 | * @task_getscheduler: |
681 | 679 | * Check permission before obtaining scheduling information for process |
682 | 680 | * @p. |
683 | 681 | * @p contains the task_struct for process. |
684 | 682 | * Return 0 if permission is granted. |
685 | | - * @task_movememory |
| 683 | + * @task_movememory: |
686 | 684 | * Check permission before moving memory owned by process @p. |
687 | 685 | * @p contains the task_struct for process. |
688 | 686 | * Return 0 if permission is granted. |
|
769 | 767 | * socket structure, but rather, the socket security information is stored |
770 | 768 | * in the associated inode. Typically, the inode alloc_security hook will |
771 | 769 | * allocate and and attach security information to |
772 | | - * sock->inode->i_security. This hook may be used to update the |
773 | | - * sock->inode->i_security field with additional information that wasn't |
774 | | - * available when the inode was allocated. |
| 770 | + * SOCK_INODE(sock)->i_security. This hook may be used to update the |
| 771 | + * SOCK_INODE(sock)->i_security field with additional information that |
| 772 | + * wasn't available when the inode was allocated. |
775 | 773 | * @sock contains the newly created socket structure. |
776 | 774 | * @family contains the requested protocol family. |
777 | 775 | * @type contains the requested communications type. |
|
876 | 874 | * @socket_getpeersec_dgram: |
877 | 875 | * This hook allows the security module to provide peer socket security |
878 | 876 | * state for udp sockets on a per-packet basis to userspace via |
879 | | - * getsockopt SO_GETPEERSEC. The application must first have indicated |
880 | | - * the IP_PASSSEC option via getsockopt. It can then retrieve the |
| 877 | + * getsockopt SO_GETPEERSEC. The application must first have indicated |
| 878 | + * the IP_PASSSEC option via getsockopt. It can then retrieve the |
881 | 879 | * security state returned by this hook for a packet via the SCM_SECURITY |
882 | 880 | * ancillary message type. |
883 | | - * @skb is the skbuff for the packet being queried |
884 | | - * @secdata is a pointer to a buffer in which to copy the security data |
885 | | - * @seclen is the maximum length for @secdata |
| 881 | + * @sock contains the peer socket. May be NULL. |
| 882 | + * @skb is the sk_buff for the packet being queried. May be NULL. |
| 883 | + * @secid pointer to store the secid of the packet. |
886 | 884 | * Return 0 on success, error on failure. |
887 | 885 | * @sk_alloc_security: |
888 | 886 | * Allocate and attach a security structure to the sk->sk_security field, |
|
906 | 904 | * @secmark_relabel_packet: |
907 | 905 | * check if the process should be allowed to relabel packets to |
908 | 906 | * the given secid |
909 | | - * @security_secmark_refcount_inc |
| 907 | + * @secmark_refcount_inc: |
910 | 908 | * tells the LSM to increment the number of secmark labeling rules loaded |
911 | | - * @security_secmark_refcount_dec |
| 909 | + * @secmark_refcount_dec: |
912 | 910 | * tells the LSM to decrement the number of secmark labeling rules loaded |
913 | 911 | * @req_classify_flow: |
914 | 912 | * Sets the flow's sid to the openreq sid. |
|
1113 | 1111 | * |
1114 | 1112 | * @msg_queue_alloc_security: |
1115 | 1113 | * Allocate and attach a security structure to the |
1116 | | - * msq->q_perm.security field. The security field is initialized to |
| 1114 | + * @perm->security field. The security field is initialized to |
1117 | 1115 | * NULL when the structure is first created. |
1118 | | - * @msq contains the message queue structure to be modified. |
| 1116 | + * @perm contains the IPC permissions of the message queue. |
1119 | 1117 | * Return 0 if operation was successful and permission is granted. |
1120 | 1118 | * @msg_queue_free_security: |
1121 | | - * Deallocate security structure for this message queue. |
1122 | | - * @msq contains the message queue structure to be modified. |
| 1119 | + * Deallocate security field @perm->security for the message queue. |
| 1120 | + * @perm contains the IPC permissions of the message queue. |
1123 | 1121 | * @msg_queue_associate: |
1124 | 1122 | * Check permission when a message queue is requested through the |
1125 | | - * msgget system call. This hook is only called when returning the |
| 1123 | + * msgget system call. This hook is only called when returning the |
1126 | 1124 | * message queue identifier for an existing message queue, not when a |
1127 | 1125 | * new message queue is created. |
1128 | | - * @msq contains the message queue to act upon. |
| 1126 | + * @perm contains the IPC permissions of the message queue. |
1129 | 1127 | * @msqflg contains the operation control flags. |
1130 | 1128 | * Return 0 if permission is granted. |
1131 | 1129 | * @msg_queue_msgctl: |
1132 | 1130 | * Check permission when a message control operation specified by @cmd |
1133 | | - * is to be performed on the message queue @msq. |
1134 | | - * The @msq may be NULL, e.g. for IPC_INFO or MSG_INFO. |
1135 | | - * @msq contains the message queue to act upon. May be NULL. |
| 1131 | + * is to be performed on the message queue with permissions @perm. |
| 1132 | + * The @perm may be NULL, e.g. for IPC_INFO or MSG_INFO. |
| 1133 | + * @perm contains the IPC permissions of the msg queue. May be NULL. |
1136 | 1134 | * @cmd contains the operation to be performed. |
1137 | 1135 | * Return 0 if permission is granted. |
1138 | 1136 | * @msg_queue_msgsnd: |
1139 | 1137 | * Check permission before a message, @msg, is enqueued on the message |
1140 | | - * queue, @msq. |
1141 | | - * @msq contains the message queue to send message to. |
| 1138 | + * queue with permissions @perm. |
| 1139 | + * @perm contains the IPC permissions of the message queue. |
1142 | 1140 | * @msg contains the message to be enqueued. |
1143 | 1141 | * @msqflg contains operational flags. |
1144 | 1142 | * Return 0 if permission is granted. |
1145 | 1143 | * @msg_queue_msgrcv: |
1146 | 1144 | * Check permission before a message, @msg, is removed from the message |
1147 | | - * queue, @msq. The @target task structure contains a pointer to the |
| 1145 | + * queue. The @target task structure contains a pointer to the |
1148 | 1146 | * process that will be receiving the message (not equal to the current |
1149 | 1147 | * process when inline receives are being performed). |
1150 | | - * @msq contains the message queue to retrieve message from. |
| 1148 | + * @perm contains the IPC permissions of the message queue. |
1151 | 1149 | * @msg contains the message destination. |
1152 | 1150 | * @target contains the task structure for recipient process. |
1153 | 1151 | * @type contains the type of message requested. |
|
1157 | 1155 | * Security hooks for System V Shared Memory Segments |
1158 | 1156 | * |
1159 | 1157 | * @shm_alloc_security: |
1160 | | - * Allocate and attach a security structure to the shp->shm_perm.security |
1161 | | - * field. The security field is initialized to NULL when the structure is |
| 1158 | + * Allocate and attach a security structure to the @perm->security |
| 1159 | + * field. The security field is initialized to NULL when the structure is |
1162 | 1160 | * first created. |
1163 | | - * @shp contains the shared memory structure to be modified. |
| 1161 | + * @perm contains the IPC permissions of the shared memory structure. |
1164 | 1162 | * Return 0 if operation was successful and permission is granted. |
1165 | 1163 | * @shm_free_security: |
1166 | | - * Deallocate the security struct for this memory segment. |
1167 | | - * @shp contains the shared memory structure to be modified. |
| 1164 | + * Deallocate the security structure @perm->security for the memory segment. |
| 1165 | + * @perm contains the IPC permissions of the shared memory structure. |
1168 | 1166 | * @shm_associate: |
1169 | 1167 | * Check permission when a shared memory region is requested through the |
1170 | | - * shmget system call. This hook is only called when returning the shared |
| 1168 | + * shmget system call. This hook is only called when returning the shared |
1171 | 1169 | * memory region identifier for an existing region, not when a new shared |
1172 | 1170 | * memory region is created. |
1173 | | - * @shp contains the shared memory structure to be modified. |
| 1171 | + * @perm contains the IPC permissions of the shared memory structure. |
1174 | 1172 | * @shmflg contains the operation control flags. |
1175 | 1173 | * Return 0 if permission is granted. |
1176 | 1174 | * @shm_shmctl: |
1177 | 1175 | * Check permission when a shared memory control operation specified by |
1178 | | - * @cmd is to be performed on the shared memory region @shp. |
1179 | | - * The @shp may be NULL, e.g. for IPC_INFO or SHM_INFO. |
1180 | | - * @shp contains shared memory structure to be modified. |
| 1176 | + * @cmd is to be performed on the shared memory region with permissions @perm. |
| 1177 | + * The @perm may be NULL, e.g. for IPC_INFO or SHM_INFO. |
| 1178 | + * @perm contains the IPC permissions of the shared memory structure. |
1181 | 1179 | * @cmd contains the operation to be performed. |
1182 | 1180 | * Return 0 if permission is granted. |
1183 | 1181 | * @shm_shmat: |
1184 | 1182 | * Check permissions prior to allowing the shmat system call to attach the |
1185 | | - * shared memory segment @shp to the data segment of the calling process. |
1186 | | - * The attaching address is specified by @shmaddr. |
1187 | | - * @shp contains the shared memory structure to be modified. |
| 1183 | + * shared memory segment with permissions @perm to the data segment of the |
| 1184 | + * calling process. The attaching address is specified by @shmaddr. |
| 1185 | + * @perm contains the IPC permissions of the shared memory structure. |
1188 | 1186 | * @shmaddr contains the address to attach memory region to. |
1189 | 1187 | * @shmflg contains the operational flags. |
1190 | 1188 | * Return 0 if permission is granted. |
1191 | 1189 | * |
1192 | 1190 | * Security hooks for System V Semaphores |
1193 | 1191 | * |
1194 | 1192 | * @sem_alloc_security: |
1195 | | - * Allocate and attach a security structure to the sma->sem_perm.security |
1196 | | - * field. The security field is initialized to NULL when the structure is |
| 1193 | + * Allocate and attach a security structure to the @perm->security |
| 1194 | + * field. The security field is initialized to NULL when the structure is |
1197 | 1195 | * first created. |
1198 | | - * @sma contains the semaphore structure |
| 1196 | + * @perm contains the IPC permissions of the semaphore. |
1199 | 1197 | * Return 0 if operation was successful and permission is granted. |
1200 | 1198 | * @sem_free_security: |
1201 | | - * deallocate security struct for this semaphore |
1202 | | - * @sma contains the semaphore structure. |
| 1199 | + * Deallocate security structure @perm->security for the semaphore. |
| 1200 | + * @perm contains the IPC permissions of the semaphore. |
1203 | 1201 | * @sem_associate: |
1204 | 1202 | * Check permission when a semaphore is requested through the semget |
1205 | | - * system call. This hook is only called when returning the semaphore |
| 1203 | + * system call. This hook is only called when returning the semaphore |
1206 | 1204 | * identifier for an existing semaphore, not when a new one must be |
1207 | 1205 | * created. |
1208 | | - * @sma contains the semaphore structure. |
| 1206 | + * @perm contains the IPC permissions of the semaphore. |
1209 | 1207 | * @semflg contains the operation control flags. |
1210 | 1208 | * Return 0 if permission is granted. |
1211 | 1209 | * @sem_semctl: |
1212 | 1210 | * Check permission when a semaphore operation specified by @cmd is to be |
1213 | | - * performed on the semaphore @sma. The @sma may be NULL, e.g. for |
| 1211 | + * performed on the semaphore. The @perm may be NULL, e.g. for |
1214 | 1212 | * IPC_INFO or SEM_INFO. |
1215 | | - * @sma contains the semaphore structure. May be NULL. |
| 1213 | + * @perm contains the IPC permissions of the semaphore. May be NULL. |
1216 | 1214 | * @cmd contains the operation to be performed. |
1217 | 1215 | * Return 0 if permission is granted. |
1218 | 1216 | * @sem_semop: |
1219 | 1217 | * Check permissions before performing operations on members of the |
1220 | | - * semaphore set @sma. If the @alter flag is nonzero, the semaphore set |
| 1218 | + * semaphore set. If the @alter flag is nonzero, the semaphore set |
1221 | 1219 | * may be modified. |
1222 | | - * @sma contains the semaphore structure. |
| 1220 | + * @perm contains the IPC permissions of the semaphore. |
1223 | 1221 | * @sops contains the operations to perform. |
1224 | 1222 | * @nsops contains the number of operations to perform. |
1225 | 1223 | * @alter contains the flag indicating whether changes are to be made. |
|
1292 | 1290 | * Check permission before accessing the kernel message ring or changing |
1293 | 1291 | * logging to the console. |
1294 | 1292 | * See the syslog(2) manual page for an explanation of the @type values. |
1295 | | - * @type contains the type of action. |
1296 | | - * @from_file indicates the context of action (if it came from /proc). |
| 1293 | + * @type contains the SYSLOG_ACTION_* constant from <include/linux/syslog.h> |
1297 | 1294 | * Return 0 if permission is granted. |
1298 | 1295 | * @settime: |
1299 | 1296 | * Check permission to change the system time. |
1300 | | - * struct timespec64 is defined in include/linux/time64.h and timezone |
1301 | | - * is defined in include/linux/time.h |
| 1297 | + * struct timespec64 is defined in <include/linux/time64.h> and timezone |
| 1298 | + * is defined in <include/linux/time.h> |
1302 | 1299 | * @ts contains new time |
1303 | 1300 | * @tz contains new timezone |
1304 | 1301 | * Return 0 if permission is granted. |
|
1340 | 1337 | * @audit_rule_init: |
1341 | 1338 | * Allocate and initialize an LSM audit rule structure. |
1342 | 1339 | * @field contains the required Audit action. |
1343 | | - * Fields flags are defined in include/linux/audit.h |
| 1340 | + * Fields flags are defined in <include/linux/audit.h> |
1344 | 1341 | * @op contains the operator the rule uses. |
1345 | 1342 | * @rulestr contains the context where the rule will be applied to. |
1346 | 1343 | * @lsmrule contains a pointer to receive the result. |
1347 | 1344 | * Return 0 if @lsmrule has been successfully set, |
1348 | 1345 | * -EINVAL in case of an invalid rule. |
1349 | 1346 | * |
1350 | 1347 | * @audit_rule_known: |
1351 | | - * Specifies whether given @rule contains any fields related to |
| 1348 | + * Specifies whether given @krule contains any fields related to |
1352 | 1349 | * current LSM. |
1353 | | - * @rule contains the audit rule of interest. |
| 1350 | + * @krule contains the audit rule of interest. |
1354 | 1351 | * Return 1 in case of relation found, 0 otherwise. |
1355 | 1352 | * |
1356 | 1353 | * @audit_rule_match: |
|
1359 | 1356 | * @secid contains the security id in question. |
1360 | 1357 | * @field contains the field which relates to current LSM. |
1361 | 1358 | * @op contains the operator that will be used for matching. |
1362 | | - * @rule points to the audit rule that will be checked against. |
| 1359 | + * @lrule points to the audit rule that will be checked against. |
1363 | 1360 | * Return 1 if secid matches the rule, 0 if it does not, -ERRNO on failure. |
1364 | 1361 | * |
1365 | 1362 | * @audit_rule_free: |
1366 | 1363 | * Deallocate the LSM audit rule structure previously allocated by |
1367 | 1364 | * audit_rule_init. |
1368 | | - * @rule contains the allocated rule |
| 1365 | + * @lsmrule contains the allocated rule |
1369 | 1366 | * |
1370 | 1367 | * @inode_invalidate_secctx: |
1371 | 1368 | * Notify the security module that it must revalidate the security context |
|
1378 | 1375 | * this hook to initialize the security context in its incore inode to the |
1379 | 1376 | * value provided by the server for the file when the server returned the |
1380 | 1377 | * file's attributes to the client. |
1381 | | - * |
1382 | 1378 | * Must be called with inode->i_mutex locked. |
1383 | | - * |
1384 | 1379 | * @inode we wish to set the security context of. |
1385 | 1380 | * @ctx contains the string which we wish to set in the inode. |
1386 | 1381 | * @ctxlen contains the length of @ctx. |
|
1393 | 1388 | * this hook to change the security context in its incore inode and on the |
1394 | 1389 | * backing filesystem to a value provided by the client on a SETATTR |
1395 | 1390 | * operation. |
1396 | | - * |
1397 | 1391 | * Must be called with inode->i_mutex locked. |
1398 | | - * |
1399 | 1392 | * @dentry contains the inode we wish to set the security context of. |
1400 | 1393 | * @ctx contains the string which we wish to set in the inode. |
1401 | 1394 | * @ctxlen contains the length of @ctx. |
1402 | 1395 | * |
1403 | 1396 | * @inode_getsecctx: |
1404 | 1397 | * On success, returns 0 and fills out @ctx and @ctxlen with the security |
1405 | 1398 | * context for the given @inode. |
1406 | | - * |
1407 | 1399 | * @inode we wish to get the security context of. |
1408 | 1400 | * @ctx is a pointer in which to place the allocated security context. |
1409 | 1401 | * @ctxlen points to the place to put the length of @ctx. |
@@ -1640,28 +1632,28 @@ union security_list_options { |
1640 | 1632 | int (*msg_msg_alloc_security)(struct msg_msg *msg); |
1641 | 1633 | void (*msg_msg_free_security)(struct msg_msg *msg); |
1642 | 1634 |
|
1643 | | - int (*msg_queue_alloc_security)(struct kern_ipc_perm *msq); |
1644 | | - void (*msg_queue_free_security)(struct kern_ipc_perm *msq); |
1645 | | - int (*msg_queue_associate)(struct kern_ipc_perm *msq, int msqflg); |
1646 | | - int (*msg_queue_msgctl)(struct kern_ipc_perm *msq, int cmd); |
1647 | | - int (*msg_queue_msgsnd)(struct kern_ipc_perm *msq, struct msg_msg *msg, |
| 1635 | + int (*msg_queue_alloc_security)(struct kern_ipc_perm *perm); |
| 1636 | + void (*msg_queue_free_security)(struct kern_ipc_perm *perm); |
| 1637 | + int (*msg_queue_associate)(struct kern_ipc_perm *perm, int msqflg); |
| 1638 | + int (*msg_queue_msgctl)(struct kern_ipc_perm *perm, int cmd); |
| 1639 | + int (*msg_queue_msgsnd)(struct kern_ipc_perm *perm, struct msg_msg *msg, |
1648 | 1640 | int msqflg); |
1649 | | - int (*msg_queue_msgrcv)(struct kern_ipc_perm *msq, struct msg_msg *msg, |
| 1641 | + int (*msg_queue_msgrcv)(struct kern_ipc_perm *perm, struct msg_msg *msg, |
1650 | 1642 | struct task_struct *target, long type, |
1651 | 1643 | int mode); |
1652 | 1644 |
|
1653 | | - int (*shm_alloc_security)(struct kern_ipc_perm *shp); |
1654 | | - void (*shm_free_security)(struct kern_ipc_perm *shp); |
1655 | | - int (*shm_associate)(struct kern_ipc_perm *shp, int shmflg); |
1656 | | - int (*shm_shmctl)(struct kern_ipc_perm *shp, int cmd); |
1657 | | - int (*shm_shmat)(struct kern_ipc_perm *shp, char __user *shmaddr, |
| 1645 | + int (*shm_alloc_security)(struct kern_ipc_perm *perm); |
| 1646 | + void (*shm_free_security)(struct kern_ipc_perm *perm); |
| 1647 | + int (*shm_associate)(struct kern_ipc_perm *perm, int shmflg); |
| 1648 | + int (*shm_shmctl)(struct kern_ipc_perm *perm, int cmd); |
| 1649 | + int (*shm_shmat)(struct kern_ipc_perm *perm, char __user *shmaddr, |
1658 | 1650 | int shmflg); |
1659 | 1651 |
|
1660 | | - int (*sem_alloc_security)(struct kern_ipc_perm *sma); |
1661 | | - void (*sem_free_security)(struct kern_ipc_perm *sma); |
1662 | | - int (*sem_associate)(struct kern_ipc_perm *sma, int semflg); |
1663 | | - int (*sem_semctl)(struct kern_ipc_perm *sma, int cmd); |
1664 | | - int (*sem_semop)(struct kern_ipc_perm *sma, struct sembuf *sops, |
| 1652 | + int (*sem_alloc_security)(struct kern_ipc_perm *perm); |
| 1653 | + void (*sem_free_security)(struct kern_ipc_perm *perm); |
| 1654 | + int (*sem_associate)(struct kern_ipc_perm *perm, int semflg); |
| 1655 | + int (*sem_semctl)(struct kern_ipc_perm *perm, int cmd); |
| 1656 | + int (*sem_semop)(struct kern_ipc_perm *perm, struct sembuf *sops, |
1665 | 1657 | unsigned nsops, int alter); |
1666 | 1658 |
|
1667 | 1659 | int (*netlink_send)(struct sock *sk, struct sk_buff *skb); |
|
0 commit comments