Lines Matching defs:dfa
435 * unpack_dfa - unpack a file rule dfa
437 * @flags: dfa flags to check
439 * returns dfa or ERR_PTR or NULL if no dfa
445 struct aa_dfa *dfa = NULL;
450 * The dfa is aligned with in the blob to 8 bytes
452 * alignment adjust needed by dfa unpack
459 dfa = aa_dfa_unpack(blob + pad, size - pad, flags);
461 if (IS_ERR(dfa))
462 return dfa;
466 return dfa;
931 * in the dfa accept table
998 /* accept2 used for dfa flags */
1006 pdb->dfa = unpack_dfa(e, flags);
1007 if (IS_ERR(pdb->dfa)) {
1008 error = PTR_ERR(pdb->dfa);
1009 pdb->dfa = NULL;
1010 *info = "failed to unpack - dfa";
1012 } else if (!pdb->dfa) {
1014 *info = "missing required dfa";
1019 * only unpack the following if a dfa is present
1028 /* default start state for xmatch and file dfa */
1032 size_t state_count = pdb->dfa->tables[YYTD_ID_BASE]->td_lolen;
1036 *info = "invalid dfa start state";
1042 pdb->start[i] = aa_dfa_next(pdb->dfa, pdb->start[0],
1048 if (pdb->dfa && pdb->perms && !pdb->dfa->tables[YYTD_ID_ACCEPT2]) {
1049 /* add dfa flags table missing in v2 */
1050 u32 noents = pdb->dfa->tables[YYTD_ID_ACCEPT]->td_lolen;
1051 u16 tdflags = pdb->dfa->tables[YYTD_ID_ACCEPT]->td_flags;
1054 pdb->dfa->tables[YYTD_ID_ACCEPT2] = kvzalloc(tsize, GFP_KERNEL);
1055 if (!pdb->dfa->tables[YYTD_ID_ACCEPT2]) {
1056 *info = "failed to alloc dfa flags table";
1060 pdb->dfa->tables[YYTD_ID_ACCEPT2]->td_lolen = noents;
1061 pdb->dfa->tables[YYTD_ID_ACCEPT2]->td_flags = tdflags;
1065 * transition table may be present even when the dfa is
1074 if (!pdb->dfa && pdb->trans.table)
1078 * - move compat mapping here, requires dfa merging first
1175 if (profile->attach.xmatch->dfa) {
1299 /* generic policy dfa - optional and may be NULL */
1306 if (aa_dfa_next(rules->policy->dfa, rules->policy->start[0],
1309 aa_dfa_next(rules->policy->dfa,
1329 } else if (rules->file->dfa) {
1338 } else if (rules->policy->dfa &&
1482 * @dfa: the dfa to check accept indexes are in range
1485 static bool verify_dfa_accept_index(struct aa_dfa *dfa, int table_size)
1488 for (i = 0; i < dfa->tables[YYTD_ID_ACCEPT]->td_lolen; i++) {
1489 if (ACCEPT_TABLE(dfa)[i] >= table_size)
1565 if (rules->file->dfa && !verify_dfa_accept_index(rules->file->dfa,
1572 if (rules->policy->dfa &&
1573 !verify_dfa_accept_index(rules->policy->dfa, rules->policy->size)) {