Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
common.h File Reference
#include <linux/ctype.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/file.h>
#include <linux/kmod.h>
#include <linux/fs.h>
#include <linux/sched.h>
#include <linux/namei.h>
#include <linux/mount.h>
#include <linux/list.h>
#include <linux/cred.h>
#include <linux/poll.h>
#include <linux/binfmts.h>
#include <linux/highmem.h>
#include <linux/net.h>
#include <linux/inet.h>
#include <linux/in.h>
#include <linux/in6.h>
#include <linux/un.h>
#include <net/sock.h>
#include <net/af_unix.h>
#include <net/ip.h>
#include <net/ipv6.h>
#include <net/udp.h>

Go to the source code of this file.

Data Structures

struct  tomoyo_acl_head
 
struct  tomoyo_shared_acl_head
 
struct  tomoyo_request_info
 
struct  tomoyo_path_info
 
struct  tomoyo_name
 
struct  tomoyo_name_union
 
struct  tomoyo_number_union
 
struct  tomoyo_ipaddr_union
 
struct  tomoyo_group
 
struct  tomoyo_path_group
 
struct  tomoyo_number_group
 
struct  tomoyo_address_group
 
struct  tomoyo_mini_stat
 
struct  tomoyo_page_dump
 
struct  tomoyo_obj_info
 
struct  tomoyo_argv
 
struct  tomoyo_envp
 
struct  tomoyo_execve
 
struct  tomoyo_condition_element
 
struct  tomoyo_condition
 
struct  tomoyo_acl_info
 
struct  tomoyo_domain_info
 
struct  tomoyo_task_acl
 
struct  tomoyo_path_acl
 
struct  tomoyo_path_number_acl
 
struct  tomoyo_mkdev_acl
 
struct  tomoyo_path2_acl
 
struct  tomoyo_mount_acl
 
struct  tomoyo_env_acl
 
struct  tomoyo_inet_acl
 
struct  tomoyo_unix_acl
 
struct  tomoyo_acl_param
 
struct  tomoyo_io_buffer
 
struct  tomoyo_transition_control
 
struct  tomoyo_aggregator
 
struct  tomoyo_manager
 
struct  tomoyo_preference
 
struct  tomoyo_profile
 
struct  tomoyo_time
 
struct  tomoyo_policy_namespace
 

Macros

#define TOMOYO_HASH_BITS   8
 
#define TOMOYO_MAX_HASH   (1u<<TOMOYO_HASH_BITS)
 
#define TOMOYO_SOCK_MAX   6
 
#define TOMOYO_EXEC_TMPSIZE   4096
 
#define TOMOYO_GC_IN_PROGRESS   -1
 
#define TOMOYO_MAX_PROFILES   256
 
#define TOMOYO_MAX_ACL_GROUPS   256
 
#define TOMOYO_RETRY_REQUEST   1
 
#define TOMOYO_MAX_IO_READ_QUEUE   64
 

Enumerations

enum  tomoyo_conditions_index {
  TOMOYO_TASK_UID, TOMOYO_TASK_EUID, TOMOYO_TASK_SUID, TOMOYO_TASK_FSUID,
  TOMOYO_TASK_GID, TOMOYO_TASK_EGID, TOMOYO_TASK_SGID, TOMOYO_TASK_FSGID,
  TOMOYO_TASK_PID, TOMOYO_TASK_PPID, TOMOYO_EXEC_ARGC, TOMOYO_EXEC_ENVC,
  TOMOYO_TYPE_IS_SOCKET, TOMOYO_TYPE_IS_SYMLINK, TOMOYO_TYPE_IS_FILE, TOMOYO_TYPE_IS_BLOCK_DEV,
  TOMOYO_TYPE_IS_DIRECTORY, TOMOYO_TYPE_IS_CHAR_DEV, TOMOYO_TYPE_IS_FIFO, TOMOYO_MODE_SETUID,
  TOMOYO_MODE_SETGID, TOMOYO_MODE_STICKY, TOMOYO_MODE_OWNER_READ, TOMOYO_MODE_OWNER_WRITE,
  TOMOYO_MODE_OWNER_EXECUTE, TOMOYO_MODE_GROUP_READ, TOMOYO_MODE_GROUP_WRITE, TOMOYO_MODE_GROUP_EXECUTE,
  TOMOYO_MODE_OTHERS_READ, TOMOYO_MODE_OTHERS_WRITE, TOMOYO_MODE_OTHERS_EXECUTE, TOMOYO_EXEC_REALPATH,
  TOMOYO_SYMLINK_TARGET, TOMOYO_PATH1_UID, TOMOYO_PATH1_GID, TOMOYO_PATH1_INO,
  TOMOYO_PATH1_MAJOR, TOMOYO_PATH1_MINOR, TOMOYO_PATH1_PERM, TOMOYO_PATH1_TYPE,
  TOMOYO_PATH1_DEV_MAJOR, TOMOYO_PATH1_DEV_MINOR, TOMOYO_PATH2_UID, TOMOYO_PATH2_GID,
  TOMOYO_PATH2_INO, TOMOYO_PATH2_MAJOR, TOMOYO_PATH2_MINOR, TOMOYO_PATH2_PERM,
  TOMOYO_PATH2_TYPE, TOMOYO_PATH2_DEV_MAJOR, TOMOYO_PATH2_DEV_MINOR, TOMOYO_PATH1_PARENT_UID,
  TOMOYO_PATH1_PARENT_GID, TOMOYO_PATH1_PARENT_INO, TOMOYO_PATH1_PARENT_PERM, TOMOYO_PATH2_PARENT_UID,
  TOMOYO_PATH2_PARENT_GID, TOMOYO_PATH2_PARENT_INO, TOMOYO_PATH2_PARENT_PERM, TOMOYO_MAX_CONDITION_KEYWORD,
  TOMOYO_NUMBER_UNION, TOMOYO_NAME_UNION, TOMOYO_ARGV_ENTRY, TOMOYO_ENVP_ENTRY
}
 
enum  tomoyo_path_stat_index {
  TOMOYO_PATH1, TOMOYO_PATH1_PARENT, TOMOYO_PATH2, TOMOYO_PATH2_PARENT,
  TOMOYO_MAX_PATH_STAT
}
 
enum  tomoyo_mode_index {
  TOMOYO_CONFIG_DISABLED, TOMOYO_CONFIG_LEARNING, TOMOYO_CONFIG_PERMISSIVE, TOMOYO_CONFIG_ENFORCING,
  TOMOYO_CONFIG_MAX_MODE, TOMOYO_CONFIG_WANT_REJECT_LOG = 64, TOMOYO_CONFIG_WANT_GRANT_LOG = 128, TOMOYO_CONFIG_USE_DEFAULT = 255
}
 
enum  tomoyo_policy_id {
  TOMOYO_ID_GROUP, TOMOYO_ID_ADDRESS_GROUP, TOMOYO_ID_PATH_GROUP, TOMOYO_ID_NUMBER_GROUP,
  TOMOYO_ID_TRANSITION_CONTROL, TOMOYO_ID_AGGREGATOR, TOMOYO_ID_MANAGER, TOMOYO_ID_CONDITION,
  TOMOYO_ID_NAME, TOMOYO_ID_ACL, TOMOYO_ID_DOMAIN, TOMOYO_MAX_POLICY
}
 
enum  tomoyo_domain_info_flags_index { TOMOYO_DIF_QUOTA_WARNED, TOMOYO_DIF_TRANSITION_FAILED, TOMOYO_MAX_DOMAIN_INFO_FLAGS }
 
enum  tomoyo_grant_log { TOMOYO_GRANTLOG_AUTO, TOMOYO_GRANTLOG_NO, TOMOYO_GRANTLOG_YES }
 
enum  tomoyo_group_id { TOMOYO_PATH_GROUP, TOMOYO_NUMBER_GROUP, TOMOYO_ADDRESS_GROUP, TOMOYO_MAX_GROUP }
 
enum  tomoyo_value_type { TOMOYO_VALUE_TYPE_INVALID, TOMOYO_VALUE_TYPE_DECIMAL, TOMOYO_VALUE_TYPE_OCTAL, TOMOYO_VALUE_TYPE_HEXADECIMAL }
 
enum  tomoyo_transition_type {
  TOMOYO_TRANSITION_CONTROL_NO_RESET, TOMOYO_TRANSITION_CONTROL_RESET, TOMOYO_TRANSITION_CONTROL_NO_INITIALIZE, TOMOYO_TRANSITION_CONTROL_INITIALIZE,
  TOMOYO_TRANSITION_CONTROL_NO_KEEP, TOMOYO_TRANSITION_CONTROL_KEEP, TOMOYO_MAX_TRANSITION_TYPE
}
 
enum  tomoyo_acl_entry_type_index {
  TOMOYO_TYPE_PATH_ACL, TOMOYO_TYPE_PATH2_ACL, TOMOYO_TYPE_PATH_NUMBER_ACL, TOMOYO_TYPE_MKDEV_ACL,
  TOMOYO_TYPE_MOUNT_ACL, TOMOYO_TYPE_INET_ACL, TOMOYO_TYPE_UNIX_ACL, TOMOYO_TYPE_ENV_ACL,
  TOMOYO_TYPE_MANUAL_TASK_ACL
}
 
enum  tomoyo_path_acl_index {
  TOMOYO_TYPE_EXECUTE, TOMOYO_TYPE_READ, TOMOYO_TYPE_WRITE, TOMOYO_TYPE_APPEND,
  TOMOYO_TYPE_UNLINK, TOMOYO_TYPE_GETATTR, TOMOYO_TYPE_RMDIR, TOMOYO_TYPE_TRUNCATE,
  TOMOYO_TYPE_SYMLINK, TOMOYO_TYPE_CHROOT, TOMOYO_TYPE_UMOUNT, TOMOYO_MAX_PATH_OPERATION
}
 
enum  tomoyo_memory_stat_type { TOMOYO_MEMORY_POLICY, TOMOYO_MEMORY_AUDIT, TOMOYO_MEMORY_QUERY, TOMOYO_MAX_MEMORY_STAT }
 
enum  tomoyo_mkdev_acl_index { TOMOYO_TYPE_MKBLOCK, TOMOYO_TYPE_MKCHAR, TOMOYO_MAX_MKDEV_OPERATION }
 
enum  tomoyo_network_acl_index {
  TOMOYO_NETWORK_BIND, TOMOYO_NETWORK_LISTEN, TOMOYO_NETWORK_CONNECT, TOMOYO_NETWORK_SEND,
  TOMOYO_MAX_NETWORK_OPERATION
}
 
enum  tomoyo_path2_acl_index { TOMOYO_TYPE_LINK, TOMOYO_TYPE_RENAME, TOMOYO_TYPE_PIVOT_ROOT, TOMOYO_MAX_PATH2_OPERATION }
 
enum  tomoyo_path_number_acl_index {
  TOMOYO_TYPE_CREATE, TOMOYO_TYPE_MKDIR, TOMOYO_TYPE_MKFIFO, TOMOYO_TYPE_MKSOCK,
  TOMOYO_TYPE_IOCTL, TOMOYO_TYPE_CHMOD, TOMOYO_TYPE_CHOWN, TOMOYO_TYPE_CHGRP,
  TOMOYO_MAX_PATH_NUMBER_OPERATION
}
 
enum  tomoyo_securityfs_interface_index {
  TOMOYO_DOMAINPOLICY, TOMOYO_EXCEPTIONPOLICY, TOMOYO_PROCESS_STATUS, TOMOYO_STAT,
  TOMOYO_AUDIT, TOMOYO_VERSION, TOMOYO_PROFILE, TOMOYO_QUERY,
  TOMOYO_MANAGER
}
 
enum  tomoyo_special_mount {
  TOMOYO_MOUNT_BIND, TOMOYO_MOUNT_MOVE, TOMOYO_MOUNT_REMOUNT, TOMOYO_MOUNT_MAKE_UNBINDABLE,
  TOMOYO_MOUNT_MAKE_PRIVATE, TOMOYO_MOUNT_MAKE_SLAVE, TOMOYO_MOUNT_MAKE_SHARED, TOMOYO_MAX_SPECIAL_MOUNT
}
 
enum  tomoyo_mac_index {
  TOMOYO_MAC_FILE_EXECUTE, TOMOYO_MAC_FILE_OPEN, TOMOYO_MAC_FILE_CREATE, TOMOYO_MAC_FILE_UNLINK,
  TOMOYO_MAC_FILE_GETATTR, TOMOYO_MAC_FILE_MKDIR, TOMOYO_MAC_FILE_RMDIR, TOMOYO_MAC_FILE_MKFIFO,
  TOMOYO_MAC_FILE_MKSOCK, TOMOYO_MAC_FILE_TRUNCATE, TOMOYO_MAC_FILE_SYMLINK, TOMOYO_MAC_FILE_MKBLOCK,
  TOMOYO_MAC_FILE_MKCHAR, TOMOYO_MAC_FILE_LINK, TOMOYO_MAC_FILE_RENAME, TOMOYO_MAC_FILE_CHMOD,
  TOMOYO_MAC_FILE_CHOWN, TOMOYO_MAC_FILE_CHGRP, TOMOYO_MAC_FILE_IOCTL, TOMOYO_MAC_FILE_CHROOT,
  TOMOYO_MAC_FILE_MOUNT, TOMOYO_MAC_FILE_UMOUNT, TOMOYO_MAC_FILE_PIVOT_ROOT, TOMOYO_MAC_NETWORK_INET_STREAM_BIND,
  TOMOYO_MAC_NETWORK_INET_STREAM_LISTEN, TOMOYO_MAC_NETWORK_INET_STREAM_CONNECT, TOMOYO_MAC_NETWORK_INET_DGRAM_BIND, TOMOYO_MAC_NETWORK_INET_DGRAM_SEND,
  TOMOYO_MAC_NETWORK_INET_RAW_BIND, TOMOYO_MAC_NETWORK_INET_RAW_SEND, TOMOYO_MAC_NETWORK_UNIX_STREAM_BIND, TOMOYO_MAC_NETWORK_UNIX_STREAM_LISTEN,
  TOMOYO_MAC_NETWORK_UNIX_STREAM_CONNECT, TOMOYO_MAC_NETWORK_UNIX_DGRAM_BIND, TOMOYO_MAC_NETWORK_UNIX_DGRAM_SEND, TOMOYO_MAC_NETWORK_UNIX_SEQPACKET_BIND,
  TOMOYO_MAC_NETWORK_UNIX_SEQPACKET_LISTEN, TOMOYO_MAC_NETWORK_UNIX_SEQPACKET_CONNECT, TOMOYO_MAC_ENVIRON, TOMOYO_MAX_MAC_INDEX
}
 
enum  tomoyo_mac_category_index { TOMOYO_MAC_CATEGORY_FILE, TOMOYO_MAC_CATEGORY_NETWORK, TOMOYO_MAC_CATEGORY_MISC, TOMOYO_MAX_MAC_CATEGORY_INDEX }
 
enum  tomoyo_policy_stat_type {
  TOMOYO_STAT_POLICY_UPDATES, TOMOYO_STAT_POLICY_LEARNING, TOMOYO_STAT_POLICY_PERMISSIVE, TOMOYO_STAT_POLICY_ENFORCING,
  TOMOYO_MAX_POLICY_STAT
}
 
enum  tomoyo_pref_index { TOMOYO_PREF_MAX_AUDIT_LOG, TOMOYO_PREF_MAX_LEARNING_ENTRY, TOMOYO_MAX_PREF }
 

Functions

bool tomoyo_address_matches_group (const bool is_ipv6, const __be32 *address, const struct tomoyo_group *group)
 
bool tomoyo_compare_number_union (const unsigned long value, const struct tomoyo_number_union *ptr)
 
bool tomoyo_condition (struct tomoyo_request_info *r, const struct tomoyo_condition *cond)
 
bool tomoyo_correct_domain (const unsigned char *domainname)
 
bool tomoyo_correct_path (const char *filename)
 
bool tomoyo_correct_word (const char *string)
 
bool tomoyo_domain_def (const unsigned char *buffer)
 
bool tomoyo_domain_quota_is_ok (struct tomoyo_request_info *r)
 
bool tomoyo_dump_page (struct linux_binprm *bprm, unsigned long pos, struct tomoyo_page_dump *dump)
 
bool tomoyo_memory_ok (void *ptr)
 
bool tomoyo_number_matches_group (const unsigned long min, const unsigned long max, const struct tomoyo_group *group)
 
bool tomoyo_parse_ipaddr_union (struct tomoyo_acl_param *param, struct tomoyo_ipaddr_union *ptr)
 
bool tomoyo_parse_name_union (struct tomoyo_acl_param *param, struct tomoyo_name_union *ptr)
 
bool tomoyo_parse_number_union (struct tomoyo_acl_param *param, struct tomoyo_number_union *ptr)
 
bool tomoyo_path_matches_pattern (const struct tomoyo_path_info *filename, const struct tomoyo_path_info *pattern)
 
bool tomoyo_permstr (const char *string, const char *keyword)
 
bool tomoyo_str_starts (char **src, const char *find)
 
chartomoyo_encode (const char *str)
 
chartomoyo_encode2 (const char *str, int str_len)
 
chartomoyo_init_log (struct tomoyo_request_info *r, int len, const char *fmt, va_list args)
 
chartomoyo_read_token (struct tomoyo_acl_param *param)
 
chartomoyo_realpath_from_path (struct path *path)
 
chartomoyo_realpath_nofollow (const char *pathname)
 
const chartomoyo_get_exe (void)
 
const chartomoyo_yesno (const unsigned int value)
 
struct tomoyo_path_infotomoyo_compare_name_union (const struct tomoyo_path_info *name, const struct tomoyo_name_union *ptr)
 
struct tomoyo_path_infotomoyo_get_domainname (struct tomoyo_acl_param *param)
 
struct tomoyo_path_infotomoyo_get_name (const char *name)
 
struct tomoyo_path_infotomoyo_path_matches_group (const struct tomoyo_path_info *pathname, const struct tomoyo_group *group)
 
int tomoyo_check_open_permission (struct tomoyo_domain_info *domain, struct path *path, const int flag)
 
int tomoyo_close_control (struct tomoyo_io_buffer *head)
 
int tomoyo_env_perm (struct tomoyo_request_info *r, const char *env)
 
int tomoyo_execute_permission (struct tomoyo_request_info *r, const struct tomoyo_path_info *filename)
 
int tomoyo_find_next_domain (struct linux_binprm *bprm)
 
int tomoyo_get_mode (const struct tomoyo_policy_namespace *ns, const u8 profile, const u8 index)
 
int tomoyo_init_request_info (struct tomoyo_request_info *r, struct tomoyo_domain_info *domain, const u8 index)
 
int tomoyo_mkdev_perm (const u8 operation, struct path *path, const unsigned int mode, unsigned int dev)
 
int tomoyo_mount_permission (const char *dev_name, struct path *path, const char *type, unsigned long flags, void *data_page)
 
int tomoyo_open_control (const u8 type, struct file *file)
 
int tomoyo_path2_perm (const u8 operation, struct path *path1, struct path *path2)
 
int tomoyo_path_number_perm (const u8 operation, struct path *path, unsigned long number)
 
int tomoyo_path_perm (const u8 operation, struct path *path, const char *target)
 
unsigned int tomoyo_poll_control (struct file *file, poll_table *wait)
 
unsigned int tomoyo_poll_log (struct file *file, poll_table *wait)
 
int tomoyo_socket_bind_permission (struct socket *sock, struct sockaddr *addr, int addr_len)
 
int tomoyo_socket_connect_permission (struct socket *sock, struct sockaddr *addr, int addr_len)
 
int tomoyo_socket_listen_permission (struct socket *sock)
 
int tomoyo_socket_sendmsg_permission (struct socket *sock, struct msghdr *msg, int size)
 
int tomoyo_supervisor (struct tomoyo_request_info *r, const char *fmt,...) __printf(2
 
int int tomoyo_update_domain (struct tomoyo_acl_info *new_entry, const int size, struct tomoyo_acl_param *param, bool(*check_duplicate)(const struct tomoyo_acl_info *, const struct tomoyo_acl_info *), bool(*merge_duplicate)(struct tomoyo_acl_info *, struct tomoyo_acl_info *, const bool))
 
int tomoyo_update_policy (struct tomoyo_acl_head *new_entry, const int size, struct tomoyo_acl_param *param, bool(*check_duplicate)(const struct tomoyo_acl_head *, const struct tomoyo_acl_head *))
 
int tomoyo_write_aggregator (struct tomoyo_acl_param *param)
 
int tomoyo_write_file (struct tomoyo_acl_param *param)
 
int tomoyo_write_group (struct tomoyo_acl_param *param, const u8 type)
 
int tomoyo_write_misc (struct tomoyo_acl_param *param)
 
int tomoyo_write_inet_network (struct tomoyo_acl_param *param)
 
int tomoyo_write_transition_control (struct tomoyo_acl_param *param, const u8 type)
 
int tomoyo_write_unix_network (struct tomoyo_acl_param *param)
 
ssize_t tomoyo_read_control (struct tomoyo_io_buffer *head, char __user *buffer, const int buffer_len)
 
ssize_t tomoyo_write_control (struct tomoyo_io_buffer *head, const char __user *buffer, const int buffer_len)
 
struct tomoyo_conditiontomoyo_get_condition (struct tomoyo_acl_param *param)
 
struct tomoyo_domain_infotomoyo_assign_domain (const char *domainname, const bool transit)
 
struct tomoyo_domain_infotomoyo_find_domain (const char *domainname)
 
struct tomoyo_grouptomoyo_get_group (struct tomoyo_acl_param *param, const u8 idx)
 
struct tomoyo_policy_namespacetomoyo_assign_namespace (const char *domainname)
 
struct tomoyo_profiletomoyo_profile (const struct tomoyo_policy_namespace *ns, const u8 profile)
 
unsigned int tomoyo_check_flags (const struct tomoyo_domain_info *domain, const u8 index)
 
u8 tomoyo_parse_ulong (unsigned long *result, char **str)
 
voidtomoyo_commit_ok (void *data, const unsigned int size)
 
void __init tomoyo_load_builtin_policy (void)
 
void __init tomoyo_mm_init (void)
 
void tomoyo_check_acl (struct tomoyo_request_info *r, bool(*check_entry)(struct tomoyo_request_info *, const struct tomoyo_acl_info *))
 
void tomoyo_check_profile (void)
 
void tomoyo_convert_time (time_t time, struct tomoyo_time *stamp)
 
void tomoyo_del_condition (struct list_head *element)
 
void tomoyo_fill_path_info (struct tomoyo_path_info *ptr)
 
void tomoyo_get_attributes (struct tomoyo_obj_info *obj)
 
void tomoyo_init_policy_namespace (struct tomoyo_policy_namespace *ns)
 
void tomoyo_load_policy (const char *filename)
 
void tomoyo_normalize_line (unsigned char *buffer)
 
void tomoyo_notify_gc (struct tomoyo_io_buffer *head, const bool is_register)
 
void tomoyo_print_ip (char *buf, const unsigned int size, const struct tomoyo_ipaddr_union *ptr)
 
void tomoyo_print_ulong (char *buffer, const int buffer_len, const unsigned long value, const u8 type)
 
void tomoyo_put_name_union (struct tomoyo_name_union *ptr)
 
void tomoyo_put_number_union (struct tomoyo_number_union *ptr)
 
void tomoyo_read_log (struct tomoyo_io_buffer *head)
 
void tomoyo_update_stat (const u8 index)
 
void tomoyo_warn_oom (const char *function)
 
void tomoyo_write_log (struct tomoyo_request_info *r, const char *fmt,...) __printf(2
 
void void tomoyo_write_log2 (struct tomoyo_request_info *r, int len, const char *fmt, va_list args)
 

Variables

struct tomoyo_acl_head __packed
 
bool tomoyo_policy_loaded
 
const char *const tomoyo_condition_keyword [TOMOYO_MAX_CONDITION_KEYWORD]
 
const char *const tomoyo_dif [TOMOYO_MAX_DOMAIN_INFO_FLAGS]
 
const char *const tomoyo_mac_keywords [TOMOYO_MAX_MAC_INDEX+TOMOYO_MAX_MAC_CATEGORY_INDEX]
 
const char *const tomoyo_mode [TOMOYO_CONFIG_MAX_MODE]
 
const char *const tomoyo_path_keyword [TOMOYO_MAX_PATH_OPERATION]
 
const char *const tomoyo_proto_keyword [TOMOYO_SOCK_MAX]
 
const char *const tomoyo_socket_keyword [TOMOYO_MAX_NETWORK_OPERATION]
 
const u8 tomoyo_index2category [TOMOYO_MAX_MAC_INDEX]
 
const u8 tomoyo_pn2mac [TOMOYO_MAX_PATH_NUMBER_OPERATION]
 
const u8 tomoyo_pnnn2mac [TOMOYO_MAX_MKDEV_OPERATION]
 
const u8 tomoyo_pp2mac [TOMOYO_MAX_PATH2_OPERATION]
 
struct list_head tomoyo_condition_list
 
struct list_head tomoyo_domain_list
 
struct list_head tomoyo_name_list [TOMOYO_MAX_HASH]
 
struct list_head tomoyo_namespace_list
 
struct mutex tomoyo_policy_lock
 
struct srcu_struct tomoyo_ss
 
struct tomoyo_domain_info tomoyo_kernel_domain
 
struct tomoyo_policy_namespace tomoyo_kernel_namespace
 
unsigned int tomoyo_memory_quota [TOMOYO_MAX_MEMORY_STAT]
 
unsigned int tomoyo_memory_used [TOMOYO_MAX_MEMORY_STAT]
 

: Pointer to "struct tomoyo_path_info". Maybe NULL.

tomoyo_put_name - Drop reference on "struct tomoyo_name".

Returns nothing.

#define list_for_each_cookie(pos, head)
 

Macro Definition Documentation

#define list_for_each_cookie (   pos,
  head 
)
Value:
if (!pos) \
for ( ; pos != (head); pos = srcu_dereference(pos->next, &tomoyo_ss))

list_for_each_cookie - iterate over a list with cookie. : the &struct list_head to use as a loop cursor. : the head for your list.

Definition at line 1325 of file common.h.

#define TOMOYO_EXEC_TMPSIZE   4096

Definition at line 53 of file common.h.

#define TOMOYO_GC_IN_PROGRESS   -1

Definition at line 56 of file common.h.

#define TOMOYO_HASH_BITS   8

Definition at line 44 of file common.h.

#define TOMOYO_MAX_ACL_GROUPS   256

Definition at line 62 of file common.h.

#define TOMOYO_MAX_HASH   (1u<<TOMOYO_HASH_BITS)

Definition at line 45 of file common.h.

#define TOMOYO_MAX_IO_READ_QUEUE   64

Definition at line 782 of file common.h.

#define TOMOYO_MAX_PROFILES   256

Definition at line 59 of file common.h.

#define TOMOYO_RETRY_REQUEST   1

Definition at line 380 of file common.h.

#define TOMOYO_SOCK_MAX   6

Definition at line 51 of file common.h.

Enumeration Type Documentation

Enumerator:
TOMOYO_TYPE_PATH_ACL 
TOMOYO_TYPE_PATH2_ACL 
TOMOYO_TYPE_PATH_NUMBER_ACL 
TOMOYO_TYPE_MKDEV_ACL 
TOMOYO_TYPE_MOUNT_ACL 
TOMOYO_TYPE_INET_ACL 
TOMOYO_TYPE_UNIX_ACL 
TOMOYO_TYPE_ENV_ACL 
TOMOYO_TYPE_MANUAL_TASK_ACL 

Definition at line 224 of file common.h.

Enumerator:
TOMOYO_TASK_UID 
TOMOYO_TASK_EUID 
TOMOYO_TASK_SUID 
TOMOYO_TASK_FSUID 
TOMOYO_TASK_GID 
TOMOYO_TASK_EGID 
TOMOYO_TASK_SGID 
TOMOYO_TASK_FSGID 
TOMOYO_TASK_PID 
TOMOYO_TASK_PPID 
TOMOYO_EXEC_ARGC 
TOMOYO_EXEC_ENVC 
TOMOYO_TYPE_IS_SOCKET 
TOMOYO_TYPE_IS_SYMLINK 
TOMOYO_TYPE_IS_FILE 
TOMOYO_TYPE_IS_BLOCK_DEV 
TOMOYO_TYPE_IS_DIRECTORY 
TOMOYO_TYPE_IS_CHAR_DEV 
TOMOYO_TYPE_IS_FIFO 
TOMOYO_MODE_SETUID 
TOMOYO_MODE_SETGID 
TOMOYO_MODE_STICKY 
TOMOYO_MODE_OWNER_READ 
TOMOYO_MODE_OWNER_WRITE 
TOMOYO_MODE_OWNER_EXECUTE 
TOMOYO_MODE_GROUP_READ 
TOMOYO_MODE_GROUP_WRITE 
TOMOYO_MODE_GROUP_EXECUTE 
TOMOYO_MODE_OTHERS_READ 
TOMOYO_MODE_OTHERS_WRITE 
TOMOYO_MODE_OTHERS_EXECUTE 
TOMOYO_EXEC_REALPATH 
TOMOYO_SYMLINK_TARGET 
TOMOYO_PATH1_UID 
TOMOYO_PATH1_GID 
TOMOYO_PATH1_INO 
TOMOYO_PATH1_MAJOR 
TOMOYO_PATH1_MINOR 
TOMOYO_PATH1_PERM 
TOMOYO_PATH1_TYPE 
TOMOYO_PATH1_DEV_MAJOR 
TOMOYO_PATH1_DEV_MINOR 
TOMOYO_PATH2_UID 
TOMOYO_PATH2_GID 
TOMOYO_PATH2_INO 
TOMOYO_PATH2_MAJOR 
TOMOYO_PATH2_MINOR 
TOMOYO_PATH2_PERM 
TOMOYO_PATH2_TYPE 
TOMOYO_PATH2_DEV_MAJOR 
TOMOYO_PATH2_DEV_MINOR 
TOMOYO_PATH1_PARENT_UID 
TOMOYO_PATH1_PARENT_GID 
TOMOYO_PATH1_PARENT_INO 
TOMOYO_PATH1_PARENT_PERM 
TOMOYO_PATH2_PARENT_UID 
TOMOYO_PATH2_PARENT_GID 
TOMOYO_PATH2_PARENT_INO 
TOMOYO_PATH2_PARENT_PERM 
TOMOYO_MAX_CONDITION_KEYWORD 
TOMOYO_NUMBER_UNION 
TOMOYO_NAME_UNION 
TOMOYO_ARGV_ENTRY 
TOMOYO_ENVP_ENTRY 

Definition at line 65 of file common.h.

Enumerator:
TOMOYO_DIF_QUOTA_WARNED 
TOMOYO_DIF_TRANSITION_FAILED 
TOMOYO_MAX_DOMAIN_INFO_FLAGS 

Definition at line 172 of file common.h.

Enumerator:
TOMOYO_GRANTLOG_AUTO 
TOMOYO_GRANTLOG_NO 
TOMOYO_GRANTLOG_YES 

Definition at line 186 of file common.h.

Enumerator:
TOMOYO_PATH_GROUP 
TOMOYO_NUMBER_GROUP 
TOMOYO_ADDRESS_GROUP 
TOMOYO_MAX_GROUP 

Definition at line 196 of file common.h.

Enumerator:
TOMOYO_MAC_CATEGORY_FILE 
TOMOYO_MAC_CATEGORY_NETWORK 
TOMOYO_MAC_CATEGORY_MISC 
TOMOYO_MAX_MAC_CATEGORY_INDEX 

Definition at line 366 of file common.h.

Enumerator:
TOMOYO_MAC_FILE_EXECUTE 
TOMOYO_MAC_FILE_OPEN 
TOMOYO_MAC_FILE_CREATE 
TOMOYO_MAC_FILE_UNLINK 
TOMOYO_MAC_FILE_GETATTR 
TOMOYO_MAC_FILE_MKDIR 
TOMOYO_MAC_FILE_RMDIR 
TOMOYO_MAC_FILE_MKFIFO 
TOMOYO_MAC_FILE_MKSOCK 
TOMOYO_MAC_FILE_TRUNCATE 
TOMOYO_MAC_FILE_SYMLINK 
TOMOYO_MAC_FILE_MKBLOCK 
TOMOYO_MAC_FILE_MKCHAR 
TOMOYO_MAC_FILE_LINK 
TOMOYO_MAC_FILE_RENAME 
TOMOYO_MAC_FILE_CHMOD 
TOMOYO_MAC_FILE_CHOWN 
TOMOYO_MAC_FILE_CHGRP 
TOMOYO_MAC_FILE_IOCTL 
TOMOYO_MAC_FILE_CHROOT 
TOMOYO_MAC_FILE_MOUNT 
TOMOYO_MAC_FILE_UMOUNT 
TOMOYO_MAC_FILE_PIVOT_ROOT 
TOMOYO_MAC_NETWORK_INET_STREAM_BIND 
TOMOYO_MAC_NETWORK_INET_STREAM_LISTEN 
TOMOYO_MAC_NETWORK_INET_STREAM_CONNECT 
TOMOYO_MAC_NETWORK_INET_DGRAM_BIND 
TOMOYO_MAC_NETWORK_INET_DGRAM_SEND 
TOMOYO_MAC_NETWORK_INET_RAW_BIND 
TOMOYO_MAC_NETWORK_INET_RAW_SEND 
TOMOYO_MAC_NETWORK_UNIX_STREAM_BIND 
TOMOYO_MAC_NETWORK_UNIX_STREAM_LISTEN 
TOMOYO_MAC_NETWORK_UNIX_STREAM_CONNECT 
TOMOYO_MAC_NETWORK_UNIX_DGRAM_BIND 
TOMOYO_MAC_NETWORK_UNIX_DGRAM_SEND 
TOMOYO_MAC_NETWORK_UNIX_SEQPACKET_BIND 
TOMOYO_MAC_NETWORK_UNIX_SEQPACKET_LISTEN 
TOMOYO_MAC_NETWORK_UNIX_SEQPACKET_CONNECT 
TOMOYO_MAC_ENVIRON 
TOMOYO_MAX_MAC_INDEX 

Definition at line 322 of file common.h.

Enumerator:
TOMOYO_MEMORY_POLICY 
TOMOYO_MEMORY_AUDIT 
TOMOYO_MEMORY_QUERY 
TOMOYO_MAX_MEMORY_STAT 

Definition at line 253 of file common.h.

Enumerator:
TOMOYO_TYPE_MKBLOCK 
TOMOYO_TYPE_MKCHAR 
TOMOYO_MAX_MKDEV_OPERATION 

Definition at line 260 of file common.h.

Enumerator:
TOMOYO_CONFIG_DISABLED 
TOMOYO_CONFIG_LEARNING 
TOMOYO_CONFIG_PERMISSIVE 
TOMOYO_CONFIG_ENFORCING 
TOMOYO_CONFIG_MAX_MODE 
TOMOYO_CONFIG_WANT_REJECT_LOG 
TOMOYO_CONFIG_WANT_GRANT_LOG 
TOMOYO_CONFIG_USE_DEFAULT 

Definition at line 144 of file common.h.

Enumerator:
TOMOYO_NETWORK_BIND 
TOMOYO_NETWORK_LISTEN 
TOMOYO_NETWORK_CONNECT 
TOMOYO_NETWORK_SEND 
TOMOYO_MAX_NETWORK_OPERATION 

Definition at line 267 of file common.h.

Enumerator:
TOMOYO_TYPE_LINK 
TOMOYO_TYPE_RENAME 
TOMOYO_TYPE_PIVOT_ROOT 
TOMOYO_MAX_PATH2_OPERATION 

Definition at line 276 of file common.h.

Enumerator:
TOMOYO_TYPE_EXECUTE 
TOMOYO_TYPE_READ 
TOMOYO_TYPE_WRITE 
TOMOYO_TYPE_APPEND 
TOMOYO_TYPE_UNLINK 
TOMOYO_TYPE_GETATTR 
TOMOYO_TYPE_RMDIR 
TOMOYO_TYPE_TRUNCATE 
TOMOYO_TYPE_SYMLINK 
TOMOYO_TYPE_CHROOT 
TOMOYO_TYPE_UMOUNT 
TOMOYO_MAX_PATH_OPERATION 

Definition at line 237 of file common.h.

Enumerator:
TOMOYO_TYPE_CREATE 
TOMOYO_TYPE_MKDIR 
TOMOYO_TYPE_MKFIFO 
TOMOYO_TYPE_MKSOCK 
TOMOYO_TYPE_IOCTL 
TOMOYO_TYPE_CHMOD 
TOMOYO_TYPE_CHOWN 
TOMOYO_TYPE_CHGRP 
TOMOYO_MAX_PATH_NUMBER_OPERATION 

Definition at line 284 of file common.h.

Enumerator:
TOMOYO_PATH1 
TOMOYO_PATH1_PARENT 
TOMOYO_PATH2 
TOMOYO_PATH2_PARENT 
TOMOYO_MAX_PATH_STAT 

Definition at line 134 of file common.h.

Enumerator:
TOMOYO_ID_GROUP 
TOMOYO_ID_ADDRESS_GROUP 
TOMOYO_ID_PATH_GROUP 
TOMOYO_ID_NUMBER_GROUP 
TOMOYO_ID_TRANSITION_CONTROL 
TOMOYO_ID_AGGREGATOR 
TOMOYO_ID_MANAGER 
TOMOYO_ID_CONDITION 
TOMOYO_ID_NAME 
TOMOYO_ID_ACL 
TOMOYO_ID_DOMAIN 
TOMOYO_MAX_POLICY 

Definition at line 156 of file common.h.

Enumerator:
TOMOYO_STAT_POLICY_UPDATES 
TOMOYO_STAT_POLICY_LEARNING 
TOMOYO_STAT_POLICY_PERMISSIVE 
TOMOYO_STAT_POLICY_ENFORCING 
TOMOYO_MAX_POLICY_STAT 

Definition at line 383 of file common.h.

Enumerator:
TOMOYO_PREF_MAX_AUDIT_LOG 
TOMOYO_PREF_MAX_LEARNING_ENTRY 
TOMOYO_MAX_PREF 

Definition at line 393 of file common.h.

Enumerator:
TOMOYO_DOMAINPOLICY 
TOMOYO_EXCEPTIONPOLICY 
TOMOYO_PROCESS_STATUS 
TOMOYO_STAT 
TOMOYO_AUDIT 
TOMOYO_VERSION 
TOMOYO_PROFILE 
TOMOYO_QUERY 
TOMOYO_MANAGER 

Definition at line 297 of file common.h.

Enumerator:
TOMOYO_MOUNT_BIND 
TOMOYO_MOUNT_MOVE 
TOMOYO_MOUNT_REMOUNT 
TOMOYO_MOUNT_MAKE_UNBINDABLE 
TOMOYO_MOUNT_MAKE_PRIVATE 
TOMOYO_MOUNT_MAKE_SLAVE 
TOMOYO_MOUNT_MAKE_SHARED 
TOMOYO_MAX_SPECIAL_MOUNT 

Definition at line 310 of file common.h.

Enumerator:
TOMOYO_TRANSITION_CONTROL_NO_RESET 
TOMOYO_TRANSITION_CONTROL_RESET 
TOMOYO_TRANSITION_CONTROL_NO_INITIALIZE 
TOMOYO_TRANSITION_CONTROL_INITIALIZE 
TOMOYO_TRANSITION_CONTROL_NO_KEEP 
TOMOYO_TRANSITION_CONTROL_KEEP 
TOMOYO_MAX_TRANSITION_TYPE 

Definition at line 212 of file common.h.

Enumerator:
TOMOYO_VALUE_TYPE_INVALID 
TOMOYO_VALUE_TYPE_DECIMAL 
TOMOYO_VALUE_TYPE_OCTAL 
TOMOYO_VALUE_TYPE_HEXADECIMAL 

Definition at line 204 of file common.h.

Function Documentation

bool tomoyo_address_matches_group ( const bool  is_ipv6,
const __be32 address,
const struct tomoyo_group group 
)

tomoyo_address_matches_group - Check whether the given address matches members of the given address group.

: True if is an IPv6 address. : An IPv4 or IPv6 address. : Pointer to "struct tomoyo_address_group".

Returns true if matches addresses in group, false otherwise.

Caller holds tomoyo_read_lock().

Definition at line 179 of file group.c.

struct tomoyo_domain_info* tomoyo_assign_domain ( const char domainname,
const bool  transit 
)
read

tomoyo_assign_domain - Create a domain or a namespace.

: The name of domain. : True if transit to domain found or created.

Returns pointer to "struct tomoyo_domain_info" on success, NULL otherwise.

Caller holds tomoyo_read_lock().

Definition at line 504 of file domain.c.

struct tomoyo_policy_namespace* tomoyo_assign_namespace ( const char domainname)
read

tomoyo_assign_namespace - Create a new namespace.

: Name of namespace to create.

Returns pointer to "struct tomoyo_policy_namespace" on success, NULL otherwise.

Caller holds tomoyo_read_lock().

Definition at line 445 of file domain.c.

void tomoyo_check_acl ( struct tomoyo_request_info r,
bool(*)(struct tomoyo_request_info *, const struct tomoyo_acl_info *)  check_entry 
)

tomoyo_check_acl - Do permission check.

: Pointer to "struct tomoyo_request_info". : Callback function to check type specific parameters.

Returns 0 on success, negative value otherwise.

Caller holds tomoyo_read_lock().

Definition at line 156 of file domain.c.

unsigned int tomoyo_check_flags ( const struct tomoyo_domain_info domain,
const u8  index 
)
int tomoyo_check_open_permission ( struct tomoyo_domain_info domain,
struct path path,
const int  flag 
)

tomoyo_check_open_permission - Check permission for "read" and "write".

: Pointer to "struct tomoyo_domain_info". : Pointer to "struct path". : Flags for open().

Returns 0 on success, negative value otherwise.

Definition at line 735 of file file.c.

void tomoyo_check_profile ( void  )

tomoyo_check_profile - Check all profiles currently assigned to domains are defined.

Definition at line 2703 of file common.c.

int tomoyo_close_control ( struct tomoyo_io_buffer head)

tomoyo_close_control - close() for /sys/kernel/security/tomoyo/ interface.

: Pointer to "struct tomoyo_io_buffer".

Returns 0.

Definition at line 2687 of file common.c.

void* tomoyo_commit_ok ( void data,
const unsigned int  size 
)

tomoyo_commit_ok - Check memory quota.

: Data to copy from. : Size in byte.

Returns pointer to allocated memory on success, NULL otherwise. is zero-cleared on success.

Caller holds tomoyo_policy_lock mutex.

Definition at line 72 of file memory.c.

struct tomoyo_path_info* tomoyo_compare_name_union ( const struct tomoyo_path_info name,
const struct tomoyo_name_union ptr 
)
read

Definition at line 81 of file file.c.

bool tomoyo_compare_number_union ( const unsigned long  value,
const struct tomoyo_number_union ptr 
)

tomoyo_compare_number_union - Check whether a value matches "struct tomoyo_number_union" or not.

: Number to check. : Pointer to "struct tomoyo_number_union".

Returns true if matches , false otherwise.

Definition at line 111 of file file.c.

tomoyo_condition - Check condition part.

: Pointer to "struct tomoyo_request_info". : Pointer to "struct tomoyo_condition". Maybe NULL.

Returns true on success, false otherwise.

Caller holds tomoyo_read_lock().

Definition at line 744 of file condition.c.

void tomoyo_convert_time ( time_t  time,
struct tomoyo_time stamp 
)

tomoyo_convert_time - Convert time_t to YYYY/MM/DD hh/mm/ss.

: Seconds since 1970/01/01 00:00:00. : Pointer to "struct tomoyo_time".

Returns nothing.

This function does not handle Y2038 problem.

Definition at line 90 of file util.c.

bool tomoyo_correct_domain ( const unsigned char domainname)

tomoyo_correct_domain - Check whether the given domainname follows the naming rules.

: The domainname to check.

Returns true if follows the naming rules, false otherwise.

Definition at line 545 of file util.c.

bool tomoyo_correct_path ( const char filename)

tomoyo_correct_path - Validate a pathname.

: The pathname to check.

Check whether the given pathname follows the naming rules. Returns true if follows the naming rules, false otherwise.

Definition at line 533 of file util.c.

bool tomoyo_correct_word ( const char string)

tomoyo_correct_word - Validate a string.

: The string to check.

Check whether the given string follows the naming rules. Returns true if follows the naming rules, false otherwise.

Definition at line 520 of file util.c.

void tomoyo_del_condition ( struct list_head element)

tomoyo_del_condition - Delete members in "struct tomoyo_condition".

: Pointer to "struct list_head".

Returns nothing.

Definition at line 268 of file gc.c.

bool tomoyo_domain_def ( const unsigned char buffer)

tomoyo_domain_def - Check whether the given token can be a domainname.

: The token to check.

Returns true if possibly be a domainname, false otherwise.

Definition at line 571 of file util.c.

bool tomoyo_domain_quota_is_ok ( struct tomoyo_request_info r)

tomoyo_domain_quota_is_ok - Check for domain's quota.

: Pointer to "struct tomoyo_request_info".

Returns true if the domain is not exceeded quota, false otherwise.

Caller holds tomoyo_read_lock().

Definition at line 1023 of file util.c.

bool tomoyo_dump_page ( struct linux_binprm bprm,
unsigned long  pos,
struct tomoyo_page_dump dump 
)

tomoyo_dump_page - Dump a page to buffer.

: Pointer to "struct linux_binprm". : Location to dump. : Poiner to "struct tomoyo_page_dump".

Returns true on success, false otherwise.

Definition at line 864 of file domain.c.

char* tomoyo_encode ( const char str)

tomoyo_encode - Encode binary string to ascii string.

: String in binary format.

Returns pointer to in ascii format on success, NULL otherwise.

This function uses kzalloc(), so caller must kfree() if this function didn't return NULL.

Definition at line 76 of file realpath.c.

char* tomoyo_encode2 ( const char str,
int  str_len 
)

tomoyo_encode2 - Encode binary string to ascii string.

: String in binary format. : Size of in byte.

Returns pointer to in ascii format on success, NULL otherwise.

This function uses kzalloc(), so caller must kfree() if this function didn't return NULL.

Definition at line 21 of file realpath.c.

int tomoyo_env_perm ( struct tomoyo_request_info r,
const char env 
)

tomoyo_env_perm - Check permission for environment variable's name.

: Pointer to "struct tomoyo_request_info". : The name of environment variable.

Returns 0 on success, negative value otherwise.

Caller holds tomoyo_read_lock().

Definition at line 49 of file environ.c.

int tomoyo_execute_permission ( struct tomoyo_request_info r,
const struct tomoyo_path_info filename 
)

tomoyo_execute_permission - Check permission for execute operation.

: Pointer to "struct tomoyo_request_info". : Filename to check.

Returns 0 on success, negative value otherwise.

Caller holds tomoyo_read_lock().

Definition at line 587 of file file.c.

void tomoyo_fill_path_info ( struct tomoyo_path_info ptr)

tomoyo_fill_path_info - Fill in "struct tomoyo_path_info" members.

: Pointer to "struct tomoyo_path_info" to fill in.

The caller sets "struct tomoyo_path_info"->name.

Definition at line 661 of file util.c.

struct tomoyo_domain_info* tomoyo_find_domain ( const char domainname)
read

tomoyo_find_domain - Find a domain by the given name.

: The domainname to find.

Returns pointer to "struct tomoyo_domain_info" if found, NULL otherwise.

Caller holds tomoyo_read_lock().

Definition at line 597 of file util.c.

int tomoyo_find_next_domain ( struct linux_binprm bprm)

tomoyo_find_next_domain - Find a domain.

: Pointer to "struct linux_binprm".

Returns 0 on success, negative value otherwise.

Caller holds tomoyo_read_lock().

Definition at line 676 of file domain.c.

void tomoyo_get_attributes ( struct tomoyo_obj_info obj)

tomoyo_get_attributes - Revalidate "struct inode".

: Pointer to "struct tomoyo_obj_info".

Returns nothing.

Definition at line 693 of file condition.c.

struct tomoyo_condition* tomoyo_get_condition ( struct tomoyo_acl_param param)
read

tomoyo_get_condition - Parse condition part.

Parameters
Pointer to "struct tomoyo_acl_param".

Returns pointer to "struct tomoyo_condition" on success, NULL otherwise.

Definition at line 478 of file condition.c.

struct tomoyo_path_info* tomoyo_get_domainname ( struct tomoyo_acl_param param)
read

tomoyo_get_domainname - Read a domainname from a line.

Parameters
Pointer to "struct tomoyo_acl_param".

Returns a domainname on success, NULL otherwise.

Definition at line 169 of file util.c.

const char* tomoyo_get_exe ( void  )

tomoyo_get_exe - Get tomoyo_realpath() of current process.

Returns the tomoyo_realpath() of current process on success, NULL otherwise.

This function uses kzalloc(), so the caller must call kfree() if this function didn't return NULL.

Definition at line 949 of file util.c.

struct tomoyo_group* tomoyo_get_group ( struct tomoyo_acl_param param,
const u8  idx 
)
read

tomoyo_get_group - Allocate memory for "struct tomoyo_path_group"/"struct tomoyo_number_group".

Parameters
Pointer to "struct tomoyo_acl_param". : Index number.

Returns pointer to "struct tomoyo_group" on success, NULL otherwise.

Definition at line 92 of file memory.c.

int tomoyo_get_mode ( const struct tomoyo_policy_namespace ns,
const u8  profile,
const u8  index 
)

tomoyo_get_mode - Get MAC mode.

: Pointer to "struct tomoyo_policy_namespace". : Profile number. : Index number of functionality.

Returns mode.

Definition at line 972 of file util.c.

struct tomoyo_path_info* tomoyo_get_name ( const char name)
read

Definition at line 147 of file memory.c.

char* tomoyo_init_log ( struct tomoyo_request_info r,
int  len,
const char fmt,
va_list  args 
)

tomoyo_init_log - Allocate buffer for audit logs.

: Pointer to "struct tomoyo_request_info". : Buffer size needed for and . : The printf()'s format string. : va_list structure for .

Returns pointer to allocated memory.

This function uses kzalloc(), so caller must kfree() if this function didn't return NULL.

Definition at line 243 of file audit.c.

void tomoyo_init_policy_namespace ( struct tomoyo_policy_namespace ns)

tomoyo_init_policy_namespace - Initialize namespace.

: Pointer to "struct tomoyo_policy_namespace".

Returns nothing.

Definition at line 343 of file common.c.

int tomoyo_init_request_info ( struct tomoyo_request_info r,
struct tomoyo_domain_info domain,
const u8  index 
)

tomoyo_init_request_info - Initialize "struct tomoyo_request_info" members.

: Pointer to "struct tomoyo_request_info" to initialize. : Pointer to "struct tomoyo_domain_info". NULL for tomoyo_domain(). : Index number of functionality.

Returns mode.

Definition at line 999 of file util.c.

void __init tomoyo_load_builtin_policy ( void  )

tomoyo_load_builtin_policy - Load built-in policy.

Returns nothing.

Definition at line 2738 of file common.c.

void tomoyo_load_policy ( const char filename)

tomoyo_load_policy - Run external policy loader to load policy.

: The program about to start.

This function checks whether is /sbin/init , and if so invoke /sbin/tomoyo-init and wait for the termination of /sbin/tomoyo-init and then continues invocation of /sbin/init. /sbin/tomoyo-init reads policy files in /etc/tomoyo/ directory and writes to /sys/kernel/security/tomoyo/ interfaces.

Returns nothing.

Definition at line 83 of file load_policy.c.

bool tomoyo_memory_ok ( void ptr)

tomoyo_memory_ok - Check memory quota.

: Pointer to allocated memory.

Returns true on success, false otherwise.

Returns true if is not NULL and quota not exceeded, false otherwise.

Caller holds tomoyo_policy_lock mutex.

Definition at line 46 of file memory.c.

int tomoyo_mkdev_perm ( const u8  operation,
struct path path,
const unsigned int  mode,
unsigned int  dev 
)

tomoyo_mkdev_perm - Check permission for "mkblock" and "mkchar".

: Type of operation. (TOMOYO_TYPE_MKCHAR or TOMOYO_TYPE_MKBLOCK) : Pointer to "struct path". : Create mode. : Device number.

Returns 0 on success, negative value otherwise.

Definition at line 841 of file file.c.

void __init tomoyo_mm_init ( void  )

tomoyo_mm_init - Initialize mm related code.

Definition at line 190 of file memory.c.

int tomoyo_mount_permission ( const char dev_name,
struct path path,
const char type,
unsigned long  flags,
void data_page 
)

tomoyo_mount_permission - Check permission for mount() operation.

: Name of device file. Maybe NULL. : Pointer to "struct path". : Name of filesystem type. Maybe NULL. : Mount options. : Optional data. Maybe NULL.

Returns 0 on success, negative value otherwise.

Definition at line 187 of file mount.c.

void tomoyo_normalize_line ( unsigned char buffer)

tomoyo_normalize_line - Format string.

: The line to normalize.

Leading and trailing whitespaces are removed. Multiple whitespaces are packed into single space.

Returns nothing.

Definition at line 414 of file util.c.

void tomoyo_notify_gc ( struct tomoyo_io_buffer head,
const bool  is_register 
)

tomoyo_notify_gc - Register/unregister /sys/kernel/security/tomoyo/ users.

: Pointer to "struct tomoyo_io_buffer". : True if register, false if unregister.

Returns nothing.

Definition at line 630 of file gc.c.

bool tomoyo_number_matches_group ( const unsigned long  min,
const unsigned long  max,
const struct tomoyo_group group 
)

tomoyo_number_matches_group - Check whether the given number matches members of the given number group.

: Min number. : Max number. : Pointer to "struct tomoyo_number_group".

Returns true if and partially overlaps , false otherwise.

Caller holds tomoyo_read_lock().

Definition at line 150 of file group.c.

int tomoyo_open_control ( const u8  type,
struct file file 
)

Definition at line 2347 of file common.c.

bool tomoyo_parse_ipaddr_union ( struct tomoyo_acl_param param,
struct tomoyo_ipaddr_union ptr 
)

tomoyo_parse_ipaddr_union - Parse an IP address.

Parameters
Pointer to "struct tomoyo_acl_param". : Pointer to "struct tomoyo_ipaddr_union".

Returns true on success, false otherwise.

Definition at line 49 of file network.c.

bool tomoyo_parse_name_union ( struct tomoyo_acl_param param,
struct tomoyo_name_union ptr 
)

tomoyo_parse_name_union - Parse a tomoyo_name_union.

Parameters
Pointer to "struct tomoyo_acl_param". : Pointer to "struct tomoyo_name_union".

Returns true on success, false otherwise.

Definition at line 257 of file util.c.

bool tomoyo_parse_number_union ( struct tomoyo_acl_param param,
struct tomoyo_number_union ptr 
)

tomoyo_parse_number_union - Parse a tomoyo_number_union.

Parameters
Pointer to "struct tomoyo_acl_param". : Pointer to "struct tomoyo_number_union".

Returns true on success, false otherwise.

Definition at line 281 of file util.c.

u8 tomoyo_parse_ulong ( unsigned long result,
char **  str 
)

tomoyo_parse_ulong - Parse an "unsigned long" value.

Returns
: Pointer to "unsigned long". : Pointer to string to parse.

Returns one of values in "enum tomoyo_value_type".

The is updated to point the first character after the value on success.

Definition at line 197 of file util.c.

int tomoyo_path2_perm ( const u8  operation,
struct path path1,
struct path path2 
)

tomoyo_path2_perm - Check permission for "rename", "link" and "pivot_root".

: Type of operation. : Pointer to "struct path". : Pointer to "struct path".

Returns 0 on success, negative value otherwise.

Definition at line 885 of file file.c.

struct tomoyo_path_info* tomoyo_path_matches_group ( const struct tomoyo_path_info pathname,
const struct tomoyo_group group 
)
read

tomoyo_path_matches_group - Check whether the given pathname matches members of the given pathname group.

: The name of pathname. : Pointer to "struct tomoyo_path_group".

Returns matched member's pathname if matches pathnames in , NULL otherwise.

Caller holds tomoyo_read_lock().

Definition at line 125 of file group.c.

bool tomoyo_path_matches_pattern ( const struct tomoyo_path_info filename,
const struct tomoyo_path_info pattern 
)

/ '/' + 'One or more repetitions of dir/' (e.g. /dir/ /dir/dir/ /dir/dir/dir/ ).

Definition at line 920 of file util.c.

int tomoyo_path_number_perm ( const u8  type,
struct path path,
unsigned long  number 
)

tomoyo_path_number_perm - Check permission for "create", "mkdir", "mkfifo", "mksock", "ioctl", "chmod", "chown", "chgrp".

: Type of operation. : Pointer to "struct path". : Number.

Returns 0 on success, negative value otherwise.

Definition at line 690 of file file.c.

int tomoyo_path_perm ( const u8  operation,
struct path path,
const char target 
)

tomoyo_path_perm - Check permission for "unlink", "rmdir", "truncate", "symlink", "append", "chroot" and "unmount".

: Type of operation. : Pointer to "struct path". : Symlink's target if is TOMOYO_TYPE_SYMLINK, NULL otherwise.

Returns 0 on success, negative value otherwise.

Definition at line 785 of file file.c.

bool tomoyo_permstr ( const char string,
const char keyword 
)

tomoyo_permstr - Find permission keywords.

: String representation for permissions in foo/bar/buz format. : Keyword to find from /

Returns ture if was found in , false otherwise.

This function assumes that strncmp(w1, w2, strlen(w1)) != 0 if w1 != w2.

Definition at line 131 of file util.c.

unsigned int tomoyo_poll_control ( struct file file,
poll_table wait 
)

Definition at line 2457 of file common.c.

unsigned int tomoyo_poll_log ( struct file file,
poll_table wait 
)

Definition at line 462 of file audit.c.

void tomoyo_print_ip ( char buf,
const unsigned int  size,
const struct tomoyo_ipaddr_union ptr 
)

tomoyo_print_ip - Print an IP address.

: Buffer to write to. : Size of . : Pointer to "struct ipaddr_union".

Returns nothing.

Definition at line 123 of file network.c.

void tomoyo_print_ulong ( char buffer,
const int  buffer_len,
const unsigned long  value,
const u8  type 
)

tomoyo_print_ulong - Print an "unsigned long" value.

: Pointer to buffer. : Size of . : An "unsigned long" value. : Type of .

Returns nothing.

Definition at line 236 of file util.c.

tomoyo_profile - Find a profile.

: Pointer to "struct tomoyo_policy_namespace". : Profile number to find.

Returns pointer to "struct tomoyo_profile".

Definition at line 527 of file common.c.

void tomoyo_put_name_union ( struct tomoyo_name_union ptr)

tomoyo_put_name_union - Drop reference on "struct tomoyo_name_union".

: Pointer to "struct tomoyo_name_union".

Returns nothing.

Definition at line 66 of file file.c.

void tomoyo_put_number_union ( struct tomoyo_number_union ptr)

tomoyo_put_number_union - Drop reference on "struct tomoyo_number_union".

: Pointer to "struct tomoyo_number_union".

Returns nothing.

Definition at line 98 of file file.c.

ssize_t tomoyo_read_control ( struct tomoyo_io_buffer head,
char __user buffer,
const int  buffer_len 
)

tomoyo_read_control - read() for /sys/kernel/security/tomoyo/ interface.

: Pointer to "struct tomoyo_io_buffer". : Poiner to buffer to write to. : Size of .

Returns bytes read on success, negative value otherwise.

Definition at line 2513 of file common.c.

void tomoyo_read_log ( struct tomoyo_io_buffer head)

tomoyo_read_log - Read an audit log.

: Pointer to "struct tomoyo_io_buffer".

Returns nothing.

Definition at line 432 of file audit.c.

char* tomoyo_read_token ( struct tomoyo_acl_param param)

tomoyo_read_token - Read a word from a line.

Parameters
Pointer to "struct tomoyo_acl_param".

Returns a word on success, "" otherwise.

To allow the caller to skip NULL check, this function returns "" rather than NULL if there is no more words to read.

Definition at line 149 of file util.c.

char* tomoyo_realpath_from_path ( struct path path)

tomoyo_realpath_from_path - Returns realpath(3) of the given pathname but ignores chroot'ed root.

: Pointer to "struct path".

Returns the realpath of the given on success, NULL otherwise.

If dentry is a directory, trailing '/' is appended. Characters out of 0x20 < c < 0x7F range are converted to style octal string. Character \ is converted to \ string.

These functions use kzalloc(), so the caller must call kfree() if these functions didn't return NULL.

Definition at line 250 of file realpath.c.

char* tomoyo_realpath_nofollow ( const char pathname)

tomoyo_realpath_nofollow - Get realpath of a pathname.

: The pathname to solve.

Returns the realpath of on success, NULL otherwise.

Definition at line 318 of file realpath.c.

int tomoyo_socket_bind_permission ( struct socket sock,
struct sockaddr addr,
int  addr_len 
)

tomoyo_socket_bind_permission - Check permission for setting the local address of a socket.

: Pointer to "struct socket". : Pointer to "struct sockaddr". : Size of .

Returns 0 on success, negative value otherwise.

Definition at line 717 of file network.c.

int tomoyo_socket_connect_permission ( struct socket sock,
struct sockaddr addr,
int  addr_len 
)

tomoyo_socket_connect_permission - Check permission for setting the remote address of a socket.

: Pointer to "struct socket". : Pointer to "struct sockaddr". : Size of .

Returns 0 on success, negative value otherwise.

Definition at line 680 of file network.c.

int tomoyo_socket_listen_permission ( struct socket sock)

tomoyo_socket_listen_permission - Check permission for listening a socket.

: Pointer to "struct socket".

Returns 0 on success, negative value otherwise.

Definition at line 645 of file network.c.

int tomoyo_socket_sendmsg_permission ( struct socket sock,
struct msghdr msg,
int  size 
)

tomoyo_socket_sendmsg_permission - Check permission for sending a datagram.

: Pointer to "struct socket". : Pointer to "struct msghdr". : Unused.

Returns 0 on success, negative value otherwise.

Definition at line 752 of file network.c.

bool tomoyo_str_starts ( char **  src,
const char find 
)

tomoyo_str_starts - Check whether the given string starts with the given keyword.

: Pointer to pointer to the string. : Pointer to the keyword.

Returns true if starts with , false otherwise.

The is updated to point the first character after the if starts with .

Definition at line 392 of file util.c.

int tomoyo_supervisor ( struct tomoyo_request_info r,
const char fmt,
  ... 
)
int int tomoyo_update_domain ( struct tomoyo_acl_info new_entry,
const int  size,
struct tomoyo_acl_param param,
bool(*)(const struct tomoyo_acl_info *, const struct tomoyo_acl_info *)  check_duplicate,
bool(*)(struct tomoyo_acl_info *, struct tomoyo_acl_info *, const bool merge_duplicate 
)

tomoyo_update_domain - Update an entry for domain policy.

: Pointer to "struct tomoyo_acl_info". : Size of in bytes.

Parameters
Pointer to "struct tomoyo_acl_param". : Callback function to find duplicated entry. : Callback function to merge duplicated entry.

Returns 0 on success, negative value otherwise.

Caller holds tomoyo_read_lock().

Definition at line 88 of file domain.c.

int tomoyo_update_policy ( struct tomoyo_acl_head new_entry,
const int  size,
struct tomoyo_acl_param param,
bool(*)(const struct tomoyo_acl_head *, const struct tomoyo_acl_head *)  check_duplicate 
)

tomoyo_update_policy - Update an entry for exception policy.

: Pointer to "struct tomoyo_acl_info". : Size of in bytes.

Parameters
Pointer to "struct tomoyo_acl_param". : Callback function to find duplicated entry.

Returns 0 on success, negative value otherwise.

Caller holds tomoyo_read_lock().

Definition at line 28 of file domain.c.

void tomoyo_update_stat ( const u8  index)

tomoyo_update_stat - Update statistic counters.

: Index for policy type.

Returns nothing.

Definition at line 2268 of file common.c.

void tomoyo_warn_oom ( const char function)

tomoyo_warn_oom - Print out of memory warning message.

: Function's name.

Definition at line 16 of file memory.c.

int tomoyo_write_aggregator ( struct tomoyo_acl_param param)

tomoyo_write_aggregator - Write "struct tomoyo_aggregator" list.

Parameters
Pointer to "struct tomoyo_acl_param".

Returns 0 on success, negative value otherwise.

Caller holds tomoyo_read_lock().

Definition at line 388 of file domain.c.

ssize_t tomoyo_write_control ( struct tomoyo_io_buffer head,
const char __user buffer,
const int  buffer_len 
)

tomoyo_write_control - write() for /sys/kernel/security/tomoyo/ interface.

: Pointer to "struct tomoyo_io_buffer". : Pointer to buffer to read from. : Size of .

Returns on success, negative value otherwise.

Definition at line 2585 of file common.c.

int tomoyo_write_file ( struct tomoyo_acl_param param)

tomoyo_write_file - Update file related list.

Parameters
Pointer to "struct tomoyo_acl_param".

Returns 0 on success, negative value otherwise.

Caller holds tomoyo_read_lock().

Definition at line 994 of file file.c.

int tomoyo_write_group ( struct tomoyo_acl_param param,
const u8  type 
)

tomoyo_write_group - Write "struct tomoyo_path_group"/"struct tomoyo_number_group"/"struct tomoyo_address_group" list.

Parameters
Pointer to "struct tomoyo_acl_param". : Type of this group.

Returns 0 on success, negative value otherwise.

Definition at line 71 of file group.c.

int tomoyo_write_inet_network ( struct tomoyo_acl_param param)

tomoyo_write_inet_network - Write "struct tomoyo_inet_acl" list.

Parameters
Pointer to "struct tomoyo_acl_param".

Returns 0 on success, negative value otherwise.

Caller holds tomoyo_read_lock().

Definition at line 281 of file network.c.

void tomoyo_write_log ( struct tomoyo_request_info r,
const char fmt,
  ... 
)
void void tomoyo_write_log2 ( struct tomoyo_request_info r,
int  len,
const char fmt,
va_list  args 
)

tomoyo_write_log2 - Write an audit log.

: Pointer to "struct tomoyo_request_info". : Buffer size needed for and . : The printf()'s format string. : va_list structure for .

Returns nothing.

Definition at line 360 of file audit.c.

int tomoyo_write_misc ( struct tomoyo_acl_param param)

tomoyo_write_misc - Update environment variable list.

Parameters
Pointer to "struct tomoyo_acl_param".

Returns 0 on success, negative value otherwise.

Definition at line 117 of file environ.c.

int tomoyo_write_transition_control ( struct tomoyo_acl_param param,
const u8  type 
)

tomoyo_write_transition_control - Write "struct tomoyo_transition_control" list.

Parameters
Pointer to "struct tomoyo_acl_param". : Type of this entry.

Returns 0 on success, negative value otherwise.

Definition at line 233 of file domain.c.

int tomoyo_write_unix_network ( struct tomoyo_acl_param param)

tomoyo_write_unix_network - Write "struct tomoyo_unix_acl" list.

Parameters
Pointer to "struct tomoyo_acl_param".

Returns 0 on success, negative value otherwise.

Definition at line 326 of file network.c.

const char* tomoyo_yesno ( const unsigned int  value)

tomoyo_yesno - Return "yes" or "no".

: Bool value.

Definition at line 181 of file common.c.

Variable Documentation

const char* const tomoyo_condition_keyword[TOMOYO_MAX_CONDITION_KEYWORD]

Definition at line 72 of file common.c.

struct list_head tomoyo_condition_list

Definition at line 1132 of file common.c.

struct list_head tomoyo_domain_list
const u8 tomoyo_index2category[TOMOYO_MAX_MAC_INDEX]

Definition at line 20 of file util.c.

struct tomoyo_domain_info tomoyo_kernel_domain

Definition at line 14 of file domain.c.

struct tomoyo_policy_namespace tomoyo_kernel_namespace

Definition at line 185 of file memory.c.

Definition at line 22 of file common.c.

unsigned int tomoyo_memory_quota[TOMOYO_MAX_MEMORY_STAT]

Definition at line 33 of file memory.c.

unsigned int tomoyo_memory_used[TOMOYO_MAX_MEMORY_STAT]

Definition at line 31 of file memory.c.

Definition at line 13 of file common.c.

struct list_head tomoyo_name_list[TOMOYO_MAX_HASH]

Definition at line 138 of file memory.c.

struct list_head tomoyo_namespace_list
const char* const tomoyo_path_keyword[TOMOYO_MAX_PATH_OPERATION]

Definition at line 141 of file common.c.

Definition at line 48 of file file.c.

Definition at line 30 of file file.c.

bool tomoyo_policy_loaded

Definition at line 14 of file util.c.

struct mutex tomoyo_policy_lock

Definition at line 38 of file file.c.

const char* const tomoyo_proto_keyword[TOMOYO_SOCK_MAX]

Definition at line 32 of file network.c.

const char* const tomoyo_socket_keyword[TOMOYO_MAX_NETWORK_OPERATION]

Definition at line 156 of file common.c.

struct srcu_struct tomoyo_ss

Definition at line 539 of file tomoyo.c.