Chris PeBenito 3865d6
## <module name="clock" layer="system">
Chris PeBenito e32d52
## <summary>Policy for reading and setting the hardware clock.</summary>
Chris PeBenito b2b38c
Chris PeBenito daa0e0
########################################
Chris PeBenito c9428d
## <interface name="clock_domtrans">
Chris PeBenito daa0e0
##	<description>
Chris PeBenito daa0e0
##		Execute hwclock in the clock domain.
Chris PeBenito daa0e0
##	</description>
Chris PeBenito daa0e0
##	<parameter name="domain">
Chris PeBenito daa0e0
##		The type of the process performing this action.
Chris PeBenito daa0e0
##	</parameter>
Chris PeBenito daa0e0
## </interface>
Chris PeBenito 075c4f
#
Chris PeBenito c9428d
define(`clock_domtrans',`
Chris PeBenito 0c73cd
	requires_block_template(`$0'_depend)
Chris PeBenito 0c73cd
Chris PeBenito a71972
	domain_auto_trans($1,hwclock_exec_t,hwclock_t)
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	allow $1 hwclock_t:fd use;
Chris PeBenito 0c73cd
	allow hwclock_t $1:fd use;
Chris PeBenito 0c73cd
	allow hwclock_t $1:fifo_file rw_file_perms;
Chris PeBenito 0c73cd
	allow hwclock_t $1:process sigchld;
Chris PeBenito 075c4f
')
Chris PeBenito 075c4f
Chris PeBenito c9428d
define(`clock_domtrans_depend',`
Chris PeBenito 0c73cd
	type hwclock_t, hwclock_exec_t;
Chris PeBenito 0c73cd
Chris PeBenito dd8229
	class file rx_file_perms;
Chris PeBenito 0c73cd
	class process { transition noatsecure siginh rlimitinh sigchld };
Chris PeBenito 0c73cd
	class fd use;
Chris PeBenito 0c73cd
	class fifo_file rw_file_perms;
Chris PeBenito 075c4f
')
Chris PeBenito 075c4f
Chris PeBenito daa0e0
########################################
Chris PeBenito c9428d
## <interface name="clock_run">
Chris PeBenito daa0e0
##	<description>
Chris PeBenito daa0e0
##		Execute hwclock in the clock domain, and
Chris PeBenito daa0e0
##		allow the specified role the hwclock domain.
Chris PeBenito daa0e0
##	</description>
Chris PeBenito daa0e0
##	<parameter name="domain">
Chris PeBenito daa0e0
##		The type of the process performing this action.
Chris PeBenito daa0e0
##	</parameter>
Chris PeBenito daa0e0
##	<parameter name="role">
Chris PeBenito daa0e0
##		The role to be allowed the clock domain.
Chris PeBenito daa0e0
##	</parameter>
Chris PeBenito daa0e0
##	<parameter name="terminal">
Chris PeBenito daa0e0
##		The type of the terminal allow the clock domain to use.
Chris PeBenito daa0e0
##	</parameter>
Chris PeBenito daa0e0
## </interface>
Chris PeBenito daa0e0
#
Chris PeBenito c9428d
define(`clock_run',`
Chris PeBenito 0c73cd
	requires_block_template(`$0'_depend)
Chris PeBenito 0c73cd
Chris PeBenito c9428d
	clock_domtrans($1)
Chris PeBenito 0c73cd
	role $2 types hwclock_t;
Chris PeBenito 0c73cd
	allow hwclock_t $3:chr_file { getattr read write ioctl };
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito c9428d
define(`clock_run_depend',`
Chris PeBenito 0c73cd
	type hwclock_t;
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	class chr_file { getattr read write ioctl };
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito 3865d6
########################################
Chris PeBenito c9428d
## <interface name="clock_exec">
Chris PeBenito 3865d6
##     <description>
Chris PeBenito 3865d6
##             Execute hwclock
Chris PeBenito 3865d6
##     </description>
Chris PeBenito 3865d6
##     <parameter name="domain">
Chris PeBenito 3865d6
##             The type of the process performing this action.
Chris PeBenito 3865d6
##     </parameter>
Chris PeBenito 3865d6
## </interface>
Chris PeBenito 075c4f
#
Chris PeBenito c9428d
define(`clock_exec',`
Chris PeBenito 0c73cd
	requires_block_template(`$0'_depend)
Chris PeBenito 0c73cd
Chris PeBenito a71972
	can_exec($1,hwclock_exec_t)
Chris PeBenito 075c4f
')
Chris PeBenito 075c4f
Chris PeBenito c9428d
define(`clock_exec_depend',`
Chris PeBenito 0c73cd
	type hwclock_exec_t;
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	class file { getattr read execute execute_no_trans };
Chris PeBenito 075c4f
')
Chris PeBenito 075c4f
Chris PeBenito 3865d6
########################################
Chris PeBenito c9428d
## <interface name="clock_rw_adjtime">
Chris PeBenito 3865d6
##     <description>
Chris PeBenito 3865d6
##             Allow executing domain to modify clock drift
Chris PeBenito 3865d6
##     </description>
Chris PeBenito 3865d6
##     <parameter name="domain">
Chris PeBenito 3865d6
##             The type of the process performing this action.
Chris PeBenito 3865d6
##     </parameter>
Chris PeBenito 3865d6
## </interface>
Chris PeBenito b2b38c
#
Chris PeBenito c9428d
define(`clock_rw_adjtime',`
Chris PeBenito 0c73cd
	requires_block_template(`$0'_depend)
Chris PeBenito 0c73cd
Chris PeBenito a71972
	allow $1 adjtime_t:file rw_file_perms;
Chris PeBenito c9428d
	files_read_generic_etc_files_directory($1)
Chris PeBenito b2b38c
')
Chris PeBenito b2b38c
Chris PeBenito c9428d
define(`clock_rw_adjtime_depend',`
Chris PeBenito 0c73cd
	type adjtime_t;
Chris PeBenito 0c73cd
Chris PeBenito a71972
	class file rw_file_perms;
Chris PeBenito b2b38c
')
Chris PeBenito e32d52
Chris PeBenito e32d52
## </module>