linux: remove redundant SDT tracepoints

Remove all the 'entry' and 'return' probes; they clutter up the source
and are redundant to FBT.

Reviewed By:	dchagin
Sponsored By:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D30040
This commit is contained in:
Edward Tomasz Napierala 2021-05-05 13:58:54 +01:00
parent 2aca58e16f
commit 5e8caee259
5 changed files with 18 additions and 358 deletions

View File

@ -91,58 +91,32 @@ LIN_SDT_PROBE_DEFINE1(futex, futex, destroy, "struct sx *");
/**
* DTrace probes in this module.
*/
LIN_SDT_PROBE_DEFINE2(futex, futex_put, entry, "struct futex *",
"struct waiting_proc *");
LIN_SDT_PROBE_DEFINE3(futex, futex_put, destroy, "uint32_t *", "uint32_t",
"int");
LIN_SDT_PROBE_DEFINE3(futex, futex_put, unlock, "uint32_t *", "uint32_t",
"int");
LIN_SDT_PROBE_DEFINE0(futex, futex_put, return);
LIN_SDT_PROBE_DEFINE3(futex, futex_get0, entry, "uint32_t *", "struct futex **",
"uint32_t");
LIN_SDT_PROBE_DEFINE1(futex, futex_get0, umtx_key_get_error, "int");
LIN_SDT_PROBE_DEFINE3(futex, futex_get0, shared, "uint32_t *", "uint32_t",
"int");
LIN_SDT_PROBE_DEFINE1(futex, futex_get0, null, "uint32_t *");
LIN_SDT_PROBE_DEFINE3(futex, futex_get0, new, "uint32_t *", "uint32_t", "int");
LIN_SDT_PROBE_DEFINE1(futex, futex_get0, return, "int");
LIN_SDT_PROBE_DEFINE3(futex, futex_get, entry, "uint32_t *",
"struct waiting_proc **", "struct futex **");
LIN_SDT_PROBE_DEFINE0(futex, futex_get, error);
LIN_SDT_PROBE_DEFINE1(futex, futex_get, return, "int");
LIN_SDT_PROBE_DEFINE3(futex, futex_sleep, entry, "struct futex *",
"struct waiting_proc **", "struct timespec *");
LIN_SDT_PROBE_DEFINE5(futex, futex_sleep, requeue_error, "int", "uint32_t *",
"struct waiting_proc *", "uint32_t *", "uint32_t");
LIN_SDT_PROBE_DEFINE3(futex, futex_sleep, sleep_error, "int", "uint32_t *",
"struct waiting_proc *");
LIN_SDT_PROBE_DEFINE1(futex, futex_sleep, return, "int");
LIN_SDT_PROBE_DEFINE3(futex, futex_wake, entry, "struct futex *", "int",
"uint32_t");
LIN_SDT_PROBE_DEFINE3(futex, futex_wake, iterate, "uint32_t",
"struct waiting_proc *", "uint32_t");
LIN_SDT_PROBE_DEFINE1(futex, futex_wake, wakeup, "struct waiting_proc *");
LIN_SDT_PROBE_DEFINE1(futex, futex_wake, return, "int");
LIN_SDT_PROBE_DEFINE4(futex, futex_requeue, entry, "struct futex *", "int",
"struct futex *", "int");
LIN_SDT_PROBE_DEFINE1(futex, futex_requeue, wakeup, "struct waiting_proc *");
LIN_SDT_PROBE_DEFINE3(futex, futex_requeue, requeue, "uint32_t *",
"struct waiting_proc *", "uint32_t");
LIN_SDT_PROBE_DEFINE1(futex, futex_requeue, return, "int");
LIN_SDT_PROBE_DEFINE4(futex, futex_wait, entry, "struct futex *",
"struct waiting_proc **", "struct timespec *", "uint32_t");
LIN_SDT_PROBE_DEFINE1(futex, futex_wait, sleep_error, "int");
LIN_SDT_PROBE_DEFINE1(futex, futex_wait, return, "int");
LIN_SDT_PROBE_DEFINE3(futex, futex_atomic_op, entry, "struct thread *",
"int", "uint32_t");
LIN_SDT_PROBE_DEFINE4(futex, futex_atomic_op, decoded_op, "int", "int", "int",
"int");
LIN_SDT_PROBE_DEFINE0(futex, futex_atomic_op, missing_access_check);
LIN_SDT_PROBE_DEFINE1(futex, futex_atomic_op, unimplemented_op, "int");
LIN_SDT_PROBE_DEFINE1(futex, futex_atomic_op, unimplemented_cmp, "int");
LIN_SDT_PROBE_DEFINE1(futex, futex_atomic_op, return, "int");
LIN_SDT_PROBE_DEFINE2(futex, linux_sys_futex, entry, "struct thread *",
"struct linux_sys_futex_args *");
LIN_SDT_PROBE_DEFINE0(futex, linux_sys_futex, unimplemented_clockswitch);
LIN_SDT_PROBE_DEFINE1(futex, linux_sys_futex, copyin_error, "int");
LIN_SDT_PROBE_DEFINE0(futex, linux_sys_futex, invalid_cmp_requeue_use);
@ -166,28 +140,11 @@ LIN_SDT_PROBE_DEFINE0(futex, linux_sys_futex, deprecated_requeue);
LIN_SDT_PROBE_DEFINE0(futex, linux_sys_futex, unimplemented_wait_requeue_pi);
LIN_SDT_PROBE_DEFINE0(futex, linux_sys_futex, unimplemented_cmp_requeue_pi);
LIN_SDT_PROBE_DEFINE1(futex, linux_sys_futex, unknown_operation, "int");
LIN_SDT_PROBE_DEFINE1(futex, linux_sys_futex, return, "int");
LIN_SDT_PROBE_DEFINE2(futex, linux_set_robust_list, entry, "struct thread *",
"struct linux_set_robust_list_args *");
LIN_SDT_PROBE_DEFINE0(futex, linux_set_robust_list, size_error);
LIN_SDT_PROBE_DEFINE1(futex, linux_set_robust_list, return, "int");
LIN_SDT_PROBE_DEFINE2(futex, linux_get_robust_list, entry, "struct thread *",
"struct linux_get_robust_list_args *");
LIN_SDT_PROBE_DEFINE1(futex, linux_get_robust_list, copyout_error, "int");
LIN_SDT_PROBE_DEFINE1(futex, linux_get_robust_list, return, "int");
LIN_SDT_PROBE_DEFINE3(futex, handle_futex_death, entry,
"struct linux_emuldata *", "uint32_t *", "unsigned int");
LIN_SDT_PROBE_DEFINE1(futex, handle_futex_death, copyin_error, "int");
LIN_SDT_PROBE_DEFINE1(futex, handle_futex_death, return, "int");
LIN_SDT_PROBE_DEFINE3(futex, fetch_robust_entry, entry,
"struct linux_robust_list **", "struct linux_robust_list **",
"unsigned int *");
LIN_SDT_PROBE_DEFINE1(futex, fetch_robust_entry, copyin_error, "int");
LIN_SDT_PROBE_DEFINE1(futex, fetch_robust_entry, return, "int");
LIN_SDT_PROBE_DEFINE2(futex, release_futexes, entry, "struct thread *",
"struct linux_emuldata *");
LIN_SDT_PROBE_DEFINE1(futex, release_futexes, copyin_error, "int");
LIN_SDT_PROBE_DEFINE0(futex, release_futexes, return);
struct futex;
@ -298,7 +255,6 @@ futex_copyin_timeout(int op, struct l_timespec *luts, int clockrt,
static void
futex_put(struct futex *f, struct waiting_proc *wp)
{
LIN_SDT_PROBE2(futex, futex_put, entry, f, wp);
if (wp != NULL) {
if ((wp->wp_flags & FUTEX_WP_REMOVED) == 0)
@ -320,8 +276,6 @@ futex_put(struct futex *f, struct waiting_proc *wp)
umtx_key_release(&f->f_key);
FUTEX_DESTROY(f);
free(f, M_FUTEX);
LIN_SDT_PROBE0(futex, futex_put, return);
return;
}
@ -332,8 +286,6 @@ futex_put(struct futex *f, struct waiting_proc *wp)
if (FUTEX_LOCKED(f))
futex_unlock(f);
FUTEXES_UNLOCK;
LIN_SDT_PROBE0(futex, futex_put, return);
}
static int
@ -343,15 +295,12 @@ futex_get0(uint32_t *uaddr, struct futex **newf, uint32_t flags)
struct umtx_key key;
int error;
LIN_SDT_PROBE3(futex, futex_get0, entry, uaddr, newf, flags);
*newf = tmpf = NULL;
error = umtx_key_get(uaddr, TYPE_FUTEX, (flags & FUTEX_SHARED) ?
AUTO_SHARE : THREAD_SHARE, &key);
if (error) {
LIN_SDT_PROBE1(futex, futex_get0, umtx_key_get_error, error);
LIN_SDT_PROBE1(futex, futex_get0, return, error);
return (error);
}
retry:
@ -368,8 +317,6 @@ futex_get0(uint32_t *uaddr, struct futex **newf, uint32_t flags)
FUTEXES_UNLOCK;
umtx_key_release(&key);
LIN_SDT_PROBE1(futex, futex_get0, return,
EINVAL);
return (EINVAL);
}
@ -389,7 +336,6 @@ futex_get0(uint32_t *uaddr, struct futex **newf, uint32_t flags)
LINUX_CTR3(sys_futex, "futex_get uaddr %p ref %d shared %d",
uaddr, f->f_refcount, f->f_key.shared);
LIN_SDT_PROBE1(futex, futex_get0, return, 0);
return (0);
}
}
@ -400,7 +346,6 @@ futex_get0(uint32_t *uaddr, struct futex **newf, uint32_t flags)
LIN_SDT_PROBE1(futex, futex_get0, null, uaddr);
LINUX_CTR1(sys_futex, "futex_get uaddr %p null", uaddr);
LIN_SDT_PROBE1(futex, futex_get0, return, 0);
return (0);
}
@ -432,7 +377,6 @@ futex_get0(uint32_t *uaddr, struct futex **newf, uint32_t flags)
uaddr, tmpf->f_refcount, tmpf->f_key.shared);
*newf = tmpf;
LIN_SDT_PROBE1(futex, futex_get0, return, 0);
return (0);
}
@ -442,8 +386,6 @@ futex_get(uint32_t *uaddr, struct waiting_proc **wp, struct futex **f,
{
int error;
LIN_SDT_PROBE3(futex, futex_get, entry, uaddr, wp, f);
if (flags & FUTEX_CREATE_WP) {
*wp = malloc(sizeof(struct waiting_proc), M_FUTEX_WP, M_WAITOK);
(*wp)->wp_flags = 0;
@ -455,7 +397,6 @@ futex_get(uint32_t *uaddr, struct waiting_proc **wp, struct futex **f,
if (flags & FUTEX_CREATE_WP)
free(*wp, M_FUTEX_WP);
LIN_SDT_PROBE1(futex, futex_get, return, error);
return (error);
}
if (flags & FUTEX_CREATE_WP) {
@ -463,7 +404,6 @@ futex_get(uint32_t *uaddr, struct waiting_proc **wp, struct futex **f,
(*wp)->wp_futex = *f;
}
LIN_SDT_PROBE1(futex, futex_get, return, error);
return (error);
}
@ -512,7 +452,6 @@ futex_sleep(struct futex *f, struct waiting_proc *wp, struct timespec *ts)
sbt = 0;
prec = 0;
}
LIN_SDT_PROBE3(futex, futex_sleep, entry, f, wp, sbt);
LINUX_CTR4(sys_futex, "futex_sleep enter uaddr %p wp %p timo %ld ref %d",
f->f_uaddr, wp, sbt, f->f_refcount);
@ -544,7 +483,6 @@ futex_sleep(struct futex *f, struct waiting_proc *wp, struct timespec *ts)
futex_put(f, wp);
LIN_SDT_PROBE1(futex, futex_sleep, return, error);
return (error);
}
@ -554,12 +492,8 @@ futex_wake(struct futex *f, int n, uint32_t bitset)
struct waiting_proc *wp, *wpt;
int count = 0;
LIN_SDT_PROBE3(futex, futex_wake, entry, f, n, bitset);
if (bitset == 0) {
LIN_SDT_PROBE1(futex, futex_wake, return, EINVAL);
if (bitset == 0)
return (EINVAL);
}
FUTEX_ASSERT_LOCKED(f);
TAILQ_FOREACH_SAFE(wp, &f->f_waiting_proc, wp_list, wpt) {
@ -582,7 +516,6 @@ futex_wake(struct futex *f, int n, uint32_t bitset)
break;
}
LIN_SDT_PROBE1(futex, futex_wake, return, count);
return (count);
}
@ -592,8 +525,6 @@ futex_requeue(struct futex *f, int n, struct futex *f2, int n2)
struct waiting_proc *wp, *wpt;
int count = 0;
LIN_SDT_PROBE4(futex, futex_requeue, entry, f, n, f2, n2);
FUTEX_ASSERT_LOCKED(f);
FUTEX_ASSERT_LOCKED(f2);
@ -629,7 +560,6 @@ futex_requeue(struct futex *f, int n, struct futex *f2, int n2)
}
}
LIN_SDT_PROBE1(futex, futex_requeue, return, count);
return (count);
}
@ -639,10 +569,7 @@ futex_wait(struct futex *f, struct waiting_proc *wp, struct timespec *ts,
{
int error;
LIN_SDT_PROBE4(futex, futex_wait, entry, f, wp, ts, bitset);
if (bitset == 0) {
LIN_SDT_PROBE1(futex, futex_wait, return, EINVAL);
futex_put(f, wp);
return (EINVAL);
}
@ -654,7 +581,6 @@ futex_wait(struct futex *f, struct waiting_proc *wp, struct timespec *ts,
if (error == EWOULDBLOCK)
error = ETIMEDOUT;
LIN_SDT_PROBE1(futex, futex_wait, return, error);
return (error);
}
@ -667,8 +593,6 @@ futex_atomic_op(struct thread *td, int encoded_op, uint32_t *uaddr)
int cmparg = (encoded_op << 20) >> 20;
int oldval = 0, ret;
LIN_SDT_PROBE3(futex, futex_atomic_op, entry, td, encoded_op, uaddr);
if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
oparg = 1 << oparg;
@ -700,10 +624,8 @@ futex_atomic_op(struct thread *td, int encoded_op, uint32_t *uaddr)
break;
}
if (ret) {
LIN_SDT_PROBE1(futex, futex_atomic_op, return, ret);
if (ret)
return (ret);
}
switch (cmp) {
case FUTEX_OP_CMP_EQ:
@ -729,7 +651,6 @@ futex_atomic_op(struct thread *td, int encoded_op, uint32_t *uaddr)
ret = -ENOSYS;
}
LIN_SDT_PROBE1(futex, futex_atomic_op, return, ret);
return (ret);
}
@ -744,8 +665,6 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
int error, save;
uint32_t flags, val;
LIN_SDT_PROBE2(futex, linux_sys_futex, entry, td, args);
if (args->op & LINUX_FUTEX_PRIVATE_FLAG) {
flags = 0;
args->op &= ~LINUX_FUTEX_PRIVATE_FLAG;
@ -764,7 +683,6 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
args->op != LINUX_FUTEX_WAIT_REQUEUE_PI) {
LIN_SDT_PROBE0(futex, linux_sys_futex,
unimplemented_clockswitch);
LIN_SDT_PROBE1(futex, linux_sys_futex, return, ENOSYS);
return (ENOSYS);
}
@ -788,7 +706,6 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
if (error) {
LIN_SDT_PROBE1(futex, linux_sys_futex, copyin_error,
error);
LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
return (error);
}
ts = &uts;
@ -798,10 +715,8 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
retry0:
error = futex_get(args->uaddr, &wp, &f,
flags | FUTEX_CREATE_WP);
if (error) {
LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
if (error)
return (error);
}
error = copyin_nofault(args->uaddr, &val, sizeof(val));
if (error) {
@ -813,7 +728,6 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
error);
LINUX_CTR1(sys_futex, "WAIT copyin failed %d",
error);
LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
return (error);
}
if (val != args->val) {
@ -824,9 +738,6 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
"WAIT uaddr %p val 0x%x != uval 0x%x",
args->uaddr, args->val, val);
futex_put(f, wp);
LIN_SDT_PROBE1(futex, linux_sys_futex, return,
EWOULDBLOCK);
return (EWOULDBLOCK);
}
@ -845,15 +756,11 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
error = futex_get(args->uaddr, NULL, &f,
flags | FUTEX_DONTCREATE);
if (error) {
LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
if (error)
return (error);
}
if (f == NULL) {
td->td_retval[0] = 0;
LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
return (error);
}
td->td_retval[0] = futex_wake(f, args->val, args->val3);
@ -876,16 +783,13 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
if (args->uaddr == args->uaddr2) {
LIN_SDT_PROBE0(futex, linux_sys_futex,
invalid_cmp_requeue_use);
LIN_SDT_PROBE1(futex, linux_sys_futex, return, EINVAL);
return (EINVAL);
}
retry1:
error = futex_get(args->uaddr, NULL, &f, flags | FUTEX_DONTLOCK);
if (error) {
LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
if (error)
return (error);
}
/*
* To avoid deadlocks return EINVAL if second futex
@ -898,8 +802,6 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
flags | FUTEX_DONTEXISTS | FUTEX_DONTLOCK);
if (error) {
futex_put(f, NULL);
LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
return (error);
}
futex_lock(f);
@ -915,7 +817,6 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
error);
LINUX_CTR1(sys_futex, "CMP_REQUEUE copyin failed %d",
error);
LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
return (error);
}
if (val != args->val3) {
@ -925,8 +826,6 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
args->val, val);
futex_put(f2, NULL);
futex_put(f, NULL);
LIN_SDT_PROBE1(futex, linux_sys_futex, return, EAGAIN);
return (EAGAIN);
}
@ -944,23 +843,17 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
args->uaddr, args->val, args->uaddr2, args->val3,
args->timeout);
if (args->uaddr == args->uaddr2) {
LIN_SDT_PROBE1(futex, linux_sys_futex, return, EINVAL);
if (args->uaddr == args->uaddr2)
return (EINVAL);
}
retry2:
error = futex_get(args->uaddr, NULL, &f, flags | FUTEX_DONTLOCK);
if (error) {
LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
if (error)
return (error);
}
error = futex_get(args->uaddr2, NULL, &f2, flags | FUTEX_DONTLOCK);
if (error) {
futex_put(f, NULL);
LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
return (error);
}
futex_lock(f);
@ -984,7 +877,6 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
error = copyin(args->uaddr2, &val, sizeof(val));
if (error == 0)
goto retry2;
LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
return (error);
}
@ -1015,7 +907,6 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
LIN_SDT_PROBE0(futex, linux_sys_futex,
unimplemented_lock_pi);
}
LIN_SDT_PROBE1(futex, linux_sys_futex, return, ENOSYS);
return (ENOSYS);
case LINUX_FUTEX_UNLOCK_PI:
@ -1027,7 +918,6 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
LIN_SDT_PROBE0(futex, linux_sys_futex,
unimplemented_unlock_pi);
}
LIN_SDT_PROBE1(futex, linux_sys_futex, return, ENOSYS);
return (ENOSYS);
case LINUX_FUTEX_TRYLOCK_PI:
@ -1039,7 +929,6 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
LIN_SDT_PROBE0(futex, linux_sys_futex,
unimplemented_trylock_pi);
}
LIN_SDT_PROBE1(futex, linux_sys_futex, return, ENOSYS);
return (ENOSYS);
case LINUX_FUTEX_REQUEUE:
@ -1056,8 +945,6 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
LIN_SDT_PROBE0(futex, linux_sys_futex,
deprecated_requeue);
}
LIN_SDT_PROBE1(futex, linux_sys_futex, return, EINVAL);
return (EINVAL);
case LINUX_FUTEX_WAIT_REQUEUE_PI:
@ -1069,7 +956,6 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
LIN_SDT_PROBE0(futex, linux_sys_futex,
unimplemented_wait_requeue_pi);
}
LIN_SDT_PROBE1(futex, linux_sys_futex, return, ENOSYS);
return (ENOSYS);
case LINUX_FUTEX_CMP_REQUEUE_PI:
@ -1081,18 +967,15 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
LIN_SDT_PROBE0(futex, linux_sys_futex,
unimplemented_cmp_requeue_pi);
}
LIN_SDT_PROBE1(futex, linux_sys_futex, return, ENOSYS);
return (ENOSYS);
default:
linux_msg(td, "unsupported futex op %d", args->op);
LIN_SDT_PROBE1(futex, linux_sys_futex, unknown_operation,
args->op);
LIN_SDT_PROBE1(futex, linux_sys_futex, return, ENOSYS);
return (ENOSYS);
}
LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
return (error);
}
@ -1101,18 +984,14 @@ linux_set_robust_list(struct thread *td, struct linux_set_robust_list_args *args
{
struct linux_emuldata *em;
LIN_SDT_PROBE2(futex, linux_set_robust_list, entry, td, args);
if (args->len != sizeof(struct linux_robust_list_head)) {
LIN_SDT_PROBE0(futex, linux_set_robust_list, size_error);
LIN_SDT_PROBE1(futex, linux_set_robust_list, return, EINVAL);
return (EINVAL);
}
em = em_find(td);
em->robust_futexes = args->head;
LIN_SDT_PROBE1(futex, linux_set_robust_list, return, 0);
return (0);
}
@ -1125,22 +1004,15 @@ linux_get_robust_list(struct thread *td, struct linux_get_robust_list_args *args
struct thread *td2;
int error = 0;
LIN_SDT_PROBE2(futex, linux_get_robust_list, entry, td, args);
if (!args->pid) {
em = em_find(td);
KASSERT(em != NULL, ("get_robust_list: emuldata notfound.\n"));
head = em->robust_futexes;
} else {
td2 = tdfind(args->pid, -1);
if (td2 == NULL) {
LIN_SDT_PROBE1(futex, linux_get_robust_list, return,
ESRCH);
if (td2 == NULL)
return (ESRCH);
}
if (SV_PROC_ABI(td2->td_proc) != SV_ABI_LINUX) {
LIN_SDT_PROBE1(futex, linux_get_robust_list, return,
EPERM);
PROC_UNLOCK(td2->td_proc);
return (EPERM);
}
@ -1152,9 +1024,6 @@ linux_get_robust_list(struct thread *td, struct linux_get_robust_list_args *args
priv_check(td, PRIV_CRED_SETEUID) ||
p_candebug(td, td2->td_proc)) {
PROC_UNLOCK(td2->td_proc);
LIN_SDT_PROBE1(futex, linux_get_robust_list, return,
EPERM);
return (EPERM);
}
head = em->robust_futexes;
@ -1166,7 +1035,6 @@ linux_get_robust_list(struct thread *td, struct linux_get_robust_list_args *args
if (error) {
LIN_SDT_PROBE1(futex, linux_get_robust_list, copyout_error,
error);
LIN_SDT_PROBE1(futex, linux_get_robust_list, return, EFAULT);
return (EFAULT);
}
@ -1176,7 +1044,6 @@ linux_get_robust_list(struct thread *td, struct linux_get_robust_list_args *args
error);
}
LIN_SDT_PROBE1(futex, linux_get_robust_list, return, error);
return (error);
}
@ -1188,24 +1055,18 @@ handle_futex_death(struct linux_emuldata *em, uint32_t *uaddr,
struct futex *f;
int error;
LIN_SDT_PROBE3(futex, handle_futex_death, entry, em, uaddr, pi);
retry:
error = copyin(uaddr, &uval, 4);
if (error) {
LIN_SDT_PROBE1(futex, handle_futex_death, copyin_error, error);
LIN_SDT_PROBE1(futex, handle_futex_death, return, EFAULT);
return (EFAULT);
}
if ((uval & FUTEX_TID_MASK) == em->em_tid) {
mval = (uval & FUTEX_WAITERS) | FUTEX_OWNER_DIED;
nval = casuword32(uaddr, uval, mval);
if (nval == -1) {
LIN_SDT_PROBE1(futex, handle_futex_death, return,
EFAULT);
if (nval == -1)
return (EFAULT);
}
if (nval != uval)
goto retry;
@ -1213,11 +1074,8 @@ handle_futex_death(struct linux_emuldata *em, uint32_t *uaddr,
if (!pi && (uval & FUTEX_WAITERS)) {
error = futex_get(uaddr, NULL, &f,
FUTEX_DONTCREATE | FUTEX_SHARED);
if (error) {
LIN_SDT_PROBE1(futex, handle_futex_death,
return, error);
if (error)
return (error);
}
if (f != NULL) {
futex_wake(f, 1, FUTEX_BITSET_MATCH_ANY);
futex_put(f, NULL);
@ -1225,7 +1083,6 @@ handle_futex_death(struct linux_emuldata *em, uint32_t *uaddr,
}
}
LIN_SDT_PROBE1(futex, handle_futex_death, return, 0);
return (0);
}
@ -1236,19 +1093,15 @@ fetch_robust_entry(struct linux_robust_list **entry,
l_ulong uentry;
int error;
LIN_SDT_PROBE3(futex, fetch_robust_entry, entry, entry, head, pi);
error = copyin((const void *)head, &uentry, sizeof(l_ulong));
if (error) {
LIN_SDT_PROBE1(futex, fetch_robust_entry, copyin_error, error);
LIN_SDT_PROBE1(futex, fetch_robust_entry, return, EFAULT);
return (EFAULT);
}
*entry = (void *)(uentry & ~1UL);
*pi = uentry & 1;
LIN_SDT_PROBE1(futex, fetch_robust_entry, return, 0);
return (0);
}
@ -1262,32 +1115,23 @@ release_futexes(struct thread *td, struct linux_emuldata *em)
l_long futex_offset;
int rc, error;
LIN_SDT_PROBE2(futex, release_futexes, entry, td, em);
head = em->robust_futexes;
if (head == NULL) {
LIN_SDT_PROBE0(futex, release_futexes, return);
if (head == NULL)
return;
}
if (fetch_robust_entry(&entry, PTRIN(&head->list.next), &pi)) {
LIN_SDT_PROBE0(futex, release_futexes, return);
if (fetch_robust_entry(&entry, PTRIN(&head->list.next), &pi))
return;
}
error = copyin(&head->futex_offset, &futex_offset,
sizeof(futex_offset));
if (error) {
LIN_SDT_PROBE1(futex, release_futexes, copyin_error, error);
LIN_SDT_PROBE0(futex, release_futexes, return);
return;
}
if (fetch_robust_entry(&pending, PTRIN(&head->pending_list), &pip)) {
LIN_SDT_PROBE0(futex, release_futexes, return);
if (fetch_robust_entry(&pending, PTRIN(&head->pending_list), &pip))
return;
}
while (entry != &head->list) {
rc = fetch_robust_entry(&next_entry, PTRIN(&entry->next), &next_pi);
@ -1295,13 +1139,10 @@ release_futexes(struct thread *td, struct linux_emuldata *em)
if (entry != pending)
if (handle_futex_death(em,
(uint32_t *)((caddr_t)entry + futex_offset), pi)) {
LIN_SDT_PROBE0(futex, release_futexes, return);
return;
}
if (rc) {
LIN_SDT_PROBE0(futex, release_futexes, return);
if (rc)
return;
}
entry = next_entry;
pi = next_pi;
@ -1314,6 +1155,4 @@ release_futexes(struct thread *td, struct linux_emuldata *em)
if (pending)
handle_futex_death(em, (uint32_t *)((caddr_t)pending + futex_offset), pip);
LIN_SDT_PROBE0(futex, release_futexes, return);
}

View File

@ -75,16 +75,10 @@ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
/**
* DTrace probes in this module.
*/
LIN_SDT_PROBE_DEFINE2(sysctl, handle_string, entry, "struct l___sysctl_args *",
"char *");
LIN_SDT_PROBE_DEFINE1(sysctl, handle_string, copyout_error, "int");
LIN_SDT_PROBE_DEFINE1(sysctl, handle_string, return, "int");
LIN_SDT_PROBE_DEFINE2(sysctl, linux_sysctl, entry, "struct l___sysctl_args *",
"struct thread *");
LIN_SDT_PROBE_DEFINE1(sysctl, linux_sysctl, copyin_error, "int");
LIN_SDT_PROBE_DEFINE2(sysctl, linux_sysctl, wrong_length, "int", "int");
LIN_SDT_PROBE_DEFINE1(sysctl, linux_sysctl, unsupported_sysctl, "char *");
LIN_SDT_PROBE_DEFINE1(sysctl, linux_sysctl, return, "int");
#ifdef LINUX_LEGACY_SYSCALLS
static int
@ -92,8 +86,6 @@ handle_string(struct l___sysctl_args *la, char *value)
{
int error;
LIN_SDT_PROBE2(sysctl, handle_string, entry, la, value);
if (la->oldval != 0) {
l_int len = strlen(value);
error = copyout(value, PTRIN(la->oldval), len + 1);
@ -102,17 +94,13 @@ handle_string(struct l___sysctl_args *la, char *value)
if (error) {
LIN_SDT_PROBE1(sysctl, handle_string, copyout_error,
error);
LIN_SDT_PROBE1(sysctl, handle_string, return, error);
return (error);
}
}
if (la->newval != 0) {
LIN_SDT_PROBE1(sysctl, handle_string, return, ENOTDIR);
if (la->newval != 0)
return (ENOTDIR);
}
LIN_SDT_PROBE1(sysctl, handle_string, return, 0);
return (0);
}
@ -125,19 +113,15 @@ linux_sysctl(struct thread *td, struct linux_sysctl_args *args)
char *sysctl_string;
int error, i;
LIN_SDT_PROBE2(sysctl, linux_sysctl, entry, td, args->args);
error = copyin(args->args, &la, sizeof(la));
if (error) {
LIN_SDT_PROBE1(sysctl, linux_sysctl, copyin_error, error);
LIN_SDT_PROBE1(sysctl, linux_sysctl, return, error);
return (error);
}
if (la.nlen <= 0 || la.nlen > LINUX_CTL_MAXNAME) {
LIN_SDT_PROBE2(sysctl, linux_sysctl, wrong_length, la.nlen,
LINUX_CTL_MAXNAME);
LIN_SDT_PROBE1(sysctl, linux_sysctl, return, ENOTDIR);
return (ENOTDIR);
}
@ -145,7 +129,6 @@ linux_sysctl(struct thread *td, struct linux_sysctl_args *args)
error = copyin(PTRIN(la.name), mib, la.nlen * sizeof(l_int));
if (error) {
LIN_SDT_PROBE1(sysctl, linux_sysctl, copyin_error, error);
LIN_SDT_PROBE1(sysctl, linux_sysctl, return, error);
free(mib, M_LINUX);
return (error);
}
@ -159,7 +142,6 @@ linux_sysctl(struct thread *td, struct linux_sysctl_args *args)
case LINUX_KERN_VERSION:
error = handle_string(&la, version);
free(mib, M_LINUX);
LIN_SDT_PROBE1(sysctl, linux_sysctl, return, error);
return (error);
default:
break;
@ -189,7 +171,6 @@ linux_sysctl(struct thread *td, struct linux_sysctl_args *args)
free(mib, M_LINUX);
LIN_SDT_PROBE1(sysctl, linux_sysctl, return, ENOTDIR);
return (ENOTDIR);
}
#endif

View File

@ -75,58 +75,33 @@ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
/**
* DTrace probes in this module.
*/
LIN_SDT_PROBE_DEFINE2(time, native_to_linux_timespec, entry,
"struct l_timespec *", "struct timespec *");
LIN_SDT_PROBE_DEFINE0(time, native_to_linux_timespec, return);
LIN_SDT_PROBE_DEFINE2(time, linux_to_native_timespec, entry,
"struct timespec *", "struct l_timespec *");
LIN_SDT_PROBE_DEFINE1(time, linux_to_native_timespec, return, "int");
LIN_SDT_PROBE_DEFINE2(time, linux_to_native_clockid, entry, "clockid_t *",
"clockid_t");
LIN_SDT_PROBE_DEFINE1(time, linux_to_native_clockid, unsupported_clockid,
"clockid_t");
LIN_SDT_PROBE_DEFINE1(time, linux_to_native_clockid, unknown_clockid,
"clockid_t");
LIN_SDT_PROBE_DEFINE1(time, linux_to_native_clockid, return, "int");
LIN_SDT_PROBE_DEFINE2(time, linux_clock_gettime, entry, "clockid_t",
"struct l_timespec *");
LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime, conversion_error, "int");
LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime, gettime_error, "int");
LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime, copyout_error, "int");
LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime, return, "int");
LIN_SDT_PROBE_DEFINE2(time, linux_clock_settime, entry, "clockid_t",
"struct l_timespec *");
LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, conversion_error, "int");
LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, settime_error, "int");
LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, copyin_error, "int");
LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, return, "int");
LIN_SDT_PROBE_DEFINE2(time, linux_clock_getres, entry, "clockid_t",
"struct l_timespec *");
LIN_SDT_PROBE_DEFINE0(time, linux_clock_getres, nullcall);
LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, conversion_error, "int");
LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, getres_error, "int");
LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, copyout_error, "int");
LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, return, "int");
LIN_SDT_PROBE_DEFINE2(time, linux_nanosleep, entry, "const struct l_timespec *",
"struct l_timespec *");
LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, conversion_error, "int");
LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, copyout_error, "int");
LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, copyin_error, "int");
LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, return, "int");
LIN_SDT_PROBE_DEFINE4(time, linux_clock_nanosleep, entry, "clockid_t", "int",
"struct l_timespec *", "struct l_timespec *");
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, conversion_error, "int");
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, copyout_error, "int");
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, copyin_error, "int");
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, unsupported_flags, "int");
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, unsupported_clockid, "int");
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, return, "int");
int
native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp)
{
LIN_SDT_PROBE2(time, native_to_linux_timespec, entry, ltp, ntp);
#ifdef COMPAT_LINUX32
if (ntp->tv_sec > INT_MAX || ntp->tv_sec < INT_MIN)
return (EOVERFLOW);
@ -134,7 +109,6 @@ native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp)
ltp->tv_sec = ntp->tv_sec;
ltp->tv_nsec = ntp->tv_nsec;
LIN_SDT_PROBE0(time, native_to_linux_timespec, return);
return (0);
}
@ -142,16 +116,11 @@ int
linux_to_native_timespec(struct timespec *ntp, struct l_timespec *ltp)
{
LIN_SDT_PROBE2(time, linux_to_native_timespec, entry, ntp, ltp);
if (ltp->tv_sec < 0 || ltp->tv_nsec < 0 || ltp->tv_nsec > 999999999) {
LIN_SDT_PROBE1(time, linux_to_native_timespec, return, EINVAL);
if (ltp->tv_sec < 0 || ltp->tv_nsec < 0 || ltp->tv_nsec > 999999999)
return (EINVAL);
}
ntp->tv_sec = ltp->tv_sec;
ntp->tv_nsec = ltp->tv_nsec;
LIN_SDT_PROBE1(time, linux_to_native_timespec, return, 0);
return (0);
}
@ -181,8 +150,6 @@ int
linux_to_native_clockid(clockid_t *n, clockid_t l)
{
LIN_SDT_PROBE2(time, linux_to_native_clockid, entry, n, l);
if (l < 0) {
/* cpu-clock */
if ((l & LINUX_CLOCKFD_MASK) == LINUX_CLOCKFD)
@ -226,16 +193,13 @@ linux_to_native_clockid(clockid_t *n, clockid_t l)
case LINUX_CLOCK_TAI:
LIN_SDT_PROBE1(time, linux_to_native_clockid,
unsupported_clockid, l);
LIN_SDT_PROBE1(time, linux_to_native_clockid, return, EINVAL);
return (EINVAL);
default:
LIN_SDT_PROBE1(time, linux_to_native_clockid,
unknown_clockid, l);
LIN_SDT_PROBE1(time, linux_to_native_clockid, return, EINVAL);
return (EINVAL);
}
LIN_SDT_PROBE1(time, linux_to_native_clockid, return, 0);
return (0);
}
@ -264,15 +228,12 @@ linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args)
pid_t pid;
lwpid_t tid;
LIN_SDT_PROBE2(time, linux_clock_gettime, entry, args->which, args->tp);
error = linux_to_native_clockid(&nwhich, args->which);
if (error != 0) {
linux_msg(curthread,
"unsupported clock_gettime clockid %d", args->which);
LIN_SDT_PROBE1(time, linux_clock_gettime, conversion_error,
error);
LIN_SDT_PROBE1(time, linux_clock_gettime, return, error);
return (error);
}
@ -375,7 +336,6 @@ linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args)
}
if (error != 0) {
LIN_SDT_PROBE1(time, linux_clock_gettime, gettime_error, error);
LIN_SDT_PROBE1(time, linux_clock_gettime, return, error);
return (error);
}
error = native_to_linux_timespec(&lts, &tp);
@ -385,7 +345,6 @@ linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args)
if (error != 0)
LIN_SDT_PROBE1(time, linux_clock_gettime, copyout_error, error);
LIN_SDT_PROBE1(time, linux_clock_gettime, return, error);
return (error);
}
@ -397,28 +356,23 @@ linux_clock_settime(struct thread *td, struct linux_clock_settime_args *args)
int error;
clockid_t nwhich;
LIN_SDT_PROBE2(time, linux_clock_settime, entry, args->which, args->tp);
error = linux_to_native_clockid(&nwhich, args->which);
if (error != 0) {
linux_msg(curthread,
"unsupported clock_settime clockid %d", args->which);
LIN_SDT_PROBE1(time, linux_clock_settime, conversion_error,
error);
LIN_SDT_PROBE1(time, linux_clock_settime, return, error);
return (error);
}
error = copyin(args->tp, &lts, sizeof lts);
if (error != 0) {
LIN_SDT_PROBE1(time, linux_clock_settime, copyin_error, error);
LIN_SDT_PROBE1(time, linux_clock_settime, return, error);
return (error);
}
error = linux_to_native_timespec(&ts, &lts);
if (error != 0) {
LIN_SDT_PROBE1(time, linux_clock_settime, conversion_error,
error);
LIN_SDT_PROBE1(time, linux_clock_settime, return, error);
return (error);
}
@ -426,7 +380,6 @@ linux_clock_settime(struct thread *td, struct linux_clock_settime_args *args)
if (error != 0)
LIN_SDT_PROBE1(time, linux_clock_settime, settime_error, error);
LIN_SDT_PROBE1(time, linux_clock_settime, return, error);
return (error);
}
@ -441,15 +394,12 @@ linux_clock_getres(struct thread *td, struct linux_clock_getres_args *args)
pid_t pid;
lwpid_t tid;
LIN_SDT_PROBE2(time, linux_clock_getres, entry, args->which, args->tp);
error = linux_to_native_clockid(&nwhich, args->which);
if (error != 0) {
linux_msg(curthread,
"unsupported clock_getres clockid %d", args->which);
LIN_SDT_PROBE1(time, linux_clock_getres, conversion_error,
error);
LIN_SDT_PROBE1(time, linux_clock_getres, return, error);
return (error);
}
@ -482,7 +432,6 @@ linux_clock_getres(struct thread *td, struct linux_clock_getres_args *args)
if (args->tp == NULL) {
LIN_SDT_PROBE0(time, linux_clock_getres, nullcall);
LIN_SDT_PROBE1(time, linux_clock_getres, return, 0);
return (0);
}
@ -522,7 +471,6 @@ linux_clock_getres(struct thread *td, struct linux_clock_getres_args *args)
error = kern_clock_getres(td, nwhich, &ts);
if (error != 0) {
LIN_SDT_PROBE1(time, linux_clock_getres, getres_error, error);
LIN_SDT_PROBE1(time, linux_clock_getres, return, error);
return (error);
}
@ -534,7 +482,6 @@ linux_clock_getres(struct thread *td, struct linux_clock_getres_args *args)
if (error != 0)
LIN_SDT_PROBE1(time, linux_clock_getres, copyout_error, error);
LIN_SDT_PROBE1(time, linux_clock_getres, return, error);
return (error);
}
@ -546,12 +493,9 @@ linux_nanosleep(struct thread *td, struct linux_nanosleep_args *args)
struct timespec rqts, rmts;
int error, error2;
LIN_SDT_PROBE2(time, linux_nanosleep, entry, args->rqtp, args->rmtp);
error = copyin(args->rqtp, &lrqts, sizeof lrqts);
if (error != 0) {
LIN_SDT_PROBE1(time, linux_nanosleep, copyin_error, error);
LIN_SDT_PROBE1(time, linux_nanosleep, return, error);
return (error);
}
@ -563,7 +507,6 @@ linux_nanosleep(struct thread *td, struct linux_nanosleep_args *args)
error = linux_to_native_timespec(&rqts, &lrqts);
if (error != 0) {
LIN_SDT_PROBE1(time, linux_nanosleep, conversion_error, error);
LIN_SDT_PROBE1(time, linux_nanosleep, return, error);
return (error);
}
error = kern_nanosleep(td, &rqts, rmtp);
@ -575,12 +518,10 @@ linux_nanosleep(struct thread *td, struct linux_nanosleep_args *args)
if (error2 != 0) {
LIN_SDT_PROBE1(time, linux_nanosleep, copyout_error,
error2);
LIN_SDT_PROBE1(time, linux_nanosleep, return, error2);
return (error2);
}
}
LIN_SDT_PROBE1(time, linux_nanosleep, return, error);
return (error);
}
@ -593,14 +534,10 @@ linux_clock_nanosleep(struct thread *td, struct linux_clock_nanosleep_args *args
int error, error2, flags;
clockid_t clockid;
LIN_SDT_PROBE4(time, linux_clock_nanosleep, entry, args->which,
args->flags, args->rqtp, args->rmtp);
error = linux_to_native_timerflags(&flags, args->flags);
if (error != 0) {
LIN_SDT_PROBE1(time, linux_clock_nanosleep, unsupported_flags,
args->flags);
LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, error);
return (error);
}
@ -610,7 +547,6 @@ linux_clock_nanosleep(struct thread *td, struct linux_clock_nanosleep_args *args
"unsupported clock_nanosleep clockid %d", args->which);
LIN_SDT_PROBE1(time, linux_clock_nanosleep, unsupported_clockid,
args->which);
LIN_SDT_PROBE1(time, linux_clock_settime, return, error);
return (error);
}
@ -618,7 +554,6 @@ linux_clock_nanosleep(struct thread *td, struct linux_clock_nanosleep_args *args
if (error != 0) {
LIN_SDT_PROBE1(time, linux_clock_nanosleep, copyin_error,
error);
LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, error);
return (error);
}
@ -631,7 +566,6 @@ linux_clock_nanosleep(struct thread *td, struct linux_clock_nanosleep_args *args
if (error != 0) {
LIN_SDT_PROBE1(time, linux_clock_nanosleep, conversion_error,
error);
LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, error);
return (error);
}
error = kern_clock_nanosleep(td, clockid, flags, &rqts, rmtp);
@ -644,12 +578,9 @@ linux_clock_nanosleep(struct thread *td, struct linux_clock_nanosleep_args *args
if (error2 != 0) {
LIN_SDT_PROBE1(time, linux_clock_nanosleep,
copyout_error, error2);
LIN_SDT_PROBE1(time, linux_clock_nanosleep,
return, error2);
return (error2);
}
}
LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, error);
return (error);
}

View File

@ -61,43 +61,11 @@ 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");
LIN_SDT_PROBE_DEFINE2(uid16, linux_setregid16, entry, "l_gid16_t", "l_gid16_t");
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");
DUMMY(setfsuid16);
DUMMY(setfsgid16);
@ -122,14 +90,11 @@ linux_chown16(struct thread *td, struct linux_chown16_args *args)
* 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);
error = kern_fchownat(td, AT_FDCWD, path, UIO_SYSSPACE,
CAST_NOCHG(args->uid), CAST_NOCHG(args->gid), 0);
LFREEPATH(path);
LIN_SDT_PROBE1(uid16, linux_chown16, return, error);
}
return (error);
}
@ -151,14 +116,11 @@ linux_lchown16(struct thread *td, struct linux_lchown16_args *args)
* 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);
error = kern_fchownat(td, AT_FDCWD, path, UIO_SYSSPACE,
CAST_NOCHG(args->uid), CAST_NOCHG(args->gid), AT_SYMLINK_NOFOLLOW);
LFREEPATH(path);
LIN_SDT_PROBE1(uid16, linux_lchown16, return, error);
}
return (error);
}
@ -172,19 +134,13 @@ linux_setgroups16(struct thread *td, struct linux_setgroups16_args *args)
int ngrp, error;
struct proc *p;
LIN_SDT_PROBE2(uid16, linux_setgroups16, entry, args->gidsetsize,
args->gidset);
ngrp = args->gidsetsize;
if (ngrp < 0 || ngrp >= ngroups_max + 1) {
LIN_SDT_PROBE1(uid16, linux_setgroups16, return, EINVAL);
if (ngrp < 0 || ngrp >= ngroups_max + 1)
return (EINVAL);
}
linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_LINUX, M_WAITOK);
error = copyin(args->gidset, linux_gidset, ngrp * sizeof(l_gid16_t));
if (error) {
LIN_SDT_PROBE1(uid16, linux_setgroups16, copyin_error, error);
LIN_SDT_PROBE1(uid16, linux_setgroups16, return, error);
free(linux_gidset, M_LINUX);
return (error);
}
@ -229,7 +185,6 @@ linux_setgroups16(struct thread *td, struct linux_setgroups16_args *args)
out:
free(linux_gidset, M_LINUX);
LIN_SDT_PROBE1(uid16, linux_setgroups16, return, error);
return (error);
}
@ -241,9 +196,6 @@ linux_getgroups16(struct thread *td, struct linux_getgroups16_args *args)
gid_t *bsd_gidset;
int bsd_gidsetsz, ngrp, error;
LIN_SDT_PROBE2(uid16, linux_getgroups16, entry, args->gidsetsize,
args->gidset);
cred = td->td_ucred;
bsd_gidset = cred->cr_groups;
bsd_gidsetsz = cred->cr_ngroups - 1;
@ -256,15 +208,11 @@ linux_getgroups16(struct thread *td, struct linux_getgroups16_args *args)
if ((ngrp = args->gidsetsize) == 0) {
td->td_retval[0] = bsd_gidsetsz;
LIN_SDT_PROBE1(uid16, linux_getgroups16, return, 0);
return (0);
}
if (ngrp < bsd_gidsetsz) {
LIN_SDT_PROBE1(uid16, linux_getgroups16, return, EINVAL);
if (ngrp < bsd_gidsetsz)
return (EINVAL);
}
ngrp = 0;
linux_gidset = malloc(bsd_gidsetsz * sizeof(*linux_gidset),
@ -278,13 +226,11 @@ linux_getgroups16(struct thread *td, struct linux_getgroups16_args *args)
free(linux_gidset, M_LINUX);
if (error) {
LIN_SDT_PROBE1(uid16, linux_getgroups16, copyout_error, error);
LIN_SDT_PROBE1(uid16, linux_getgroups16, return, error);
return (error);
}
td->td_retval[0] = ngrp;
LIN_SDT_PROBE1(uid16, linux_getgroups16, return, 0);
return (0);
}
@ -292,11 +238,8 @@ int
linux_getgid16(struct thread *td, struct linux_getgid16_args *args)
{
LIN_SDT_PROBE0(uid16, linux_getgid16, entry);
td->td_retval[0] = td->td_ucred->cr_rgid;
LIN_SDT_PROBE1(uid16, linux_getgid16, return, 0);
return (0);
}
@ -304,11 +247,8 @@ int
linux_getuid16(struct thread *td, struct linux_getuid16_args *args)
{
LIN_SDT_PROBE0(uid16, linux_getuid16, entry);
td->td_retval[0] = td->td_ucred->cr_ruid;
LIN_SDT_PROBE1(uid16, linux_getuid16, return, 0);
return (0);
}
@ -318,11 +258,8 @@ linux_getegid16(struct thread *td, struct linux_getegid16_args *args)
struct getegid_args bsd;
int error;
LIN_SDT_PROBE0(uid16, linux_getegid16, entry);
error = sys_getegid(td, &bsd);
LIN_SDT_PROBE1(uid16, linux_getegid16, return, error);
return (error);
}
@ -332,11 +269,8 @@ linux_geteuid16(struct thread *td, struct linux_geteuid16_args *args)
struct geteuid_args bsd;
int error;
LIN_SDT_PROBE0(uid16, linux_geteuid16, entry);
error = sys_geteuid(td, &bsd);
LIN_SDT_PROBE1(uid16, linux_geteuid16, return, error);
return (error);
}
@ -346,12 +280,9 @@ linux_setgid16(struct thread *td, struct linux_setgid16_args *args)
struct setgid_args bsd;
int error;
LIN_SDT_PROBE1(uid16, linux_setgid16, entry, args->gid);
bsd.gid = args->gid;
error = sys_setgid(td, &bsd);
LIN_SDT_PROBE1(uid16, linux_setgid16, return, error);
return (error);
}
@ -361,12 +292,9 @@ linux_setuid16(struct thread *td, struct linux_setuid16_args *args)
struct setuid_args bsd;
int error;
LIN_SDT_PROBE1(uid16, linux_setuid16, entry, args->uid);
bsd.uid = args->uid;
error = sys_setuid(td, &bsd);
LIN_SDT_PROBE1(uid16, linux_setuid16, return, error);
return (error);
}
@ -376,13 +304,10 @@ linux_setregid16(struct thread *td, struct linux_setregid16_args *args)
struct setregid_args bsd;
int error;
LIN_SDT_PROBE2(uid16, linux_setregid16, entry, args->rgid, args->egid);
bsd.rgid = CAST_NOCHG(args->rgid);
bsd.egid = CAST_NOCHG(args->egid);
error = sys_setregid(td, &bsd);
LIN_SDT_PROBE1(uid16, linux_setregid16, return, error);
return (error);
}
@ -392,13 +317,10 @@ linux_setreuid16(struct thread *td, struct linux_setreuid16_args *args)
struct setreuid_args bsd;
int error;
LIN_SDT_PROBE2(uid16, linux_setreuid16, entry, args->ruid, args->euid);
bsd.ruid = CAST_NOCHG(args->ruid);
bsd.euid = CAST_NOCHG(args->euid);
error = sys_setreuid(td, &bsd);
LIN_SDT_PROBE1(uid16, linux_setreuid16, return, error);
return (error);
}
@ -408,15 +330,11 @@ linux_setresgid16(struct thread *td, struct linux_setresgid16_args *args)
struct setresgid_args bsd;
int error;
LIN_SDT_PROBE3(uid16, linux_setresgid16, entry, args->rgid, args->egid,
args->sgid);
bsd.rgid = CAST_NOCHG(args->rgid);
bsd.egid = CAST_NOCHG(args->egid);
bsd.sgid = CAST_NOCHG(args->sgid);
error = sys_setresgid(td, &bsd);
LIN_SDT_PROBE1(uid16, linux_setresgid16, return, error);
return (error);
}
@ -426,14 +344,10 @@ linux_setresuid16(struct thread *td, struct linux_setresuid16_args *args)
struct setresuid_args bsd;
int error;
LIN_SDT_PROBE3(uid16, linux_setresuid16, entry, args->ruid, args->euid,
args->suid);
bsd.ruid = CAST_NOCHG(args->ruid);
bsd.euid = CAST_NOCHG(args->euid);
bsd.suid = CAST_NOCHG(args->suid);
error = sys_setresuid(td, &bsd);
LIN_SDT_PROBE1(uid16, linux_setresuid16, return, error);
return (error);
}

View File

@ -77,23 +77,18 @@ int linux_emul_convpath(struct thread *, const char *, enum uio_seg, char **, in
#define LFREEPATH(path) free(path, M_TEMP)
#define DUMMY(s) \
LIN_SDT_PROBE_DEFINE0(dummy, s, entry); \
LIN_SDT_PROBE_DEFINE0(dummy, s, not_implemented); \
LIN_SDT_PROBE_DEFINE1(dummy, s, return, "int"); \
int \
linux_ ## s(struct thread *td, struct linux_ ## s ## _args *args) \
{ \
static pid_t pid; \
\
LIN_SDT_PROBE0(dummy, s, entry); \
\
if (pid != td->td_proc->p_pid) { \
linux_msg(td, "syscall %s not implemented", #s); \
LIN_SDT_PROBE0(dummy, s, not_implemented); \
pid = td->td_proc->p_pid; \
}; \
\
LIN_SDT_PROBE1(dummy, s, return, ENOSYS); \
return (ENOSYS); \
} \
struct __hack