From f4408b8e8e594e54f5dbc66616addf01359eae3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thi=C3=A9baud=20Weksteen?= Date: Wed, 22 Sep 2021 09:15:53 +0000 Subject: [PATCH] Revert "Fix build and use new cil_write_build_ast" Revert "Use cil_write_build_ast" Revert submission 1827311-update_libselinux Reason for revert: b/200771997 Reverted Changes: I088d1e94c:Fix build and use new cil_write_build_ast I14dc4dc58:Merge remote-tracking branch 'aosp/upstream-master... I7b77f4469:Use cil_write_build_ast Change-Id: I7b34185a9205c550cdfee2ac29acad1bea7879a4 --- libselinux/Android.bp | 2 -- libsepol/Android.bp | 2 +- libsepol/cil/include/cil/cil_write_ast.h | 7 +++++++ libsepol/cil/src/android.c | 1 - libsepol/cil/src/cil_write_ast.c | 10 ++-------- 5 files changed, 10 insertions(+), 12 deletions(-) create mode 100644 libsepol/cil/include/cil/cil_write_ast.h diff --git a/libselinux/Android.bp b/libselinux/Android.bp index 5fb2deb4..4d0291be 100644 --- a/libselinux/Android.bp +++ b/libselinux/Android.bp @@ -173,7 +173,6 @@ cc_library { "src/mapping.c", "src/procattr.c", "src/reject_unknown.c", - "src/sestatus.c", "src/setenforce.c", "src/setexecfilecon.c", "src/setfilecon.c", @@ -201,7 +200,6 @@ cc_library { "src/mapping.c", "src/procattr.c", "src/reject_unknown.c", - "src/sestatus.c", "src/setexecfilecon.c", "src/stringrep.c", ], diff --git a/libsepol/Android.bp b/libsepol/Android.bp index 5232a68a..9c56fc4b 100644 --- a/libsepol/Android.bp +++ b/libsepol/Android.bp @@ -80,9 +80,9 @@ cc_library { "src/policydb.c", "src/policydb_convert.c", "src/policydb_public.c", - "src/policydb_validate.c", "src/port_record.c", "src/ports.c", + "src/roles.c", "src/services.c", "src/sidtab.c", "src/symtab.c", diff --git a/libsepol/cil/include/cil/cil_write_ast.h b/libsepol/cil/include/cil/cil_write_ast.h new file mode 100644 index 00000000..77c3087e --- /dev/null +++ b/libsepol/cil/include/cil/cil_write_ast.h @@ -0,0 +1,7 @@ +#ifndef CIL_WRITE_H_ +#define CIL_WRITE_H_ + +#include + +int cil_write_ast(struct cil_db *db, const char* path); +#endif /* CIL_WRITE_H_ */ diff --git a/libsepol/cil/src/android.c b/libsepol/cil/src/android.c index ecbd86a4..2fa5e965 100644 --- a/libsepol/cil/src/android.c +++ b/libsepol/cil/src/android.c @@ -829,7 +829,6 @@ static int cil_build_mappings_tree(hashtab_key_t k, hashtab_datum_t d, void *arg /* re)declare typeattribute. */ cil_typeattribute_init(&typeattr); typeattr->datum.name = new_key; - typeattr->datum.fqn = new_key; cil_tree_node_init(&ast_node); ast_node->data = typeattr; ast_node->flavor = CIL_TYPEATTRIBUTE; diff --git a/libsepol/cil/src/cil_write_ast.c b/libsepol/cil/src/cil_write_ast.c index 38374f10..d7f00bcc 100644 --- a/libsepol/cil/src/cil_write_ast.c +++ b/libsepol/cil/src/cil_write_ast.c @@ -1521,10 +1521,7 @@ static int __write_cil_ast_node_helper(struct cil_tree_node *node, uint32_t *fin struct cil_write_ast_args *args = extra_args; if (node->flavor == CIL_SRC_INFO) { - // ANDROID: The generated cil may be split/merged later on. Do not output - // source information to avoid issues when loading the resulting policy with - // libsepol. - // cil_write_src_info_node(args->out, node); + cil_write_src_info_node(args->out, node); return SEPOL_OK; } @@ -1559,10 +1556,7 @@ static int __write_cil_ast_last_child_helper(struct cil_tree_node *node, void *e if (parent->flavor == CIL_ROOT) { return SEPOL_OK; } else if (parent->flavor == CIL_SRC_INFO) { - // ANDROID: The generated cil may be split/merged later on. Do not output - // source information to avoid issues when loading the resulting policy with - // libsepol. - // fprintf(args->out, ";;* lme\n"); + fprintf(args->out, ";;* lme\n"); return SEPOL_OK; }