Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\apparmor\lsm.c Create Date:2022-07-28 19:53:06
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:apparmor_setprocattr

Proto:static int apparmor_setprocattr(const char *name, void *value, size_t size)

Type:int

Parameter:

TypeParameterName
const char *name
void *value
size_tsize
618  largs = NULL , args = value
621  TODO: cleanup audit init so we don't need _aad = {0,} (sa, LSM_AUDIT_DATA_NONE, OP_SETPROCATTR)
623  If size == 0 Then Return -EINVAL
627  If args[size - 1] != '\0' Then
629  largs = args = Allocation memory
630  If Not args Then Return -ENOMEM
632  memcpy(args, value, size)
633  args[size] = '\0'
636  error = -EINVAL
637  args = strim - Removes leading and trailing whitespace from @s.*@s: The string to be stripped.* Note that the first trailing whitespace is replaced with a %NUL-terminator* in the given string @s. Returns a pointer to the first non-whitespace* character in @s.
638  command = strsep - Split a string into tokens*@s: The string to be searched*@ct: The characters to search for* strsep() updates @s to point after the token, ready for the next call.* It returns empty tokens, too, behaving exactly like the libc function
639  If Not args Then Go to out
641  args = skip_spaces - Removes leading whitespace from @str.*@str: The string to be stripped.* Returns a pointer to the first non-whitespace character in @str.
642  If Not args Then Go to out
645  arg_size = size - args - If largs Then largs Else value
646  If strcmp(name, "current") == 0 Then
647  If strcmp(command, "changehat") == 0 Then
650  Else if strcmp(command, "permhat") == 0 Then
653  Else if strcmp(command, "changeprofile") == 0 Then
655  Else if strcmp(command, "permprofile") == 0 Then
657  Else if strcmp(command, "stack") == 0 Then
659  Else Go to fail
661  Else if strcmp(name, "exec") == 0 Then
662  If strcmp(command, "exec") == 0 Then error = aa_change_profile - perform a one-way profile transition*@fqname: name of profile may include namespace (NOT NULL)*@onexec: whether this transition is to take place immediately or at exec*@flags: flags affecting change behavior
664  Else if strcmp(command, "stack") == 0 Then error = aa_change_profile - perform a one-way profile transition*@fqname: name of profile may include namespace (NOT NULL)*@onexec: whether this transition is to take place immediately or at exec*@flags: flags affecting change behavior
667  Else Go to fail
669  Else Go to fail
673  If Not error Then error = size
675  out :
676  kfree(largs)
677  Return error
679  fail :
680  label = gin_current_label_crit_section - current's confining label and update it* Returns: up to date confining label or the ns unconfined label (NOT NULL)* Not safe to call inside locks* The returned reference must be put with end_current_label_crit_section()*
681  info = name
682  error = error = -EINVAL
683  aa_audit_msg - Log a message to the audit subsystem*@sa: audit event structure (NOT NULL)*@cb: optional callback fn for type specific fields (MAYBE NULL)
684  d_label_crit_section - put a reference found with begin_current_label..*@label: label reference to put* Should only be used with a reference obtained with* begin_current_label_crit_section and never used in situations where the* task cred may be updated
685  Go to out