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

interfaces: support Tegra display drivers #7173

Merged
merged 7 commits into from
Aug 26, 2019
15 changes: 11 additions & 4 deletions interfaces/builtin/opengl.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ unix (bind,listen) type=seqpacket addr="@cuda-uvmfd-[0-9a-f]*",
/dev/nvhost-* rw,
/dev/nvmap rw,

# Tegra display driver
/dev/tegra_dc_ctrl rw,
/dev/tegra_dc_[0-9]* rw,

# OpenCL ICD files
/etc/OpenCL/vendors/ r,
/etc/OpenCL/vendors/** r,
Expand All @@ -91,10 +95,11 @@ unix (bind,listen) type=seqpacket addr="@cuda-uvmfd-[0-9a-f]*",
@{PROC}/driver/prl_vtg rw,

# /sys/devices
/sys/devices/pci[0-9a-f]*/**/config r,
/sys/devices/pci[0-9a-f]*/**/revision r,
/sys/devices/pci[0-9a-f]*/**/{,subsystem_}device r,
/sys/devices/pci[0-9a-f]*/**/{,subsystem_}vendor r,
/sys/devices/{,*pcie-controller/}pci[0-9a-f]*/**/config r,
/sys/devices/{,*pcie-controller/}pci[0-9a-f]*/**/revision r,
/sys/devices/{,*pcie-controller/}pci[0-9a-f]*/**/{,subsystem_}class r,
/sys/devices/{,*pcie-controller/}pci[0-9a-f]*/**/{,subsystem_}device r,
/sys/devices/{,*pcie-controller/}pci[0-9a-f]*/**/{,subsystem_}vendor r,
/sys/devices/**/drm{,_dp_aux_dev}/** r,

# FIXME: this is an information leak and snapd should instead query udev for
Expand All @@ -121,6 +126,8 @@ var openglConnectedPlugUDev = []string{
`KERNEL=="renderD[0-9]*"`,
`KERNEL=="nvhost-*"`,
`KERNEL=="nvmap"`,
`KERNEL=="tegra_dc_ctrl"`,
`KERNEL=="tegra_dc_[0-9]*"`,
}

func init() {
Expand Down
6 changes: 5 additions & 1 deletion interfaces/builtin/opengl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (s *OpenglInterfaceSuite) TestAppArmorSpec(c *C) {
func (s *OpenglInterfaceSuite) TestUDevSpec(c *C) {
spec := &udev.Specification{}
c.Assert(spec.AddConnectedPlug(s.iface, s.plug, s.slot), IsNil)
c.Assert(spec.Snippets(), HasLen, 6)
c.Assert(spec.Snippets(), HasLen, 8)
c.Assert(spec.Snippets(), testutil.Contains, `# opengl
SUBSYSTEM=="drm", KERNEL=="card[0-9]*", TAG+="snap_consumer_app"`)
c.Assert(spec.Snippets(), testutil.Contains, `# opengl
Expand All @@ -93,6 +93,10 @@ KERNEL=="renderD[0-9]*", TAG+="snap_consumer_app"`)
KERNEL=="nvhost-*", TAG+="snap_consumer_app"`)
c.Assert(spec.Snippets(), testutil.Contains, `# opengl
KERNEL=="nvmap", TAG+="snap_consumer_app"`)
c.Assert(spec.Snippets(), testutil.Contains, `# opengl
KERNEL=="tegra_dc_ctrl", TAG+="snap_consumer_app"`)
c.Assert(spec.Snippets(), testutil.Contains, `# opengl
KERNEL=="tegra_dc_[0-9]*", TAG+="snap_consumer_app"`)
c.Assert(spec.Snippets(), testutil.Contains, `TAG=="snap_consumer_app", RUN+="/usr/lib/snapd/snap-device-helper $env{ACTION} snap_consumer_app $devpath $major:$minor"`)
}

Expand Down
6 changes: 6 additions & 0 deletions interfaces/builtin/x11.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ unix (bind, listen, accept)
type=stream
addr="@/tmp/.ICE-unix/[0-9]*",

# On systems with Tegra drivers, X11 needs to create the socket for clients to
# use.
unix (bind, listen, accept)
type=dgram
addr="@nvidia[0-9a-f]*",
jdstrand marked this conversation as resolved.
Show resolved Hide resolved

# For Xorg to detect screens
/sys/devices/pci**/boot_vga r,
/sys/devices/pci**/resources r,
Expand Down