Add setuid wrappers for per-UID buffers
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · ----- On May 27, 2019, at 5:51 PM, Gabriel-Andrew Pollo-Guilbert…
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...
Quoted 5 lines
liblttng-ust/lttng-ust-comm.c +0
-0
liblttng-ust/lttng-ust-comm.c void ust_unlock(void) · line 232
Quoted 9 lines
liblttng-ust/lttng-ust-comm.c +2
-1@@ -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 }; +#define LTTNG_UST_INIT_SEM_COUNT 2
I know I'm the one who asked for a #define, but in general, it's better to use:
enum { LTTNG_UST_INIT_SEM_COUNT = 2 };
So we do not pollute the preprocessor namespace (e.g. output of gcc -dM -E file.c).
Thanks,
Mathieu
Signature · 3 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com