Skip to content

Commit

Permalink
security: remove dead hook task_setgid
Browse files Browse the repository at this point in the history
Unused hook.  Remove.

Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>
  • Loading branch information
eparis authored and James Morris committed Apr 12, 2010
1 parent 43ed8c3 commit 06ad187
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 47 deletions.
20 changes: 0 additions & 20 deletions include/linux/security.h
Expand Up @@ -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
* @flags contains one of the LSM_SETID_* values.
* 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:
* Check permission before setting the process group identifier of the
* process @p to @pgid.
Expand Down Expand Up @@ -1526,7 +1514,6 @@ struct security_operations {
int (*kernel_module_request)(char *kmod_name);
int (*task_fix_setuid) (struct cred *new, const struct cred *old,
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_getpgid) (struct task_struct *p);
int (*task_getsid) (struct task_struct *p);
Expand Down Expand Up @@ -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_task_fix_setuid(struct cred *new, const struct cred *old,
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_getpgid(struct task_struct *p);
int security_task_getsid(struct task_struct *p);
Expand Down Expand Up @@ -2323,12 +2309,6 @@ static inline int security_task_fix_setuid(struct cred *new,
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)
{
return 0;
Expand Down
16 changes: 0 additions & 16 deletions kernel/sys.c
Expand Up @@ -491,10 +491,6 @@ SYSCALL_DEFINE2(setregid, gid_t, rgid, gid_t, egid)
return -ENOMEM;
old = current_cred();

retval = security_task_setgid(rgid, egid, (gid_t)-1, LSM_SETID_RE);
if (retval)
goto error;

retval = -EPERM;
if (rgid != (gid_t) -1) {
if (old->gid == rgid ||
Expand Down Expand Up @@ -542,10 +538,6 @@ SYSCALL_DEFINE1(setgid, gid_t, gid)
return -ENOMEM;
old = current_cred();

retval = security_task_setgid(gid, (gid_t)-1, (gid_t)-1, LSM_SETID_ID);
if (retval)
goto error;

retval = -EPERM;
if (capable(CAP_SETGID))
new->gid = new->egid = new->sgid = new->fsgid = gid;
Expand Down Expand Up @@ -776,10 +768,6 @@ SYSCALL_DEFINE3(setresgid, gid_t, rgid, gid_t, egid, gid_t, sgid)
return -ENOMEM;
old = current_cred();

retval = security_task_setgid(rgid, egid, sgid, LSM_SETID_RES);
if (retval)
goto error;

retval = -EPERM;
if (!capable(CAP_SETGID)) {
if (rgid != (gid_t) -1 && rgid != old->gid &&
Expand Down Expand Up @@ -872,9 +860,6 @@ SYSCALL_DEFINE1(setfsgid, gid_t, gid)
old = current_cred();
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 ||
gid == old->sgid || gid == old->fsgid ||
capable(CAP_SETGID)) {
Expand All @@ -884,7 +869,6 @@ SYSCALL_DEFINE1(setfsgid, gid_t, gid)
}
}

error:
abort_creds(new);
return old_fsgid;

Expand Down
6 changes: 0 additions & 6 deletions security/capability.c
Expand Up @@ -392,11 +392,6 @@ static int cap_kernel_module_request(char *kmod_name)
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)
{
return 0;
Expand Down Expand Up @@ -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_module_request);
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_getpgid);
set_to_cap_if_null(ops, task_getsid);
Expand Down
5 changes: 0 additions & 5 deletions security/security.c
Expand Up @@ -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);
}

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)
{
return security_ops->task_setpgid(p, pgid);
Expand Down

0 comments on commit 06ad187

Please sign in to comment.