diff options
Diffstat (limited to 'include/linux/security.h')
-rw-r--r-- | include/linux/security.h | 214 |
1 files changed, 163 insertions, 51 deletions
diff --git a/include/linux/security.h b/include/linux/security.h index c673dfd4dffc..53a34539382a 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -36,7 +36,11 @@ | |||
36 | 36 | ||
37 | extern unsigned securebits; | 37 | extern unsigned securebits; |
38 | 38 | ||
39 | /* Maximum number of letters for an LSM name string */ | ||
40 | #define SECURITY_NAME_MAX 10 | ||
41 | |||
39 | struct ctl_table; | 42 | struct ctl_table; |
43 | struct audit_krule; | ||
40 | 44 | ||
41 | /* | 45 | /* |
42 | * These functions are in security/capability.c and are used | 46 | * These functions are in security/capability.c and are used |
@@ -136,6 +140,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
136 | /** | 140 | /** |
137 | * struct security_operations - main security structure | 141 | * struct security_operations - main security structure |
138 | * | 142 | * |
143 | * Security module identifier. | ||
144 | * | ||
145 | * @name: | ||
146 | * A string that acts as a unique identifeir for the LSM with max number | ||
147 | * of characters = SECURITY_NAME_MAX. | ||
148 | * | ||
139 | * Security hooks for program execution operations. | 149 | * Security hooks for program execution operations. |
140 | * | 150 | * |
141 | * @bprm_alloc_security: | 151 | * @bprm_alloc_security: |
@@ -220,7 +230,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
220 | * loopback/bind mount (@flags & MS_BIND), @dev_name identifies the | 230 | * loopback/bind mount (@flags & MS_BIND), @dev_name identifies the |
221 | * pathname of the object being mounted. | 231 | * pathname of the object being mounted. |
222 | * @dev_name contains the name for object being mounted. | 232 | * @dev_name contains the name for object being mounted. |
223 | * @nd contains the nameidata structure for mount point object. | 233 | * @path contains the path for mount point object. |
224 | * @type contains the filesystem type. | 234 | * @type contains the filesystem type. |
225 | * @flags contains the mount flags. | 235 | * @flags contains the mount flags. |
226 | * @data contains the filesystem-specific data. | 236 | * @data contains the filesystem-specific data. |
@@ -239,7 +249,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
239 | * Check permission before the device with superblock @mnt->sb is mounted | 249 | * Check permission before the device with superblock @mnt->sb is mounted |
240 | * on the mount point named by @nd. | 250 | * on the mount point named by @nd. |
241 | * @mnt contains the vfsmount for device being mounted. | 251 | * @mnt contains the vfsmount for device being mounted. |
242 | * @nd contains the nameidata object for the mount point. | 252 | * @path contains the path for the mount point. |
243 | * Return 0 if permission is granted. | 253 | * Return 0 if permission is granted. |
244 | * @sb_umount: | 254 | * @sb_umount: |
245 | * Check permission before the @mnt file system is unmounted. | 255 | * Check permission before the @mnt file system is unmounted. |
@@ -268,16 +278,16 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
268 | * This hook is called any time a mount is successfully grafetd to | 278 | * This hook is called any time a mount is successfully grafetd to |
269 | * the tree. | 279 | * the tree. |
270 | * @mnt contains the mounted filesystem. | 280 | * @mnt contains the mounted filesystem. |
271 | * @mountpoint_nd contains the nameidata structure for the mount point. | 281 | * @mountpoint contains the path for the mount point. |
272 | * @sb_pivotroot: | 282 | * @sb_pivotroot: |
273 | * Check permission before pivoting the root filesystem. | 283 | * Check permission before pivoting the root filesystem. |
274 | * @old_nd contains the nameidata structure for the new location of the current root (put_old). | 284 | * @old_path contains the path for the new location of the current root (put_old). |
275 | * @new_nd contains the nameidata structure for the new root (new_root). | 285 | * @new_path contains the path for the new root (new_root). |
276 | * Return 0 if permission is granted. | 286 | * Return 0 if permission is granted. |
277 | * @sb_post_pivotroot: | 287 | * @sb_post_pivotroot: |
278 | * Update module state after a successful pivot. | 288 | * Update module state after a successful pivot. |
279 | * @old_nd contains the nameidata structure for the old root. | 289 | * @old_path contains the path for the old root. |
280 | * @new_nd contains the nameidata structure for the new root. | 290 | * @new_path contains the path for the new root. |
281 | * @sb_get_mnt_opts: | 291 | * @sb_get_mnt_opts: |
282 | * Get the security relevant mount options used for a superblock | 292 | * Get the security relevant mount options used for a superblock |
283 | * @sb the superblock to get security mount options from | 293 | * @sb the superblock to get security mount options from |
@@ -468,6 +478,11 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
468 | * @dentry is the dentry being changed. | 478 | * @dentry is the dentry being changed. |
469 | * Return 0 on success. If error is returned, then the operation | 479 | * Return 0 on success. If error is returned, then the operation |
470 | * causing setuid bit removal is failed. | 480 | * causing setuid bit removal is failed. |
481 | * @inode_getsecid: | ||
482 | * Get the secid associated with the node. | ||
483 | * @inode contains a pointer to the inode. | ||
484 | * @secid contains a pointer to the location where result will be saved. | ||
485 | * In case of failure, @secid will be set to zero. | ||
471 | * | 486 | * |
472 | * Security hooks for file operations | 487 | * Security hooks for file operations |
473 | * | 488 | * |
@@ -636,6 +651,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
636 | * @task_getsecid: | 651 | * @task_getsecid: |
637 | * Retrieve the security identifier of the process @p. | 652 | * Retrieve the security identifier of the process @p. |
638 | * @p contains the task_struct for the process and place is into @secid. | 653 | * @p contains the task_struct for the process and place is into @secid. |
654 | * In case of failure, @secid will be set to zero. | ||
655 | * | ||
639 | * @task_setgroups: | 656 | * @task_setgroups: |
640 | * Check permission before setting the supplementary group set of the | 657 | * Check permission before setting the supplementary group set of the |
641 | * current process. | 658 | * current process. |
@@ -910,24 +927,24 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
910 | * Security hooks for XFRM operations. | 927 | * Security hooks for XFRM operations. |
911 | * | 928 | * |
912 | * @xfrm_policy_alloc_security: | 929 | * @xfrm_policy_alloc_security: |
913 | * @xp contains the xfrm_policy being added to Security Policy Database | 930 | * @ctxp is a pointer to the xfrm_sec_ctx being added to Security Policy |
914 | * used by the XFRM system. | 931 | * Database used by the XFRM system. |
915 | * @sec_ctx contains the security context information being provided by | 932 | * @sec_ctx contains the security context information being provided by |
916 | * the user-level policy update program (e.g., setkey). | 933 | * the user-level policy update program (e.g., setkey). |
917 | * Allocate a security structure to the xp->security field; the security | 934 | * Allocate a security structure to the xp->security field; the security |
918 | * field is initialized to NULL when the xfrm_policy is allocated. | 935 | * field is initialized to NULL when the xfrm_policy is allocated. |
919 | * Return 0 if operation was successful (memory to allocate, legal context) | 936 | * Return 0 if operation was successful (memory to allocate, legal context) |
920 | * @xfrm_policy_clone_security: | 937 | * @xfrm_policy_clone_security: |
921 | * @old contains an existing xfrm_policy in the SPD. | 938 | * @old_ctx contains an existing xfrm_sec_ctx. |
922 | * @new contains a new xfrm_policy being cloned from old. | 939 | * @new_ctxp contains a new xfrm_sec_ctx being cloned from old. |
923 | * Allocate a security structure to the new->security field | 940 | * Allocate a security structure in new_ctxp that contains the |
924 | * that contains the information from the old->security field. | 941 | * information from the old_ctx structure. |
925 | * Return 0 if operation was successful (memory to allocate). | 942 | * Return 0 if operation was successful (memory to allocate). |
926 | * @xfrm_policy_free_security: | 943 | * @xfrm_policy_free_security: |
927 | * @xp contains the xfrm_policy | 944 | * @ctx contains the xfrm_sec_ctx |
928 | * Deallocate xp->security. | 945 | * Deallocate xp->security. |
929 | * @xfrm_policy_delete_security: | 946 | * @xfrm_policy_delete_security: |
930 | * @xp contains the xfrm_policy. | 947 | * @ctx contains the xfrm_sec_ctx. |
931 | * Authorize deletion of xp->security. | 948 | * Authorize deletion of xp->security. |
932 | * @xfrm_state_alloc_security: | 949 | * @xfrm_state_alloc_security: |
933 | * @x contains the xfrm_state being added to the Security Association | 950 | * @x contains the xfrm_state being added to the Security Association |
@@ -947,7 +964,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
947 | * @x contains the xfrm_state. | 964 | * @x contains the xfrm_state. |
948 | * Authorize deletion of x->security. | 965 | * Authorize deletion of x->security. |
949 | * @xfrm_policy_lookup: | 966 | * @xfrm_policy_lookup: |
950 | * @xp contains the xfrm_policy for which the access control is being | 967 | * @ctx contains the xfrm_sec_ctx for which the access control is being |
951 | * checked. | 968 | * checked. |
952 | * @fl_secid contains the flow security label that is used to authorize | 969 | * @fl_secid contains the flow security label that is used to authorize |
953 | * access to the policy xp. | 970 | * access to the policy xp. |
@@ -997,6 +1014,11 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
997 | * @ipcp contains the kernel IPC permission structure | 1014 | * @ipcp contains the kernel IPC permission structure |
998 | * @flag contains the desired (requested) permission set | 1015 | * @flag contains the desired (requested) permission set |
999 | * Return 0 if permission is granted. | 1016 | * Return 0 if permission is granted. |
1017 | * @ipc_getsecid: | ||
1018 | * Get the secid associated with the ipc object. | ||
1019 | * @ipcp contains the kernel IPC permission structure. | ||
1020 | * @secid contains a pointer to the location where result will be saved. | ||
1021 | * In case of failure, @secid will be set to zero. | ||
1000 | * | 1022 | * |
1001 | * Security hooks for individual messages held in System V IPC message queues | 1023 | * Security hooks for individual messages held in System V IPC message queues |
1002 | * @msg_msg_alloc_security: | 1024 | * @msg_msg_alloc_security: |
@@ -1223,9 +1245,42 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1223 | * @secdata contains the security context. | 1245 | * @secdata contains the security context. |
1224 | * @seclen contains the length of the security context. | 1246 | * @seclen contains the length of the security context. |
1225 | * | 1247 | * |
1248 | * Security hooks for Audit | ||
1249 | * | ||
1250 | * @audit_rule_init: | ||
1251 | * Allocate and initialize an LSM audit rule structure. | ||
1252 | * @field contains the required Audit action. Fields flags are defined in include/linux/audit.h | ||
1253 | * @op contains the operator the rule uses. | ||
1254 | * @rulestr contains the context where the rule will be applied to. | ||
1255 | * @lsmrule contains a pointer to receive the result. | ||
1256 | * Return 0 if @lsmrule has been successfully set, | ||
1257 | * -EINVAL in case of an invalid rule. | ||
1258 | * | ||
1259 | * @audit_rule_known: | ||
1260 | * Specifies whether given @rule contains any fields related to current LSM. | ||
1261 | * @rule contains the audit rule of interest. | ||
1262 | * Return 1 in case of relation found, 0 otherwise. | ||
1263 | * | ||
1264 | * @audit_rule_match: | ||
1265 | * Determine if given @secid matches a rule previously approved | ||
1266 | * by @audit_rule_known. | ||
1267 | * @secid contains the security id in question. | ||
1268 | * @field contains the field which relates to current LSM. | ||
1269 | * @op contains the operator that will be used for matching. | ||
1270 | * @rule points to the audit rule that will be checked against. | ||
1271 | * @actx points to the audit context associated with the check. | ||
1272 | * Return 1 if secid matches the rule, 0 if it does not, -ERRNO on failure. | ||
1273 | * | ||
1274 | * @audit_rule_free: | ||
1275 | * Deallocate the LSM audit rule structure previously allocated by | ||
1276 | * audit_rule_init. | ||
1277 | * @rule contains the allocated rule | ||
1278 | * | ||
1226 | * This is the main security structure. | 1279 | * This is the main security structure. |
1227 | */ | 1280 | */ |
1228 | struct security_operations { | 1281 | struct security_operations { |
1282 | char name[SECURITY_NAME_MAX + 1]; | ||
1283 | |||
1229 | int (*ptrace) (struct task_struct * parent, struct task_struct * child); | 1284 | int (*ptrace) (struct task_struct * parent, struct task_struct * child); |
1230 | int (*capget) (struct task_struct * target, | 1285 | int (*capget) (struct task_struct * target, |
1231 | kernel_cap_t * effective, | 1286 | kernel_cap_t * effective, |
@@ -1260,20 +1315,20 @@ struct security_operations { | |||
1260 | int (*sb_copy_data)(char *orig, char *copy); | 1315 | int (*sb_copy_data)(char *orig, char *copy); |
1261 | int (*sb_kern_mount) (struct super_block *sb, void *data); | 1316 | int (*sb_kern_mount) (struct super_block *sb, void *data); |
1262 | int (*sb_statfs) (struct dentry *dentry); | 1317 | int (*sb_statfs) (struct dentry *dentry); |
1263 | int (*sb_mount) (char *dev_name, struct nameidata * nd, | 1318 | int (*sb_mount) (char *dev_name, struct path *path, |
1264 | char *type, unsigned long flags, void *data); | 1319 | char *type, unsigned long flags, void *data); |
1265 | int (*sb_check_sb) (struct vfsmount * mnt, struct nameidata * nd); | 1320 | int (*sb_check_sb) (struct vfsmount * mnt, struct path *path); |
1266 | int (*sb_umount) (struct vfsmount * mnt, int flags); | 1321 | int (*sb_umount) (struct vfsmount * mnt, int flags); |
1267 | void (*sb_umount_close) (struct vfsmount * mnt); | 1322 | void (*sb_umount_close) (struct vfsmount * mnt); |
1268 | void (*sb_umount_busy) (struct vfsmount * mnt); | 1323 | void (*sb_umount_busy) (struct vfsmount * mnt); |
1269 | void (*sb_post_remount) (struct vfsmount * mnt, | 1324 | void (*sb_post_remount) (struct vfsmount * mnt, |
1270 | unsigned long flags, void *data); | 1325 | unsigned long flags, void *data); |
1271 | void (*sb_post_addmount) (struct vfsmount * mnt, | 1326 | void (*sb_post_addmount) (struct vfsmount * mnt, |
1272 | struct nameidata * mountpoint_nd); | 1327 | struct path *mountpoint); |
1273 | int (*sb_pivotroot) (struct nameidata * old_nd, | 1328 | int (*sb_pivotroot) (struct path *old_path, |
1274 | struct nameidata * new_nd); | 1329 | struct path *new_path); |
1275 | void (*sb_post_pivotroot) (struct nameidata * old_nd, | 1330 | void (*sb_post_pivotroot) (struct path *old_path, |
1276 | struct nameidata * new_nd); | 1331 | struct path *new_path); |
1277 | int (*sb_get_mnt_opts) (const struct super_block *sb, | 1332 | int (*sb_get_mnt_opts) (const struct super_block *sb, |
1278 | struct security_mnt_opts *opts); | 1333 | struct security_mnt_opts *opts); |
1279 | int (*sb_set_mnt_opts) (struct super_block *sb, | 1334 | int (*sb_set_mnt_opts) (struct super_block *sb, |
@@ -1317,6 +1372,7 @@ struct security_operations { | |||
1317 | int (*inode_getsecurity)(const struct inode *inode, const char *name, void **buffer, bool alloc); | 1372 | int (*inode_getsecurity)(const struct inode *inode, const char *name, void **buffer, bool alloc); |
1318 | int (*inode_setsecurity)(struct inode *inode, const char *name, const void *value, size_t size, int flags); | 1373 | int (*inode_setsecurity)(struct inode *inode, const char *name, const void *value, size_t size, int flags); |
1319 | int (*inode_listsecurity)(struct inode *inode, char *buffer, size_t buffer_size); | 1374 | int (*inode_listsecurity)(struct inode *inode, char *buffer, size_t buffer_size); |
1375 | void (*inode_getsecid)(const struct inode *inode, u32 *secid); | ||
1320 | 1376 | ||
1321 | int (*file_permission) (struct file * file, int mask); | 1377 | int (*file_permission) (struct file * file, int mask); |
1322 | int (*file_alloc_security) (struct file * file); | 1378 | int (*file_alloc_security) (struct file * file); |
@@ -1369,6 +1425,7 @@ struct security_operations { | |||
1369 | void (*task_to_inode)(struct task_struct *p, struct inode *inode); | 1425 | void (*task_to_inode)(struct task_struct *p, struct inode *inode); |
1370 | 1426 | ||
1371 | int (*ipc_permission) (struct kern_ipc_perm * ipcp, short flag); | 1427 | int (*ipc_permission) (struct kern_ipc_perm * ipcp, short flag); |
1428 | void (*ipc_getsecid) (struct kern_ipc_perm *ipcp, u32 *secid); | ||
1372 | 1429 | ||
1373 | int (*msg_msg_alloc_security) (struct msg_msg * msg); | 1430 | int (*msg_msg_alloc_security) (struct msg_msg * msg); |
1374 | void (*msg_msg_free_security) (struct msg_msg * msg); | 1431 | void (*msg_msg_free_security) (struct msg_msg * msg); |
@@ -1454,17 +1511,17 @@ struct security_operations { | |||
1454 | #endif /* CONFIG_SECURITY_NETWORK */ | 1511 | #endif /* CONFIG_SECURITY_NETWORK */ |
1455 | 1512 | ||
1456 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | 1513 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
1457 | int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, | 1514 | int (*xfrm_policy_alloc_security) (struct xfrm_sec_ctx **ctxp, |
1458 | struct xfrm_user_sec_ctx *sec_ctx); | 1515 | struct xfrm_user_sec_ctx *sec_ctx); |
1459 | int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new); | 1516 | int (*xfrm_policy_clone_security) (struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctx); |
1460 | void (*xfrm_policy_free_security) (struct xfrm_policy *xp); | 1517 | void (*xfrm_policy_free_security) (struct xfrm_sec_ctx *ctx); |
1461 | int (*xfrm_policy_delete_security) (struct xfrm_policy *xp); | 1518 | int (*xfrm_policy_delete_security) (struct xfrm_sec_ctx *ctx); |
1462 | int (*xfrm_state_alloc_security) (struct xfrm_state *x, | 1519 | int (*xfrm_state_alloc_security) (struct xfrm_state *x, |
1463 | struct xfrm_user_sec_ctx *sec_ctx, | 1520 | struct xfrm_user_sec_ctx *sec_ctx, |
1464 | u32 secid); | 1521 | u32 secid); |
1465 | void (*xfrm_state_free_security) (struct xfrm_state *x); | 1522 | void (*xfrm_state_free_security) (struct xfrm_state *x); |
1466 | int (*xfrm_state_delete_security) (struct xfrm_state *x); | 1523 | int (*xfrm_state_delete_security) (struct xfrm_state *x); |
1467 | int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 fl_secid, u8 dir); | 1524 | int (*xfrm_policy_lookup)(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); |
1468 | int (*xfrm_state_pol_flow_match)(struct xfrm_state *x, | 1525 | int (*xfrm_state_pol_flow_match)(struct xfrm_state *x, |
1469 | struct xfrm_policy *xp, struct flowi *fl); | 1526 | struct xfrm_policy *xp, struct flowi *fl); |
1470 | int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall); | 1527 | int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall); |
@@ -1480,10 +1537,18 @@ struct security_operations { | |||
1480 | 1537 | ||
1481 | #endif /* CONFIG_KEYS */ | 1538 | #endif /* CONFIG_KEYS */ |
1482 | 1539 | ||
1540 | #ifdef CONFIG_AUDIT | ||
1541 | int (*audit_rule_init)(u32 field, u32 op, char *rulestr, void **lsmrule); | ||
1542 | int (*audit_rule_known)(struct audit_krule *krule); | ||
1543 | int (*audit_rule_match)(u32 secid, u32 field, u32 op, void *lsmrule, | ||
1544 | struct audit_context *actx); | ||
1545 | void (*audit_rule_free)(void *lsmrule); | ||
1546 | #endif /* CONFIG_AUDIT */ | ||
1483 | }; | 1547 | }; |
1484 | 1548 | ||
1485 | /* prototypes */ | 1549 | /* prototypes */ |
1486 | extern int security_init (void); | 1550 | extern int security_init (void); |
1551 | extern int security_module_enable(struct security_operations *ops); | ||
1487 | extern int register_security (struct security_operations *ops); | 1552 | extern int register_security (struct security_operations *ops); |
1488 | extern int mod_reg_security (const char *name, struct security_operations *ops); | 1553 | extern int mod_reg_security (const char *name, struct security_operations *ops); |
1489 | extern struct dentry *securityfs_create_file(const char *name, mode_t mode, | 1554 | extern struct dentry *securityfs_create_file(const char *name, mode_t mode, |
@@ -1528,16 +1593,16 @@ void security_sb_free(struct super_block *sb); | |||
1528 | int security_sb_copy_data(char *orig, char *copy); | 1593 | int security_sb_copy_data(char *orig, char *copy); |
1529 | int security_sb_kern_mount(struct super_block *sb, void *data); | 1594 | int security_sb_kern_mount(struct super_block *sb, void *data); |
1530 | int security_sb_statfs(struct dentry *dentry); | 1595 | int security_sb_statfs(struct dentry *dentry); |
1531 | int security_sb_mount(char *dev_name, struct nameidata *nd, | 1596 | int security_sb_mount(char *dev_name, struct path *path, |
1532 | char *type, unsigned long flags, void *data); | 1597 | char *type, unsigned long flags, void *data); |
1533 | int security_sb_check_sb(struct vfsmount *mnt, struct nameidata *nd); | 1598 | int security_sb_check_sb(struct vfsmount *mnt, struct path *path); |
1534 | int security_sb_umount(struct vfsmount *mnt, int flags); | 1599 | int security_sb_umount(struct vfsmount *mnt, int flags); |
1535 | void security_sb_umount_close(struct vfsmount *mnt); | 1600 | void security_sb_umount_close(struct vfsmount *mnt); |
1536 | void security_sb_umount_busy(struct vfsmount *mnt); | 1601 | void security_sb_umount_busy(struct vfsmount *mnt); |
1537 | void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *data); | 1602 | void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *data); |
1538 | void security_sb_post_addmount(struct vfsmount *mnt, struct nameidata *mountpoint_nd); | 1603 | void security_sb_post_addmount(struct vfsmount *mnt, struct path *mountpoint); |
1539 | int security_sb_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd); | 1604 | int security_sb_pivotroot(struct path *old_path, struct path *new_path); |
1540 | void security_sb_post_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd); | 1605 | void security_sb_post_pivotroot(struct path *old_path, struct path *new_path); |
1541 | int security_sb_get_mnt_opts(const struct super_block *sb, | 1606 | int security_sb_get_mnt_opts(const struct super_block *sb, |
1542 | struct security_mnt_opts *opts); | 1607 | struct security_mnt_opts *opts); |
1543 | int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); | 1608 | int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); |
@@ -1578,6 +1643,7 @@ int security_inode_killpriv(struct dentry *dentry); | |||
1578 | int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc); | 1643 | int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc); |
1579 | int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags); | 1644 | int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags); |
1580 | int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size); | 1645 | int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size); |
1646 | void security_inode_getsecid(const struct inode *inode, u32 *secid); | ||
1581 | int security_file_permission(struct file *file, int mask); | 1647 | int security_file_permission(struct file *file, int mask); |
1582 | int security_file_alloc(struct file *file); | 1648 | int security_file_alloc(struct file *file); |
1583 | void security_file_free(struct file *file); | 1649 | void security_file_free(struct file *file); |
@@ -1622,6 +1688,7 @@ int security_task_prctl(int option, unsigned long arg2, unsigned long arg3, | |||
1622 | void security_task_reparent_to_init(struct task_struct *p); | 1688 | void security_task_reparent_to_init(struct task_struct *p); |
1623 | void security_task_to_inode(struct task_struct *p, struct inode *inode); | 1689 | void security_task_to_inode(struct task_struct *p, struct inode *inode); |
1624 | int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag); | 1690 | int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag); |
1691 | void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid); | ||
1625 | int security_msg_msg_alloc(struct msg_msg *msg); | 1692 | int security_msg_msg_alloc(struct msg_msg *msg); |
1626 | void security_msg_msg_free(struct msg_msg *msg); | 1693 | void security_msg_msg_free(struct msg_msg *msg); |
1627 | int security_msg_queue_alloc(struct msg_queue *msq); | 1694 | int security_msg_queue_alloc(struct msg_queue *msq); |
@@ -1805,7 +1872,7 @@ static inline int security_sb_statfs (struct dentry *dentry) | |||
1805 | return 0; | 1872 | return 0; |
1806 | } | 1873 | } |
1807 | 1874 | ||
1808 | static inline int security_sb_mount (char *dev_name, struct nameidata *nd, | 1875 | static inline int security_sb_mount (char *dev_name, struct path *path, |
1809 | char *type, unsigned long flags, | 1876 | char *type, unsigned long flags, |
1810 | void *data) | 1877 | void *data) |
1811 | { | 1878 | { |
@@ -1813,7 +1880,7 @@ static inline int security_sb_mount (char *dev_name, struct nameidata *nd, | |||
1813 | } | 1880 | } |
1814 | 1881 | ||
1815 | static inline int security_sb_check_sb (struct vfsmount *mnt, | 1882 | static inline int security_sb_check_sb (struct vfsmount *mnt, |
1816 | struct nameidata *nd) | 1883 | struct path *path) |
1817 | { | 1884 | { |
1818 | return 0; | 1885 | return 0; |
1819 | } | 1886 | } |
@@ -1834,17 +1901,17 @@ static inline void security_sb_post_remount (struct vfsmount *mnt, | |||
1834 | { } | 1901 | { } |
1835 | 1902 | ||
1836 | static inline void security_sb_post_addmount (struct vfsmount *mnt, | 1903 | static inline void security_sb_post_addmount (struct vfsmount *mnt, |
1837 | struct nameidata *mountpoint_nd) | 1904 | struct path *mountpoint) |
1838 | { } | 1905 | { } |
1839 | 1906 | ||
1840 | static inline int security_sb_pivotroot (struct nameidata *old_nd, | 1907 | static inline int security_sb_pivotroot (struct path *old_path, |
1841 | struct nameidata *new_nd) | 1908 | struct path *new_path) |
1842 | { | 1909 | { |
1843 | return 0; | 1910 | return 0; |
1844 | } | 1911 | } |
1845 | 1912 | ||
1846 | static inline void security_sb_post_pivotroot (struct nameidata *old_nd, | 1913 | static inline void security_sb_post_pivotroot (struct path *old_path, |
1847 | struct nameidata *new_nd) | 1914 | struct path *new_path) |
1848 | { } | 1915 | { } |
1849 | static inline int security_sb_get_mnt_opts(const struct super_block *sb, | 1916 | static inline int security_sb_get_mnt_opts(const struct super_block *sb, |
1850 | struct security_mnt_opts *opts) | 1917 | struct security_mnt_opts *opts) |
@@ -2022,6 +2089,11 @@ static inline int security_inode_listsecurity(struct inode *inode, char *buffer, | |||
2022 | return 0; | 2089 | return 0; |
2023 | } | 2090 | } |
2024 | 2091 | ||
2092 | static inline void security_inode_getsecid(const struct inode *inode, u32 *secid) | ||
2093 | { | ||
2094 | *secid = 0; | ||
2095 | } | ||
2096 | |||
2025 | static inline int security_file_permission (struct file *file, int mask) | 2097 | static inline int security_file_permission (struct file *file, int mask) |
2026 | { | 2098 | { |
2027 | return 0; | 2099 | return 0; |
@@ -2137,7 +2209,9 @@ static inline int security_task_getsid (struct task_struct *p) | |||
2137 | } | 2209 | } |
2138 | 2210 | ||
2139 | static inline void security_task_getsecid (struct task_struct *p, u32 *secid) | 2211 | static inline void security_task_getsecid (struct task_struct *p, u32 *secid) |
2140 | { } | 2212 | { |
2213 | *secid = 0; | ||
2214 | } | ||
2141 | 2215 | ||
2142 | static inline int security_task_setgroups (struct group_info *group_info) | 2216 | static inline int security_task_setgroups (struct group_info *group_info) |
2143 | { | 2217 | { |
@@ -2216,6 +2290,11 @@ static inline int security_ipc_permission (struct kern_ipc_perm *ipcp, | |||
2216 | return 0; | 2290 | return 0; |
2217 | } | 2291 | } |
2218 | 2292 | ||
2293 | static inline void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid) | ||
2294 | { | ||
2295 | *secid = 0; | ||
2296 | } | ||
2297 | |||
2219 | static inline int security_msg_msg_alloc (struct msg_msg * msg) | 2298 | static inline int security_msg_msg_alloc (struct msg_msg * msg) |
2220 | { | 2299 | { |
2221 | return 0; | 2300 | return 0; |
@@ -2562,16 +2641,16 @@ static inline void security_inet_conn_established(struct sock *sk, | |||
2562 | 2641 | ||
2563 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | 2642 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
2564 | 2643 | ||
2565 | int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx); | 2644 | int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *sec_ctx); |
2566 | int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new); | 2645 | int security_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctxp); |
2567 | void security_xfrm_policy_free(struct xfrm_policy *xp); | 2646 | void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx); |
2568 | int security_xfrm_policy_delete(struct xfrm_policy *xp); | 2647 | int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx); |
2569 | int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx); | 2648 | int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx); |
2570 | int security_xfrm_state_alloc_acquire(struct xfrm_state *x, | 2649 | int security_xfrm_state_alloc_acquire(struct xfrm_state *x, |
2571 | struct xfrm_sec_ctx *polsec, u32 secid); | 2650 | struct xfrm_sec_ctx *polsec, u32 secid); |
2572 | int security_xfrm_state_delete(struct xfrm_state *x); | 2651 | int security_xfrm_state_delete(struct xfrm_state *x); |
2573 | void security_xfrm_state_free(struct xfrm_state *x); | 2652 | void security_xfrm_state_free(struct xfrm_state *x); |
2574 | int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir); | 2653 | int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); |
2575 | int security_xfrm_state_pol_flow_match(struct xfrm_state *x, | 2654 | int security_xfrm_state_pol_flow_match(struct xfrm_state *x, |
2576 | struct xfrm_policy *xp, struct flowi *fl); | 2655 | struct xfrm_policy *xp, struct flowi *fl); |
2577 | int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid); | 2656 | int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid); |
@@ -2579,21 +2658,21 @@ void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl); | |||
2579 | 2658 | ||
2580 | #else /* CONFIG_SECURITY_NETWORK_XFRM */ | 2659 | #else /* CONFIG_SECURITY_NETWORK_XFRM */ |
2581 | 2660 | ||
2582 | static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) | 2661 | static inline int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *sec_ctx) |
2583 | { | 2662 | { |
2584 | return 0; | 2663 | return 0; |
2585 | } | 2664 | } |
2586 | 2665 | ||
2587 | static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) | 2666 | static inline int security_xfrm_policy_clone(struct xfrm_sec_ctx *old, struct xfrm_sec_ctx **new_ctxp) |
2588 | { | 2667 | { |
2589 | return 0; | 2668 | return 0; |
2590 | } | 2669 | } |
2591 | 2670 | ||
2592 | static inline void security_xfrm_policy_free(struct xfrm_policy *xp) | 2671 | static inline void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx) |
2593 | { | 2672 | { |
2594 | } | 2673 | } |
2595 | 2674 | ||
2596 | static inline int security_xfrm_policy_delete(struct xfrm_policy *xp) | 2675 | static inline int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx) |
2597 | { | 2676 | { |
2598 | return 0; | 2677 | return 0; |
2599 | } | 2678 | } |
@@ -2619,7 +2698,7 @@ static inline int security_xfrm_state_delete(struct xfrm_state *x) | |||
2619 | return 0; | 2698 | return 0; |
2620 | } | 2699 | } |
2621 | 2700 | ||
2622 | static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir) | 2701 | static inline int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir) |
2623 | { | 2702 | { |
2624 | return 0; | 2703 | return 0; |
2625 | } | 2704 | } |
@@ -2672,5 +2751,38 @@ static inline int security_key_permission(key_ref_t key_ref, | |||
2672 | #endif | 2751 | #endif |
2673 | #endif /* CONFIG_KEYS */ | 2752 | #endif /* CONFIG_KEYS */ |
2674 | 2753 | ||
2754 | #ifdef CONFIG_AUDIT | ||
2755 | #ifdef CONFIG_SECURITY | ||
2756 | int security_audit_rule_init(u32 field, u32 op, char *rulestr, void **lsmrule); | ||
2757 | int security_audit_rule_known(struct audit_krule *krule); | ||
2758 | int security_audit_rule_match(u32 secid, u32 field, u32 op, void *lsmrule, | ||
2759 | struct audit_context *actx); | ||
2760 | void security_audit_rule_free(void *lsmrule); | ||
2761 | |||
2762 | #else | ||
2763 | |||
2764 | static inline int security_audit_rule_init(u32 field, u32 op, char *rulestr, | ||
2765 | void **lsmrule) | ||
2766 | { | ||
2767 | return 0; | ||
2768 | } | ||
2769 | |||
2770 | static inline int security_audit_rule_known(struct audit_krule *krule) | ||
2771 | { | ||
2772 | return 0; | ||
2773 | } | ||
2774 | |||
2775 | static inline int security_audit_rule_match(u32 secid, u32 field, u32 op, | ||
2776 | void *lsmrule, struct audit_context *actx) | ||
2777 | { | ||
2778 | return 0; | ||
2779 | } | ||
2780 | |||
2781 | static inline void security_audit_rule_free(void *lsmrule) | ||
2782 | { } | ||
2783 | |||
2784 | #endif /* CONFIG_SECURITY */ | ||
2785 | #endif /* CONFIG_AUDIT */ | ||
2786 | |||
2675 | #endif /* ! __LINUX_SECURITY_H */ | 2787 | #endif /* ! __LINUX_SECURITY_H */ |
2676 | 2788 | ||