Skip to contentSkip to conversation

Add setuid wrappers for per-UID buffers

PATCH Mathieu Desnoyers 1 participant 1 message Jun 4, 2019 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Mathieu Desnoyers

author Acked-by
#1 lore raw
Quoted 8 lines · ----- On May 31, 2019, at 5:04 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.

[...]

Quoted 10 lines
doc/man/lttng-ust.3.txt +0 -0
index 5c9c9f5d..b252c11d 100644
@@ -744,6 +744,17 @@ library before you start the application. Typical use cases

include
daemons closing all file descriptors after man:fork(2), and buggy applications doing ``double-closes''.

doc/man/lttng-ust.3.txt

Quoted 6 lines
doc/man/lttng-ust.3.txt +6 -0
+Using LTTng-UST with applications that change user
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+If your application is traced using per-UID buffers and changes user ID using
+man:setuid(2), the library `liblttng-ust-setuid.so` needs to be preloaded
+before starting the application with the `LD_PRELOAD` environment variable (see
+man:ld.so(8)). This way, events generated after the UID change will be fowarded

fowarded -> forwarded

The rest looks good, please add this tag to your next round for this patch:

I'll wait until feedback is provided on the testing side (lttng-tools) and the work on that front is finalized before merging this patch into lttng-ust.

Thanks,

Mathieu

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com