Skip to content

[v17] MWI: Fix missing O_CLOEXEC in botfs.openSecure() and other issues#55503

Merged
timothyb89 merged 4 commits intobranch/v17from
bot/backport-55411-branch/v17
Jun 6, 2025
Merged

[v17] MWI: Fix missing O_CLOEXEC in botfs.openSecure() and other issues#55503
timothyb89 merged 4 commits intobranch/v17from
bot/backport-55411-branch/v17

Conversation

@timothyb89
Copy link
Copy Markdown
Contributor

Backport #55411 to branch/v17

changelog: The tbot client now ensures the O_CLOEXEC flag is used when opening files on Linux hosts

This fixes various issues in botfs's `openSecure` implementation for
Linux, particularly:
- Added missing `O_CLOEXEC` flag to `openat2()` flags
- Added EINTR retry loop to follow the stdlib's `OpenFile()`
  implementation.
- Remove `O_CREATE` from `ReadFlags`, and convert it to a pseudo-enum
  so we can accurately predict intent (see next item)
- Pass `0` mode to `openat2()` when reading (see above)
- Renamed confusingly named `OpenMode` to `OpenFlags`, because it
  corresponds to flags, not file modes.
- Fixed coincidentally correct misuse of `unix.O_RDONLY`

Note that while removing `O_CREATE` from read flags is technically a
breaking change, we still automatically files downstream as needed.
This results in a "new" debug-level log, but not any actual behavior
change.
@public-teleport-github-review-bot public-teleport-github-review-bot Bot removed the request for review from zmb3 June 6, 2025 09:06
@timothyb89 timothyb89 added this pull request to the merge queue Jun 6, 2025
Merged via the queue into branch/v17 with commit 61be7d6 Jun 6, 2025
40 checks passed
@timothyb89 timothyb89 deleted the bot/backport-55411-branch/v17 branch June 6, 2025 22:24
@fheinecke fheinecke mentioned this pull request Jul 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants