Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Jan 2007 14:44:01 +0300
From:      "Andrew N. Below" <defan@zenon.net>
To:        <freebsd-hackers@freebsd.org>
Subject:   how to deny reading of several sysctls (for a set of uids, f.e.)
Message-ID:  <082f01c73ee3$c6b3f810$970da8c0@jam.zenon.net>

next in thread | raw e-mail | index | archive | help
Hello.

System - RELENG_6.

Easiest way I found is to patch libc.
But in this case we still can get an original library and use
LD_PRELOAD.

Is there any way to obtain uid of calling process (thread?)
within the kernel?

We have following extern in src/lib/libc/gen/sysctl.c:
[..]
extern int __sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
    void *newp, size_t newlen);
[..]

And there is __sysctl (src/sys/kern/kern_sysctl.c):

[..]
/*
 * MPSAFE
 */
int
__sysctl(struct thread *td, struct sysctl_args *uap)
[..]

1. Whether this function is called from libc sysctl() ?

2. What can we get from td here? My knowledge about FreeBSD kernel
and kernel threads is not yet enough for understanding this.

I also thought about passing control variable from libc
to kernel, but it seems to be bad idea.

Any other ways?

--
Andrew N. Below




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?082f01c73ee3$c6b3f810$970da8c0>