Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few cleanups around symlinks #337

Merged
merged 3 commits into from
Sep 9, 2024

Conversation

cgwalters
Copy link
Contributor

mkcomposefs: Drop duplicate invocation of lcfs_node_set_mode()

Just noticed this while I was reading the code for other reasons.

Signed-off-by: Colin Walters walters@verbum.org


Add fallible lcfs_node_try_set_mode()

Previously I added code to validate this but it happened much
later. The mode (type) of a file is a very fundamental property
and we should constrain its state as early as possible.

Signed-off-by: Colin Walters walters@verbum.org


Add lcfs_node_set_symlink_payload

Historically we accept any arbitrary data in the dumpfile
for the file size for symlink, and end up ignoring it
ultimately when we write the EROFS. However previously
it was pretty confusing as the in-memory node data
could have a bogus size.

Add an API and use it both in the mkcomposefs path and
in the "reread from EROFS path" to perform more consistent
validation for symlink targets. This just wraps the
previous lcfs_node_set_payload() API, inheriting its
checks for length.

Signed-off-by: Colin Walters walters@verbum.org


Just noticed this while I was reading the code for other reasons.

Signed-off-by: Colin Walters <walters@verbum.org>
Previously I added code to validate this but it happened much
later. The mode (type) of a file is a very fundamental property
and we should constrain its state as early as possible.

Signed-off-by: Colin Walters <walters@verbum.org>
Historically we accept any arbitrary data in the dumpfile
for the file size for symlink, and end up ignoring it
ultimately when we write the EROFS. However previously
it was pretty confusing as the in-memory node data
could have a bogus size.

Add an API and use it both in the mkcomposefs path *and*
in the "reread from EROFS path" to perform more consistent
validation for symlink targets. This just wraps the
previous `lcfs_node_set_payload()` API, inheriting its
checks for length.

Signed-off-by: Colin Walters <walters@verbum.org>
Copy link
Collaborator

@jeckersb jeckersb left a comment

Choose a reason for hiding this comment

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

LGTM

@jeckersb jeckersb merged commit ce01895 into containers:main Sep 9, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants