• Home
  • Raw
  • Download

Lines Matching refs:e

105 		       const char *name, const char *info, struct aa_ext *e,  in audit_iface()  argument
110 if (e) in audit_iface()
111 aad(&sa)->iface.pos = e->pos - e->start; in audit_iface()
198 static bool inbounds(struct aa_ext *e, size_t size) in inbounds() argument
200 return (size <= e->end - e->pos); in inbounds()
219 static size_t unpack_u16_chunk(struct aa_ext *e, char **chunk) in unpack_u16_chunk() argument
222 void *pos = e->pos; in unpack_u16_chunk()
224 if (!inbounds(e, sizeof(u16))) in unpack_u16_chunk()
226 size = le16_to_cpu(get_unaligned((__le16 *) e->pos)); in unpack_u16_chunk()
227 e->pos += sizeof(__le16); in unpack_u16_chunk()
228 if (!inbounds(e, size)) in unpack_u16_chunk()
230 *chunk = e->pos; in unpack_u16_chunk()
231 e->pos += size; in unpack_u16_chunk()
235 e->pos = pos; in unpack_u16_chunk()
240 static bool unpack_X(struct aa_ext *e, enum aa_code code) in unpack_X() argument
242 if (!inbounds(e, 1)) in unpack_X()
244 if (*(u8 *) e->pos != code) in unpack_X()
246 e->pos++; in unpack_X()
266 static bool unpack_nameX(struct aa_ext *e, enum aa_code code, const char *name) in unpack_nameX() argument
271 void *pos = e->pos; in unpack_nameX()
276 if (unpack_X(e, AA_NAME)) { in unpack_nameX()
278 size_t size = unpack_u16_chunk(e, &tag); in unpack_nameX()
288 if (unpack_X(e, code)) in unpack_nameX()
292 e->pos = pos; in unpack_nameX()
296 static bool unpack_u8(struct aa_ext *e, u8 *data, const char *name) in unpack_u8() argument
298 void *pos = e->pos; in unpack_u8()
300 if (unpack_nameX(e, AA_U8, name)) { in unpack_u8()
301 if (!inbounds(e, sizeof(u8))) in unpack_u8()
304 *data = get_unaligned((u8 *)e->pos); in unpack_u8()
305 e->pos += sizeof(u8); in unpack_u8()
310 e->pos = pos; in unpack_u8()
314 static bool unpack_u32(struct aa_ext *e, u32 *data, const char *name) in unpack_u32() argument
316 void *pos = e->pos; in unpack_u32()
318 if (unpack_nameX(e, AA_U32, name)) { in unpack_u32()
319 if (!inbounds(e, sizeof(u32))) in unpack_u32()
322 *data = le32_to_cpu(get_unaligned((__le32 *) e->pos)); in unpack_u32()
323 e->pos += sizeof(u32); in unpack_u32()
328 e->pos = pos; in unpack_u32()
332 static bool unpack_u64(struct aa_ext *e, u64 *data, const char *name) in unpack_u64() argument
334 void *pos = e->pos; in unpack_u64()
336 if (unpack_nameX(e, AA_U64, name)) { in unpack_u64()
337 if (!inbounds(e, sizeof(u64))) in unpack_u64()
340 *data = le64_to_cpu(get_unaligned((__le64 *) e->pos)); in unpack_u64()
341 e->pos += sizeof(u64); in unpack_u64()
346 e->pos = pos; in unpack_u64()
350 static size_t unpack_array(struct aa_ext *e, const char *name) in unpack_array() argument
352 void *pos = e->pos; in unpack_array()
354 if (unpack_nameX(e, AA_ARRAY, name)) { in unpack_array()
356 if (!inbounds(e, sizeof(u16))) in unpack_array()
358 size = (int)le16_to_cpu(get_unaligned((__le16 *) e->pos)); in unpack_array()
359 e->pos += sizeof(u16); in unpack_array()
364 e->pos = pos; in unpack_array()
368 static size_t unpack_blob(struct aa_ext *e, char **blob, const char *name) in unpack_blob() argument
370 void *pos = e->pos; in unpack_blob()
372 if (unpack_nameX(e, AA_BLOB, name)) { in unpack_blob()
374 if (!inbounds(e, sizeof(u32))) in unpack_blob()
376 size = le32_to_cpu(get_unaligned((__le32 *) e->pos)); in unpack_blob()
377 e->pos += sizeof(u32); in unpack_blob()
378 if (inbounds(e, (size_t) size)) { in unpack_blob()
379 *blob = e->pos; in unpack_blob()
380 e->pos += size; in unpack_blob()
386 e->pos = pos; in unpack_blob()
390 static int unpack_str(struct aa_ext *e, const char **string, const char *name) in unpack_str() argument
394 void *pos = e->pos; in unpack_str()
396 if (unpack_nameX(e, AA_STRING, name)) { in unpack_str()
397 size = unpack_u16_chunk(e, &src_str); in unpack_str()
409 e->pos = pos; in unpack_str()
413 static int unpack_strdup(struct aa_ext *e, char **string, const char *name) in unpack_strdup() argument
416 void *pos = e->pos; in unpack_strdup()
417 int res = unpack_str(e, &tmp, name); in unpack_strdup()
425 e->pos = pos; in unpack_strdup()
439 static struct aa_dfa *unpack_dfa(struct aa_ext *e) in unpack_dfa() argument
445 size = unpack_blob(e, &blob, "aadfa"); in unpack_dfa()
452 size_t sz = blob - (char *) e->start - in unpack_dfa()
453 ((e->pos - e->start) & 7); in unpack_dfa()
474 static bool unpack_trans_table(struct aa_ext *e, struct aa_profile *profile) in unpack_trans_table() argument
476 void *saved_pos = e->pos; in unpack_trans_table()
479 if (unpack_nameX(e, AA_STRUCT, "xtable")) { in unpack_trans_table()
482 size = unpack_array(e, NULL); in unpack_trans_table()
494 int c, j, pos, size2 = unpack_strdup(e, &str, NULL); in unpack_trans_table()
530 if (!unpack_nameX(e, AA_ARRAYEND, NULL)) in unpack_trans_table()
532 if (!unpack_nameX(e, AA_STRUCTEND, NULL)) in unpack_trans_table()
539 e->pos = saved_pos; in unpack_trans_table()
543 static bool unpack_xattrs(struct aa_ext *e, struct aa_profile *profile) in unpack_xattrs() argument
545 void *pos = e->pos; in unpack_xattrs()
547 if (unpack_nameX(e, AA_STRUCT, "xattrs")) { in unpack_xattrs()
550 size = unpack_array(e, NULL); in unpack_xattrs()
556 if (!unpack_strdup(e, &profile->xattrs[i], NULL)) in unpack_xattrs()
559 if (!unpack_nameX(e, AA_ARRAYEND, NULL)) in unpack_xattrs()
561 if (!unpack_nameX(e, AA_STRUCTEND, NULL)) in unpack_xattrs()
568 e->pos = pos; in unpack_xattrs()
572 static bool unpack_secmark(struct aa_ext *e, struct aa_profile *profile) in unpack_secmark() argument
574 void *pos = e->pos; in unpack_secmark()
577 if (unpack_nameX(e, AA_STRUCT, "secmark")) { in unpack_secmark()
578 size = unpack_array(e, NULL); in unpack_secmark()
588 if (!unpack_u8(e, &profile->secmark[i].audit, NULL)) in unpack_secmark()
590 if (!unpack_u8(e, &profile->secmark[i].deny, NULL)) in unpack_secmark()
592 if (!unpack_strdup(e, &profile->secmark[i].label, NULL)) in unpack_secmark()
595 if (!unpack_nameX(e, AA_ARRAYEND, NULL)) in unpack_secmark()
597 if (!unpack_nameX(e, AA_STRUCTEND, NULL)) in unpack_secmark()
612 e->pos = pos; in unpack_secmark()
616 static bool unpack_rlimits(struct aa_ext *e, struct aa_profile *profile) in unpack_rlimits() argument
618 void *pos = e->pos; in unpack_rlimits()
621 if (unpack_nameX(e, AA_STRUCT, "rlimits")) { in unpack_rlimits()
624 if (!unpack_u32(e, &tmp, NULL)) in unpack_rlimits()
628 size = unpack_array(e, NULL); in unpack_rlimits()
634 if (!unpack_u64(e, &tmp2, NULL)) in unpack_rlimits()
638 if (!unpack_nameX(e, AA_ARRAYEND, NULL)) in unpack_rlimits()
640 if (!unpack_nameX(e, AA_STRUCTEND, NULL)) in unpack_rlimits()
646 e->pos = pos; in unpack_rlimits()
671 static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name) in unpack_profile() argument
687 if (!unpack_nameX(e, AA_STRUCT, "profile")) in unpack_profile()
689 if (!unpack_str(e, &name, NULL)) in unpack_profile()
709 (void) unpack_str(e, &profile->rename, "rename"); in unpack_profile()
712 (void) unpack_str(e, &profile->attach, "attach"); in unpack_profile()
715 profile->xmatch = unpack_dfa(e); in unpack_profile()
724 if (!unpack_u32(e, &tmp, NULL)) { in unpack_profile()
732 (void) unpack_str(e, &profile->disconnected, "disconnected"); in unpack_profile()
735 if (!unpack_nameX(e, AA_STRUCT, "flags")) { in unpack_profile()
740 if (!unpack_u32(e, &tmp, NULL)) in unpack_profile()
744 if (!unpack_u32(e, &tmp, NULL)) in unpack_profile()
746 if (tmp == PACKED_MODE_COMPLAIN || (e->version & FORCE_COMPLAIN_FLAG)) in unpack_profile()
752 if (!unpack_u32(e, &tmp, NULL)) in unpack_profile()
757 if (!unpack_nameX(e, AA_STRUCTEND, NULL)) in unpack_profile()
761 if (unpack_u32(e, &profile->path_flags, "path_flags")) in unpack_profile()
769 if (!unpack_u32(e, &(profile->caps.allow.cap[0]), NULL)) in unpack_profile()
771 if (!unpack_u32(e, &(profile->caps.audit.cap[0]), NULL)) in unpack_profile()
773 if (!unpack_u32(e, &(profile->caps.quiet.cap[0]), NULL)) in unpack_profile()
775 if (!unpack_u32(e, &tmpcap.cap[0], NULL)) in unpack_profile()
779 if (unpack_nameX(e, AA_STRUCT, "caps64")) { in unpack_profile()
781 if (!unpack_u32(e, &(profile->caps.allow.cap[1]), NULL)) in unpack_profile()
783 if (!unpack_u32(e, &(profile->caps.audit.cap[1]), NULL)) in unpack_profile()
785 if (!unpack_u32(e, &(profile->caps.quiet.cap[1]), NULL)) in unpack_profile()
787 if (!unpack_u32(e, &(tmpcap.cap[1]), NULL)) in unpack_profile()
789 if (!unpack_nameX(e, AA_STRUCTEND, NULL)) in unpack_profile()
794 if (unpack_nameX(e, AA_STRUCT, "capsx")) { in unpack_profile()
796 if (!unpack_u32(e, &(profile->caps.extended.cap[0]), NULL)) in unpack_profile()
798 if (!unpack_u32(e, &(profile->caps.extended.cap[1]), NULL)) in unpack_profile()
800 if (!unpack_nameX(e, AA_STRUCTEND, NULL)) in unpack_profile()
804 if (!unpack_xattrs(e, profile)) { in unpack_profile()
809 if (!unpack_rlimits(e, profile)) { in unpack_profile()
814 if (!unpack_secmark(e, profile)) { in unpack_profile()
819 if (unpack_nameX(e, AA_STRUCT, "policydb")) { in unpack_profile()
822 profile->policy.dfa = unpack_dfa(e); in unpack_profile()
831 if (!unpack_u32(e, &profile->policy.start[0], "start")) in unpack_profile()
841 if (!unpack_nameX(e, AA_STRUCTEND, NULL)) in unpack_profile()
847 profile->file.dfa = unpack_dfa(e); in unpack_profile()
854 if (!unpack_u32(e, &profile->file.start, "dfa_start")) in unpack_profile()
864 if (!unpack_trans_table(e, profile)) { in unpack_profile()
869 if (unpack_nameX(e, AA_STRUCT, "data")) { in unpack_profile()
887 while (unpack_strdup(e, &key, NULL)) { in unpack_profile()
895 data->size = unpack_blob(e, &data->data, NULL); in unpack_profile()
907 if (!unpack_nameX(e, AA_STRUCTEND, NULL)) { in unpack_profile()
913 if (!unpack_nameX(e, AA_STRUCTEND, NULL)) { in unpack_profile()
925 audit_iface(profile, NULL, name, info, e, error); in unpack_profile()
939 static int verify_header(struct aa_ext *e, int required, const char **ns) in verify_header() argument
946 if (!unpack_u32(e, &e->version, "version")) { in verify_header()
949 e, error); in verify_header()
958 if (VERSION_LT(e->version, v5) || VERSION_GT(e->version, v7)) { in verify_header()
960 e, error); in verify_header()
965 if (unpack_str(e, &name, "namespace")) { in verify_header()
968 e, error); in verify_header()
972 audit_iface(NULL, NULL, NULL, "invalid ns change", e, in verify_header()
1060 struct aa_ext e = { in aa_unpack() local
1067 while (e.pos < e.end) { in aa_unpack()
1070 error = verify_header(&e, e.pos == e.start, ns); in aa_unpack()
1074 start = e.pos; in aa_unpack()
1075 profile = unpack_profile(&e, &ns_name); in aa_unpack()
1086 error = aa_calc_profile_hash(profile, e.version, start, in aa_unpack()
1087 e.pos - start); in aa_unpack()
1101 udata->abi = e.version & K_ABI_MASK; in aa_unpack()