[lttng-dev] [lttng-ust RFC v3] Add setuid wrappers for per-UID buffers

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Tue May 28 10:02:43 EDT 2019

----- On May 27, 2019, at 5:51 PM, Gabriel-Andrew Pollo-Guilbert gabriel.pollo-guilbert at efficios.com wrote:

> In case of a per-UID buffer, events following a change of user ID should be
> forwarded to buffers of the new UID. In order to do so, we add a wrapper around
> setuid(3), setreuid(3) and setresuid(2) that unregister and re-register the
> application from the session daemon.
> While there exist some other functions such as seteuid(3) or setfsuid(2), we
> don't need to add a wrapper for them since they do not edit the real user ID,
> the actual ID returned by getuid(3) and used for creating the buffers.

The general approach looks good.

The missing part is adding tests within lttng-tools "destructive" tests (because
they will likely change the system configuration to add users (?)).

One nit below since we are here...

> diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c
> index 61dbb41b..0d0b9eb4 100644
> --- a/liblttng-ust/lttng-ust-comm.c
> +++ b/liblttng-ust/lttng-ust-comm.c
> @@ -225,10 +225,12 @@ void ust_unlock(void)
>  *   daemon problems).
>  */
> static sem_t constructor_wait;
> +
> /*
>  * Doing this for both the global and local sessiond.
>  */
> -static int sem_count = { 2 };

I know I'm the one who asked for a #define, but in general, it's better
to use:


So we do not pollute the preprocessor namespace (e.g. output of gcc -dM -E file.c).



Mathieu Desnoyers
EfficiOS Inc.

More information about the lttng-dev mailing list