aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/security.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/security.h')
-rw-r--r--include/linux/security.h40
1 files changed, 36 insertions, 4 deletions
diff --git a/include/linux/security.h b/include/linux/security.h
index a300a3f2fe68..df591d289ec9 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -51,8 +51,14 @@ extern void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe);
51extern int cap_bprm_secureexec(struct linux_binprm *bprm); 51extern int cap_bprm_secureexec(struct linux_binprm *bprm);
52extern int cap_inode_setxattr(struct dentry *dentry, char *name, void *value, size_t size, int flags); 52extern int cap_inode_setxattr(struct dentry *dentry, char *name, void *value, size_t size, int flags);
53extern int cap_inode_removexattr(struct dentry *dentry, char *name); 53extern int cap_inode_removexattr(struct dentry *dentry, char *name);
54extern int cap_inode_need_killpriv(struct dentry *dentry);
55extern int cap_inode_killpriv(struct dentry *dentry);
54extern int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags); 56extern int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags);
55extern void cap_task_reparent_to_init (struct task_struct *p); 57extern void cap_task_reparent_to_init (struct task_struct *p);
58extern int cap_task_kill(struct task_struct *p, struct siginfo *info, int sig, u32 secid);
59extern int cap_task_setscheduler (struct task_struct *p, int policy, struct sched_param *lp);
60extern int cap_task_setioprio (struct task_struct *p, int ioprio);
61extern int cap_task_setnice (struct task_struct *p, int nice);
56extern int cap_syslog (int type); 62extern int cap_syslog (int type);
57extern int cap_vm_enough_memory(struct mm_struct *mm, long pages); 63extern int cap_vm_enough_memory(struct mm_struct *mm, long pages);
58 64
@@ -413,6 +419,18 @@ struct request_sock;
413 * is specified by @buffer_size. @buffer may be NULL to request 419 * is specified by @buffer_size. @buffer may be NULL to request
414 * the size of the buffer required. 420 * the size of the buffer required.
415 * Returns number of bytes used/required on success. 421 * Returns number of bytes used/required on success.
422 * @inode_need_killpriv:
423 * Called when an inode has been changed.
424 * @dentry is the dentry being changed.
425 * Return <0 on error to abort the inode change operation.
426 * Return 0 if inode_killpriv does not need to be called.
427 * Return >0 if inode_killpriv does need to be called.
428 * @inode_killpriv:
429 * The setuid bit is being removed. Remove similar security labels.
430 * Called with the dentry->d_inode->i_mutex held.
431 * @dentry is the dentry being changed.
432 * Return 0 on success. If error is returned, then the operation
433 * causing setuid bit removal is failed.
416 * 434 *
417 * Security hooks for file operations 435 * Security hooks for file operations
418 * 436 *
@@ -1239,6 +1257,8 @@ struct security_operations {
1239 int (*inode_getxattr) (struct dentry *dentry, char *name); 1257 int (*inode_getxattr) (struct dentry *dentry, char *name);
1240 int (*inode_listxattr) (struct dentry *dentry); 1258 int (*inode_listxattr) (struct dentry *dentry);
1241 int (*inode_removexattr) (struct dentry *dentry, char *name); 1259 int (*inode_removexattr) (struct dentry *dentry, char *name);
1260 int (*inode_need_killpriv) (struct dentry *dentry);
1261 int (*inode_killpriv) (struct dentry *dentry);
1242 const char *(*inode_xattr_getsuffix) (void); 1262 const char *(*inode_xattr_getsuffix) (void);
1243 int (*inode_getsecurity)(const struct inode *inode, const char *name, void *buffer, size_t size, int err); 1263 int (*inode_getsecurity)(const struct inode *inode, const char *name, void *buffer, size_t size, int err);
1244 int (*inode_setsecurity)(struct inode *inode, const char *name, const void *value, size_t size, int flags); 1264 int (*inode_setsecurity)(struct inode *inode, const char *name, const void *value, size_t size, int flags);
@@ -1496,6 +1516,8 @@ void security_inode_post_setxattr(struct dentry *dentry, char *name,
1496int security_inode_getxattr(struct dentry *dentry, char *name); 1516int security_inode_getxattr(struct dentry *dentry, char *name);
1497int security_inode_listxattr(struct dentry *dentry); 1517int security_inode_listxattr(struct dentry *dentry);
1498int security_inode_removexattr(struct dentry *dentry, char *name); 1518int security_inode_removexattr(struct dentry *dentry, char *name);
1519int security_inode_need_killpriv(struct dentry *dentry);
1520int security_inode_killpriv(struct dentry *dentry);
1499const char *security_inode_xattr_getsuffix(void); 1521const char *security_inode_xattr_getsuffix(void);
1500int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err); 1522int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err);
1501int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags); 1523int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags);
@@ -1891,6 +1913,16 @@ static inline int security_inode_removexattr (struct dentry *dentry, char *name)
1891 return cap_inode_removexattr(dentry, name); 1913 return cap_inode_removexattr(dentry, name);
1892} 1914}
1893 1915
1916static inline int security_inode_need_killpriv(struct dentry *dentry)
1917{
1918 return cap_inode_need_killpriv(dentry);
1919}
1920
1921static inline int security_inode_killpriv(struct dentry *dentry)
1922{
1923 return cap_inode_killpriv(dentry);
1924}
1925
1894static inline const char *security_inode_xattr_getsuffix (void) 1926static inline const char *security_inode_xattr_getsuffix (void)
1895{ 1927{
1896 return NULL ; 1928 return NULL ;
@@ -2035,12 +2067,12 @@ static inline int security_task_setgroups (struct group_info *group_info)
2035 2067
2036static inline int security_task_setnice (struct task_struct *p, int nice) 2068static inline int security_task_setnice (struct task_struct *p, int nice)
2037{ 2069{
2038 return 0; 2070 return cap_task_setnice(p, nice);
2039} 2071}
2040 2072
2041static inline int security_task_setioprio (struct task_struct *p, int ioprio) 2073static inline int security_task_setioprio (struct task_struct *p, int ioprio)
2042{ 2074{
2043 return 0; 2075 return cap_task_setioprio(p, ioprio);
2044} 2076}
2045 2077
2046static inline int security_task_getioprio (struct task_struct *p) 2078static inline int security_task_getioprio (struct task_struct *p)
@@ -2058,7 +2090,7 @@ static inline int security_task_setscheduler (struct task_struct *p,
2058 int policy, 2090 int policy,
2059 struct sched_param *lp) 2091 struct sched_param *lp)
2060{ 2092{
2061 return 0; 2093 return cap_task_setscheduler(p, policy, lp);
2062} 2094}
2063 2095
2064static inline int security_task_getscheduler (struct task_struct *p) 2096static inline int security_task_getscheduler (struct task_struct *p)
@@ -2075,7 +2107,7 @@ static inline int security_task_kill (struct task_struct *p,
2075 struct siginfo *info, int sig, 2107 struct siginfo *info, int sig,
2076 u32 secid) 2108 u32 secid)
2077{ 2109{
2078 return 0; 2110 return cap_task_kill(p, info, sig, secid);
2079} 2111}
2080 2112
2081static inline int security_task_wait (struct task_struct *p) 2113static inline int security_task_wait (struct task_struct *p)