Skip to content

Commit 06ad187

Browse files
eparisxjamesmorris
authored andcommitted
security: remove dead hook task_setgid
Unused hook. Remove. Signed-off-by: Eric Paris <eparis@redhat.com> Signed-off-by: James Morris <jmorris@namei.org>
1 parent 43ed8c3 commit 06ad187

4 files changed

Lines changed: 0 additions & 47 deletions

File tree

‎include/linux/security.h‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -683,18 +683,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
683683
* @old is the set of credentials that are being replaces
684684
* @flags contains one of the LSM_SETID_* values.
685685
* Return 0 on success.
686-
* @task_setgid:
687-
* Check permission before setting one or more of the group identity
688-
* attributes of the current process. The @flags parameter indicates
689-
* which of the set*gid system calls invoked this hook and how to
690-
* interpret the @id0, @id1, and @id2 parameters. See the LSM_SETID
691-
* definitions at the beginning of this file for the @flags values and
692-
* their meanings.
693-
* @id0 contains a gid.
694-
* @id1 contains a gid.
695-
* @id2 contains a gid.
696-
* @flags contains one of the LSM_SETID_* values.
697-
* Return 0 if permission is granted.
698686
* @task_setpgid:
699687
* Check permission before setting the process group identifier of the
700688
* process @p to @pgid.
@@ -1526,7 +1514,6 @@ struct security_operations {
15261514
int (*kernel_module_request)(char *kmod_name);
15271515
int (*task_fix_setuid) (struct cred *new, const struct cred *old,
15281516
int flags);
1529-
int (*task_setgid) (gid_t id0, gid_t id1, gid_t id2, int flags);
15301517
int (*task_setpgid) (struct task_struct *p, pid_t pgid);
15311518
int (*task_getpgid) (struct task_struct *p);
15321519
int (*task_getsid) (struct task_struct *p);
@@ -1782,7 +1769,6 @@ int security_kernel_create_files_as(struct cred *new, struct inode *inode);
17821769
int security_kernel_module_request(char *kmod_name);
17831770
int security_task_fix_setuid(struct cred *new, const struct cred *old,
17841771
int flags);
1785-
int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags);
17861772
int security_task_setpgid(struct task_struct *p, pid_t pgid);
17871773
int security_task_getpgid(struct task_struct *p);
17881774
int security_task_getsid(struct task_struct *p);
@@ -2323,12 +2309,6 @@ static inline int security_task_fix_setuid(struct cred *new,
23232309
return cap_task_fix_setuid(new, old, flags);
23242310
}
23252311

2326-
static inline int security_task_setgid(gid_t id0, gid_t id1, gid_t id2,
2327-
int flags)
2328-
{
2329-
return 0;
2330-
}
2331-
23322312
static inline int security_task_setpgid(struct task_struct *p, pid_t pgid)
23332313
{
23342314
return 0;

‎kernel/sys.c‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,6 @@ SYSCALL_DEFINE2(setregid, gid_t, rgid, gid_t, egid)
491491
return -ENOMEM;
492492
old = current_cred();
493493

494-
retval = security_task_setgid(rgid, egid, (gid_t)-1, LSM_SETID_RE);
495-
if (retval)
496-
goto error;
497-
498494
retval = -EPERM;
499495
if (rgid != (gid_t) -1) {
500496
if (old->gid == rgid ||
@@ -542,10 +538,6 @@ SYSCALL_DEFINE1(setgid, gid_t, gid)
542538
return -ENOMEM;
543539
old = current_cred();
544540

545-
retval = security_task_setgid(gid, (gid_t)-1, (gid_t)-1, LSM_SETID_ID);
546-
if (retval)
547-
goto error;
548-
549541
retval = -EPERM;
550542
if (capable(CAP_SETGID))
551543
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)
776768
return -ENOMEM;
777769
old = current_cred();
778770

779-
retval = security_task_setgid(rgid, egid, sgid, LSM_SETID_RES);
780-
if (retval)
781-
goto error;
782-
783771
retval = -EPERM;
784772
if (!capable(CAP_SETGID)) {
785773
if (rgid != (gid_t) -1 && rgid != old->gid &&
@@ -872,9 +860,6 @@ SYSCALL_DEFINE1(setfsgid, gid_t, gid)
872860
old = current_cred();
873861
old_fsgid = old->fsgid;
874862

875-
if (security_task_setgid(gid, (gid_t)-1, (gid_t)-1, LSM_SETID_FS))
876-
goto error;
877-
878863
if (gid == old->gid || gid == old->egid ||
879864
gid == old->sgid || gid == old->fsgid ||
880865
capable(CAP_SETGID)) {
@@ -884,7 +869,6 @@ SYSCALL_DEFINE1(setfsgid, gid_t, gid)
884869
}
885870
}
886871

887-
error:
888872
abort_creds(new);
889873
return old_fsgid;
890874

‎security/capability.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,6 @@ static int cap_kernel_module_request(char *kmod_name)
392392
return 0;
393393
}
394394

395-
static int cap_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags)
396-
{
397-
return 0;
398-
}
399-
400395
static int cap_task_setpgid(struct task_struct *p, pid_t pgid)
401396
{
402397
return 0;
@@ -968,7 +963,6 @@ void security_fixup_ops(struct security_operations *ops)
968963
set_to_cap_if_null(ops, kernel_create_files_as);
969964
set_to_cap_if_null(ops, kernel_module_request);
970965
set_to_cap_if_null(ops, task_fix_setuid);
971-
set_to_cap_if_null(ops, task_setgid);
972966
set_to_cap_if_null(ops, task_setpgid);
973967
set_to_cap_if_null(ops, task_getpgid);
974968
set_to_cap_if_null(ops, task_getsid);

‎security/security.c‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -738,11 +738,6 @@ int security_task_fix_setuid(struct cred *new, const struct cred *old,
738738
return security_ops->task_fix_setuid(new, old, flags);
739739
}
740740

741-
int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags)
742-
{
743-
return security_ops->task_setgid(id0, id1, id2, flags);
744-
}
745-
746741
int security_task_setpgid(struct task_struct *p, pid_t pgid)
747742
{
748743
return security_ops->task_setpgid(p, pgid);

0 commit comments

Comments
 (0)