2001-09-01 18:11:45 +00:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 2001 The FreeBSD Project
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2003-06-10 21:29:12 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
2006-03-19 11:10:33 +00:00
|
|
|
#include "opt_compat.h"
|
|
|
|
|
2008-03-31 12:01:21 +00:00
|
|
|
#include <sys/fcntl.h>
|
2001-09-01 18:11:45 +00:00
|
|
|
#include <sys/param.h>
|
2012-05-05 19:42:38 +00:00
|
|
|
#include <sys/kernel.h>
|
2002-04-13 23:11:23 +00:00
|
|
|
#include <sys/lock.h>
|
2002-09-05 08:13:20 +00:00
|
|
|
#include <sys/malloc.h>
|
2002-04-13 23:11:23 +00:00
|
|
|
#include <sys/mutex.h>
|
2006-11-06 13:42:10 +00:00
|
|
|
#include <sys/priv.h>
|
2001-09-01 18:11:45 +00:00
|
|
|
#include <sys/proc.h>
|
2012-05-05 19:42:38 +00:00
|
|
|
#include <sys/sdt.h>
|
2002-09-01 22:30:27 +00:00
|
|
|
#include <sys/syscallsubr.h>
|
2001-09-01 18:11:45 +00:00
|
|
|
#include <sys/sysproto.h>
|
2002-09-05 08:13:20 +00:00
|
|
|
#include <sys/systm.h>
|
2001-09-01 18:11:45 +00:00
|
|
|
|
2005-01-14 04:44:56 +00:00
|
|
|
#ifdef COMPAT_LINUX32
|
2004-08-16 07:28:16 +00:00
|
|
|
#include <machine/../linux32/linux.h>
|
|
|
|
#include <machine/../linux32/linux32_proto.h>
|
2005-01-14 04:44:56 +00:00
|
|
|
#else
|
|
|
|
#include <machine/../linux/linux.h>
|
|
|
|
#include <machine/../linux/linux_proto.h>
|
2004-08-16 07:28:16 +00:00
|
|
|
#endif
|
2002-09-05 08:13:20 +00:00
|
|
|
|
2012-05-05 19:42:38 +00:00
|
|
|
#include <compat/linux/linux_dtrace.h>
|
2001-09-01 18:11:45 +00:00
|
|
|
#include <compat/linux/linux_util.h>
|
|
|
|
|
2012-05-05 19:42:38 +00:00
|
|
|
/* DTrace init */
|
|
|
|
LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* DTrace probes in this module.
|
|
|
|
*/
|
|
|
|
LIN_SDT_PROBE_DEFINE3(uid16, linux_chown16, entry, "char *", "l_uid16_t",
|
|
|
|
"l_gid16_t");
|
|
|
|
LIN_SDT_PROBE_DEFINE1(uid16, linux_chown16, conv_path, "char *");
|
|
|
|
LIN_SDT_PROBE_DEFINE1(uid16, linux_chown16, return, "int");
|
|
|
|
LIN_SDT_PROBE_DEFINE3(uid16, linux_lchown16, entry, "char *", "l_uid16_t",
|
|
|
|
"l_gid16_t");
|
|
|
|
LIN_SDT_PROBE_DEFINE1(uid16, linux_lchown16, conv_path, "char *");
|
|
|
|
LIN_SDT_PROBE_DEFINE1(uid16, linux_lchown16, return, "int");
|
|
|
|
LIN_SDT_PROBE_DEFINE2(uid16, linux_setgroups16, entry, "l_uint", "l_gid16_t *");
|
|
|
|
LIN_SDT_PROBE_DEFINE1(uid16, linux_setgroups16, copyin_error, "int");
|
|
|
|
LIN_SDT_PROBE_DEFINE1(uid16, linux_setgroups16, priv_check_cred_error, "int");
|
|
|
|
LIN_SDT_PROBE_DEFINE1(uid16, linux_setgroups16, return, "int");
|
|
|
|
LIN_SDT_PROBE_DEFINE2(uid16, linux_getgroups16, entry, "l_uint", "l_gid16_t *");
|
|
|
|
LIN_SDT_PROBE_DEFINE1(uid16, linux_getgroups16, copyout_error, "int");
|
|
|
|
LIN_SDT_PROBE_DEFINE1(uid16, linux_getgroups16, return, "int");
|
|
|
|
LIN_SDT_PROBE_DEFINE0(uid16, linux_getgid16, entry);
|
|
|
|
LIN_SDT_PROBE_DEFINE1(uid16, linux_getgid16, return, "int");
|
|
|
|
LIN_SDT_PROBE_DEFINE0(uid16, linux_getuid16, entry);
|
|
|
|
LIN_SDT_PROBE_DEFINE1(uid16, linux_getuid16, return, "int");
|
|
|
|
LIN_SDT_PROBE_DEFINE0(uid16, linux_getegid16, entry);
|
|
|
|
LIN_SDT_PROBE_DEFINE1(uid16, linux_getegid16, return, "int");
|
|
|
|
LIN_SDT_PROBE_DEFINE0(uid16, linux_geteuid16, entry);
|
|
|
|
LIN_SDT_PROBE_DEFINE1(uid16, linux_geteuid16, return, "int");
|
|
|
|
LIN_SDT_PROBE_DEFINE1(uid16, linux_setgid16, entry, "l_gid16_t");
|
|
|
|
LIN_SDT_PROBE_DEFINE1(uid16, linux_setgid16, return, "int");
|
|
|
|
LIN_SDT_PROBE_DEFINE1(uid16, linux_setuid16, entry, "l_uid16_t");
|
|
|
|
LIN_SDT_PROBE_DEFINE1(uid16, linux_setuid16, return, "int");
|
2013-10-01 15:40:27 +00:00
|
|
|
LIN_SDT_PROBE_DEFINE2(uid16, linux_setregid16, entry, "l_gid16_t", "l_gid16_t");
|
2012-05-05 19:42:38 +00:00
|
|
|
LIN_SDT_PROBE_DEFINE1(uid16, linux_setregid16, return, "int");
|
|
|
|
LIN_SDT_PROBE_DEFINE2(uid16, linux_setreuid16, entry, "l_uid16_t", "l_uid16_t");
|
|
|
|
LIN_SDT_PROBE_DEFINE1(uid16, linux_setreuid16, return, "int");
|
|
|
|
LIN_SDT_PROBE_DEFINE3(uid16, linux_setresgid16, entry, "l_gid16_t", "l_gid16_t",
|
|
|
|
"l_gid16_t");
|
|
|
|
LIN_SDT_PROBE_DEFINE1(uid16, linux_setresgid16, return, "int");
|
|
|
|
LIN_SDT_PROBE_DEFINE3(uid16, linux_setresuid16, entry, "l_uid16_t", "l_uid16_t",
|
|
|
|
"l_uid16_t");
|
|
|
|
LIN_SDT_PROBE_DEFINE1(uid16, linux_setresuid16, return, "int");
|
|
|
|
|
2001-09-01 18:11:45 +00:00
|
|
|
DUMMY(setfsuid16);
|
|
|
|
DUMMY(setfsgid16);
|
|
|
|
DUMMY(getresuid16);
|
|
|
|
DUMMY(getresgid16);
|
|
|
|
|
2002-09-01 22:30:27 +00:00
|
|
|
#define CAST_NOCHG(x) ((x == 0xFFFF) ? -1 : x)
|
2001-10-14 03:56:53 +00:00
|
|
|
|
2001-09-01 18:11:45 +00:00
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_chown16(struct thread *td, struct linux_chown16_args *args)
|
2001-09-01 18:11:45 +00:00
|
|
|
{
|
2002-09-01 22:30:27 +00:00
|
|
|
char *path;
|
|
|
|
int error;
|
2001-09-01 18:11:45 +00:00
|
|
|
|
2002-09-01 22:30:27 +00:00
|
|
|
LCONVPATHEXIST(td, args->path, &path);
|
2001-09-01 18:11:45 +00:00
|
|
|
|
2012-05-05 19:42:38 +00:00
|
|
|
/*
|
|
|
|
* The DTrace probes have to be after the LCONVPATHEXIST, as
|
|
|
|
* LCONVPATHEXIST may return on its own and we do not want to
|
|
|
|
* have a stray entry without the corresponding return.
|
|
|
|
*/
|
|
|
|
LIN_SDT_PROBE3(uid16, linux_chown16, entry, args->path, args->uid,
|
|
|
|
args->gid);
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_chown16, conv_path, path);
|
|
|
|
|
2014-11-13 18:01:51 +00:00
|
|
|
error = kern_fchownat(td, AT_FDCWD, path, UIO_SYSSPACE,
|
|
|
|
CAST_NOCHG(args->uid), CAST_NOCHG(args->gid), 0);
|
2002-09-01 22:30:27 +00:00
|
|
|
LFREEPATH(path);
|
2012-05-05 19:42:38 +00:00
|
|
|
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_chown16, return, error);
|
2002-09-01 22:30:27 +00:00
|
|
|
return (error);
|
2001-09-01 18:11:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_lchown16(struct thread *td, struct linux_lchown16_args *args)
|
2001-09-01 18:11:45 +00:00
|
|
|
{
|
2002-09-01 22:30:27 +00:00
|
|
|
char *path;
|
|
|
|
int error;
|
2001-09-01 18:11:45 +00:00
|
|
|
|
2002-09-01 22:30:27 +00:00
|
|
|
LCONVPATHEXIST(td, args->path, &path);
|
2001-09-01 18:11:45 +00:00
|
|
|
|
2012-05-05 19:42:38 +00:00
|
|
|
/*
|
|
|
|
* The DTrace probes have to be after the LCONVPATHEXIST, as
|
|
|
|
* LCONVPATHEXIST may return on its own and we do not want to
|
|
|
|
* have a stray entry without the corresponding return.
|
|
|
|
*/
|
|
|
|
LIN_SDT_PROBE3(uid16, linux_lchown16, entry, args->path, args->uid,
|
|
|
|
args->gid);
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_lchown16, conv_path, path);
|
|
|
|
|
2014-11-13 18:01:51 +00:00
|
|
|
error = kern_fchownat(td, AT_FDCWD, path, UIO_SYSSPACE,
|
|
|
|
CAST_NOCHG(args->uid), CAST_NOCHG(args->gid), AT_SYMLINK_NOFOLLOW);
|
2002-09-01 22:30:27 +00:00
|
|
|
LFREEPATH(path);
|
2012-05-05 19:42:38 +00:00
|
|
|
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_lchown16, return, error);
|
2002-09-01 22:30:27 +00:00
|
|
|
return (error);
|
2001-09-01 18:11:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_setgroups16(struct thread *td, struct linux_setgroups16_args *args)
|
2001-09-01 18:11:45 +00:00
|
|
|
{
|
|
|
|
struct ucred *newcred, *oldcred;
|
2009-06-19 17:10:35 +00:00
|
|
|
l_gid16_t *linux_gidset;
|
2001-09-01 18:11:45 +00:00
|
|
|
gid_t *bsd_gidset;
|
|
|
|
int ngrp, error;
|
2002-04-13 23:11:23 +00:00
|
|
|
struct proc *p;
|
2001-09-01 18:11:45 +00:00
|
|
|
|
2012-05-05 19:42:38 +00:00
|
|
|
LIN_SDT_PROBE2(uid16, linux_setgroups16, entry, args->gidsetsize,
|
|
|
|
args->gidset);
|
2001-09-01 18:11:45 +00:00
|
|
|
|
|
|
|
ngrp = args->gidsetsize;
|
2012-05-05 19:42:38 +00:00
|
|
|
if (ngrp < 0 || ngrp >= ngroups_max + 1) {
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_setgroups16, return, EINVAL);
|
2002-04-13 23:11:23 +00:00
|
|
|
return (EINVAL);
|
2012-05-05 19:42:38 +00:00
|
|
|
}
|
2009-06-19 17:10:35 +00:00
|
|
|
linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_TEMP, M_WAITOK);
|
2003-03-03 09:14:26 +00:00
|
|
|
error = copyin(args->gidset, linux_gidset, ngrp * sizeof(l_gid16_t));
|
2011-10-11 13:40:37 +00:00
|
|
|
if (error) {
|
2012-05-05 19:42:38 +00:00
|
|
|
LIN_SDT_PROBE1(uid16, linux_setgroups16, copyin_error, error);
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_setgroups16, return, error);
|
2011-10-11 10:32:23 +00:00
|
|
|
free(linux_gidset, M_TEMP);
|
2002-04-13 23:11:23 +00:00
|
|
|
return (error);
|
2011-10-11 13:40:37 +00:00
|
|
|
}
|
2002-04-13 23:11:23 +00:00
|
|
|
newcred = crget();
|
|
|
|
p = td->td_proc;
|
|
|
|
PROC_LOCK(p);
|
2009-06-19 17:10:35 +00:00
|
|
|
oldcred = crcopysafe(p, newcred);
|
2001-09-01 18:11:45 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* cr_groups[0] holds egid. Setting the whole set from
|
|
|
|
* the supplied set will cause egid to be changed too.
|
|
|
|
* Keep cr_groups[0] unchanged to prevent that.
|
|
|
|
*/
|
|
|
|
|
2007-06-12 00:12:01 +00:00
|
|
|
if ((error = priv_check_cred(oldcred, PRIV_CRED_SETGROUPS, 0)) != 0) {
|
2002-04-13 23:11:23 +00:00
|
|
|
PROC_UNLOCK(p);
|
|
|
|
crfree(newcred);
|
2012-05-05 19:42:38 +00:00
|
|
|
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_setgroups16, priv_check_cred_error,
|
|
|
|
error);
|
2009-06-19 17:10:35 +00:00
|
|
|
goto out;
|
2002-04-13 23:11:23 +00:00
|
|
|
}
|
2001-09-01 18:11:45 +00:00
|
|
|
|
|
|
|
if (ngrp > 0) {
|
|
|
|
newcred->cr_ngroups = ngrp + 1;
|
|
|
|
|
|
|
|
bsd_gidset = newcred->cr_groups;
|
|
|
|
ngrp--;
|
|
|
|
while (ngrp >= 0) {
|
|
|
|
bsd_gidset[ngrp + 1] = linux_gidset[ngrp];
|
|
|
|
ngrp--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
newcred->cr_ngroups = 1;
|
|
|
|
|
2001-09-12 08:38:13 +00:00
|
|
|
setsugid(td->td_proc);
|
2002-04-13 23:11:23 +00:00
|
|
|
p->p_ucred = newcred;
|
|
|
|
PROC_UNLOCK(p);
|
2001-09-01 18:11:45 +00:00
|
|
|
crfree(oldcred);
|
2009-06-19 17:10:35 +00:00
|
|
|
error = 0;
|
|
|
|
out:
|
|
|
|
free(linux_gidset, M_TEMP);
|
2012-05-05 19:42:38 +00:00
|
|
|
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_setgroups16, return, error);
|
2009-06-19 17:10:35 +00:00
|
|
|
return (error);
|
2001-09-01 18:11:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_getgroups16(struct thread *td, struct linux_getgroups16_args *args)
|
2001-09-01 18:11:45 +00:00
|
|
|
{
|
|
|
|
struct ucred *cred;
|
2009-06-19 17:10:35 +00:00
|
|
|
l_gid16_t *linux_gidset;
|
2001-09-01 18:11:45 +00:00
|
|
|
gid_t *bsd_gidset;
|
|
|
|
int bsd_gidsetsz, ngrp, error;
|
|
|
|
|
2012-05-05 19:42:38 +00:00
|
|
|
LIN_SDT_PROBE2(uid16, linux_getgroups16, entry, args->gidsetsize,
|
|
|
|
args->gidset);
|
2001-09-01 18:11:45 +00:00
|
|
|
|
2002-02-27 18:32:23 +00:00
|
|
|
cred = td->td_ucred;
|
2001-09-01 18:11:45 +00:00
|
|
|
bsd_gidset = cred->cr_groups;
|
|
|
|
bsd_gidsetsz = cred->cr_ngroups - 1;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* cr_groups[0] holds egid. Returning the whole set
|
|
|
|
* here will cause a duplicate. Exclude cr_groups[0]
|
|
|
|
* to prevent that.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if ((ngrp = args->gidsetsize) == 0) {
|
2001-09-12 08:38:13 +00:00
|
|
|
td->td_retval[0] = bsd_gidsetsz;
|
2012-05-05 19:42:38 +00:00
|
|
|
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_getgroups16, return, 0);
|
2001-09-01 18:11:45 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2012-05-05 19:42:38 +00:00
|
|
|
if (ngrp < bsd_gidsetsz) {
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_getgroups16, return, EINVAL);
|
2001-09-01 18:11:45 +00:00
|
|
|
return (EINVAL);
|
2012-05-05 19:42:38 +00:00
|
|
|
}
|
2001-09-01 18:11:45 +00:00
|
|
|
|
|
|
|
ngrp = 0;
|
2009-06-19 17:10:35 +00:00
|
|
|
linux_gidset = malloc(bsd_gidsetsz * sizeof(*linux_gidset),
|
|
|
|
M_TEMP, M_WAITOK);
|
2001-09-01 18:11:45 +00:00
|
|
|
while (ngrp < bsd_gidsetsz) {
|
|
|
|
linux_gidset[ngrp] = bsd_gidset[ngrp + 1];
|
|
|
|
ngrp++;
|
|
|
|
}
|
|
|
|
|
2003-03-03 09:14:26 +00:00
|
|
|
error = copyout(linux_gidset, args->gidset, ngrp * sizeof(l_gid16_t));
|
2009-06-19 17:10:35 +00:00
|
|
|
free(linux_gidset, M_TEMP);
|
2012-05-05 19:42:38 +00:00
|
|
|
if (error) {
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_getgroups16, copyout_error, error);
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_getgroups16, return, error);
|
2001-09-01 18:11:45 +00:00
|
|
|
return (error);
|
2012-05-05 19:42:38 +00:00
|
|
|
}
|
2001-09-01 18:11:45 +00:00
|
|
|
|
2001-09-12 08:38:13 +00:00
|
|
|
td->td_retval[0] = ngrp;
|
2012-05-05 19:42:38 +00:00
|
|
|
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_getgroups16, return, 0);
|
2001-09-01 18:11:45 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2001-09-12 08:38:13 +00:00
|
|
|
* The FreeBSD native getgid(2) and getuid(2) also modify td->td_retval[1]
|
2007-02-24 16:49:25 +00:00
|
|
|
* when COMPAT_43 is defined. This clobbers registers that are assumed to
|
|
|
|
* be preserved. The following lightweight syscalls fixes this. See also
|
|
|
|
* linux_getpid(2), linux_getgid(2) and linux_getuid(2) in linux_misc.c
|
2001-09-01 18:11:45 +00:00
|
|
|
*
|
|
|
|
* linux_getgid16() - MP SAFE
|
|
|
|
* linux_getuid16() - MP SAFE
|
|
|
|
*/
|
|
|
|
|
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_getgid16(struct thread *td, struct linux_getgid16_args *args)
|
2001-09-01 18:11:45 +00:00
|
|
|
{
|
2001-09-12 08:38:13 +00:00
|
|
|
|
2012-05-05 19:42:38 +00:00
|
|
|
LIN_SDT_PROBE0(uid16, linux_getgid16, entry);
|
|
|
|
|
2002-02-27 18:32:23 +00:00
|
|
|
td->td_retval[0] = td->td_ucred->cr_rgid;
|
2012-05-05 19:42:38 +00:00
|
|
|
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_getgid16, return, 0);
|
2001-09-01 18:11:45 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_getuid16(struct thread *td, struct linux_getuid16_args *args)
|
2001-09-01 18:11:45 +00:00
|
|
|
{
|
2001-09-12 08:38:13 +00:00
|
|
|
|
2012-05-05 19:42:38 +00:00
|
|
|
LIN_SDT_PROBE0(uid16, linux_getuid16, entry);
|
|
|
|
|
2002-02-27 18:32:23 +00:00
|
|
|
td->td_retval[0] = td->td_ucred->cr_ruid;
|
2012-05-05 19:42:38 +00:00
|
|
|
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_getuid16, return, 0);
|
2001-09-01 18:11:45 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_getegid16(struct thread *td, struct linux_getegid16_args *args)
|
2001-09-01 18:11:45 +00:00
|
|
|
{
|
|
|
|
struct getegid_args bsd;
|
2012-05-05 19:42:38 +00:00
|
|
|
int error;
|
|
|
|
|
|
|
|
LIN_SDT_PROBE0(uid16, linux_getegid16, entry);
|
|
|
|
|
|
|
|
error = sys_getegid(td, &bsd);
|
2001-09-01 18:11:45 +00:00
|
|
|
|
2012-05-05 19:42:38 +00:00
|
|
|
LIN_SDT_PROBE1(uid16, linux_getegid16, return, error);
|
|
|
|
return (error);
|
2001-09-01 18:11:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_geteuid16(struct thread *td, struct linux_geteuid16_args *args)
|
2001-09-01 18:11:45 +00:00
|
|
|
{
|
|
|
|
struct geteuid_args bsd;
|
2012-05-05 19:42:38 +00:00
|
|
|
int error;
|
|
|
|
|
|
|
|
LIN_SDT_PROBE0(uid16, linux_geteuid16, entry);
|
|
|
|
|
|
|
|
error = sys_geteuid(td, &bsd);
|
2001-09-01 18:11:45 +00:00
|
|
|
|
2012-05-05 19:42:38 +00:00
|
|
|
LIN_SDT_PROBE1(uid16, linux_geteuid16, return, error);
|
|
|
|
return (error);
|
2001-09-01 18:11:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_setgid16(struct thread *td, struct linux_setgid16_args *args)
|
2001-09-01 18:11:45 +00:00
|
|
|
{
|
|
|
|
struct setgid_args bsd;
|
2012-05-05 19:42:38 +00:00
|
|
|
int error;
|
|
|
|
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_setgid16, entry, args->gid);
|
2001-09-01 18:11:45 +00:00
|
|
|
|
|
|
|
bsd.gid = args->gid;
|
2012-05-05 19:42:38 +00:00
|
|
|
error = sys_setgid(td, &bsd);
|
|
|
|
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_setgid16, return, error);
|
|
|
|
return (error);
|
2001-09-01 18:11:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_setuid16(struct thread *td, struct linux_setuid16_args *args)
|
2001-09-01 18:11:45 +00:00
|
|
|
{
|
|
|
|
struct setuid_args bsd;
|
2012-05-05 19:42:38 +00:00
|
|
|
int error;
|
|
|
|
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_setuid16, entry, args->uid);
|
2001-09-01 18:11:45 +00:00
|
|
|
|
|
|
|
bsd.uid = args->uid;
|
2012-05-05 19:42:38 +00:00
|
|
|
error = sys_setuid(td, &bsd);
|
|
|
|
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_setuid16, return, error);
|
|
|
|
return (error);
|
2001-09-01 18:11:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_setregid16(struct thread *td, struct linux_setregid16_args *args)
|
2001-09-01 18:11:45 +00:00
|
|
|
{
|
|
|
|
struct setregid_args bsd;
|
2012-05-05 19:42:38 +00:00
|
|
|
int error;
|
|
|
|
|
|
|
|
LIN_SDT_PROBE2(uid16, linux_setregid16, entry, args->rgid, args->egid);
|
2001-09-01 18:11:45 +00:00
|
|
|
|
2001-10-14 03:56:53 +00:00
|
|
|
bsd.rgid = CAST_NOCHG(args->rgid);
|
|
|
|
bsd.egid = CAST_NOCHG(args->egid);
|
2012-05-05 19:42:38 +00:00
|
|
|
error = sys_setregid(td, &bsd);
|
|
|
|
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_setregid16, return, error);
|
|
|
|
return (error);
|
2001-09-01 18:11:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_setreuid16(struct thread *td, struct linux_setreuid16_args *args)
|
2001-09-01 18:11:45 +00:00
|
|
|
{
|
|
|
|
struct setreuid_args bsd;
|
2012-05-05 19:42:38 +00:00
|
|
|
int error;
|
|
|
|
|
|
|
|
LIN_SDT_PROBE2(uid16, linux_setreuid16, entry, args->ruid, args->euid);
|
2001-09-01 18:11:45 +00:00
|
|
|
|
2001-10-14 03:56:53 +00:00
|
|
|
bsd.ruid = CAST_NOCHG(args->ruid);
|
|
|
|
bsd.euid = CAST_NOCHG(args->euid);
|
2012-05-05 19:42:38 +00:00
|
|
|
error = sys_setreuid(td, &bsd);
|
|
|
|
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_setreuid16, return, error);
|
|
|
|
return (error);
|
2001-09-01 18:11:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_setresgid16(struct thread *td, struct linux_setresgid16_args *args)
|
2001-09-01 18:11:45 +00:00
|
|
|
{
|
|
|
|
struct setresgid_args bsd;
|
2012-05-05 19:42:38 +00:00
|
|
|
int error;
|
|
|
|
|
|
|
|
LIN_SDT_PROBE3(uid16, linux_setresgid16, entry, args->rgid, args->egid,
|
|
|
|
args->sgid);
|
2001-09-01 18:11:45 +00:00
|
|
|
|
2001-10-14 03:56:53 +00:00
|
|
|
bsd.rgid = CAST_NOCHG(args->rgid);
|
|
|
|
bsd.egid = CAST_NOCHG(args->egid);
|
|
|
|
bsd.sgid = CAST_NOCHG(args->sgid);
|
2012-05-05 19:42:38 +00:00
|
|
|
error = sys_setresgid(td, &bsd);
|
|
|
|
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_setresgid16, return, error);
|
|
|
|
return (error);
|
2001-09-01 18:11:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_setresuid16(struct thread *td, struct linux_setresuid16_args *args)
|
2001-09-01 18:11:45 +00:00
|
|
|
{
|
|
|
|
struct setresuid_args bsd;
|
2012-05-05 19:42:38 +00:00
|
|
|
int error;
|
|
|
|
|
|
|
|
LIN_SDT_PROBE3(uid16, linux_setresuid16, entry, args->ruid, args->euid,
|
|
|
|
args->suid);
|
2001-09-01 18:11:45 +00:00
|
|
|
|
2001-10-14 03:56:53 +00:00
|
|
|
bsd.ruid = CAST_NOCHG(args->ruid);
|
|
|
|
bsd.euid = CAST_NOCHG(args->euid);
|
|
|
|
bsd.suid = CAST_NOCHG(args->suid);
|
2012-05-05 19:42:38 +00:00
|
|
|
error = sys_setresuid(td, &bsd);
|
|
|
|
|
|
|
|
LIN_SDT_PROBE1(uid16, linux_setresuid16, return, error);
|
|
|
|
return (error);
|
2001-09-01 18:11:45 +00:00
|
|
|
}
|