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
#
Chris PeBenito b4cd15
# Device types
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
Chris PeBenito b4cd15
attribute device_node;
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# device_t is the type of /dev.
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
type device_t, device_node;
Chris PeBenito b4cd15
filesystem_associate(device_t)
Chris PeBenito 33bc0d
filesystem_tmpfs_associate(device_t)
Chris PeBenito 33bc0d
filesystem_noxattr_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 b4cd15
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
# zero_device_t is the type of /dev/zero.
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
type zero_device_t, device_node;
Chris PeBenito b4cd15
filesystem_associate(zero_device_t)
Chris PeBenito 33bc0d
filesystem_tmpfs_associate(zero_device_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# null_device_t is the type of /dev/null.
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
type null_device_t, device_node;
Chris PeBenito b4cd15
filesystem_associate(null_device_t)
Chris PeBenito 33bc0d
filesystem_tmpfs_associate(null_device_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# memory_device_t is the type of /dev/kmem,
Chris PeBenito b4cd15
# /dev/mem and /dev/port.
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
type memory_device_t, device_node;
Chris PeBenito b4cd15
filesystem_associate(memory_device_t)
Chris PeBenito 33bc0d
filesystem_tmpfs_associate(memory_device_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
attribute memory_raw_read;
Chris PeBenito b4cd15
attribute memory_raw_write;
Chris PeBenito b4cd15
neverallow ~memory_raw_read memory_device_t:{ chr_file blk_file } read;
Chris PeBenito b4cd15
neverallow ~memory_raw_write memory_device_t:{ chr_file blk_file } { append write };
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# random_device_t is the type of /dev/random
Chris PeBenito b4cd15
# urandom_device_t is the type of /dev/urandom
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
type random_device_t, device_node;
Chris PeBenito b4cd15
type urandom_device_t, device_node;
Chris PeBenito b4cd15
filesystem_associate(random_device_t)
Chris PeBenito b4cd15
filesystem_associate(urandom_device_t)
Chris PeBenito 33bc0d
filesystem_tmpfs_associate(random_device_t)
Chris PeBenito 33bc0d
filesystem_tmpfs_associate(urandom_device_t)
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 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 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 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 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 b4cd15
#
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)