Skip to content

CFE-3429: Use current process ID to investigate proc filesystem to workaround in-container non-root owned symlinks (3.24)#5780

Merged
craigcomstock merged 9 commits intocfengine:3.24.xfrom
craigcomstock:CFE-3429/3.24
Sep 23, 2025
Merged

CFE-3429: Use current process ID to investigate proc filesystem to workaround in-container non-root owned symlinks (3.24)#5780
craigcomstock merged 9 commits intocfengine:3.24.xfrom
craigcomstock:CFE-3429/3.24

Conversation

@craigcomstock
Copy link
Contributor

@craigcomstock craigcomstock commented Apr 23, 2025

No description provided.

@cf-bottom
Copy link

Thanks for submitting a pull request! Maybe @larsewi can review this?

@github-actions
Copy link

Marking this PR as stale due to inactivity; it will be closed in 7 days.

@github-actions github-actions bot added the stale Pull requests with no recent activity label May 31, 2025
@github-actions
Copy link

github-actions bot commented Jun 8, 2025

Closing PR due to inactivity. Feel free to open a new PR if necessary.

@github-actions github-actions bot closed this Jun 8, 2025
@nickanderson nickanderson removed after-release stale Pull requests with no recent activity labels Jul 29, 2025
@nickanderson nickanderson self-requested a review July 29, 2025 18:21
@nickanderson nickanderson reopened this Jul 29, 2025
@nickanderson
Copy link
Member

@craigcomstock , looks like this one auto-closed, re-opening.

Copy link
Member

@nickanderson nickanderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been using 3.27 nightly for some container stuff. Would be nice to have this back in 3.24.

@github-actions
Copy link

Marking this PR as stale due to inactivity; it will be closed in 7 days.

@github-actions github-actions bot added the stale Pull requests with no recent activity label Aug 28, 2025
@github-actions
Copy link

github-actions bot commented Sep 5, 2025

Closing PR due to inactivity. Feel free to open a new PR if necessary.

Jakob Riepler and others added 4 commits September 8, 2025 09:28
…n-container non-root owned symlinks

Note man 5 proc mentions how the symlinks work:

       /proc/self
              When a process accesses this magic symbolic link, it resolves to the process's own /proc/pid directory.

and also:

              With  the  advent  of network namespaces, various information relating to the network stack is virtualized (see net‐
              work_namespaces(7)).  Thus, since Linux 2.6.25, /proc/net is a symbolic link to the directory /proc/self/net,  which
              contains  the  same files and directories as listed below.  However, these files and directories now expose informa‐
              tion for the network namespace of which the process is a member.

So this change seems like a good workaround for linux systems and CFEngine's requirement that symlinks be owned by the running pid.

Ticket: CFE-3429
Changelog: title
Signed-off-by: Craig Comstock <craig.comstock@northern.tech>
(cherry picked from commit 031972b)
…ace discovery.

Ticket: CFE-3429
Changelog: none
(cherry picked from commit 8441e84)
These have checks for environment variables to override to support testing.

Ticket: CFE-3429
Changelog: none
(cherry picked from commit 628055f)
To align with change to reading /proc/<pid>/...

Ticket: CFE-3429
Changelog: none
(cherry picked from commit 8470d79)
@craigcomstock craigcomstock self-assigned this Sep 8, 2025
@github-actions github-actions bot removed the stale Pull requests with no recent activity label Sep 8, 2025
@craigcomstock
Copy link
Contributor Author

the libntech bump in this PR was stale and caused macos unit test failures, so rebased libntech to current 3.24.x version.

The function 'strchrnul' has been marked as being introduced in macOS
15.4, although it seems to have been working for as long as we have been
testing on macOS. Since warnings are treated as errors, the build will
fail. Hence, the simplest way to silence the warning is, it to specify
the deployment target to be a minimum of macOS 15.4.

```
logging.c:651:28: error: 'strchrnul' is only available on macOS 15.4 or newer [-Werror,-Wunguarded-availability-new]
  651 |         char *next_token = strchrnul(token, ',');
  CC       queue.lo
      |                            ^~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_string.h:198:9: note: 'strchrnul' has been marked as being introduced in macOS 15.4 here, but the deployment target is macOS 15.0.0
  198 |         strchrnul(const char *__s, int __c);
  CC       rb-tree.lo
      |         ^
logging.c:651:28: note: enclose 'strchrnul' in a __builtin_available check to silence this warning
  651 |         char *next_token = strchrnul(token, ',');
      |                            ^~~~~~~~~
1 error generated.
```

It has been done similarly here: NorthernTechHQ/libntech#255

Signed-off-by: Victor Moene <victor.moene@northern.tech>
(cherry picked from commit f1c9a91)
olehermanse and others added 3 commits September 22, 2025 16:59
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
(cherry picked from commit 1486c24)

 Conflicts:
	.github/workflows/macos_unit_tests.yml

Use of librsync (cfengine#5629) was not cherry picked to 3.24.x
Check for Homebrew if we're on Darwin and use brew's --prefix.

Ticket: CFE-4385
(cherry picked from commit 7e88d4b)

 Conflicts:
	.github/workflows/macos_unit_tests.yml
	configure.ac

using librsync (cfengine#5629) was not cherry-picked to 3.24.x so adjustments were needed.
The argument checking has been present for a while.
Interestingly 3 days ago there was a commit to silence many of these warnings: curl/curl@92f215f

Ticket: CFE-3429
Changelog: none
@craigcomstock craigcomstock marked this pull request as ready for review September 23, 2025 16:32
@craigcomstock
Copy link
Contributor Author

the curl_easy_setopt() problem doesn't seem to be present in master so this should be sufficient here.

@craigcomstock craigcomstock merged commit 159426d into cfengine:3.24.x Sep 23, 2025
9 checks passed
@craigcomstock craigcomstock deleted the CFE-3429/3.24 branch September 23, 2025 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

6 participants