Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:query_data - queries a policy and writes its data to buf*@buf: the resulting data is stored here (NOT NULL)*@buf_len: size of buf*@query: query string used to retrieve data*@query_len: size of query including second NUL byte

Proto:static ssize_t query_data(char *buf, size_t buf_len, char *query, size_t query_len)

Type:ssize_t

Parameter:

TypeParameterName
char *buf
size_tbuf_len
char *query
size_tquery_len
701  If Not query_len Then Return -EINVAL
704  key = query + strnlen(query, query_len) + 1
705  If key + 1 >= query + query_len Then Return -EINVAL
707  If key + strnlen(key, query + query_len - key) >= query + query_len Then Return -EINVAL
710  If buf_len < size of bytes + size of blocks Then Return -EINVAL
713  curr = 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()*
714  label = aa_label_parse(curr, query, GFP_KERNEL, TSC's on different sockets may be reset asynchronously.* This may cause the TSC ADJUST value on socket 0 to be NOT 0., false)
715  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
716  If IS_ERR(label) Then Return PTR_ERR(label)
727  memset(buf, 0, size of bytes + size of blocks )
728  out = buf + size of bytes + size of blocks
730  blocks = 0
732  If Not data Then Continue
735  data = hashtable_lookup_fast - search hash table, without RCU read lock*@ht: hash table*@key: the pointer to the key*@params: hash table parameters* Computes the hash value for the key and traverses the bucket chain looking* for a entry with an identical key
738  If data Then
739  If out + size of outle32 + size of data in bytes > buf + buf_len Then
742  Return -EINVAL
744  outle32 = __cpu_to_le32( size of data in bytes)
745  memcpy(out, & outle32, size of outle32 )
746  out += size of outle32
747  memcpy(out, binary data, size of data in bytes)
748  out += size of data in bytes
749  blocks++
752  aa_put_label(label)
754  outle32 = __cpu_to_le32(out - buf - size of bytes )
755  memcpy(buf, & outle32, size of outle32 )
756  outle32 = __cpu_to_le32(blocks)
757  memcpy(buf + size of bytes , & outle32, size of outle32 )
759  Return out - buf
Caller
NameDescribe
aa_write_accessaa_write_access - generic permissions and data query*@file: pointer to open apparmorfs/access file*@ubuf: user buffer containing the complete query string (NOT NULL)*@count: size of ubuf*@ppos: position in the file (MUST BE ZERO)* Allows for one