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

Device: Fix diskAddRootUserNSEntry to add root mapping only if it's required #13332

Merged
merged 1 commit into from
Apr 16, 2024

Conversation

mihalicyn
Copy link
Member

@mihalicyn mihalicyn commented Apr 15, 2024

Fix diskAddRootUserNSEntry logic to correcly handle case when we have not-groupped UID/GID mapping like this:
[{true false 1000 0 1} {false true 1000 0 1}]

because right now it assumes that mapping should be like [{true true 1000 0 1}]

which is logically equivalent.

This become noticable after my change in #12718, before that this issue in logic was reproducible only if user will do something like this:
cat << EOF
uid $(id -u) 1000000
gid $(id -g) 1000000
EOF
) | lxc config set idmap raw.idmap -
which is an extremely rare usecase.

Fixes: #13325

…mapping only if it's required

Fix diskAddRootUserNSEntry logic to correcly handle case when
we have not-groupped UID/GID mapping like this:
[{true false 1000 0 1} {false true 1000 0 1}]

because right now it assumes that mapping should be like
[{true true 1000 0 1}]

which is logically equivalent.

This become noticable after my change in canonical#12718, before that
this issue in logic was reproducible only if user will do something like this:
  cat << EOF
uid $(id -u) 1000000
gid $(id -g) 1000000
EOF
  ) | lxc config set idmap raw.idmap -
which is an extremely rare usecase.

Fixes: canonical#13325
Signed-off-by: Alexander Mikhalitsyn <[email protected]>
@tomponline tomponline changed the title lxd/device/device_utils_disk: fix diskAddRootUserNSEntry to add root … Device: Fix diskAddRootUserNSEntry to add root mapping only if it's required Apr 16, 2024
@tomponline
Copy link
Member

Thanks @mihalicyn

Please can you add a test for this to https://github.com/canonical/lxd-ci/blob/main/tests/storage-disks-vm

@tomponline tomponline merged commit b4d1295 into canonical:main Apr 16, 2024
29 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.

Failed to start virtiofsd error wtih lxd 5.21.1 LTS
2 participants