-
Notifications
You must be signed in to change notification settings - Fork 200
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
Skip directories and symlinks when mounting libraries #282
Conversation
db0263c
to
db63f0e
Compare
LGTM besides the one nit. |
This ensures that only actual libraries from the compat folders are mounted into the container. Signed-off-by: Evan Lezar <[email protected]>
db63f0e
to
ad1f8c8
Compare
@@ -28,6 +28,7 @@ static char **mount_files(struct error *, const char *, const struct nvc_contain | |||
static char **mount_driverstore_files(struct error *, const char *, const struct nvc_container *, const char *, const char *[], size_t); | |||
static char *mount_directory(struct error *, const char *, const struct nvc_container *, const char *); | |||
static char *mount_firmware(struct error *, const char *, const struct nvc_container *, const char *); | |||
static char *mount_in_root(struct error *err, const char *src, const char *rootfs, const char *path, uid_t uid, uid_t gid, unsigned long mountflags); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency, we shouldn't have the variable names here.
@@ -28,6 +28,7 @@ static char **mount_files(struct error *, const char *, const struct nvc_contain | |||
static char **mount_driverstore_files(struct error *, const char *, const struct nvc_container *, const char *, const char *[], size_t); | |||
static char *mount_directory(struct error *, const char *, const struct nvc_container *, const char *); | |||
static char *mount_firmware(struct error *, const char *, const struct nvc_container *, const char *); | |||
static char *mount_in_root(struct error *err, const char *src, const char *rootfs, const char *path, uid_t uid, uid_t gid, unsigned long mountflags); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider renaming to mount_at_with_flags()
if (path_join(err, src, root, dir) < 0) | ||
return (NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider changing this to path_resolve_full()
to be symmetrical with what we now do in mount_firmware()
.
return (NULL); | ||
return mount_with_flags(err, src, dst, cnt->uid, cnt->gid, MS_RDONLY|MS_NODEV|MS_NOSUID); | ||
return mount_with_flags(err, src, dst, uid, gid, mountflags); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we can, let's just fold the logic for mount_with_flags()
in here.
This ensures that only actual libraries from the compat folders are mounted into the container.
If symlinks or directories are detected an error is raised.