Blob Blame History Raw
## <module name="kernel" layer="kernel">
## <summary>
##	Policy for kernel threads, security interface (selinuxfs),
##	proc filesystem, sysfs filesystem, and usb device filesystem.
## </summary>

########################################
#
# kernel_make_userland_entrypoint(domain,entrypoint)
#
define(`kernel_make_userland_entrypoint',`
	requires_block_template(`$0'_depend)

	allow kernel_t $2:file { getattr read execute };
	allow kernel_t $1:process transition;
	allow $1 kernel_t:fd use;
	type_transition kernel_t $2:process $1;
	dontaudit kernel_t $1:process { noatsecure siginh rlimitinh };

	allow $1 kernel_t:fd use;
	allow kernel_t $1:fd use;
	allow kernel_t $1:fifo_file rw_file_perms;
	allow $1 kernel_t:process sigchld;
')

define(`kernel_make_userland_entrypoint_depend',`
	type kernel_t;

	class process { transition noatsecure siginh rlimitinh sigchld };
	class file { getattr read execute };
	class fifo_file rw_file_perms;
	class fd use;
')

########################################
#
# kernel_share_state(domain)
#
define(`kernel_share_state',`
	requires_block_template(`$0'_depend)

	allow kernel_t $1:process share;
')

define(`kernel_share_state_depend',`
	type kernel_t;

	class process share;
')

########################################
#
# kernel_use_file_descriptors(domain)
#
define(`kernel_use_file_descriptors',`
	requires_block_template(`$0'_depend)

	allow $1 kernel_t:fd use;
')

define(`kernel_use_file_descriptors_depend',`
	type kernel_t;

	class fd use;
')

########################################
#
# kernel_ignore_use_file_descriptors(domain)
#
define(`kernel_ignore_use_file_descriptors',`
	requires_block_template(`$0'_depend)

	dontaudit $1 kernel_t:fd use;
')

define(`kernel_ignore_use_file_descriptors_depend',`
	type kernel_t;

	class fd use;
')

########################################
#
# kernel_make_root_filesystem_mountpoint(domain)
#
define(`kernel_make_root_filesystem_mountpoint',`
	requires_block_template(`$0'_depend)

	allow kernel_t $1:dir mounton;
')

define(`kernel_make_root_filesystem_mountpoint_depend',`
	type kernel_t;

	class dir mounton;
')

########################################
#
# kernel_make_process_identity_change_constraint_exception(domain)
#
define(`kernel_make_process_identity_change_constraint_exception',`
	requires_block_template(`$0'_depend)

	typeattribute $1 can_change_process_identity;
')

define(`kernel_make_process_identity_change_constraint_exception_depend',`
	attribute can_change_process_identity;
')

########################################
#
# kernel_make_role_change_constraint_exception(domain)
#
define(`kernel_make_role_change_constraint_exception',`
	requires_block_template(`$0'_depend)

	typeattribute $1 can_change_process_role;
')

define(`kernel_make_role_change_constraint_exception_depend',`
	attribute can_change_process_role;
')

########################################
#
# kernel_make_object_identity_change_constraint_exception(domain)
#
define(`kernel_make_object_identity_change_constraint_exception',`
	requires_block_template(`$0'_depend)

	typeattribute $1 can_change_object_identity;
')

define(`kernel_make_object_identity_change_constraint_exception_depend',`
	attribute can_change_object_identity;
')

########################################
#
# kernel_load_module(domain)
#
define(`kernel_load_module',`
	requires_block_template(`$0'_depend)

	allow $1 self:capability sys_module;
	typeattribute $1 can_load_kernmodule;
')

define(`kernel_load_module_depend',`
	attribute can_load_kernmodule;

	class capability sys_module;
')

########################################
#
# kernel_get_selinux_enforcement_mode(domain)
#
define(`kernel_get_selinux_enforcement_mode',`
	requires_block_template(`$0'_depend)

	allow $1 security_t:dir { read search getattr };
	allow $1 security_t:file { getattr read };
')

define(`kernel_get_selinux_enforcement_mode_depend',`
	type security_t;

	class dir { read search getattr };
	class file { getattr read };
')

########################################
#
# kernel_set_selinux_enforcement_mode(domain)
#
define(`kernel_set_selinux_enforcement_mode',`
	requires_block_template(`$0'_depend)

	allow $1 security_t:dir { read search getattr };
	allow $1 security_t:file { getattr read write };
	allow $1 security_t:security setenforce;
	auditallow $1 security_t:security setenforce;
	typeattribute $1 can_setenforce;
')

define(`kernel_set_selinux_enforcement_mode_depend',`
	type security_t;

	attribute can_setenforce;

	class dir { read search getattr };
	class file { getattr read write };
	class security setenforce;
')

########################################
#
# kernel_load_selinux_policy(domain)
#
define(`kernel_load_selinux_policy',`
	requires_block_template(`$0'_depend)

	allow $1 security_t:dir { read search getattr };
	allow $1 security_t:file { getattr read write };
	allow $1 security_t:security load_policy;
	auditallow $1 security_t:security load_policy;
	typeattribute $1 can_load_policy;
')

define(`kernel_load_selinux_policy_depend',`
	type security_t;

	attribute can_load_policy;

	class dir { read search getattr };
	class file { getattr read write };
	class security load_policy;
')

########################################
#
# kernel_set_selinux_boolean(domain,[booltype])
#
define(`kernel_set_selinux_boolean',`
	requires_block_template(`$0'_depend)

	ifelse(`$2',`',`
		allow $1 security_t:dir { getattr search read };
		allow $1 security_t:file { getattr read write };
	',`
		allow $1 $2:dir { getattr search read };
		allow $1 $2:file { getattr read write };
	')

	allow $1 security_t:dir search;
	allow $1 security_t:security setbool;
	auditallow $1 security_t:security setbool;
')

define(`kernel_set_selinux_boolean_depend',`
	type security_t;

	class dir { read search getattr };
	class file { getattr read write };
	class security setbool;
')

########################################
#
# kernel_set_selinux_security_parameters(domain)
#
define(`kernel_set_selinux_security_parameters',`
	requires_block_template(`$0'_depend)

	allow $1 security_t:dir { read search getattr };
	allow $1 security_t:file { getattr read write };
	allow $1 security_t:security setsecparam;
	auditallow $1 security_t:security setsecparam;
	typeattribute $1 can_setsecparam;
')

define(`kernel_set_selinux_security_parameters_depend',`
	type security_t;

	attribute can_setsecparam;

	class dir { read search getattr };
	class file { getattr read write };
	class security setsecparam;
')

########################################
#
# kernel_validate_selinux_context(domain)
#
define(`kernel_validate_selinux_context',`
	requires_block_template(`$0'_depend)

	allow $1 security_t:dir { read search getattr };
	allow $1 security_t:file { getattr read write };
	allow $1 security_t:security check_context;
')

define(`kernel_validate_selinux_context_depend',`
	type security_t;

	class dir { read search getattr };
	class file { getattr read write };
	class security check_context;
')

########################################
#
# kernel_compute_selinux_access_vector(domain)
#
define(`kernel_compute_selinux_access_vector',`
	requires_block_template(`$0'_depend)

	allow $1 security_t:dir { read search getattr };
	allow $1 security_t:file { getattr read write };
	allow $1 security_t:security compute_av;
')

define(`kernel_compute_selinux_access_vector_depend',`
	type security_t;

	class dir { read search getattr };
	class file { getattr read write };
	class security compute_av;
')

########################################
#
# kernel_compute_selinux_create_context(domain)
#
define(`kernel_compute_selinux_create_context',`
	requires_block_template(`$0'_depend)

	allow $1 security_t:dir { read search getattr };
	allow $1 security_t:file { getattr read write };
	allow $1 security_t:security compute_create;
')

define(`kernel_compute_selinux_create_context_depend',`
	type security_t;

	class dir { read search getattr };
	class file { getattr read write };
	class security compute_create;
')

########################################
#
# kernel_compute_selinux_relabel_context(domain)
#
define(`kernel_compute_selinux_relabel_context',`
	requires_block_template(`$0'_depend)

	allow $1 security_t:dir { read search getattr };
	allow $1 security_t:file { getattr read write };
	allow $1 security_t:security compute_relabel;
')

define(`kernel_compute_selinux_relabel_context_depend',`
	type security_t;

	class dir { read search getattr };
	class file { getattr read write };
	class security compute_relabel;
')

########################################
#
# kernel_compute_selinux_reachable_user_contexts(domain)
#
define(`kernel_compute_selinux_reachable_user_contexts',`
	requires_block_template(`$0'_depend)

	allow $1 security_t:dir { read search getattr };
	allow $1 security_t:file { getattr read write };
	allow $1 security_t:security compute_user;
')

define(`kernel_compute_selinux_reachable_user_contexts_depend',`
	type security_t;

	class dir { read search getattr };
	class file { getattr read write };
	class security compute_user;
')

########################################
#
# kernel_read_ring_buffer(domain)
#
define(`kernel_read_ring_buffer',`
	requires_block_template(`$0'_depend)

	allow $1 kernel_t:system syslog_read;
')

define(`kernel_read_ring_buffer_depend',`
	type kernel_t;

	class system syslog_read;
')

########################################
#
# kernel_ignore_read_ring_buffer(domain)
#
define(`kernel_ignore_read_ring_buffer',`
	requires_block_template(`$0'_depend)

	dontaudit $1 kernel_t:system syslog_read;
')

define(`kernel_ignore_read_ring_buffer_depend',`
	type kernel_t;

	class system syslog_read;
')

########################################
#
# kernel_change_ring_buffer_level(domain)
#
define(`kernel_change_ring_buffer_level',`
	requires_block_template(`$0'_depend)

	allow $1 kernel_t:system syslog_console;
')

define(`kernel_change_ring_buffer_level_depend',`
	type kernel_t;

	class system syslog_console;
')

########################################
#
# kernel_clear_ring_buffer(domain)
#
define(`kernel_clear_ring_buffer',`
	requires_block_template(`$0'_depend)

	allow $1 kernel_t:system syslog_mod;
')

define(`kernel_clear_ring_buffer_depend',`
	type kernel_t;

	class system syslog_mod;
')

########################################
#
# kernel_get_sysvipc_info(domain)
#
define(`kernel_get_sysvipc_info',`
	requires_block_template(`$0'_depend)

	allow $1 kernel_t:system ipc_info;
')

define(`kernel_get_sysvipc_info_depend',`
	type kernel_t;

	class system ipc_info;
')

########################################
#
# kernel_get_selinuxfs_mount_point(domain)
#
define(`kernel_get_selinuxfs_mount_point',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 proc_t:{ file lnk_file } read;
	allow $1 self:dir search;
	allow $1 self:file { getattr read };
')

define(`kernel_get_selinuxfs_mount_point_depend',`
	type proc_t;

	class dir search;
	class lnk_file read;
	class file { getattr read };
')

########################################
#
# kernel_read_system_state(domain)
#
define(`kernel_read_system_state',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir r_dir_perms;
	allow $1 proc_t:lnk_file { getattr read };
	allow $1 proc_t:file r_file_perms;
')

define(`kernel_read_system_state_depend',`
	type proc_t;

	class dir r_dir_perms;
	class lnk_file { getattr read };
	class file r_file_perms;
')

########################################
#
# kernel_ignore_read_system_state(domain)
#
define(`kernel_ignore_read_system_state',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:file read;
')

define(`kernel_ignore_read_system_state_depend',`
	type proc_t;

	class file read;
')

#######################################
#
# kernel_read_software_raid_state(domain)
#
define(`kernel_read_software_raid_state',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir { getattr search read };
	allow $1 proc_mdstat_t:file { getattr read };
')

define(`kernel_read_software_raid_state_depend',`
	type proc_t, proc_mdstat_t;

	class dir { search getattr read };
	class file { getattr read };
')

########################################
#
# kernel_get_core_interface_attributes(domain)
#
define(`kernel_get_core_interface_attributes',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir { getattr search read };
	allow $1 proc_kcore_t:file getattr;
')

define(`kernel_get_core_interface_attributes_depend',`
	type proc_t, proc_kcore_t;

	class dir { search getattr read };
	class file getattr;
')

########################################
#
# kernel_ignore_get_core_interface_attributes(domain)
#
define(`kernel_ignore_get_core_interface_attributes',`
	requires_block_template(`$0'_depend)

	dontaudit $1 proc_kcore_t:file getattr;
')

define(`kernel_ignore_get_core_interface_attributes_depend',`
	type proc_kcore_t;

	class file getattr;
')

########################################
#
# kernel_read_messages(domain)
#
define(`kernel_read_messages',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 proc_kmsg_t:file { getattr read };
	typeattribute $1 can_receive_kernel_messages;
')

define(`kernel_read_messages_depend',`
	attribute can_receive_kernel_messages;

	type proc_kmsg_t, proc_t;

	class dir search;
	class file { getattr read };
')

########################################
#
# kernel_get_message_interface_attributes(domain)
#
define(`kernel_get_message_interface_attributes',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 proc_kmsg_t:file getattr;
')

define(`kernel_get_message_interface_attributes_depend',`
	type proc_kmsg_t, proc_t;

	class dir search;
	class file getattr;
')

########################################
#
# kernel_ignore_get_message_interface_attributes(domain)
#
define(`kernel_ignore_get_message_interface_attributes',`
	requires_block_template(`$0'_depend)

	dontaudit $1 proc_kmsg_t:file getattr;
')

define(`kernel_ignore_get_message_interface_attributes_depend',`
	type proc_kmsg_t, proc_t;

	class file getattr;
')

########################################
#
# kernel_read_network_state(domain)
#
define(`kernel_read_network_state',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 proc_net_t:dir { getattr search read };
	allow $1 proc_net_t:file { getattr read };
')

define(`kernel_read_network_state_depend',`
	type proc_t, proc_net_t;

	class dir { search getattr read };
	class file { getattr read };
')

########################################
#
# kernel_ignore_search_sysctl_dir(domain)
#
define(`kernel_ignore_search_sysctl_dir',`
	requires_block_template(`$0'_depend)

	dontaudit $1 sysctl_t:dir search;
')

define(`kernel_ignore_search_sysctl_dir_depend',`
	type sysctl_t;

	class dir search;
')

########################################
#
# kernel_read_device_sysctl(domain)
#
define(`kernel_read_device_sysctl',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 sysctl_t:dir { getattr search read };
	allow $1 sysctl_dev_t:dir { getattr search read };
	allow $1 sysctl_dev_t:file { getattr read };
')

define(`kernel_read_device_sysctl_depend',`
	type proc_t, sysctl_t, sysctl_dev_t;

	class dir { search getattr read };
	class file { getattr read };
')

########################################
#
# kernel_modify_device_sysctl(domain)
#
define(`kernel_modify_device_sysctl',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 sysctl_t:dir { getattr search read };
	allow $1 sysctl_dev_t:file { getattr read write };
')

define(`kernel_modify_device_sysctl_depend',`
	type proc_t, sysctl_t, sysctl_dev_t;

	class dir { search getattr read };
	class file { getattr read write };
')

########################################
#
# kernel_read_virtual_memory_sysctl(domain)
#
define(`kernel_read_virtual_memory_sysctl',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 sysctl_t:dir { getattr search read };
	allow $1 sysctl_vm_t:file { getattr read };
')

define(`kernel_read_virtual_memory_sysctl_depend',`
	type proc_t, sysctl_t, sysctl_vm_t;

	class dir { search getattr read };
	class file { getattr read };
')

########################################
#
# kernel_modify_virtual_memory_sysctl(domain)
#
define(`kernel_modify_virtual_memory_sysctl',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 sysctl_t:dir { getattr search read };
	allow $1 sysctl_vm_t:file { getattr read write };
')

define(`kernel_modify_virtual_memory_sysctl_depend',`
	type proc_t, sysctl_t, sysctl_vm_t;

	class dir { search getattr read };
	class file { getattr read write };
')

########################################
#
# kernel_ignore_search_network_sysctl_dir(domain)
#
define(`kernel_ignore_search_network_sysctl_dir',`
	requires_block_template(`$0'_depend)

	dontaudit $1 sysctl_net_t:dir search;
')

define(`kernel_ignore_search_network_sysctl_dir_depend',`
	type sysctl_net_t;

	class dir search;
')

########################################
#
# kernel_read_network_sysctl(domain)
#
define(`kernel_read_network_sysctl',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 sysctl_t:dir { getattr search read };
	allow $1 sysctl_net_t:dir { getattr search read };
	allow $1 sysctl_net_t:file { getattr read };
')

define(`kernel_read_network_sysctl_depend',`
	type proc_t, sysctl_t, sysctl_net_t;

	class dir { search getattr read };
	class file { getattr read };
')

########################################
#
# kernel_modify_network_sysctl(domain)
#
define(`kernel_modify_network_sysctl',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 sysctl_t:dir { getattr search read };
	allow $1 sysctl_net_t:dir { getattr search read };
	allow $1 sysctl_net_t:file { getattr read write };
')

define(`kernel_modify_network_sysctl_depend',`
	type proc_t, sysctl_t, sysctl_net_t;

	class dir { search getattr read };
	class file { getattr read write };
')

########################################
#
# kernel_read_unix_sysctl(domain)
#
define(`kernel_read_unix_sysctl',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 sysctl_t:dir { getattr search read };
	allow $1 sysctl_net_t:dir { getattr search read };
	allow $1 sysctl_net_unix_t:file { getattr read };
')

define(`kernel_read_net_sysctl_depend',`
	type proc_t, sysctl_t, sysctl_net_t, sysctl_net_unix_t;

	class dir { search getattr read };
	class file { getattr read };
')

########################################
#
# kernel_modify_unix_sysctl(domain)
#
define(`kernel_modify_unix_sysctl',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 sysctl_t:dir { getattr search read };
	allow $1 sysctl_net_t:dir { getattr search read };
	allow $1 sysctl_net_unix_t:file { getattr read write };
')

define(`kernel_modify_net_sysctl_depend',`
	type proc_t, sysctl_t, sysctl_net_t, sysctl_net_unix_t;

	class dir { search getattr read };
	class file { getattr read write };
')

########################################
#
# kernel_read_hotplug_sysctl(domain)
#
define(`kernel_read_hotplug_sysctl',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 sysctl_t:dir { getattr search read };
	allow $1 sysctl_kernel_t:dir { getattr search read };
	allow $1 sysctl_hotplug_t:file { getattr read };
')

define(`kernel_read_hotplug_sysctl_depend',`
	type proc_t, sysctl_t, sysctl_kernel_t, sysctl_hotplug_t;

	class dir { search getattr read };
	class file { getattr read };
')

########################################
#
# kernel_modify_hotplug_sysctl(domain)
#
define(`kernel_modify_hotplug_sysctl',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 sysctl_t:dir { getattr search read };
	allow $1 sysctl_kernel_t:dir { getattr search read };
	allow $1 sysctl_hotplug_t:file { getattr read write };
')

define(`kernel_modify_hotplug_sysctl_depend',`
	type proc_t, sysctl_t, sysctl_kernel_t, sysctl_hotplug_t;

	class dir { search getattr read };
	class file { getattr read write };
')

########################################
#
# kernel_read_modprobe_sysctl(domain)
#
define(`kernel_read_modprobe_sysctl',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 sysctl_t:dir { getattr search read };
	allow $1 sysctl_kernel_t:dir { getattr search read };
	allow $1 sysctl_modprobe_t:file { getattr read };
')

define(`kernel_read_modprobe_sysctl_depend',`
	type proc_t, sysctl_t, sysctl_kernel_t, sysctl_modprobe_t;

	class dir { search getattr read };
	class file { getattr read };
')

########################################
#
# kernel_modify_modprobe_sysctl(domain)
#
define(`kernel_modify_modprobe_sysctl',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 sysctl_t:dir { getattr search read };
	allow $1 sysctl_kernel_t:dir { getattr search read };
	allow $1 sysctl_modprobe_t:file { getattr read  write };
')

define(`kernel_modify_modprobe_sysctl_depend',`
	type proc_t, sysctl_t, sysctl_kernel_t, sysctl_modprobe_t;

	class dir { search getattr read };
	class file { getattr read write };
')

########################################
#
# kernel_read_kernel_sysctl(domain)
#
define(`kernel_read_kernel_sysctl',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 sysctl_t:dir { getattr search read };
	allow $1 sysctl_kernel_t:dir { getattr search read };
	allow $1 sysctl_kernel_t:file { getattr read };
')

define(`kernel_read_kernel_sysctl_depend',`
	type proc_t, sysctl_t, sysctl_kernel_t;

	class dir { search getattr read };
	class file { getattr read };
')

########################################
#
# kernel_modify_kernel_sysctl(domain)
#
define(`kernel_modify_kernel_sysctl',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 sysctl_t:dir { getattr search read };
	allow $1 sysctl_kernel_t:dir { getattr search read };
	allow $1 sysctl_kernel_t:file { getattr read write };
')

define(`kernel_modify_kernel_sysctl_depend',`
	type proc_t, sysctl_t, sysctl_kernel_t;

	class dir { search getattr read };
	class file { getattr read write };
')

########################################
#
# kernel_read_filesystem_sysctl(domain)
#
define(`kernel_read_filesystem_sysctl',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 sysctl_t:dir { getattr search read };
	allow $1 sysctl_fs_t:dir { getattr search read };
	allow $1 sysctl_fs_t:file { getattr read };
')

define(`kernel_read_filesystem_sysctl_depend',`
	type proc_t, sysctl_t, sysctl_fs_t;

	class dir { search getattr read };
	class file { getattr read };
')

########################################
#
# kernel_modify_filesystem_sysctl(domain)
#
define(`kernel_modify_filesystem_sysctl',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 sysctl_t:dir { getattr search read };
	allow $1 sysctl_fs_t:dir { getattr search read };
	allow $1 sysctl_fs_t:file { getattr read write };
')

define(`kernel_modify_filesystem_sysctl_depend',`
	type proc_t, sysctl_t, sysctl_fs_t;

	class dir { search getattr read };
	class file { getattr read write };
')

########################################
#
# kernel_read_irq_sysctl(domain)
#
define(`kernel_read_irq_sysctl',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 sysctl_irq_t:dir { getattr search read };
	allow $1 sysctl_irq_t:file { getattr read };
')

define(`kernel_read_irq_sysctl_depend',`
	type proc_t, sysctl_irq_t;

	class dir { search getattr read };
	class file { getattr read };
')

########################################
#
# kernel_modify_irq_sysctl(domain)
#
define(`kernel_modify_irq_sysctl',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 sysctl_irq_t:dir { getattr search read };
	allow $1 sysctl_irq_t:file { getattr read write };
')

define(`kernel_modify_irq_sysctl_depend',`
	type proc_t, sysctl_irq_t;

	class dir { search getattr read };
	class file { getattr read write };
')

########################################
#
# kernel_read_rpc_sysctl(domain)
#
define(`kernel_read_rpc_sysctl',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 proc_net_t:dir search;
	allow $1 sysctl_rpc_t:dir { getattr search read };
	allow $1 sysctl_rpc_t:file { getattr read };
')

define(`kernel_read_rpc_sysctl_depend',`
	type proc_t, proc_net_t, sysctl_rpc_t;

	class dir { search getattr read };
	class file { getattr read };
')

########################################
#
# kernel_modify_rpc_sysctl(domain)
#
define(`kernel_modify_rpc_sysctl',`
	requires_block_template(`$0'_depend)

	allow $1 proc_t:dir search;
	allow $1 proc_net_t:dir search;
	allow $1 sysctl_rpc_t:dir { getattr search read };
	allow $1 sysctl_rpc_t:file { getattr read write };
')

define(`kernel_modify_rpc_sysctl_depend',`
	type proc_t, proc_net_t, sysctl_rpc_t;

	class dir { search getattr read };
	class file { getattr read write };
')

########################################
#
# kernel_read_all_sysctl(domain)
#
define(`kernel_read_all_sysctl',`
	kernel_read_device_sysctl($1)
	kernel_read_virtual_memory_sysctl($1)
	kernel_read_network_sysctl($1)
	kernel_read_unix_sysctl($1)
	kernel_read_hotplug_sysctl($1)
	kernel_read_modprobe_sysctl($1)
	kernel_read_kernel_sysctl($1)
	kernel_read_filesystem_sysctl($1)
	kernel_read_irq_sysctl($1)
	kernel_read_rpc_sysctl($1)
')

########################################
#
# kernel_modify_all_sysctl(domain)
#
define(`kernel_modify_all_sysctl',`
	kernel_modify_device_sysctl($1)
	kernel_modify_virtual_memory_sysctl($1)
	kernel_modify_network_sysctl($1)
	kernel_modify_unix_sysctl($1)
	kernel_modify_hotplug_sysctl($1)
	kernel_modify_modprobe_sysctl($1)
	kernel_modify_kernel_sysctl($1)
	kernel_modify_filesystem_sysctl($1)
	kernel_modify_irq_sysctl($1)
	kernel_modify_rpc_sysctl($1)
')

########################################
## <interface name="kernel_search_hardware_state_dir">
##	<description>
##		Search the directory containing hardware information.
##	</description>
##	<parameter name="domain">
##		The type of the process performing this action.
##	</parameter>
##	<infoflow type="read" weight="10"/>
## </interface>
#
define(`kernel_search_hardware_state_dir',`
	requires_block_template(`$0'_depend)

	allow $1 sysfs_t:dir search;
')

define(`kernel_search_hardware_state_dir_depend',`
	type sysfs_t;

	class dir search;
')

########################################
#
# kernel_read_hardware_state(domain)
#
define(`kernel_read_hardware_state',`
	requires_block_template(`$0'_depend)

	allow $1 sysfs_t:dir { getattr search read };
	allow $1 sysfs_t:{ file lnk_file } { getattr read };
')

define(`kernel_read_hardware_state_depend',`
	type sysfs_t;

	class dir { getattr search read };
	class file { getattr read };
	class lnk_file { getattr read };
')

########################################
#
# kernel_modify_hardware_config_option(domain)
#
define(`kernel_modify_hardware_config_option',`
	requires_block_template(`$0'_depend)

	allow $1 sysfs_t:dir { getattr search read };
	allow $1 sysfs_t:lnk_file { getattr read };
	allow $1 sysfs_t:file { getattr read write };
')

define(`kernel_modify_hardware_config_option_depend',`
	type sysfs_t;

	class dir { getattr search read };
	class file { getattr read write };
	class lnk_file { getattr read };
')

########################################
## <interface name="kernel_kill_unlabeled_process">
##	<description>
##		Send a kill signal to unlabeled processes.
##	</description>
##	<parameter name="domain">
##		The type of the process performing this action.
##	</parameter>
##	<infoflow type="write" weight="1"/>
## </interface>
#
define(`kernel_kill_unlabeled_process',`
	requires_block_template(`$0'_depend)

	allow $1 unlabeled_t:process sigkill;
')

define(`kernel_kill_unlabeled_process_depend',`
	type unlabeled_t;

	class process sigkill;
')

########################################
## <interface name="kernel_signal_unlabeled_process">
##	<description>
##		Send general signals to unlabeled processes.
##	</description>
##	<parameter name="domain">
##		The type of the process performing this action.
##	</parameter>
##	<infoflow type="write" weight="1"/>
## </interface>
#
define(`kernel_signal_unlabeled_process',`
	requires_block_template(`$0'_depend)

	allow $1 unlabeled_t:process signal;
')

define(`kernel_signal_unlabeled_process_depend',`
	type unlabeled_t;

	class process signal;
')

########################################
## <interface name="kernel_signull_unlabeled_process">
##	<description>
##		Send a null signal to unlabeled processes.
##	</description>
##	<parameter name="domain">
##		The type of the process performing this action.
##	</parameter>
##	<infoflow type="write" weight="1"/>
## </interface>
#
define(`kernel_signull_unlabeled_process',`
	requires_block_template(`$0'_depend)

	allow $1 unlabeled_t:process signull;
')

define(`kernel_signull_unlabeled_process_depend',`
	type unlabeled_t;

	class process signull;
')

########################################
## <interface name="kernel_sigstop_unlabeled_process">
##	<description>
##		Send a stop signal to unlabeled processes.
##	</description>
##	<parameter name="domain">
##		The type of the process performing this action.
##	</parameter>
##	<infoflow type="write" weight="1"/>
## </interface>
#
define(`kernel_sigstop_unlabeled_process',`
	requires_block_template(`$0'_depend)

	allow $1 unlabeled_t:process sigstop;
')

define(`kernel_sigstop_unlabeled_process_depend',`
	type unlabeled_t;

	class process sigstop;
')

########################################
## <interface name="kernel_sigchld_unlabeled_process">
##	<description>
##		Send a child terminated signal to unlabeled processes.
##	</description>
##	<parameter name="domain">
##		The type of the process performing this action.
##	</parameter>
##	<infoflow type="write" weight="1"/>
## </interface>
#
define(`kernel_sigchld_unlabeled_process',`
	requires_block_template(`$0'_depend)

	allow $1 unlabeled_t:process sigchld;
')

define(`kernel_sigchld_unlabeled_process_depend',`
	type unlabeled_t;

	class process sigchld;
')

########################################
#
# kernel_ignore_get_unlabeled_block_device_attributes(domain)
#
define(`kernel_ignore_get_unlabeled_block_device_attributes',`
	requires_block_template(`$0'_depend)

	allow $1 unlabeled_t:blk_file getattr;
')

define(`kernel_ignore_get_unlabeled_block_device_attributes_depend',`
	type unlabeled_t;

	class process getattr;
')

########################################
#
# kernel_relabel_unlabeled_object(domain)
#
define(`kernel_relabel_unlabeled_object',`
	requires_block_template(`$0'_depend)

	allow $1 unlabeled_t:{ dir file lnk_file fifo_file sock_file chr_file blk_file } { getattr relabelfrom };
')

define(`kernel_relabel_unlabeled_object_depend',`
	type unlabeled_t;

	class dir { getattr relabelfrom };
	class file { getattr relabelfrom };
	class lnk_file { getattr relabelfrom };
	class fifo_file { getattr relabelfrom };
	class sock_file { getattr relabelfrom };
	class chr_file { getattr relabelfrom };
	class blk_file { getattr relabelfrom };
')

########################################
## <interface name="kernel_search_usb_hardware_state_dir">
##	<description>
##		Search the directory containing USB hardware information.
##	</description>
##	<parameter name="domain">
##		The type of the process performing this action.
##	</parameter>
##	<infoflow type="read" weight="10"/>
## </interface>
#
define(`kernel_search_usb_hardware_state_dir',`
	requires_block_template(`$0'_depend)

	allow $1 usbfs_t:dir search;
')

define(`kernel_search_usb_hardware_state_dir_depend',`
	type usbfs_t;

	class dir search;
')

########################################
#
# kernel_list_usb_hardware(domain)
#
define(`kernel_list_usb_hardware',`
	requires_block_template(`$0'_depend)

	allow $1 usbfs_t:dir { getattr search read };
	allow $1 usbfs_t:lnk_file { getattr read };
	allow $1 usbfs_t:file getattr;
')

define(`kernel_list_usb_hardware_depend',`
	type usbfs_t;

	class dir { getattr search read };
	class file getattr;
	class lnk_file { getattr read };
')

########################################
## <interface name="kernel_read_usb_hardware_state">
##	<description>
##		Read USB hardware information using
##		the usbfs filesystem interface.
##	</description>
##	<parameter name="domain">
##		The type of the process performing this action.
##	</parameter>
##	<infoflow type="read" weight="10"/>
## </interface>
#
define(`kernel_read_usb_hardware_state',`
	requires_block_template(`$0'_depend)

	allow $1 usbfs_t:dir { getattr search read };
	allow $1 usbfs_t:{ file lnk_file } { getattr read };
')

define(`kernel_read_usb_hardware_state_depend',`
	type usbfs_t;

	class dir { getattr search read };
	class file { getattr read };
	class lnk_file { getattr read };
')

########################################
#
# kernel_modify_usb_hardware_config_option(domain)
#
define(`kernel_modify_usb_hardware_config_option',`
	requires_block_template(`$0'_depend)

	allow $1 usbfs_t:dir { getattr search read };
	allow $1 usbfs_t:lnk_file { getattr read };
	allow $1 usbfs_t:file { getattr read write };
')

define(`kernel_modify_usb_hardware_config_option_depend',`
	type usbfs_t;

	class dir { getattr search read };
	class file { getattr read write };
	class lnk_file { getattr read };
')

###################################################################
#                                                                 #
# These interfaces are reversed, to decouple the base module from #
# the programs that the kernel runs, such as init and insmod, so  #
# the base module is self-contained.  These styles of interfaces  #
# should not be used anywhere else.                               #
#                                                                 #
###################################################################

########################################
#
# kernel_sigchld_from(domain)
#
define(`kernel_sigchld_from',`
	requires_block_template(`$0'_depend)

	allow kernel_t $1:process sigchld;
')

define(`kernel_sigchld_from_depend',`
	type kernel_t;

	class process sigchld;
')

########################################
#
# kernel_unlabeled_sigchld_from(domain)
#
define(`kernel_unlabeled_sigchld_from',`
	requires_block_template(`$0'_depend)

	allow unlabeled_t $1:process sigchld;
')

define(`kernel_unlabeled_sigchld_from_depend',`
	type unlabeled_t;

	class process sigchld;
')

########################################
#
# kernel_read_directory_from(domain)
#
define(`kernel_read_directory_from',`
	requires_block_template(`$0'_depend)

	allow kernel_t $1:dir { getattr search read };
')

define(`kernel_read_directory_from_depend',`
	type kernel_t;

	class dir { getattr search read };
')

## </module>