Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: Kienan Stewart via lttng-dev <lttng-dev@lists.lttng.org>
To: lttng-dev@lists.lttng.org
Subject: Re: Github Action Runners creating world-writable shared memory section: lttng-ust-wait-n
Date: Mon, 10 Mar 2025 13:36:59 -0400	[thread overview]
Message-ID: <a1a58744-f98e-4498-9be2-f2d93288bd40@efficios.com> (raw)
In-Reply-To: <CANTRYLg9VSJMeJ1XHcBCtUfiaGiyyigCoLcAdrX8r-CM+xeDEQ@mail.gmail.com>

Hi Bill,

I don't have the context about gha-runner to answer regarding their use 
of LTTng.

I can however, give a bit of context about how the those shared memory 
allocations are used within the scope of LTTng.

These shared memory sections are used for presence/absence notifications 
between lttng-sessiond and applications instrumented with LTTng-UST.

`lttng-ust-wait-8` is intended to be used for applications that are 
running as root, or those run as non-root users that are members of the 
tracing group (if configured).

`lttng-ust-wait-8-NNN` is used for non-root instrumented applications 
where NNN is the UID of the user.

When either lttng-sessiond or an application instrumented with lttng-ust 
starts, the shared memory sections will be allocated. There is special 
treatment for `lttng-ust-wait-8` since it may be used to notify non-root 
applications that are run by users that are members of the tracing 
group. In that case, it is created with an extended mode[1], as you are 
observing. Those permissions are updated when there is a root 
lttng-sessiond that starts and opens or creates a shared memory section 
at the same path[2].


On 3/10/25 10:12 AM, bill robertson via lttng-dev wrote:
> GHA runners appear to use lttng-ust for some sort of IPC between runners on
> the same machine.
> 
> $ ll /dev/shm/
> 
> -rw-rw-rw- 1 gha-runner-7 gha-runner-7  4096 Feb 20 04:03 lttng-ust-wait-8
> -rw-r----- 1 gha-runner-8 gha-runner-8  4096 Feb 20 04:03 lttng-ust-wait-8-558
> -rw-r----- 1 gha-runner-7 gha-runner-7  4096 Feb 20 04:03 lttng-ust-wait-8-559
> -rw-r----- 1 gha-runner-6 gha-runner-6  4096 Feb 20 04:03 lttng-ust-wait-8-560
> -rw-r----- 1 gha-runner-5 gha-runner-5  4096 Feb 20 04:03 lttng-ust-wait-8-561
> -rw-r----- 1 gha-runner-4 gha-runner-4  4096 Feb 20 04:03 lttng-ust-wait-8-562
> -rw-r----- 1 gha-runner-3 gha-runner-3  4096 Feb 20 04:03 lttng-ust-wait-8-563
> -rw-r----- 1 gha-runner-2 gha-runner-2  4096 Feb 20 04:03 lttng-ust-wait-8-564
> -rw-r----- 1 gha-runner-1 gha-runner-1  4096 Feb 20 04:03 lttng-ust-wait-8-565
> 
> 
> I assume that this is their code, and not some configuration issue on the
> host machine, but if this may not be the case, can someone explain what can
> be done or point me to information on the subject?

Could you clarify what you are trying to achieve?

> 
> Otherwise, is there some sort of environment variable or other setting that
> lttng will reference when creating this shared memory section such that it
> is not world-writable? All of the runners run under user accounts that are
> in a common group.

In LTTng-UST 2.14+, setting `LTTNG_UST_APP_PATH`[3] will disable 
connections to root (global) lttng-sessionds for instrumented applications.

> 
> Thanks!
> Bill
> 

[1]: 
https://github.com/lttng/lttng-ust/blob/ce89cb05f0fc02b68396220815070996fa0bb4a5/src/lib/lttng-ust/lttng-ust-comm.c#L1705
[2]: 
https://github.com/lttng/lttng-tools/blob/e995b146f3456dd51fd76288db6dae9efdbce592/src/common/shm.cpp#L118
[3]: 
https://github.com/lttng/lttng-ust/blob/ce89cb05f0fc02b68396220815070996fa0bb4a5/src/lib/lttng-ust/lttng-ust-comm.c#L611C9-L611C27


      reply	other threads:[~2025-03-10 17:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-10 14:12 bill robertson via lttng-dev
2025-03-10 17:36 ` Kienan Stewart via lttng-dev [this message]

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=a1a58744-f98e-4498-9be2-f2d93288bd40@efficios.com \
    --to=lttng-dev@lists.lttng.org \
    --cc=kstewart@efficios.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