Skip to content

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

Merged
timothyb89 merged 4 commits intobranch/v18from
bot/backport-55411-branch/v18
Jun 26, 2025
Merged

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

Conversation

@timothyb89
Copy link
Copy Markdown
Contributor

Backport #55411 to branch/v18

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.
@timothyb89 timothyb89 added this pull request to the merge queue Jun 26, 2025
Merged via the queue into branch/v18 with commit 25334ed Jun 26, 2025
42 checks passed
@timothyb89 timothyb89 deleted the bot/backport-55411-branch/v18 branch June 26, 2025 02:43
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.

5 participants