-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Allow full path in lxc.devices.allow #1708
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
Conversation
This pull request didn't trigger Jenkins as its author isn't in the whitelist. An organization member must perform one of the following:
Those commands are simple Github comments of the format: "jenkins: COMMAND" |
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.
Not clear what your goal is here. Please show exactly what an example input would look like, and explain what you're doing with it.
src/lxc/cgroups/cgfsng.c
Outdated
free(parts); | ||
} | ||
} else { | ||
strcpy(converted_value, value); |
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.
You never use converted_value anywhere.
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.
Missed a changed chunk during commit. Fixed.
src/lxc/cgroups/cgfsng.c
Outdated
} | ||
|
||
if (!snprintf(converted_value, 50, "%c %lu:%lu %s", type, | ||
MAJOR(dev), MINOR(dev), mode)) { |
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.
Did you intend to do something if this snprintf fails?
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.
No, just a trailing test. Removed.
The goal of this patch it to transform For example, currently this is not possible:
Because
|
This patch cannot be doing what you want. You write the result into a new variable 'converted_value', which you do not later use. |
See the missing commit chunk added after the initial commit 8d4f36e |
Ah yes, I missed that.
In the case where
if (n_parts == 2) {
is not true, you will be leaving converted_value uninitialized, and
write the uninitialized value.
You should also probably not write out 'type' as a %c if it is still
0.
|
I add more tests on e7a51c5 |
Here we go ! feed9c7 |
No, it should be (ret < 0 || ret >= 50) |
And then please squash them all into one commit, and I'll apply. Thanks! |
I missred the snprintf doc… |
ff5a3c4
to
a432e86
Compare
I'm sorry, I noticed two more things. First, you are mallocing to_split twice. Secondly, you are not always checking that malloc and strdup succeeded. Please fix those, or feel free at this point to tell me you prefer I just fix those and I merge. |
Some devices like LVM or cryptsetup entries have no stable major/minor, changing between host reboots. In this case, hardcoded numbers are not usable in config file and there is currently no way to use hook with lxc-device to do the link at guest startup : * `pre-start`/`autodev` hook runs in host context but has the guest in stopped state and so lxc-device not usable * `start` hook is in running state but runs in guest context and so lxc-device not available This patch converts fullpath in lxc.devices.allow to current major/minor numbers to address those changing numbers. Signed-off-by: aeris <aeris@imirhil.fr>
|
Some devices like LVM or cryptsetup entries have no stable major/minor, changing between host reboots.
In this case, hardcoded numbers are not usable in config file and there is currently no way to use hook with lxc-device to do the link at guest startup :
This patch converts fullpath in lxc.devices.allow to current major/minor numbers to address those changing numbers.
Signed-off-by: aeris aeris@imirhil.fr