Commit 06ad187e authored by Eric Paris's avatar Eric Paris Committed by James Morris

security: remove dead hook task_setgid

Unused hook.  Remove.
Signed-off-by: default avatarEric Paris <eparis@redhat.com>
Signed-off-by: default avatarJames Morris <jmorris@namei.org>
parent 43ed8c3b
...@@ -683,18 +683,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) ...@@ -683,18 +683,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
* @old is the set of credentials that are being replaces * @old is the set of credentials that are being replaces
* @flags contains one of the LSM_SETID_* values. * @flags contains one of the LSM_SETID_* values.
* Return 0 on success. * Return 0 on success.
* @task_setgid:
* Check permission before setting one or more of the group identity
* attributes of the current process. The @flags parameter indicates
* which of the set*gid system calls invoked this hook and how to
* interpret the @id0, @id1, and @id2 parameters. See the LSM_SETID
* definitions at the beginning of this file for the @flags values and
* their meanings.
* @id0 contains a gid.
* @id1 contains a gid.
* @id2 contains a gid.
* @flags contains one of the LSM_SETID_* values.
* Return 0 if permission is granted.
* @task_setpgid: * @task_setpgid:
* Check permission before setting the process group identifier of the * Check permission before setting the process group identifier of the
* process @p to @pgid. * process @p to @pgid.
...@@ -1526,7 +1514,6 @@ struct security_operations { ...@@ -1526,7 +1514,6 @@ struct security_operations {
int (*kernel_module_request)(char *kmod_name); int (*kernel_module_request)(char *kmod_name);
int (*task_fix_setuid) (struct cred *new, const struct cred *old, int (*task_fix_setuid) (struct cred *new, const struct cred *old,
int flags); int flags);
int (*task_setgid) (gid_t id0, gid_t id1, gid_t id2, int flags);
int (*task_setpgid) (struct task_struct *p, pid_t pgid); int (*task_setpgid) (struct task_struct *p, pid_t pgid);
int (*task_getpgid) (struct task_struct *p); int (*task_getpgid) (struct task_struct *p);
int (*task_getsid) (struct task_struct *p); int (*task_getsid) (struct task_struct *p);
...@@ -1782,7 +1769,6 @@ int security_kernel_create_files_as(struct cred *new, struct inode *inode); ...@@ -1782,7 +1769,6 @@ int security_kernel_create_files_as(struct cred *new, struct inode *inode);
int security_kernel_module_request(char *kmod_name); int security_kernel_module_request(char *kmod_name);
int security_task_fix_setuid(struct cred *new, const struct cred *old, int security_task_fix_setuid(struct cred *new, const struct cred *old,
int flags); int flags);
int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags);
int security_task_setpgid(struct task_struct *p, pid_t pgid); int security_task_setpgid(struct task_struct *p, pid_t pgid);
int security_task_getpgid(struct task_struct *p); int security_task_getpgid(struct task_struct *p);
int security_task_getsid(struct task_struct *p); int security_task_getsid(struct task_struct *p);
...@@ -2323,12 +2309,6 @@ static inline int security_task_fix_setuid(struct cred *new, ...@@ -2323,12 +2309,6 @@ static inline int security_task_fix_setuid(struct cred *new,
return cap_task_fix_setuid(new, old, flags); return cap_task_fix_setuid(new, old, flags);
} }
static inline int security_task_setgid(gid_t id0, gid_t id1, gid_t id2,
int flags)
{
return 0;
}
static inline int security_task_setpgid(struct task_struct *p, pid_t pgid) static inline int security_task_setpgid(struct task_struct *p, pid_t pgid)
{ {
return 0; return 0;
......
...@@ -491,10 +491,6 @@ SYSCALL_DEFINE2(setregid, gid_t, rgid, gid_t, egid) ...@@ -491,10 +491,6 @@ SYSCALL_DEFINE2(setregid, gid_t, rgid, gid_t, egid)
return -ENOMEM; return -ENOMEM;
old = current_cred(); old = current_cred();
retval = security_task_setgid(rgid, egid, (gid_t)-1, LSM_SETID_RE);
if (retval)
goto error;
retval = -EPERM; retval = -EPERM;
if (rgid != (gid_t) -1) { if (rgid != (gid_t) -1) {
if (old->gid == rgid || if (old->gid == rgid ||
...@@ -542,10 +538,6 @@ SYSCALL_DEFINE1(setgid, gid_t, gid) ...@@ -542,10 +538,6 @@ SYSCALL_DEFINE1(setgid, gid_t, gid)
return -ENOMEM; return -ENOMEM;
old = current_cred(); old = current_cred();
retval = security_task_setgid(gid, (gid_t)-1, (gid_t)-1, LSM_SETID_ID);
if (retval)
goto error;
retval = -EPERM; retval = -EPERM;
if (capable(CAP_SETGID)) if (capable(CAP_SETGID))
new->gid = new->egid = new->sgid = new->fsgid = gid; new->gid = new->egid = new->sgid = new->fsgid = gid;
...@@ -776,10 +768,6 @@ SYSCALL_DEFINE3(setresgid, gid_t, rgid, gid_t, egid, gid_t, sgid) ...@@ -776,10 +768,6 @@ SYSCALL_DEFINE3(setresgid, gid_t, rgid, gid_t, egid, gid_t, sgid)
return -ENOMEM; return -ENOMEM;
old = current_cred(); old = current_cred();
retval = security_task_setgid(rgid, egid, sgid, LSM_SETID_RES);
if (retval)
goto error;
retval = -EPERM; retval = -EPERM;
if (!capable(CAP_SETGID)) { if (!capable(CAP_SETGID)) {
if (rgid != (gid_t) -1 && rgid != old->gid && if (rgid != (gid_t) -1 && rgid != old->gid &&
...@@ -872,9 +860,6 @@ SYSCALL_DEFINE1(setfsgid, gid_t, gid) ...@@ -872,9 +860,6 @@ SYSCALL_DEFINE1(setfsgid, gid_t, gid)
old = current_cred(); old = current_cred();
old_fsgid = old->fsgid; old_fsgid = old->fsgid;
if (security_task_setgid(gid, (gid_t)-1, (gid_t)-1, LSM_SETID_FS))
goto error;
if (gid == old->gid || gid == old->egid || if (gid == old->gid || gid == old->egid ||
gid == old->sgid || gid == old->fsgid || gid == old->sgid || gid == old->fsgid ||
capable(CAP_SETGID)) { capable(CAP_SETGID)) {
...@@ -884,7 +869,6 @@ SYSCALL_DEFINE1(setfsgid, gid_t, gid) ...@@ -884,7 +869,6 @@ SYSCALL_DEFINE1(setfsgid, gid_t, gid)
} }
} }
error:
abort_creds(new); abort_creds(new);
return old_fsgid; return old_fsgid;
......
...@@ -392,11 +392,6 @@ static int cap_kernel_module_request(char *kmod_name) ...@@ -392,11 +392,6 @@ static int cap_kernel_module_request(char *kmod_name)
return 0; return 0;
} }
static int cap_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags)
{
return 0;
}
static int cap_task_setpgid(struct task_struct *p, pid_t pgid) static int cap_task_setpgid(struct task_struct *p, pid_t pgid)
{ {
return 0; return 0;
...@@ -968,7 +963,6 @@ void security_fixup_ops(struct security_operations *ops) ...@@ -968,7 +963,6 @@ void security_fixup_ops(struct security_operations *ops)
set_to_cap_if_null(ops, kernel_create_files_as); set_to_cap_if_null(ops, kernel_create_files_as);
set_to_cap_if_null(ops, kernel_module_request); set_to_cap_if_null(ops, kernel_module_request);
set_to_cap_if_null(ops, task_fix_setuid); set_to_cap_if_null(ops, task_fix_setuid);
set_to_cap_if_null(ops, task_setgid);
set_to_cap_if_null(ops, task_setpgid); set_to_cap_if_null(ops, task_setpgid);
set_to_cap_if_null(ops, task_getpgid); set_to_cap_if_null(ops, task_getpgid);
set_to_cap_if_null(ops, task_getsid); set_to_cap_if_null(ops, task_getsid);
......
...@@ -738,11 +738,6 @@ int security_task_fix_setuid(struct cred *new, const struct cred *old, ...@@ -738,11 +738,6 @@ int security_task_fix_setuid(struct cred *new, const struct cred *old,
return security_ops->task_fix_setuid(new, old, flags); return security_ops->task_fix_setuid(new, old, flags);
} }
int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags)
{
return security_ops->task_setgid(id0, id1, id2, flags);
}
int security_task_setpgid(struct task_struct *p, pid_t pgid) int security_task_setpgid(struct task_struct *p, pid_t pgid)
{ {
return security_ops->task_setpgid(p, pgid); return security_ops->task_setpgid(p, pgid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment