+ ')
+
+ ########################################
+ ##
+-## Do not audit attempts to write in a sysfs directory.
+## Unmount sysfs filesystems.
-+##
-+##
-+##
-+## Domain allowed access.
-+##
-+##
-+#
-+interface(`dev_unmount_sysfs_fs',`
-+ gen_require(`
-+ type sysfs_t;
-+ ')
-+
-+ allow $1 sysfs_t:filesystem unmount;
-+')
-+
-+########################################
-+##
- ## Search the sysfs directories.
##
##
-@@ -3904,6 +4306,7 @@ interface(`dev_list_sysfs',`
+ ##
+-## Domain to not audit.
++## Domain allowed access.
+ ##
+ ##
+ #
+-interface(`dev_dontaudit_write_sysfs_dirs',`
++interface(`dev_unmount_sysfs_fs',`
+ gen_require(`
type sysfs_t;
')
-+ read_lnk_files_pattern($1, sysfs_t, sysfs_t)
- list_dirs_pattern($1, sysfs_t, sysfs_t)
+- dontaudit $1 sysfs_t:dir write;
++ allow $1 sysfs_t:filesystem unmount;
')
-@@ -3946,23 +4349,49 @@ interface(`dev_dontaudit_write_sysfs_dirs',`
-
########################################
##
-## Create, read, write, and delete sysfs
-## directories.
-+## Read cpu online hardware state information.
++## Search the sysfs directories.
##
-+##
-+##
-+## Allow the specified domain to read /sys/devices/system/cpu/online file.
-+##
-+##
##
##
- ## Domain allowed access.
+@@ -3955,47 +4283,35 @@ interface(`dev_dontaudit_write_sysfs_dirs',`
##
##
#
-interface(`dev_manage_sysfs_dirs',`
-+interface(`dev_read_cpu_online',`
-+ gen_require(`
-+ type cpu_online_t;
-+ ')
-+
-+ dev_search_sysfs($1)
-+ read_files_pattern($1, cpu_online_t, cpu_online_t)
-+')
-+
-+########################################
-+##
-+## Relabel cpu online hardware state information.
-+##
-+##
-+##
-+## Domain allowed access.
-+##
-+##
-+#
-+interface(`dev_relabel_cpu_online',`
++interface(`dev_search_sysfs',`
gen_require(`
-+ type cpu_online_t;
type sysfs_t;
')
- manage_dirs_pattern($1, sysfs_t, sysfs_t)
-+ dev_search_sysfs($1)
-+ allow $1 cpu_online_t:file relabel_file_perms;
++ search_dirs_pattern($1, sysfs_t, sysfs_t)
')
-+
########################################
##
- ## Read hardware state information.
-@@ -4016,7 +4445,7 @@ interface(`dev_rw_sysfs',`
+-## Read hardware state information.
++## Do not audit attempts to search sysfs.
+ ##
+-##
+-##
+-## Allow the specified domain to read the contents of
+-## the sysfs filesystem. This filesystem contains
+-## information, parameters, and other settings on the
+-## hardware installed on the system.
+-##
+-##
+ ##
+ ##
+-## Domain allowed access.
++## Domain to not audit.
+ ##
+ ##
+-##
+ #
+-interface(`dev_read_sysfs',`
++interface(`dev_dontaudit_search_sysfs',`
+ gen_require(`
+ type sysfs_t;
+ ')
+
+- read_files_pattern($1, sysfs_t, sysfs_t)
+- read_lnk_files_pattern($1, sysfs_t, sysfs_t)
+-
+- list_dirs_pattern($1, sysfs_t, sysfs_t)
++ dontaudit $1 sysfs_t:dir search_dir_perms;
+ ')
+
+ ########################################
+ ##
+-## Allow caller to modify hardware state information.
++## List the contents of the sysfs directories.
+ ##
+ ##
+ ##
+@@ -4003,20 +4319,18 @@ interface(`dev_read_sysfs',`
+ ##
+ ##
+ #
+-interface(`dev_rw_sysfs',`
++interface(`dev_list_sysfs',`
+ gen_require(`
+ type sysfs_t;
+ ')
+
+- rw_files_pattern($1, sysfs_t, sysfs_t)
+ read_lnk_files_pattern($1, sysfs_t, sysfs_t)
+-
+ list_dirs_pattern($1, sysfs_t, sysfs_t)
+ ')
########################################
##
-## Read and write the TPM device.
-+## Relabel hardware state directories.
++## Write in a sysfs directories.
##
##
##
-@@ -4024,58 +4453,114 @@ interface(`dev_rw_sysfs',`
+@@ -4024,78 +4338,60 @@ interface(`dev_rw_sysfs',`
##
##
#
-interface(`dev_rw_tpm',`
-+interface(`dev_relabel_sysfs_dirs',`
++# cjp: added for cpuspeed
++interface(`dev_write_sysfs_dirs',`
gen_require(`
- type device_t, tpm_device_t;
+ type sysfs_t;
')
- rw_chr_files_pattern($1, device_t, tpm_device_t)
-+ relabel_dirs_pattern($1, sysfs_t, sysfs_t)
++ allow $1 sysfs_t:dir write;
')
########################################
##
-## Read from pseudo random number generator devices (e.g., /dev/urandom).
-+## Relabel hardware state files
++## Do not audit attempts to write in a sysfs directory.
##
-##
-##
@@ -6533,27 +6581,172 @@ index 76f285e..09ccba4 100644
-##
##
##
- ## Domain allowed access.
+-## Domain allowed access.
++## Domain to not audit.
##
##
-##
#
-interface(`dev_read_urand',`
-+interface(`dev_relabel_all_sysfs',`
++interface(`dev_dontaudit_write_sysfs_dirs',`
gen_require(`
- type device_t, urandom_device_t;
+ type sysfs_t;
')
- read_chr_files_pattern($1, device_t, urandom_device_t)
-+ relabel_dirs_pattern($1, sysfs_t, sysfs_t)
-+ relabel_files_pattern($1, sysfs_t, sysfs_t)
-+ relabel_lnk_files_pattern($1, sysfs_t, sysfs_t)
++ dontaudit $1 sysfs_t:dir write;
')
########################################
##
-## Do not audit attempts to read from pseudo
+-## random devices (e.g., /dev/urandom)
++## Read cpu online hardware state information.
+ ##
++##
++##
++## Allow the specified domain to read /sys/devices/system/cpu/online file.
++##
++##
+ ##
+ ##
+-## Domain to not audit.
++## Domain allowed access.
+ ##
+ ##
+ #
+-interface(`dev_dontaudit_read_urand',`
++interface(`dev_read_cpu_online',`
+ gen_require(`
+- type urandom_device_t;
++ type cpu_online_t;
+ ')
+
+- dontaudit $1 urandom_device_t:chr_file { getattr read };
++ dev_search_sysfs($1)
++ read_files_pattern($1, cpu_online_t, cpu_online_t)
+ ')
+
+ ########################################
+ ##
+-## Write to the pseudo random device (e.g., /dev/urandom). This
+-## sets the random number generator seed.
++## Relabel cpu online hardware state information.
+ ##
+ ##
+ ##
+@@ -4103,19 +4399,245 @@ interface(`dev_dontaudit_read_urand',`
+ ##
+ ##
+ #
+-interface(`dev_write_urand',`
++interface(`dev_relabel_cpu_online',`
+ gen_require(`
+- type device_t, urandom_device_t;
++ type cpu_online_t;
++ type sysfs_t;
+ ')
+
+- write_chr_files_pattern($1, device_t, urandom_device_t)
++ dev_search_sysfs($1)
++ allow $1 cpu_online_t:file relabel_file_perms;
+ ')
+
++
+ ########################################
+ ##
+-## Getattr generic the USB devices.
++## Read hardware state information.
+ ##
+-##
++##
++##
++## Allow the specified domain to read the contents of
++## the sysfs filesystem. This filesystem contains
++## information, parameters, and other settings on the
++## hardware installed on the system.
++##
++##
++##
++##
++## Domain allowed access.
++##
++##
++##
++#
++interface(`dev_read_sysfs',`
++ gen_require(`
++ type sysfs_t;
++ ')
++
++ read_files_pattern($1, sysfs_t, sysfs_t)
++ read_lnk_files_pattern($1, sysfs_t, sysfs_t)
++
++ list_dirs_pattern($1, sysfs_t, sysfs_t)
++')
++
++########################################
++##
++## Allow caller to modify hardware state information.
++##
++##
++##
++## Domain allowed access.
++##
++##
++#
++interface(`dev_rw_sysfs',`
++ gen_require(`
++ type sysfs_t;
++ ')
++
++ rw_files_pattern($1, sysfs_t, sysfs_t)
++ read_lnk_files_pattern($1, sysfs_t, sysfs_t)
++
++ list_dirs_pattern($1, sysfs_t, sysfs_t)
++')
++
++########################################
++##
++## Relabel hardware state directories.
++##
++##
++##
++## Domain allowed access.
++##
++##
++#
++interface(`dev_relabel_sysfs_dirs',`
++ gen_require(`
++ type sysfs_t;
++ ')
++
++ relabel_dirs_pattern($1, sysfs_t, sysfs_t)
++')
++
++########################################
++##
++## Relabel hardware state files
++##
++##
++##
++## Domain allowed access.
++##
++##
++#
++interface(`dev_relabel_all_sysfs',`
++ gen_require(`
++ type sysfs_t;
++ ')
++
++ relabel_dirs_pattern($1, sysfs_t, sysfs_t)
++ relabel_files_pattern($1, sysfs_t, sysfs_t)
++ relabel_lnk_files_pattern($1, sysfs_t, sysfs_t)
++')
++
++########################################
++##
+## Allow caller to modify hardware state information.
+##
+##
@@ -6632,13 +6825,43 @@ index 76f285e..09ccba4 100644
+########################################
+##
+## Do not audit attempts to read from pseudo
- ## random devices (e.g., /dev/urandom)
- ##
- ##
-@@ -4113,6 +4598,25 @@ interface(`dev_write_urand',`
-
- ########################################
- ##
++## random devices (e.g., /dev/urandom)
++##
++##
++##
++## Domain to not audit.
++##
++##
++#
++interface(`dev_dontaudit_read_urand',`
++ gen_require(`
++ type urandom_device_t;
++ ')
++
++ dontaudit $1 urandom_device_t:chr_file { getattr read };
++')
++
++########################################
++##
++## Write to the pseudo random device (e.g., /dev/urandom). This
++## sets the random number generator seed.
++##
++##
++##
++## Domain allowed access.
++##
++##
++#
++interface(`dev_write_urand',`
++ gen_require(`
++ type device_t, urandom_device_t;
++ ')
++
++ write_chr_files_pattern($1, device_t, urandom_device_t)
++')
++
++########################################
++##
+## Do not audit attempts to write to pseudo
+## random devices (e.g., /dev/urandom)
+##
@@ -6658,10 +6881,13 @@ index 76f285e..09ccba4 100644
+
+########################################
+##
- ## Getattr generic the USB devices.
- ##
- ##
-@@ -4409,9 +4913,9 @@ interface(`dev_rw_usbfs',`
++## Getattr generic the USB devices.
++##
++##