Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\tomoyo\domain.c Create Date:2022-07-28 19:40:17
Last Modify:2022-05-23 20:14:46 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:moyo_environ - Check permission for environment variable names.*@ee: Pointer to "struct tomoyo_execve".* Returns 0 on success, negative value otherwise.

Proto:static int tomoyo_environ(struct tomoyo_execve *ee)

Type:int

Parameter:

TypeParameterName
struct tomoyo_execve *ee
617  r = r
618  bprm = bprm
620  struct tomoyo_page_dump env_page = {}
622  arg_len = 0
623  pos = current top of mem
624  offset = pos % PAGE_SIZE
625  argv_count = argc
626  envp_count = envc
627  error = -ENOMEM
629  type = TOMOYO_MAC_ENVIRON
630  profile = Profile number to use.
631  One of tomoyo_mode_index . = moyo_get_mode - Get MAC mode.*@ns: Pointer to "struct tomoyo_policy_namespace".*@profile: Profile number.*@index: Index number of functionality.* Returns mode.
633  If Not One of tomoyo_mode_index . || Not envp_count Then Return 0
635  arg_ptr = 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).
636  If Not arg_ptr Then Go to out
638  When error == -ENOMEM cycle
639  If Not moyo_dump_page - Dump a page to buffer.*@bprm: Pointer to "struct linux_binprm".*@pos: Location to dump.*@dump: Poiner to "struct tomoyo_page_dump".* Returns true on success, false otherwise. Then Go to out
641  pos += PAGE_SIZE - offset
643  When argv_count && offset < PAGE_SIZE cycle
647  If argv_count Then
648  offset = 0
649  Continue
651  When offset < PAGE_SIZE cycle
654  If c && arg_len < TOMOYO_EXEC_TMPSIZE - 10 Then
655  If c == '=' Then
656  arg_ptr[arg_len++] = '\0'
657  Else if c == '\\' Then
658  arg_ptr[arg_len++] = '\\'
659  arg_ptr[arg_len++] = '\\'
660  Else if c > ' ' && c < 127 Then
661  arg_ptr[arg_len++] = c
662  Else
663  arg_ptr[arg_len++] = '\\'
664  arg_ptr[arg_len++] = (c >> 6) + '0'
665  arg_ptr[arg_len++] = ( c >> 3 & 7) + '0'
667  arg_ptr[arg_len++] = (c & 7) + '0'
669  Else
670  arg_ptr[arg_len] = '\0'
672  If c Then Continue
675  error = -EPERM
676  Break
678  If Not --envp_count Then
679  error = 0
680  Break
682  arg_len = 0
684  offset = 0
686  out :
687  If One of tomoyo_mode_index . != TOMOYO_CONFIG_ENFORCING Then error = 0
689  kfree(Contents of "page". Size is PAGE_SIZE. )
690  kfree(arg_ptr)
691  Return error
Caller
NameDescribe
tomoyo_find_next_domainmoyo_find_next_domain - Find a domain.*@bprm: Pointer to "struct linux_binprm".* Returns 0 on success, negative value otherwise.* Caller holds tomoyo_read_lock().