Skip to content

Remove acl-restore.sh, and add user to kvm group instead#2580

Open
0405ysj wants to merge 1 commit into
google:mainfrom
0405ysj:setfacl
Open

Remove acl-restore.sh, and add user to kvm group instead#2580
0405ysj wants to merge 1 commit into
google:mainfrom
0405ysj:setfacl

Conversation

@0405ysj
Copy link
Copy Markdown
Collaborator

@0405ysj 0405ysj commented May 19, 2026

Context: b/514558958

@0405ysj 0405ysj added the kokoro:force-run Trigger a presubmit build unconditionally. label May 19, 2026
@GoogleCuttlefishTesterBot GoogleCuttlefishTesterBot removed the kokoro:force-run Trigger a presubmit build unconditionally. label May 19, 2026
@0405ysj 0405ysj requested review from ikicha, jemoreira and k311093 May 19, 2026 08:10
@0405ysj 0405ysj marked this pull request as ready for review May 19, 2026 08:11
@0405ysj 0405ysj added the kokoro:force-run Trigger a presubmit build unconditionally. label May 19, 2026
@GoogleCuttlefishTesterBot GoogleCuttlefishTesterBot removed the kokoro:force-run Trigger a presubmit build unconditionally. label May 19, 2026
@0405ysj 0405ysj marked this pull request as draft May 19, 2026 08:44
@0405ysj 0405ysj added the kokoro:force-run Trigger a presubmit build unconditionally. label May 19, 2026
@GoogleCuttlefishTesterBot GoogleCuttlefishTesterBot removed the kokoro:force-run Trigger a presubmit build unconditionally. label May 19, 2026
@0405ysj 0405ysj force-pushed the setfacl branch 6 times, most recently from 593edcf to 79d27c1 Compare May 19, 2026 12:41
for unique_group in "${unique_groups[@]}"; do
sudo usermod -aG "$unique_group" "$username"
done
echo "Warning: Please reboot the machine (or log out and log back in) before using podcvd."
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The whole point of having the restore acls service is that logging out and back in is not necessary. Also, the groups for the device nodes can change, in fact cuttlefish-base changes them, so depending on those can be risky.

Copy link
Copy Markdown
Collaborator Author

@0405ysj 0405ysj May 20, 2026

Choose a reason for hiding this comment

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

I believe the change around cuttlefish-base is #2589, but it's fine as it doesn't introduce any new group in overall.(Needed kvm and cvdnetwork before, but will need kvm only) Though I agree that groups for device nodes could be changed, I don't think doing chown on device nodes is a common behavior.

The most critical problem I faced at was using setfacl could be problematic for some machines. Machine details are described at b/514558958. While creating Cuttlefish instances, udev change action on /dev/kvm is triggered, and it flushes existing ACL but not recover it.

I think we can make a conversation around acl-restore.sh later but resolving the critical problem is urgent, because it's highly coupled with deployment of its skill. So I'd separate this PR into two, one for doing sudo usermod -aG "$unique_group" "$username" (#2590) and the other for removing acl-restore.sh. I'm targeting to merge former one within today, but please feel free to leave comments afterwards.

@0405ysj 0405ysj force-pushed the setfacl branch 3 times, most recently from f4f62a1 to e2b36d1 Compare May 20, 2026 02:03
@0405ysj 0405ysj force-pushed the setfacl branch 2 times, most recently from 55b823f to a27f06c Compare May 21, 2026 04:29
@0405ysj 0405ysj marked this pull request as ready for review May 22, 2026 03:42
@0405ysj 0405ysj added the kokoro:force-run Trigger a presubmit build unconditionally. label May 22, 2026
@GoogleCuttlefishTesterBot GoogleCuttlefishTesterBot removed the kokoro:force-run Trigger a presubmit build unconditionally. label May 22, 2026
@0405ysj 0405ysj requested a review from jemoreira May 26, 2026 11:49
Comment thread .github/workflows/presubmit.yaml Outdated
Comment on lines -103 to -106
echo "Configuring device permissions..."
sudo setfacl -m "u:$username:rw" /dev/kvm
sudo setfacl -m "u:$username:rw" /dev/vhost-net
sudo setfacl -m "u:$username:rw" /dev/vhost-vsock
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I understand adding the user to the kvm group eliminates the need for restore-acls. But why detele these? without them the user will have to create a new session.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Because creating a new session may be necessary though setting ACL via setfacl. Those settings could be flushed by triggering udev change action while creating Cuttlefish instance.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

triggering udev change action while creating Cuttlefish instance

I am missing something here. Creating a cuttlefish instance is done without root privileges, how can that trigger changes in device nodes?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

  1. While creating cuttlefish instance, it triggers udev change action. I don't know the exact mechanism how udev change action is triggered, but I'm speculating that an event is triggered while interacting with those devices.
  2. From udev rule for /dev/kvm, uaccess is set. When it's set, it flushes current ACL setting and sets ACL dynamically depending on 'seat'. Physical workstations were okay, but it mattered on virtual environments.

@0405ysj 0405ysj marked this pull request as draft May 26, 2026 16:55
@0405ysj 0405ysj force-pushed the setfacl branch 4 times, most recently from 007e7d2 to 4342f95 Compare May 26, 2026 19:05
@0405ysj 0405ysj added the kokoro:force-run Trigger a presubmit build unconditionally. label May 26, 2026
@0405ysj 0405ysj marked this pull request as ready for review May 26, 2026 21:45
@GoogleCuttlefishTesterBot GoogleCuttlefishTesterBot removed the kokoro:force-run Trigger a presubmit build unconditionally. label May 26, 2026
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.

3 participants