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

Keep vglusers group unless no3d is used (virtualgl) #4851

Merged
merged 1 commit into from
Jan 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Keep vglusers group unless no3d is used (virtualgl)
virtualgl[1] runs `chown root:vglusers` on `/dev/nvidia*` and on devices
usually owned by the "render" group[2].  This makes them unavailable in
the sandbox if `noroot` (which causes groups to be dropped) is used.

Since firejail classifies all of the aforementioned devices as being
`DEV_3D` on fs_dev.c (which means that they are controlled by `no3d`),
treat the "vglusers" group the same as the "render" group (by always
keeping "vglusers" unless `no3d` is used).

See the discussion on #2042 (from this comment[3] onwards).

[1] https://virtualgl.org
[2] https://github.com/VirtualGL/virtualgl/blob/6f0b90be02d13171dfdfffb112485f4091a5904f/server/vglserver_config#L393
[3] #2042 (comment)

Reported-by: @JCallicoat
  • Loading branch information
kmk3 committed Jan 12, 2022
commit f3293866936b725d1fe4786efe1774ec5ae22d9c
7 changes: 6 additions & 1 deletion src/firejail/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3150,13 +3150,18 @@ int main(int argc, char **argv, char **envp) {
}
}

// add render group
// add render/vglusers group
if (!arg_no3d) {
g = get_group_id("render");
if (g) {
sprintf(ptr, "%d %d 1\n", g, g);
ptr += strlen(ptr);
}
g = get_group_id("vglusers");
if (g) {
sprintf(ptr, "%d %d 1\n", g, g);
ptr += strlen(ptr);
}
}

// add lp group
Expand Down
2 changes: 2 additions & 0 deletions src/firejail/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ static void clean_supplementary_groups(gid_t gid) {
if (!arg_no3d) {
copy_group_ifcont("render", groups, ngroups,
new_groups, &new_ngroups, MAX_GROUPS);
copy_group_ifcont("vglusers", groups, ngroups,
new_groups, &new_ngroups, MAX_GROUPS);
}

if (!arg_noprinters) {
Expand Down