[v16] MWI: Fix missing O_CLOEXEC in botfs.openSecure() and other issues (#55411)#55504
Merged
timothyb89 merged 1 commit intobranch/v16from Jun 10, 2025
Merged
[v16] MWI: Fix missing O_CLOEXEC in botfs.openSecure() and other issues (#55411)#55504timothyb89 merged 1 commit intobranch/v16from
botfs.openSecure() and other issues (#55411)#55504timothyb89 merged 1 commit intobranch/v16from
Conversation
…sues (#55411) Backport of #55411 for branch/v16 --- * MWI: Fix missing O_CLOEXEC in `botfs.openSecure()` and other issues 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. * Fix lint * Simplify mode conditional, fix comments * Handle potentially nil file returns from `os.OpenFile`
espadolini
approved these changes
Jun 6, 2025
strideynet
approved these changes
Jun 6, 2025
tigrato
approved these changes
Jun 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #55411 for branch/v16
changelog: The tbot client now ensures the O_CLOEXEC flag is used when opening files on Linux hosts
botfs.openSecure()and other issuesThis fixes various issues in botfs's
openSecureimplementation for Linux, particularly:O_CLOEXECflag toopenat2()flagsOpenFile()implementation.O_CREATEfromReadFlags, and convert it to a pseudo-enum so we can accurately predict intent (see next item)0mode toopenat2()when reading (see above)OpenModetoOpenFlags, because it corresponds to flags, not file modes.unix.O_RDONLYNote that while removing
O_CREATEfrom 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.Fix lint
Simplify mode conditional, fix comments
Handle potentially nil file returns from
os.OpenFile