diff options
Diffstat (limited to 'include/linux/security.h')
| -rw-r--r-- | include/linux/security.h | 132 |
1 files changed, 48 insertions, 84 deletions
diff --git a/include/linux/security.h b/include/linux/security.h index 19d8e04e1688..83c18e8c846d 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
| @@ -54,8 +54,8 @@ struct user_namespace; | |||
| 54 | * These functions are in security/capability.c and are used | 54 | * These functions are in security/capability.c and are used |
| 55 | * as the default capabilities functions | 55 | * as the default capabilities functions |
| 56 | */ | 56 | */ |
| 57 | extern int cap_capable(struct task_struct *tsk, const struct cred *cred, | 57 | extern int cap_capable(const struct cred *cred, struct user_namespace *ns, |
| 58 | struct user_namespace *ns, int cap, int audit); | 58 | int cap, int audit); |
| 59 | extern int cap_settime(const struct timespec *ts, const struct timezone *tz); | 59 | extern int cap_settime(const struct timespec *ts, const struct timezone *tz); |
| 60 | extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode); | 60 | extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode); |
| 61 | extern int cap_ptrace_traceme(struct task_struct *parent); | 61 | extern int cap_ptrace_traceme(struct task_struct *parent); |
| @@ -96,7 +96,6 @@ struct xfrm_user_sec_ctx; | |||
| 96 | struct seq_file; | 96 | struct seq_file; |
| 97 | 97 | ||
| 98 | extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); | 98 | extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); |
| 99 | extern int cap_netlink_recv(struct sk_buff *skb, int cap); | ||
| 100 | 99 | ||
| 101 | void reset_security_ops(void); | 100 | void reset_security_ops(void); |
| 102 | 101 | ||
| @@ -186,7 +185,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 186 | * Security module identifier. | 185 | * Security module identifier. |
| 187 | * | 186 | * |
| 188 | * @name: | 187 | * @name: |
| 189 | * A string that acts as a unique identifeir for the LSM with max number | 188 | * A string that acts as a unique identifier for the LSM with max number |
| 190 | * of characters = SECURITY_NAME_MAX. | 189 | * of characters = SECURITY_NAME_MAX. |
| 191 | * | 190 | * |
| 192 | * Security hooks for program execution operations. | 191 | * Security hooks for program execution operations. |
| @@ -275,7 +274,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 275 | * @copy copied data which will be passed to the security module. | 274 | * @copy copied data which will be passed to the security module. |
| 276 | * Returns 0 if the copy was successful. | 275 | * Returns 0 if the copy was successful. |
| 277 | * @sb_remount: | 276 | * @sb_remount: |
| 278 | * Extracts security system specifc mount options and verifys no changes | 277 | * Extracts security system specific mount options and verifies no changes |
| 279 | * are being made to those options. | 278 | * are being made to those options. |
| 280 | * @sb superblock being remounted | 279 | * @sb superblock being remounted |
| 281 | * @data contains the filesystem-specific data. | 280 | * @data contains the filesystem-specific data. |
| @@ -380,15 +379,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 380 | * Return 0 if permission is granted. | 379 | * Return 0 if permission is granted. |
| 381 | * @inode_mkdir: | 380 | * @inode_mkdir: |
| 382 | * Check permissions to create a new directory in the existing directory | 381 | * Check permissions to create a new directory in the existing directory |
| 383 | * associated with inode strcture @dir. | 382 | * associated with inode structure @dir. |
| 384 | * @dir containst the inode structure of parent of the directory to be created. | 383 | * @dir contains the inode structure of parent of the directory to be created. |
| 385 | * @dentry contains the dentry structure of new directory. | 384 | * @dentry contains the dentry structure of new directory. |
| 386 | * @mode contains the mode of new directory. | 385 | * @mode contains the mode of new directory. |
| 387 | * Return 0 if permission is granted. | 386 | * Return 0 if permission is granted. |
| 388 | * @path_mkdir: | 387 | * @path_mkdir: |
| 389 | * Check permissions to create a new directory in the existing directory | 388 | * Check permissions to create a new directory in the existing directory |
| 390 | * associated with path strcture @path. | 389 | * associated with path structure @path. |
| 391 | * @dir containst the path structure of parent of the directory | 390 | * @dir contains the path structure of parent of the directory |
| 392 | * to be created. | 391 | * to be created. |
| 393 | * @dentry contains the dentry structure of new directory. | 392 | * @dentry contains the dentry structure of new directory. |
| 394 | * @mode contains the mode of new directory. | 393 | * @mode contains the mode of new directory. |
| @@ -578,7 +577,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 578 | * @file contains the file structure. | 577 | * @file contains the file structure. |
| 579 | * @cmd contains the operation to perform. | 578 | * @cmd contains the operation to perform. |
| 580 | * @arg contains the operational arguments. | 579 | * @arg contains the operational arguments. |
| 581 | * Check permission for an ioctl operation on @file. Note that @arg can | 580 | * Check permission for an ioctl operation on @file. Note that @arg |
| 582 | * sometimes represents a user space pointer; in other cases, it may be a | 581 | * sometimes represents a user space pointer; in other cases, it may be a |
| 583 | * simple integer value. When @arg represents a user space pointer, it | 582 | * simple integer value. When @arg represents a user space pointer, it |
| 584 | * should never be used by the security module. | 583 | * should never be used by the security module. |
| @@ -590,6 +589,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 590 | * @reqprot contains the protection requested by the application. | 589 | * @reqprot contains the protection requested by the application. |
| 591 | * @prot contains the protection that will be applied by the kernel. | 590 | * @prot contains the protection that will be applied by the kernel. |
| 592 | * @flags contains the operational flags. | 591 | * @flags contains the operational flags. |
| 592 | * @addr contains virtual address that will be used for the operation. | ||
| 593 | * @addr_only contains a boolean: 0 if file-backed VMA, otherwise 1. | ||
| 593 | * Return 0 if permission is granted. | 594 | * Return 0 if permission is granted. |
| 594 | * @file_mprotect: | 595 | * @file_mprotect: |
| 595 | * Check permissions before changing memory access permissions. | 596 | * Check permissions before changing memory access permissions. |
| @@ -606,7 +607,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 606 | * Return 0 if permission is granted. | 607 | * Return 0 if permission is granted. |
| 607 | * @file_fcntl: | 608 | * @file_fcntl: |
| 608 | * Check permission before allowing the file operation specified by @cmd | 609 | * Check permission before allowing the file operation specified by @cmd |
| 609 | * from being performed on the file @file. Note that @arg can sometimes | 610 | * from being performed on the file @file. Note that @arg sometimes |
| 610 | * represents a user space pointer; in other cases, it may be a simple | 611 | * represents a user space pointer; in other cases, it may be a simple |
| 611 | * integer value. When @arg represents a user space pointer, it should | 612 | * integer value. When @arg represents a user space pointer, it should |
| 612 | * never be used by the security module. | 613 | * never be used by the security module. |
| @@ -793,16 +794,10 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 793 | * information can be saved using the eff_cap field of the | 794 | * information can be saved using the eff_cap field of the |
| 794 | * netlink_skb_parms structure. Also may be used to provide fine | 795 | * netlink_skb_parms structure. Also may be used to provide fine |
| 795 | * grained control over message transmission. | 796 | * grained control over message transmission. |
| 796 | * @sk associated sock of task sending the message., | 797 | * @sk associated sock of task sending the message. |
| 797 | * @skb contains the sk_buff structure for the netlink message. | 798 | * @skb contains the sk_buff structure for the netlink message. |
| 798 | * Return 0 if the information was successfully saved and message | 799 | * Return 0 if the information was successfully saved and message |
| 799 | * is allowed to be transmitted. | 800 | * is allowed to be transmitted. |
| 800 | * @netlink_recv: | ||
| 801 | * Check permission before processing the received netlink message in | ||
| 802 | * @skb. | ||
| 803 | * @skb contains the sk_buff structure for the netlink message. | ||
| 804 | * @cap indicates the capability required | ||
| 805 | * Return 0 if permission is granted. | ||
| 806 | * | 801 | * |
| 807 | * Security hooks for Unix domain networking. | 802 | * Security hooks for Unix domain networking. |
| 808 | * | 803 | * |
| @@ -1080,9 +1075,9 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 1080 | * should free it. | 1075 | * should free it. |
| 1081 | * @key points to the key to be queried. | 1076 | * @key points to the key to be queried. |
| 1082 | * @_buffer points to a pointer that should be set to point to the | 1077 | * @_buffer points to a pointer that should be set to point to the |
| 1083 | * resulting string (if no label or an error occurs). | 1078 | * resulting string (if no label or an error occurs). |
| 1084 | * Return the length of the string (including terminating NUL) or -ve if | 1079 | * Return the length of the string (including terminating NUL) or -ve if |
| 1085 | * an error. | 1080 | * an error. |
| 1086 | * May also return 0 (and a NULL buffer pointer) if there is no label. | 1081 | * May also return 0 (and a NULL buffer pointer) if there is no label. |
| 1087 | * | 1082 | * |
| 1088 | * Security hooks affecting all System V IPC operations. | 1083 | * Security hooks affecting all System V IPC operations. |
| @@ -1266,9 +1261,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 1266 | * @capable: | 1261 | * @capable: |
| 1267 | * Check whether the @tsk process has the @cap capability in the indicated | 1262 | * Check whether the @tsk process has the @cap capability in the indicated |
| 1268 | * credentials. | 1263 | * credentials. |
| 1269 | * @tsk contains the task_struct for the process. | ||
| 1270 | * @cred contains the credentials to use. | 1264 | * @cred contains the credentials to use. |
| 1271 | * @ns contains the user namespace we want the capability in | 1265 | * @ns contains the user namespace we want the capability in |
| 1272 | * @cap contains the capability <include/linux/capability.h>. | 1266 | * @cap contains the capability <include/linux/capability.h>. |
| 1273 | * @audit: Whether to write an audit message or not | 1267 | * @audit: Whether to write an audit message or not |
| 1274 | * Return 0 if the capability is granted for @tsk. | 1268 | * Return 0 if the capability is granted for @tsk. |
| @@ -1370,7 +1364,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 1370 | * @ctxlen contains the length of @ctx. | 1364 | * @ctxlen contains the length of @ctx. |
| 1371 | * | 1365 | * |
| 1372 | * @inode_getsecctx: | 1366 | * @inode_getsecctx: |
| 1373 | * Returns a string containing all relavent security context information | 1367 | * Returns a string containing all relevant security context information |
| 1374 | * | 1368 | * |
| 1375 | * @inode we wish to get the security context of. | 1369 | * @inode we wish to get the security context of. |
| 1376 | * @ctx is a pointer in which to place the allocated security context. | 1370 | * @ctx is a pointer in which to place the allocated security context. |
| @@ -1390,8 +1384,8 @@ struct security_operations { | |||
| 1390 | const kernel_cap_t *effective, | 1384 | const kernel_cap_t *effective, |
| 1391 | const kernel_cap_t *inheritable, | 1385 | const kernel_cap_t *inheritable, |
| 1392 | const kernel_cap_t *permitted); | 1386 | const kernel_cap_t *permitted); |
| 1393 | int (*capable) (struct task_struct *tsk, const struct cred *cred, | 1387 | int (*capable) (const struct cred *cred, struct user_namespace *ns, |
| 1394 | struct user_namespace *ns, int cap, int audit); | 1388 | int cap, int audit); |
| 1395 | int (*quotactl) (int cmds, int type, int id, struct super_block *sb); | 1389 | int (*quotactl) (int cmds, int type, int id, struct super_block *sb); |
| 1396 | int (*quota_on) (struct dentry *dentry); | 1390 | int (*quota_on) (struct dentry *dentry); |
| 1397 | int (*syslog) (int type); | 1391 | int (*syslog) (int type); |
| @@ -1424,9 +1418,9 @@ struct security_operations { | |||
| 1424 | 1418 | ||
| 1425 | #ifdef CONFIG_SECURITY_PATH | 1419 | #ifdef CONFIG_SECURITY_PATH |
| 1426 | int (*path_unlink) (struct path *dir, struct dentry *dentry); | 1420 | int (*path_unlink) (struct path *dir, struct dentry *dentry); |
| 1427 | int (*path_mkdir) (struct path *dir, struct dentry *dentry, int mode); | 1421 | int (*path_mkdir) (struct path *dir, struct dentry *dentry, umode_t mode); |
| 1428 | int (*path_rmdir) (struct path *dir, struct dentry *dentry); | 1422 | int (*path_rmdir) (struct path *dir, struct dentry *dentry); |
| 1429 | int (*path_mknod) (struct path *dir, struct dentry *dentry, int mode, | 1423 | int (*path_mknod) (struct path *dir, struct dentry *dentry, umode_t mode, |
| 1430 | unsigned int dev); | 1424 | unsigned int dev); |
| 1431 | int (*path_truncate) (struct path *path); | 1425 | int (*path_truncate) (struct path *path); |
| 1432 | int (*path_symlink) (struct path *dir, struct dentry *dentry, | 1426 | int (*path_symlink) (struct path *dir, struct dentry *dentry, |
| @@ -1435,8 +1429,7 @@ struct security_operations { | |||
| 1435 | struct dentry *new_dentry); | 1429 | struct dentry *new_dentry); |
| 1436 | int (*path_rename) (struct path *old_dir, struct dentry *old_dentry, | 1430 | int (*path_rename) (struct path *old_dir, struct dentry *old_dentry, |
| 1437 | struct path *new_dir, struct dentry *new_dentry); | 1431 | struct path *new_dir, struct dentry *new_dentry); |
| 1438 | int (*path_chmod) (struct dentry *dentry, struct vfsmount *mnt, | 1432 | int (*path_chmod) (struct path *path, umode_t mode); |
| 1439 | mode_t mode); | ||
| 1440 | int (*path_chown) (struct path *path, uid_t uid, gid_t gid); | 1433 | int (*path_chown) (struct path *path, uid_t uid, gid_t gid); |
| 1441 | int (*path_chroot) (struct path *path); | 1434 | int (*path_chroot) (struct path *path); |
| 1442 | #endif | 1435 | #endif |
| @@ -1447,16 +1440,16 @@ struct security_operations { | |||
| 1447 | const struct qstr *qstr, char **name, | 1440 | const struct qstr *qstr, char **name, |
| 1448 | void **value, size_t *len); | 1441 | void **value, size_t *len); |
| 1449 | int (*inode_create) (struct inode *dir, | 1442 | int (*inode_create) (struct inode *dir, |
| 1450 | struct dentry *dentry, int mode); | 1443 | struct dentry *dentry, umode_t mode); |
| 1451 | int (*inode_link) (struct dentry *old_dentry, | 1444 | int (*inode_link) (struct dentry *old_dentry, |
| 1452 | struct inode *dir, struct dentry *new_dentry); | 1445 | struct inode *dir, struct dentry *new_dentry); |
| 1453 | int (*inode_unlink) (struct inode *dir, struct dentry *dentry); | 1446 | int (*inode_unlink) (struct inode *dir, struct dentry *dentry); |
| 1454 | int (*inode_symlink) (struct inode *dir, | 1447 | int (*inode_symlink) (struct inode *dir, |
| 1455 | struct dentry *dentry, const char *old_name); | 1448 | struct dentry *dentry, const char *old_name); |
| 1456 | int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode); | 1449 | int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, umode_t mode); |
| 1457 | int (*inode_rmdir) (struct inode *dir, struct dentry *dentry); | 1450 | int (*inode_rmdir) (struct inode *dir, struct dentry *dentry); |
| 1458 | int (*inode_mknod) (struct inode *dir, struct dentry *dentry, | 1451 | int (*inode_mknod) (struct inode *dir, struct dentry *dentry, |
| 1459 | int mode, dev_t dev); | 1452 | umode_t mode, dev_t dev); |
| 1460 | int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry, | 1453 | int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry, |
| 1461 | struct inode *new_dir, struct dentry *new_dentry); | 1454 | struct inode *new_dir, struct dentry *new_dentry); |
| 1462 | int (*inode_readlink) (struct dentry *dentry); | 1455 | int (*inode_readlink) (struct dentry *dentry); |
| @@ -1562,7 +1555,6 @@ struct security_operations { | |||
| 1562 | struct sembuf *sops, unsigned nsops, int alter); | 1555 | struct sembuf *sops, unsigned nsops, int alter); |
| 1563 | 1556 | ||
| 1564 | int (*netlink_send) (struct sock *sk, struct sk_buff *skb); | 1557 | int (*netlink_send) (struct sock *sk, struct sk_buff *skb); |
| 1565 | int (*netlink_recv) (struct sk_buff *skb, int cap); | ||
| 1566 | 1558 | ||
| 1567 | void (*d_instantiate) (struct dentry *dentry, struct inode *inode); | 1559 | void (*d_instantiate) (struct dentry *dentry, struct inode *inode); |
| 1568 | 1560 | ||
| @@ -1674,12 +1666,10 @@ int security_capset(struct cred *new, const struct cred *old, | |||
| 1674 | const kernel_cap_t *effective, | 1666 | const kernel_cap_t *effective, |
| 1675 | const kernel_cap_t *inheritable, | 1667 | const kernel_cap_t *inheritable, |
| 1676 | const kernel_cap_t *permitted); | 1668 | const kernel_cap_t *permitted); |
| 1677 | int security_capable(struct user_namespace *ns, const struct cred *cred, | 1669 | int security_capable(const struct cred *cred, struct user_namespace *ns, |
| 1678 | int cap); | 1670 | int cap); |
| 1679 | int security_real_capable(struct task_struct *tsk, struct user_namespace *ns, | 1671 | int security_capable_noaudit(const struct cred *cred, struct user_namespace *ns, |
| 1680 | int cap); | 1672 | int cap); |
| 1681 | int security_real_capable_noaudit(struct task_struct *tsk, | ||
| 1682 | struct user_namespace *ns, int cap); | ||
| 1683 | int security_quotactl(int cmds, int type, int id, struct super_block *sb); | 1673 | int security_quotactl(int cmds, int type, int id, struct super_block *sb); |
| 1684 | int security_quota_on(struct dentry *dentry); | 1674 | int security_quota_on(struct dentry *dentry); |
| 1685 | int security_syslog(int type); | 1675 | int security_syslog(int type); |
| @@ -1716,15 +1706,15 @@ int security_inode_init_security(struct inode *inode, struct inode *dir, | |||
| 1716 | int security_old_inode_init_security(struct inode *inode, struct inode *dir, | 1706 | int security_old_inode_init_security(struct inode *inode, struct inode *dir, |
| 1717 | const struct qstr *qstr, char **name, | 1707 | const struct qstr *qstr, char **name, |
| 1718 | void **value, size_t *len); | 1708 | void **value, size_t *len); |
| 1719 | int security_inode_create(struct inode *dir, struct dentry *dentry, int mode); | 1709 | int security_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode); |
| 1720 | int security_inode_link(struct dentry *old_dentry, struct inode *dir, | 1710 | int security_inode_link(struct dentry *old_dentry, struct inode *dir, |
| 1721 | struct dentry *new_dentry); | 1711 | struct dentry *new_dentry); |
| 1722 | int security_inode_unlink(struct inode *dir, struct dentry *dentry); | 1712 | int security_inode_unlink(struct inode *dir, struct dentry *dentry); |
| 1723 | int security_inode_symlink(struct inode *dir, struct dentry *dentry, | 1713 | int security_inode_symlink(struct inode *dir, struct dentry *dentry, |
| 1724 | const char *old_name); | 1714 | const char *old_name); |
| 1725 | int security_inode_mkdir(struct inode *dir, struct dentry *dentry, int mode); | 1715 | int security_inode_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode); |
| 1726 | int security_inode_rmdir(struct inode *dir, struct dentry *dentry); | 1716 | int security_inode_rmdir(struct inode *dir, struct dentry *dentry); |
| 1727 | int security_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev); | 1717 | int security_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev); |
| 1728 | int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, | 1718 | int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, |
| 1729 | struct inode *new_dir, struct dentry *new_dentry); | 1719 | struct inode *new_dir, struct dentry *new_dentry); |
| 1730 | int security_inode_readlink(struct dentry *dentry); | 1720 | int security_inode_readlink(struct dentry *dentry); |
| @@ -1816,7 +1806,6 @@ void security_d_instantiate(struct dentry *dentry, struct inode *inode); | |||
| 1816 | int security_getprocattr(struct task_struct *p, char *name, char **value); | 1806 | int security_getprocattr(struct task_struct *p, char *name, char **value); |
| 1817 | int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size); | 1807 | int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size); |
| 1818 | int security_netlink_send(struct sock *sk, struct sk_buff *skb); | 1808 | int security_netlink_send(struct sock *sk, struct sk_buff *skb); |
| 1819 | int security_netlink_recv(struct sk_buff *skb, int cap); | ||
| 1820 | int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); | 1809 | int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); |
| 1821 | int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); | 1810 | int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); |
| 1822 | void security_release_secctx(char *secdata, u32 seclen); | 1811 | void security_release_secctx(char *secdata, u32 seclen); |
| @@ -1874,32 +1863,15 @@ static inline int security_capset(struct cred *new, | |||
| 1874 | return cap_capset(new, old, effective, inheritable, permitted); | 1863 | return cap_capset(new, old, effective, inheritable, permitted); |
| 1875 | } | 1864 | } |
| 1876 | 1865 | ||
| 1877 | static inline int security_capable(struct user_namespace *ns, | 1866 | static inline int security_capable(const struct cred *cred, |
| 1878 | const struct cred *cred, int cap) | 1867 | struct user_namespace *ns, int cap) |
| 1879 | { | 1868 | { |
| 1880 | return cap_capable(current, cred, ns, cap, SECURITY_CAP_AUDIT); | 1869 | return cap_capable(cred, ns, cap, SECURITY_CAP_AUDIT); |
| 1881 | } | ||
| 1882 | |||
| 1883 | static inline int security_real_capable(struct task_struct *tsk, struct user_namespace *ns, int cap) | ||
| 1884 | { | ||
| 1885 | int ret; | ||
| 1886 | |||
| 1887 | rcu_read_lock(); | ||
| 1888 | ret = cap_capable(tsk, __task_cred(tsk), ns, cap, SECURITY_CAP_AUDIT); | ||
| 1889 | rcu_read_unlock(); | ||
| 1890 | return ret; | ||
| 1891 | } | 1870 | } |
| 1892 | 1871 | ||
| 1893 | static inline | 1872 | static inline int security_capable_noaudit(const struct cred *cred, |
| 1894 | int security_real_capable_noaudit(struct task_struct *tsk, struct user_namespace *ns, int cap) | 1873 | struct user_namespace *ns, int cap) { |
| 1895 | { | 1874 | return cap_capable(cred, ns, cap, SECURITY_CAP_NOAUDIT); |
| 1896 | int ret; | ||
| 1897 | |||
| 1898 | rcu_read_lock(); | ||
| 1899 | ret = cap_capable(tsk, __task_cred(tsk), ns, cap, | ||
| 1900 | SECURITY_CAP_NOAUDIT); | ||
| 1901 | rcu_read_unlock(); | ||
| 1902 | return ret; | ||
| 1903 | } | 1875 | } |
| 1904 | 1876 | ||
| 1905 | static inline int security_quotactl(int cmds, int type, int id, | 1877 | static inline int security_quotactl(int cmds, int type, int id, |
| @@ -2044,7 +2016,7 @@ static inline void security_inode_free(struct inode *inode) | |||
| 2044 | static inline int security_inode_init_security(struct inode *inode, | 2016 | static inline int security_inode_init_security(struct inode *inode, |
| 2045 | struct inode *dir, | 2017 | struct inode *dir, |
| 2046 | const struct qstr *qstr, | 2018 | const struct qstr *qstr, |
| 2047 | initxattrs initxattrs, | 2019 | const initxattrs initxattrs, |
| 2048 | void *fs_data) | 2020 | void *fs_data) |
| 2049 | { | 2021 | { |
| 2050 | return 0; | 2022 | return 0; |
| @@ -2056,12 +2028,12 @@ static inline int security_old_inode_init_security(struct inode *inode, | |||
| 2056 | char **name, void **value, | 2028 | char **name, void **value, |
| 2057 | size_t *len) | 2029 | size_t *len) |
| 2058 | { | 2030 | { |
| 2059 | return 0; | 2031 | return -EOPNOTSUPP; |
| 2060 | } | 2032 | } |
| 2061 | 2033 | ||
| 2062 | static inline int security_inode_create(struct inode *dir, | 2034 | static inline int security_inode_create(struct inode *dir, |
| 2063 | struct dentry *dentry, | 2035 | struct dentry *dentry, |
| 2064 | int mode) | 2036 | umode_t mode) |
| 2065 | { | 2037 | { |
| 2066 | return 0; | 2038 | return 0; |
| 2067 | } | 2039 | } |
| @@ -2516,11 +2488,6 @@ static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb) | |||
| 2516 | return cap_netlink_send(sk, skb); | 2488 | return cap_netlink_send(sk, skb); |
| 2517 | } | 2489 | } |
| 2518 | 2490 | ||
| 2519 | static inline int security_netlink_recv(struct sk_buff *skb, int cap) | ||
| 2520 | { | ||
| 2521 | return cap_netlink_recv(skb, cap); | ||
| 2522 | } | ||
| 2523 | |||
| 2524 | static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) | 2491 | static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) |
| 2525 | { | 2492 | { |
| 2526 | return -EOPNOTSUPP; | 2493 | return -EOPNOTSUPP; |
| @@ -2855,9 +2822,9 @@ static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi | |||
| 2855 | 2822 | ||
| 2856 | #ifdef CONFIG_SECURITY_PATH | 2823 | #ifdef CONFIG_SECURITY_PATH |
| 2857 | int security_path_unlink(struct path *dir, struct dentry *dentry); | 2824 | int security_path_unlink(struct path *dir, struct dentry *dentry); |
| 2858 | int security_path_mkdir(struct path *dir, struct dentry *dentry, int mode); | 2825 | int security_path_mkdir(struct path *dir, struct dentry *dentry, umode_t mode); |
| 2859 | int security_path_rmdir(struct path *dir, struct dentry *dentry); | 2826 | int security_path_rmdir(struct path *dir, struct dentry *dentry); |
| 2860 | int security_path_mknod(struct path *dir, struct dentry *dentry, int mode, | 2827 | int security_path_mknod(struct path *dir, struct dentry *dentry, umode_t mode, |
| 2861 | unsigned int dev); | 2828 | unsigned int dev); |
| 2862 | int security_path_truncate(struct path *path); | 2829 | int security_path_truncate(struct path *path); |
| 2863 | int security_path_symlink(struct path *dir, struct dentry *dentry, | 2830 | int security_path_symlink(struct path *dir, struct dentry *dentry, |
| @@ -2866,8 +2833,7 @@ int security_path_link(struct dentry *old_dentry, struct path *new_dir, | |||
| 2866 | struct dentry *new_dentry); | 2833 | struct dentry *new_dentry); |
| 2867 | int security_path_rename(struct path *old_dir, struct dentry *old_dentry, | 2834 | int security_path_rename(struct path *old_dir, struct dentry *old_dentry, |
| 2868 | struct path *new_dir, struct dentry *new_dentry); | 2835 | struct path *new_dir, struct dentry *new_dentry); |
| 2869 | int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt, | 2836 | int security_path_chmod(struct path *path, umode_t mode); |
| 2870 | mode_t mode); | ||
| 2871 | int security_path_chown(struct path *path, uid_t uid, gid_t gid); | 2837 | int security_path_chown(struct path *path, uid_t uid, gid_t gid); |
| 2872 | int security_path_chroot(struct path *path); | 2838 | int security_path_chroot(struct path *path); |
| 2873 | #else /* CONFIG_SECURITY_PATH */ | 2839 | #else /* CONFIG_SECURITY_PATH */ |
| @@ -2877,7 +2843,7 @@ static inline int security_path_unlink(struct path *dir, struct dentry *dentry) | |||
| 2877 | } | 2843 | } |
| 2878 | 2844 | ||
| 2879 | static inline int security_path_mkdir(struct path *dir, struct dentry *dentry, | 2845 | static inline int security_path_mkdir(struct path *dir, struct dentry *dentry, |
| 2880 | int mode) | 2846 | umode_t mode) |
| 2881 | { | 2847 | { |
| 2882 | return 0; | 2848 | return 0; |
| 2883 | } | 2849 | } |
| @@ -2888,7 +2854,7 @@ static inline int security_path_rmdir(struct path *dir, struct dentry *dentry) | |||
| 2888 | } | 2854 | } |
| 2889 | 2855 | ||
| 2890 | static inline int security_path_mknod(struct path *dir, struct dentry *dentry, | 2856 | static inline int security_path_mknod(struct path *dir, struct dentry *dentry, |
| 2891 | int mode, unsigned int dev) | 2857 | umode_t mode, unsigned int dev) |
| 2892 | { | 2858 | { |
| 2893 | return 0; | 2859 | return 0; |
| 2894 | } | 2860 | } |
| @@ -2919,9 +2885,7 @@ static inline int security_path_rename(struct path *old_dir, | |||
| 2919 | return 0; | 2885 | return 0; |
| 2920 | } | 2886 | } |
| 2921 | 2887 | ||
| 2922 | static inline int security_path_chmod(struct dentry *dentry, | 2888 | static inline int security_path_chmod(struct path *path, umode_t mode) |
| 2923 | struct vfsmount *mnt, | ||
| 2924 | mode_t mode) | ||
| 2925 | { | 2889 | { |
| 2926 | return 0; | 2890 | return 0; |
| 2927 | } | 2891 | } |
| @@ -3010,7 +2974,7 @@ static inline void security_audit_rule_free(void *lsmrule) | |||
| 3010 | 2974 | ||
| 3011 | #ifdef CONFIG_SECURITYFS | 2975 | #ifdef CONFIG_SECURITYFS |
| 3012 | 2976 | ||
| 3013 | extern struct dentry *securityfs_create_file(const char *name, mode_t mode, | 2977 | extern struct dentry *securityfs_create_file(const char *name, umode_t mode, |
| 3014 | struct dentry *parent, void *data, | 2978 | struct dentry *parent, void *data, |
| 3015 | const struct file_operations *fops); | 2979 | const struct file_operations *fops); |
| 3016 | extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent); | 2980 | extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent); |
| @@ -3025,7 +2989,7 @@ static inline struct dentry *securityfs_create_dir(const char *name, | |||
| 3025 | } | 2989 | } |
| 3026 | 2990 | ||
| 3027 | static inline struct dentry *securityfs_create_file(const char *name, | 2991 | static inline struct dentry *securityfs_create_file(const char *name, |
| 3028 | mode_t mode, | 2992 | umode_t mode, |
| 3029 | struct dentry *parent, | 2993 | struct dentry *parent, |
| 3030 | void *data, | 2994 | void *data, |
| 3031 | const struct file_operations *fops) | 2995 | const struct file_operations *fops) |
