Skip to content

Commit

Permalink
Label /dev/dma_heap/* char devices with dma_device_t
Browse files Browse the repository at this point in the history
In the /dev/dma_heap directory, character devices are created to
allow userspace to allocate dma buffers that can be shared between drivers.

The change is backed by a file transition for the "system" file;
note the /dev/dma_heap directory keeps the default device_t type
so the transition will apply for a "system" file anywhere in /dev.

A new dma_device_t type was added.

Resolves: rhbz#1970744
  • Loading branch information
zpytela committed Jun 21, 2021
1 parent 11325fa commit 85f35a1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions policy/modules/kernel/devices.fc
Expand Up @@ -24,6 +24,7 @@
/dev/crash -c gen_context(system_u:object_r:crash_device_t,mls_systemhigh)
/dev/dahdi/.* -c gen_context(system_u:object_r:sound_device_t,s0)
/dev/dlm.* -c gen_context(system_u:object_r:dlm_control_device_t,s0)
/dev/dma_heap/.+ -c gen_context(system_u:object_r:dma_device_t,s0)
/dev/dmfm.* -c gen_context(system_u:object_r:sound_device_t,s0)
/dev/dmmidi.* -c gen_context(system_u:object_r:sound_device_t,s0)
/dev/drm_dp_aux.* -c gen_context(system_u:object_r:xserver_misc_device_t,s0)
Expand Down
3 changes: 3 additions & 0 deletions policy/modules/kernel/devices.if
Expand Up @@ -6556,6 +6556,7 @@ interface(`dev_filetrans_all_named_dev',`
gen_require(`
type device_t;
type acpi_device_t;
type dma_device_t;
type usb_device_t;
type uhid_device_t;
type sound_device_t;
Expand Down Expand Up @@ -6703,6 +6704,8 @@ gen_require(`
filetrans_pattern($1, device_t, dlm_control_device_t, chr_file, "dlm7")
filetrans_pattern($1, device_t, dlm_control_device_t, chr_file, "dlm8")
filetrans_pattern($1, device_t, dlm_control_device_t, chr_file, "dlm9")
# Note this file path is /dev/dma_heap/system
filetrans_pattern($1, device_t, dma_device_t, chr_file, "system")
filetrans_pattern($1, device_t, sound_device_t, chr_file, "dmfm")
filetrans_pattern($1, device_t, sound_device_t, chr_file, "dmmidi0")
filetrans_pattern($1, device_t, sound_device_t, chr_file, "dmmidi1")
Expand Down
6 changes: 6 additions & 0 deletions policy/modules/kernel/devices.te
Expand Up @@ -88,6 +88,12 @@ dev_node(crypt_device_t)
type dlm_control_device_t;
dev_node(dlm_control_device_t)

#
# Type for /dev/dma_heap/* devices
#
type dma_device_t;
dev_node(dma_device_t)

type dri_device_t;
dev_node(dri_device_t)

Expand Down

0 comments on commit 85f35a1

Please sign in to comment.