Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:aa_label_strn_parse - parse, validate and convert a text string to a label*@base: base label to use for lookups (NOT NULL)*@str: null terminated text string (NOT NULL)*@n: length of str to parse, will stop at \0 if encountered before n*@gfp: allocation

Proto:struct aa_label *aa_label_strn_parse(struct aa_label *base, const char *str, size_t n, gfp_t gfp, bool create, bool force_stack)

Type:struct aa_label

Parameter:

TypeParameterName
struct aa_label *base
const char *str
size_tn
gfp_tgfp
boolcreate
boolforce_stack
1861  DEFINE_VEC(profile, vec)
1862  currbase = base
1863  stack = 0
1864  end = str + n
1867  AA_BUG(!base)
1868  AA_BUG(!str)
1870  str = skipn_spaces - Removes leading whitespace from @str.*@str: The string to be stripped.* Returns a pointer to the first non-whitespace character in @str.* if all whitespace will return NULL
1871  If str == NULL || str == '=' && base != label Then Return ERR_PTR( - EINVAL)
1874  len = label_count_strn_entries(str, end - str)
1875  If str == '&' || force_stack Then
1877  stack = size
1878  len += stack
1879  If str == '&' Then str++
1883  error = vec_setup(profile, vec, len, gfp)
1884  If error Then Return ERR_PTR(error)
1887  When i < stack cycle vec[i] = aa_get_profile - increment refcount on profile @p*@p: profile (MAYBE NULL)* Returns: pointer to @p if @p is NULL will return NULL* Requires: @p must be held with valid refcount when called
1890  When split && i < len cycle
1892  vec[i] = sure stacks with components like* :ns:A//&B* have :ns: applied to both 'A' and 'B' by making the lookup relative* to the base if the lookup specifies an ns, else making the stacked lookup* relative to the last embedded ns in the string.
1893  If Not vec[i] Then Go to fail
1899  If ns != labels_ns(currbase) Then currbase = label
1901  str = split + 3
1902  split = aa_label_strn_split(str, end - str)
1905  If i < len Then
1906  vec[i] = sure stacks with components like* :ns:A//&B* have :ns: applied to both 'A' and 'B' by making the lookup relative* to the base if the lookup specifies an ns, else making the stacked lookup* relative to the last embedded ns in the string.
1907  If Not vec[i] Then Go to fail
1910  If len == 1 Then Return label
1914  len -= aa_vec_unique - canonical sort and unique a list of profiles*@n: number of refcounted profiles in the list (@n > 0)*@vec: list of profiles to sort and merge* Returns: the number of duplicates eliminated == references put* If @flags & VEC_FLAG_TERMINATE
1916  If len == 1 Then
1917  label = aa_get_label( & label)
1918  Go to out
1921  If create Then label = aa_vec_find_or_create_label(vec, len, gfp)
1923  Else label = vec_find - find label @l in label set*@vec: array of profiles to find equiv label for (NOT NULL)*@n: length of @vec* Returns: refcounted label if @vec equiv is in tree* else NULL if @vec equiv is not in tree
1925  If Not label Then Go to fail
1928  out :
1930  vec_cleanup(profile, vec, len)
1931  Return label
1933  fail :
1934  label = ERR_PTR( - ENOENT)
1935  Go to out
Caller
NameDescribe
aa_label_parse
apparmor_secctx_to_secid