Commit bd1f037
committed
Create privileged executable for refreshing groups
`acloud` relies on [`sg`](https://man7.org/linux/man-pages/man1/sg.1.html) to [refresh group membership](https://cs.android.com/android/platform/superproject/+/android-latest-release:tools/acloud/internal/lib/utils.py;l=1322;drc=02cef780efe034b789d0e3708d4929d2f236327b) if the user has joined the `cvdnetwork` / `kvm` / `render` groups but has not yet restarted or re-logged in.
Debian 13 changed providers of `sg` / `newgrp` from `shadow` to `util-linux`. In the `util-linux` implementation, `sg` only updates the primary group but does not update secondary groups.
- https://www.github.com/util-linux/util-linux/issues/4098
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1130245
Since `sg` no longer works to refresh the apparent secondary group memberships, we'll need an alternative implementation.
Mechanism for raising privilege copied from https://www.github.com/google/android-cuttlefish/pull/1706
Sample invocation:
```
cvd_refresh_groups /usr/bin/groups groups
```
Bug: b/5108996751 parent 3257ff8 commit bd1f037
4 files changed
Lines changed: 67 additions & 0 deletions
File tree
- base
- cvd/cuttlefish
- host/commands/refresh_groups
- package
- debian
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
Lines changed: 54 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
0 commit comments