From: Zach.Kramer@cognex.com (Kramer, Zach)
Subject: [lttng-dev] Problem with application changing UID
Date: Tue, 24 Sep 2019 14:32:41 +0000 [thread overview]
Message-ID: <SN4PR0601MB3614967ABCE12621B316C89D91840@SN4PR0601MB3614.namprd06.prod.outlook.com> (raw)
Hi,
Is LTTng intended to support userspace applications that change their UID at run-time? As in, is there an expected behavior for when this happens?
For example:
1. Embedded device boots
2. My daemon is launched as root via systemd
3. Runs privileged code
4. Changes UID to a less privileged user (500)
5. Creates LTTng session
* If session already exists, destroy it first
6. <if ?systemctl stop? is called>: Destroy session
* Otherwise it will be destroyed next daemon launch in step 5
This causes many conflicts with the trace folders that are created. Most of the time, LTTng creates a folder + metadata for both root and the user, then puts traces in the user folder. Other times, it may create a folder just for the user. This is seemingly random, since it?s a fresh device boot each time. If the daemon is launched directly (i.e. not from systemd), then the root folder gets the traces and the user folder gets the metadata. Here is a more detailed explanation:
Case
Command
Result
Comments
1
[Device boot]
systemctl start daemon
?../uid/500/32-bit --> has metadata and trace logs
Most times, this also happens:
?../uid/0/32-bit --> has metadata but no trace logs
[cid:image001.png at 01D56F9D.AF158770]
Occasionally, the uid/0 folder is not created at all. This seems random, since this is tested by rebooting the device several times.
2
[Device boot]
systemctl start daemon
systemctl stop daemon
* This uses LTTng C-API to destroy session
?../uid/500/32-bit --> has metadata but the logs were cleared
Most times, this also happens:
?../uid/0/32-bit --> has metadata but no trace logs
[cid:image001.png at 01D56F9D.AF158770]
The logs are cleared when ?lttng destroy sess? is called via the LTTng C-API. From my understanding, this should not happen.
Destroying the daemon from command line behaves properly. From my understanding, this should be practically the exact same command.
3
root at device: daemon
(launching via command-line)
When daemon is killed or session is stopped: mimics case 1
When daemon is alive:
?./uid/0/32-bit --> has trace logs but empty metadata
?./uid/500/32-bit --> has metadata but empty trace logs
[cid:image002.png at 01D56F9D.AF158770]
Is this use-case supported?
Unfortunately, the logs are huge and contain sensitive information. If they can help a substantial amount, I can prune them.
Thanks and best regards,
Zach
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.lttng.org/pipermail/lttng-dev/attachments/20190924/867149e7/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 3141 bytes
Desc: image003.png
URL: <https://lists.lttng.org/pipermail/lttng-dev/attachments/20190924/867149e7/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 6313 bytes
Desc: image004.png
URL: <https://lists.lttng.org/pipermail/lttng-dev/attachments/20190924/867149e7/attachment-0003.png>
next reply other threads:[~2019-09-24 14:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-24 14:32 Kramer, Zach [this message]
2019-09-24 15:07 ` Jonathan Rajotte-Julien
2019-09-24 16:01 ` [lttng-dev] [EXTERNAL] " Kramer, Zach
2019-09-24 16:06 ` Jonathan Rajotte-Julien
2019-09-24 16:13 ` Kramer, Zach
2019-09-24 18:45 ` Jonathan Rajotte-Julien
2019-09-27 14:07 ` Kramer, Zach
2019-09-30 19:56 ` Mathieu Desnoyers
2019-09-24 15:15 ` [lttng-dev] " Jonathan Rajotte-Julien
2019-09-24 15:52 ` [lttng-dev] [EXTERNAL] " Kramer, Zach
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=SN4PR0601MB3614967ABCE12621B316C89D91840@SN4PR0601MB3614.namprd06.prod.outlook.com \
--to=zach.kramer@cognex.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox