Merge branch 'for-linus' of git://selinuxproject.org/~jmorris/linux-security
[platform/adaptation/renesas_rcar/renesas_kernel.git] / include / linux / security.h
index 0ccceb9..83c18e8 100644 (file)
@@ -54,8 +54,8 @@ struct user_namespace;
  * These functions are in security/capability.c and are used
  * as the default capabilities functions
  */
-extern int cap_capable(struct task_struct *tsk, const struct cred *cred,
-                      struct user_namespace *ns, int cap, int audit);
+extern int cap_capable(const struct cred *cred, struct user_namespace *ns,
+                      int cap, int audit);
 extern int cap_settime(const struct timespec *ts, const struct timezone *tz);
 extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode);
 extern int cap_ptrace_traceme(struct task_struct *parent);
@@ -96,7 +96,6 @@ struct xfrm_user_sec_ctx;
 struct seq_file;
 
 extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
-extern int cap_netlink_recv(struct sk_buff *skb, int cap);
 
 void reset_security_ops(void);
 
@@ -799,12 +798,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
  *     @skb contains the sk_buff structure for the netlink message.
  *     Return 0 if the information was successfully saved and message
  *     is allowed to be transmitted.
- * @netlink_recv:
- *     Check permission before processing the received netlink message in
- *     @skb.
- *     @skb contains the sk_buff structure for the netlink message.
- *     @cap indicates the capability required
- *     Return 0 if permission is granted.
  *
  * Security hooks for Unix domain networking.
  *
@@ -1268,7 +1261,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
  * @capable:
  *     Check whether the @tsk process has the @cap capability in the indicated
  *     credentials.
- *     @tsk contains the task_struct for the process.
  *     @cred contains the credentials to use.
  *     @ns contains the user namespace we want the capability in
  *     @cap contains the capability <include/linux/capability.h>.
@@ -1392,8 +1384,8 @@ struct security_operations {
                       const kernel_cap_t *effective,
                       const kernel_cap_t *inheritable,
                       const kernel_cap_t *permitted);
-       int (*capable) (struct task_struct *tsk, const struct cred *cred,
-                       struct user_namespace *ns, int cap, int audit);
+       int (*capable) (const struct cred *cred, struct user_namespace *ns,
+                       int cap, int audit);
        int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
        int (*quota_on) (struct dentry *dentry);
        int (*syslog) (int type);
@@ -1563,7 +1555,6 @@ struct security_operations {
                          struct sembuf *sops, unsigned nsops, int alter);
 
        int (*netlink_send) (struct sock *sk, struct sk_buff *skb);
-       int (*netlink_recv) (struct sk_buff *skb, int cap);
 
        void (*d_instantiate) (struct dentry *dentry, struct inode *inode);
 
@@ -1675,12 +1666,10 @@ int security_capset(struct cred *new, const struct cred *old,
                    const kernel_cap_t *effective,
                    const kernel_cap_t *inheritable,
                    const kernel_cap_t *permitted);
-int security_capable(struct user_namespace *ns, const struct cred *cred,
-                       int cap);
-int security_real_capable(struct task_struct *tsk, struct user_namespace *ns,
+int security_capable(const struct cred *cred, struct user_namespace *ns,
                        int cap);
-int security_real_capable_noaudit(struct task_struct *tsk,
-                       struct user_namespace *ns, int cap);
+int security_capable_noaudit(const struct cred *cred, struct user_namespace *ns,
+                            int cap);
 int security_quotactl(int cmds, int type, int id, struct super_block *sb);
 int security_quota_on(struct dentry *dentry);
 int security_syslog(int type);
@@ -1817,7 +1806,6 @@ void security_d_instantiate(struct dentry *dentry, struct inode *inode);
 int security_getprocattr(struct task_struct *p, char *name, char **value);
 int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size);
 int security_netlink_send(struct sock *sk, struct sk_buff *skb);
-int security_netlink_recv(struct sk_buff *skb, int cap);
 int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
 int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);
 void security_release_secctx(char *secdata, u32 seclen);
@@ -1875,32 +1863,15 @@ static inline int security_capset(struct cred *new,
        return cap_capset(new, old, effective, inheritable, permitted);
 }
 
-static inline int security_capable(struct user_namespace *ns,
-                                  const struct cred *cred, int cap)
-{
-       return cap_capable(current, cred, ns, cap, SECURITY_CAP_AUDIT);
-}
-
-static inline int security_real_capable(struct task_struct *tsk, struct user_namespace *ns, int cap)
+static inline int security_capable(const struct cred *cred,
+                                  struct user_namespace *ns, int cap)
 {
-       int ret;
-
-       rcu_read_lock();
-       ret = cap_capable(tsk, __task_cred(tsk), ns, cap, SECURITY_CAP_AUDIT);
-       rcu_read_unlock();
-       return ret;
+       return cap_capable(cred, ns, cap, SECURITY_CAP_AUDIT);
 }
 
-static inline
-int security_real_capable_noaudit(struct task_struct *tsk, struct user_namespace *ns, int cap)
-{
-       int ret;
-
-       rcu_read_lock();
-       ret = cap_capable(tsk, __task_cred(tsk), ns, cap,
-                              SECURITY_CAP_NOAUDIT);
-       rcu_read_unlock();
-       return ret;
+static inline int security_capable_noaudit(const struct cred *cred,
+                                          struct user_namespace *ns, int cap) {
+       return cap_capable(cred, ns, cap, SECURITY_CAP_NOAUDIT);
 }
 
 static inline int security_quotactl(int cmds, int type, int id,
@@ -2517,11 +2488,6 @@ static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb)
        return cap_netlink_send(sk, skb);
 }
 
-static inline int security_netlink_recv(struct sk_buff *skb, int cap)
-{
-       return cap_netlink_recv(skb, cap);
-}
-
 static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
 {
        return -EOPNOTSUPP;