Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
@@ -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.
@@ -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);
@@ -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);
@@ -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;
+0 −16
Original line number Diff line number Diff line
@@ -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 ||
@@ -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;
@@ -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 &&
@@ -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)) {
@@ -884,7 +869,6 @@ SYSCALL_DEFINE1(setfsgid, gid_t, gid)
		}
	}

error:
	abort_creds(new);
	return old_fsgid;

+0 −6
Original line number Diff line number Diff line
@@ -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;
@@ -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);
+0 −5
Original line number Diff line number Diff line
@@ -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);