Function report |
Source Code:security\apparmor\policy_unpack.c |
Create Date:2022-07-28 19:52:14 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:pack_profile - unpack a serialized profile*@e: serialized data extent information (NOT NULL)* NOTE: unpack profile sets audit struct if there is a failure
Proto:static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name)
Type:struct aa_profile
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct aa_ext * | e | |
| char ** | ns_name |
| 676 | struct aa_profile * profile = NULL |
| 678 | info = "failed to unpack profile" |
| 680 | struct rhashtable_params params = {0} |
| 681 | char * key = NULL |
| 687 | * ns_name = NULL |
| 692 | If Not unpack_str(e, & name, NULL) Then Go to fail |
| 697 | tmpname = aa_splitn_fqname(name, strlen - Find the length of a string*@s: The string to be sized, & tmpns, & ns_len) |
| 698 | If tmpns Then |
| 700 | If Not ns_name Then |
| 707 | profile = aa_alloc_profile - allocate, initialize and return a new profile*@hname: name of the profile (NOT NULL)*@gfp: allocation type* Returns: refcount profile or NULL on failure |
| 712 | unpack_str(e, & rename, "rename") |
| 715 | unpack_str(e, & attach, "attach") |
| 718 | xmatch = pack_dfa - unpack a file rule dfa*@e: serialized data extent information (NOT NULL)* returns dfa or ERR_PTR or NULL if no dfa |
| 726 | If xmatch Then |
| 727 | If Not unpack_u32(e, & tmp, NULL) Then |
| 731 | xmatch_len = tmp |
| 735 | unpack_str(e, & disconnected, "disconnected") |
| 742 | info = "failed to unpack profile flags" |
| 743 | If Not unpack_u32(e, & tmp, NULL) Then Go to fail |
| 745 | If tmp & PACKED_FLAG_HAT Then flags |= profile is a hat |
| 747 | If Not unpack_u32(e, & tmp, NULL) Then Go to fail |
| 749 | If tmp == PACKED_MODE_COMPLAIN || version & FORCE_COMPLAIN_FLAG Then mode = allow and log access violations |
| 751 | Else if tmp == PACKED_MODE_KILL Then mode = kill task on access violation |
| 753 | Else if tmp == PACKED_MODE_UNCONFINED Then mode = profile set to unconfined |
| 755 | If Not unpack_u32(e, & tmp, NULL) Then Go to fail |
| 764 | If unpack_u32(e, & path_flags, "path_flags") Then path_flags |= flags & mediate deleted paths |
| 767 | Else path_flags = mediate deleted paths |
| 771 | info = "failed to unpack profile capabilities" |
| 772 | If Not unpack_u32(e, & (cap[0]), NULL) Then Go to fail |
| 774 | If Not unpack_u32(e, & (cap[0]), NULL) Then Go to fail |
| 776 | If Not unpack_u32(e, & (cap[0]), NULL) Then Go to fail |
| 778 | If Not unpack_u32(e, & cap[0], NULL) Then Go to fail |
| 781 | info = "failed to unpack upper profile capabilities" |
| 784 | If Not unpack_u32(e, & (cap[1]), NULL) Then Go to fail |
| 786 | If Not unpack_u32(e, & (cap[1]), NULL) Then Go to fail |
| 788 | If Not unpack_u32(e, & (cap[1]), NULL) Then Go to fail |
| 790 | If Not unpack_u32(e, & (cap[1]), NULL) Then Go to fail |
| 796 | info = "failed to unpack extended profile capabilities" |
| 799 | If Not unpack_u32(e, & (cap[0]), NULL) Then Go to fail |
| 801 | If Not unpack_u32(e, & (cap[1]), NULL) Then Go to fail |
| 807 | If Not unpack_xattrs(e, profile) Then |
| 812 | If Not unpack_rlimits(e, profile) Then |
| 817 | If Not unpack_secmark(e, profile) Then |
| 824 | info = "failed to unpack policydb" |
| 825 | Generic policy DFA specific rule types will be subsections of it = pack_dfa - unpack a file rule dfa*@e: serialized data extent information (NOT NULL)* returns dfa or ERR_PTR or NULL if no dfa |
| 829 | Go to fail |
| 830 | Else if Not Generic policy DFA specific rule types will be subsections of it Then |
| 834 | If Not unpack_u32(e, & set of start states for the different classes of data[0], "start") Then set of start states for the different classes of data[0] = DFA_START |
| 838 | When i <= AA_CLASS_LAST cycle |
| 850 | dfa = pack_dfa - unpack a file rule dfa*@e: serialized data extent information (NOT NULL)* returns dfa or ERR_PTR or NULL if no dfa |
| 856 | Else if dfa Then |
| 857 | If Not unpack_u32(e, & start, "dfa_start") Then start = DFA_START |
| 864 | Else dfa = aa_get_dfa - increment refcount on dfa @p*@dfa: dfa (MAYBE NULL)* Returns: pointer to @dfa if @dfa is NULL will return NULL* Requires: @dfa must be held with valid refcount when called |
| 873 | info = "out of memory" |
| 874 | data = 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). |
| 878 | nelem_hint = 3 |
| 879 | key_len = size of * |
| 880 | key_offset = offsetof(structaa_data, key) |
| 881 | head_offset = offsetof(structaa_data, head) |
| 890 | When unpack_strdup(e, & key, NULL) cycle |
| 891 | data = 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). |
| 892 | If Not data Then |
| 894 | Go to fail |
| 898 | size of data in bytes = unpack_blob(e, & binary data, NULL) |
| 900 | If size of data in bytes && Not binary data Then |
| 903 | Go to fail |
| 921 | Return profile |
| 923 | fail : |
| Name | Describe |
|---|---|
| aa_unpack | aa_unpack - unpack packed binary profile(s) data loaded from user space*@udata: user data copied to kmem (NOT NULL)*@lh: list to place unpacked profiles in a aa_repl_ws*@ns: Returns namespace profile is in if specified else NULL (NOT NULL)* Unpack user |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |