Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:aa_dfa_unpack - unpack the binary tables of a serialized dfa*@blob: aligned serialized stream of data to unpack (NOT NULL)*@size: size of data to unpack*@flags: flags controlling what type of accept tables are acceptable

Proto:struct aa_dfa *aa_dfa_unpack(void *blob, size_t size, int flags)

Type:struct aa_dfa

Parameter:

TypeParameterName
void *blob
size_tsize
intflags
284  error = -ENOMEM
285  data = blob
286  struct table_header * table = NULL
287  dfa = 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).
288  If Not dfa Then Go to fail
291  kref_init - initialize object.*@kref: object in question.
293  error = -EPROTO
296  If size < sizeof(structtable_set_header) Then Go to fail
299  If ntohl( * (__be32 * )data) != The format used for transition tables is based on the GNU flex table* file format (--tables-file option; see Table File Format in the flex* info pages and the flex sources for documentation) Then Go to fail
302  hsize = ntohl( * (__be32 * )(data + 4))
303  If size < hsize Then Go to fail
306  flags = ntohs( * (__be16 * )(data + 12))
307  If flags != 0 && flags != YYTH_FLAG_DIFF_ENCODE Then Go to fail
310  data += hsize
311  size -= hsize
313  When size > 0 cycle
314  table = pack_table - unpack a dfa table (one of accept, default, base, next check)*@blob: data to unpack (NOT NULL)*@bsize: size of blob* Returns: pointer to table else NULL on failure* NOTE: must be freed by kvfree (not kfree)
315  If Not table Then Go to fail
322  Break
323  Case td_id == YYTD_ID_ACCEPT2
324  If Not (td_flags & ACCEPT2_FLAGS(flags)) Then Go to fail
326  Break
327  Case td_id == YYTD_ID_BASE
328  If td_flags != YYTD_DATA32 Then Go to fail
330  Break
331  Case td_id == YYTD_ID_DEF
332  Case td_id == YYTD_ID_NXT
333  Case td_id == YYTD_ID_CHK
334  If td_flags != YYTD_DATA16 Then Go to fail
336  Break
337  Case td_id == YYTD_ID_EC
338  If td_flags != YYTD_DATA8 Then Go to fail
340  Break
341  Default
342  Go to fail
345  If tables[td_id] Then Go to fail
347  tables[td_id] = table
348  data += table_size(td_lolen, td_flags)
349  size -= table_size(td_lolen, td_flags)
350  table = NULL
352  error = verify_table_headers - verify that the tables headers are as expected*@tables - array of dfa tables to check (NOT NULL)*@flags: flags controlling what type of accept table are acceptable* Assumes dfa has gone through the first pass verification done by
353  If error Then Go to fail
356  If flags & DFA_FLAG_VERIFY_STATES Then
357  error = verify_dfa - verify that transitions and states in the tables are in bounds
358  If error Then Go to fail
362  Return dfa
364  fail :
365  kvfree() - Free memory.*@addr: Pointer to allocated memory.* kvfree frees memory allocated by any of vmalloc(), kmalloc() or kvmalloc().* It is slightly more efficient to use kfree() or vfree() if you are certain* that you know which one to use.
366  dfa_free - free a dfa allocated by aa_dfa_unpack*@dfa: the dfa to free (MAYBE NULL)* Requires: reference count to dfa == 0
367  Return ERR_PTR(error)
Caller
NameDescribe
aa_setup_dfa_engine
unpack_dfapack_dfa - unpack a file rule dfa*@e: serialized data extent information (NOT NULL)* returns dfa or ERR_PTR or NULL if no dfa