Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\tomoyo\common.c Create Date:2022-07-28 19:37:07
Last Modify:2020-03-18 09:15:18 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:moyo_open_control - open() for /sys/kernel/security/tomoyo/ interface.*@type: Type of interface.*@file: Pointer to "struct file".* Returns 0 on success, negative value otherwise.

Proto:int tomoyo_open_control(const u8 type, struct file *file)

Type:int

Parameter:

TypeParameterName
const u8type
struct file *file
2416  head = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
2418  If Not head Then Return -ENOMEM
2420  mutex_init - initialize the mutex*@mutex: the mutex to be initialized* Initialize the mutex to unlocked state.* It is not allowed to initialize an already locked mutex.( & Exclusive lock for this structure. )
2421  Type of this interface. = type
2423  Case type == TOMOYO_DOMAINPOLICY
2425  write = moyo_write_domain - Write domain policy.*@head: Pointer to "struct tomoyo_io_buffer".* Returns 0 on success, negative value otherwise.* Caller holds tomoyo_read_lock().
2426  read = moyo_read_domain - Read domain policy.*@head: Pointer to "struct tomoyo_io_buffer".* Caller holds tomoyo_read_lock().
2427  Break
2428  Case type == TOMOYO_EXCEPTIONPOLICY
2430  write = moyo_write_exception - Write exception policy.*@head: Pointer to "struct tomoyo_io_buffer".* Returns 0 on success, negative value otherwise.* Caller holds tomoyo_read_lock().
2431  read = moyo_read_exception - Read exception policy.*@head: Pointer to "struct tomoyo_io_buffer".* Caller holds tomoyo_read_lock().
2432  Break
2433  Case type == TOMOYO_AUDIT
2435  poll = moyo_poll_log - Wait for an audit log.*@file: Pointer to "struct file".*@wait: Pointer to "poll_table". Maybe NULL.* Returns EPOLLIN | EPOLLRDNORM when ready to read an audit log.
2436  read = moyo_read_log - Read an audit log.*@head: Pointer to "struct tomoyo_io_buffer".* Returns nothing.
2437  Break
2438  Case type == TOMOYO_PROCESS_STATUS
2440  write = moyo_write_pid: Specify PID to obtain domainname.*@head: Pointer to "struct tomoyo_io_buffer".* Returns 0.
2441  read = moyo_read_pid - Get domainname of the specified PID
2442  Break
2443  Case type == TOMOYO_VERSION
2445  read = moyo_read_version: Get version.*@head: Pointer to "struct tomoyo_io_buffer".* Returns version information.
2446  Size of read buffer. = 128
2447  Break
2448  Case type == TOMOYO_STAT
2450  write = moyo_write_stat - Set memory quota.*@head: Pointer to "struct tomoyo_io_buffer".* Returns 0.
2451  read = moyo_read_stat - Read statistic data.*@head: Pointer to "struct tomoyo_io_buffer".* Returns nothing.
2452  Size of read buffer. = 1024
2453  Break
2454  Case type == TOMOYO_PROFILE
2456  write = moyo_write_profile - Write profile table.*@head: Pointer to "struct tomoyo_io_buffer".* Returns 0 on success, negative value otherwise.
2457  read = moyo_read_profile - Read profile table.*@head: Pointer to "struct tomoyo_io_buffer".* Returns nothing.
2458  Break
2459  Case type == TOMOYO_QUERY
2460  poll = moyo_poll_query - poll() for /sys/kernel/security/tomoyo/query.*@file: Pointer to "struct file".*@wait: Pointer to "poll_table".* Returns EPOLLIN | EPOLLRDNORM when ready to read, 0 otherwise.
2461  write = moyo_write_answer - Write the supervisor's decision.*@head: Pointer to "struct tomoyo_io_buffer".* Returns 0 on success, -EINVAL otherwise.
2462  read = moyo_read_query - Read access requests which violated policy in enforcing mode.*@head: Pointer to "struct tomoyo_io_buffer".
2463  Break
2464  Case type == TOMOYO_MANAGER
2466  write = moyo_write_manager - Write manager policy.*@head: Pointer to "struct tomoyo_io_buffer".* Returns 0 on success, negative value otherwise.* Caller holds tomoyo_read_lock().
2467  read = moyo_read_manager - Read manager policy.*@head: Pointer to "struct tomoyo_io_buffer".* Caller holds tomoyo_read_lock().
2468  Break
2470  If Not (f_mode & le is open for reading ) Then
2475  read = NULL
2476  poll = NULL
2477  Else if Not poll Then
2479  If Not Size of read buffer. Then Size of read buffer. = 4096 * 2
2481  Buffer for reading. = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
2482  If Not Buffer for reading. Then
2483  kfree(head)
2484  Return -ENOMEM
2487  If Not (f_mode & le is open for writing ) Then
2492  write = NULL
2493  Else if write Then
2494  Size of write buffer. = 4096 * 2
2495  Buffer for writing. = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
2496  If Not Buffer for writing. Then
2498  kfree(head)
2499  Return -ENOMEM
2508  If type == TOMOYO_QUERY Then atomic_inc( & Number of "struct file" referring /sys/kernel/security/tomoyo/query* interface.)
2510  needed for tty driver, and maybe others = head
2511  tomoyo_notify_gc(head, true)
2512  Return 0
Caller
NameDescribe
tomoyo_openmoyo_open - open() for /sys/kernel/security/tomoyo/ interface.*@inode: Pointer to "struct inode".*@file: Pointer to "struct file".* Returns 0 on success, negative value otherwise.