Chris PeBenito e181fe
# Copyright (C) 2005 Tresys Technology, LLC
Chris PeBenito e181fe
Chris PeBenito 960373
policy_module(devices,1.0)
Chris PeBenito 960373
Chris PeBenito b4cd15
attribute device_node;
Chris PeBenito 6b6740
attribute memory_raw_read;
Chris PeBenito 6b6740
attribute memory_raw_write;
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# device_t is the type of /dev.
Chris PeBenito b4cd15
#
Chris PeBenito ee5772
type device_t;
Chris PeBenito ee5772
files_make_file(device_t)
Chris PeBenito a2d824
files_make_mountpoint(device_t)
Chris PeBenito 33bc0d
filesystem_tmpfs_associate(device_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
# Only directories and symlinks should be labeled device_t.
Chris PeBenito b4cd15
# If there are other files with this type, it is wrong.
Chris PeBenito b4cd15
# Relabelto is allowed for setfiles to function, in case
Chris PeBenito b4cd15
# a device node has no specific type yet, but is for some
Chris PeBenito b4cd15
# reason labeled with a specific type
Chris PeBenito 07d6e3
#cjp: want this, but udev policy breaks this
Chris PeBenito 07d6e3
#neverallow * device_t:{ file fifo_file sock_file chr_file blk_file } ~{ getattr setattr relabelfrom relabelto };
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# Type for /dev/agpgart
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
type agp_device_t, device_node;
Chris PeBenito b4cd15
filesystem_associate(agp_device_t)
Chris PeBenito 33bc0d
filesystem_tmpfs_associate(agp_device_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# Type for /dev/apm_bios
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
type apm_bios_t, device_node;
Chris PeBenito b4cd15
filesystem_associate(apm_bios_t)
Chris PeBenito 33bc0d
filesystem_tmpfs_associate(apm_bios_t)
Chris PeBenito b4cd15
Chris PeBenito dec168
type cardmgr_dev_t, device_node;
Chris PeBenito dec168
filesystem_associate(cardmgr_dev_t)
Chris PeBenito dec168
filesystem_tmpfs_associate(cardmgr_dev_t)
Chris PeBenito dec168
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# clock_device_t is the type of
Chris PeBenito b4cd15
# /dev/rtc.
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
type clock_device_t, device_node;
Chris PeBenito b4cd15
filesystem_associate(clock_device_t)
Chris PeBenito 33bc0d
filesystem_tmpfs_associate(clock_device_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# cpu control devices /dev/cpu/0/*
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
type cpu_device_t, device_node;
Chris PeBenito b4cd15
filesystem_associate(cpu_device_t)
Chris PeBenito 33bc0d
filesystem_tmpfs_associate(cpu_device_t)
Chris PeBenito b4cd15
Chris PeBenito 6b6740
type dri_device_t, device_node;
Chris PeBenito 6b6740
filesystem_associate(dri_device_t)
Chris PeBenito 6b6740
filesystem_tmpfs_associate(dri_device_t)
Chris PeBenito 6b6740
Chris PeBenito 6b6740
type event_device_t, device_node;
Chris PeBenito 6b6740
filesystem_associate(event_device_t)
Chris PeBenito 6b6740
filesystem_tmpfs_associate(event_device_t)
Chris PeBenito 6b6740
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# Type for framebuffer /dev/fb/*
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
type framebuf_device_t, device_node;
Chris PeBenito b4cd15
filesystem_associate(framebuf_device_t)
Chris PeBenito 33bc0d
filesystem_tmpfs_associate(framebuf_device_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito 700988
# Type for /dev/mapper/control
Chris PeBenito 700988
#
Chris PeBenito 700988
type lvm_control_t, device_node;
Chris PeBenito 4472f3
filesystem_associate(lvm_control_t)
Chris PeBenito 4472f3
filesystem_tmpfs_associate(lvm_control_t)
Chris PeBenito 700988
Chris PeBenito 700988
#
Chris PeBenito 6b6740
# memory_device_t is the type of /dev/kmem,
Chris PeBenito 6b6740
# /dev/mem and /dev/port.
Chris PeBenito 6b6740
#
Chris PeBenito 6b6740
type memory_device_t, device_node;
Chris PeBenito 6b6740
filesystem_associate(memory_device_t)
Chris PeBenito 6b6740
filesystem_tmpfs_associate(memory_device_t)
Chris PeBenito 6b6740
Chris PeBenito 6b6740
neverallow ~memory_raw_read memory_device_t:{ chr_file blk_file } read;
Chris PeBenito 6b6740
neverallow ~memory_raw_write memory_device_t:{ chr_file blk_file } { append write };
Chris PeBenito 6b6740
Chris PeBenito b16c6b
type misc_device_t, device_node;
Chris PeBenito b16c6b
filesystem_associate(misc_device_t)
Chris PeBenito b16c6b
filesystem_tmpfs_associate(misc_device_t)
Chris PeBenito b16c6b
Chris PeBenito 6b6740
#
Chris PeBenito 6b6740
# A more general type for mouse devices.
Chris PeBenito 6b6740
#
Chris PeBenito 6b6740
type mouse_device_t, device_node;
Chris PeBenito 6b6740
filesystem_associate(mouse_device_t)
Chris PeBenito 6b6740
filesystem_tmpfs_associate(mouse_device_t)
Chris PeBenito 6b6740
Chris PeBenito 6b6740
#
Chris PeBenito b4cd15
# Type for /dev/cpu/mtrr and /proc/mtrr
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
type mtrr_device_t, device_node;
Chris PeBenito b4cd15
filesystem_associate(mtrr_device_t)
Chris PeBenito 33bc0d
filesystem_tmpfs_associate(mtrr_device_t)
Chris PeBenito b4cd15
genfscon proc /mtrr system_u:object_r:mtrr_device_t
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito 6b6740
# null_device_t is the type of /dev/null.
Chris PeBenito 6b6740
#
Chris PeBenito 6b6740
type null_device_t, device_node;
Chris PeBenito 6b6740
filesystem_associate(null_device_t)
Chris PeBenito 6b6740
filesystem_tmpfs_associate(null_device_t)
Chris PeBenito 6b6740
Chris PeBenito 6b6740
#
Chris PeBenito b4cd15
# Type for /dev/pmu 
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
type power_device_t, device_node;
Chris PeBenito b4cd15
filesystem_associate(power_device_t)
Chris PeBenito 33bc0d
filesystem_tmpfs_associate(power_device_t)
Chris PeBenito b4cd15
Chris PeBenito 46be1f
type printer_device_t, device_node;
Chris PeBenito 46be1f
filesystem_associate(printer_device_t)
Chris PeBenito 46be1f
filesystem_tmpfs_associate(printer_device_t)
Chris PeBenito 46be1f
Chris PeBenito b4cd15
#
Chris PeBenito 6b6740
# random_device_t is the type of /dev/random
Chris PeBenito 6b6740
#
Chris PeBenito 6b6740
type random_device_t, device_node;
Chris PeBenito 6b6740
filesystem_associate(random_device_t)
Chris PeBenito 6b6740
filesystem_tmpfs_associate(random_device_t)
Chris PeBenito 6b6740
Chris PeBenito 6b6740
type scanner_device_t, device_node;
Chris PeBenito 6b6740
filesystem_associate(scanner_device_t)
Chris PeBenito 6b6740
filesystem_tmpfs_associate(scanner_device_t)
Chris PeBenito 6b6740
Chris PeBenito 6b6740
#
Chris PeBenito b4cd15
# Type for sound devices and mixers
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
type sound_device_t, device_node;
Chris PeBenito b4cd15
filesystem_associate(sound_device_t)
Chris PeBenito 33bc0d
filesystem_tmpfs_associate(sound_device_t)
Chris PeBenito 700988
Chris PeBenito 6b6740
#
Chris PeBenito 6b6740
# urandom_device_t is the type of /dev/urandom
Chris PeBenito 6b6740
#
Chris PeBenito 6b6740
type urandom_device_t, device_node;
Chris PeBenito 6b6740
filesystem_associate(urandom_device_t)
Chris PeBenito 6b6740
filesystem_tmpfs_associate(urandom_device_t)
Chris PeBenito 6b6740
Chris PeBenito 35b2fb
type v4l_device_t, device_node;
Chris PeBenito 35b2fb
filesystem_associate(v4l_device_t)
Chris PeBenito 35b2fb
filesystem_tmpfs_associate(v4l_device_t)
Chris PeBenito 35b2fb
Chris PeBenito 700988
type xserver_misc_device_t, device_node;
Chris PeBenito 700988
filesystem_associate(xserver_misc_device_t)
Chris PeBenito 700988
filesystem_tmpfs_associate(xserver_misc_device_t)
Chris PeBenito 6b6740
Chris PeBenito 6b6740
#
Chris PeBenito 6b6740
# zero_device_t is the type of /dev/zero.
Chris PeBenito 6b6740
#
Chris PeBenito 6b6740
type zero_device_t, device_node;
Chris PeBenito 6b6740
filesystem_associate(zero_device_t)
Chris PeBenito 6b6740
filesystem_tmpfs_associate(zero_device_t)