linux: error on invalid capabilities in config.json#2144
Open
Rajkaran-122 wants to merge 1 commit into
Open
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Ephemeral COPR build failed. @containers/packit-build please check. |
giuseppe
reviewed
Jul 26, 2026
giuseppe
left a comment
Member
There was a problem hiding this comment.
left a comment,
make sure to use your real name/email to sign-off the commit.
Run make clang-format before submitting the patch
Comment on lines
+4346
to
+4350
| if (read_caps (caps.effective, capabilities->effective, capabilities->effective_len, err) < 0) return -1; | ||
| if (read_caps (caps.inheritable, capabilities->inheritable, capabilities->inheritable_len, err) < 0) return -1; | ||
| if (read_caps (caps.ambient, capabilities->ambient, capabilities->ambient_len, err) < 0) return -1; | ||
| if (read_caps (caps.bounding, capabilities->bounding, capabilities->bounding_len, err) < 0) return -1; | ||
| if (read_caps (caps.permitted, capabilities->permitted, capabilities->permitted_len, err) < 0) return -1; |
Member
There was a problem hiding this comment.
please use the same pattern used in the rest of the code.
Use int ret and return ret so we propagate the same return code.
Rajkaran-122
force-pushed
the
validate-capabilities-2121
branch
2 times, most recently
from
July 27, 2026 08:37
5f50805 to
8075432
Compare
Instead of silently ignoring invalid capability strings in config.json, return an error. This prevents containers from starting without the intended privileges due to typos. Fixes: containers#2121 Signed-off-by: Rajkaran <yadavrajkaran854@gmail.com>
Rajkaran-122
force-pushed
the
validate-capabilities-2121
branch
from
July 27, 2026 09:22
8075432 to
410308d
Compare
giuseppe
reviewed
Jul 27, 2026
| read_caps (caps.bounding, capabilities->bounding, capabilities->bounding_len); | ||
| read_caps (caps.permitted, capabilities->permitted, capabilities->permitted_len); | ||
| ret = read_caps (caps.effective, capabilities->effective, capabilities->effective_len, err); | ||
| if (ret < 0) |
Member
There was a problem hiding this comment.
these if (ret < 0) could benefit from being if (UNLIKELY (ret < 0))
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.
Description:
Instead of silently ignoring invalid capability strings found in
config.jsonduring parsing,crunwill now correctly return an error.This prevents containers from starting up in a potentially unexpected or under-privileged state if the user makes a typo in their capabilities configuration.
Fixes: #2121