libsepol.check_assertions: произошло 2 невыполненных ошибки Ошибка при расширении политики - PullRequest
0 голосов
/ 09 апреля 2020

Возникли проблемы с добавлением нового сервиса в sepolicy.

Ниже приведены шаги для создания и регистрации сервиса в sepolicy

Шаги 1. Создание файла сценария verifyusb. sh

#!/system/bin/sh
   echo "Hello USB"
  +++some logic ++

шаг 2: verifyusb. sh скопировано в system / bin /

LOCAL_DEVICE_MEDIA: = device / xxx / XXX / verifyusb. sh: system / bin / verifyusb. sh

шаг 3: добавлен verifyusb. sh в устройство init.rc / xxx / xxx / rcs / init.r c

при загрузке exe c - root root system readpro c - /system/bin/verifyusb.sh

шаг 4: Создан .te путь к файлу: device / xxx / xxx / sepolicy / xxx / verifyusb.te

 type verifyusb, domain;
   type verifyusb_exec, exec_type, file_type;
   init_daemon_domain(verifyusb)

Шаг 5: зарегистрируйте файл на устройстве / xxx / xxx / sepolicy / xxx / file_contexts

/ system / bin / verifyusb. sh u: object_r: verifyusb_exe c: s0

Шаг 6: Скомпилировано и получено это сообщение:

[98% 902 / 918] build / target / product / xxx / obj / ETC / sepolicy_tests_intermediates / sepoli cy_tests FAILED: out / target / product / xxx / obj / ETC / sepolicy_tests_intermediates / sepolicy_tests / bin / bash - c "(out / host / linux -x86 / bin / sepolicy_tests -l out / host / linux -x86 / lib64 / libsepolwrap.so -f out / target / product / xxx / obj / ETC / plat_file_contexts_intermediates / plat_file_contexts -f out / target / product / xxx / obj / ETC / vendor_file_contexts_intermediates / vendor_file_contexts product / xxx / obj / ETC / sepolicy_intermediates / sepolicy) && (touch out / target / product / xxx / obj / ETC / sepolicy_tests_intermediates / sepolicy_tests) "Следующие типы в / system / должны быть связаны с атрибутом" system_file_type ": verifyusb_exe c

Шаг 7: Чтобы устранить вышеуказанную ошибку, добавлен файл «system_file_type» verifyusb.te.

type verifyusb, domain;
  type verifyusb_exec, system_file_type, exec_type, file_type;
  init_daemon_domain(verifyusb)

step8: в соответствии с исходным кодом появилась другая ошибка:

        [ 89% 818/918] build out/target/product/xxx/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows

СБОЙ: out / target / product / xxx / obj / ETC / sepolicy_neverallows_intermediates / sepolicy_neverallows / bin / bash - c "(ASAN_OPTIONS = detect_leaks = 0 out / host / linux -x86 / бен / с heckpolicy -M - c 30 -o out / target / product / xxx / obj / ETC / sepolicy_neverallows_intermediates / sepolicy_neverallows.tmp out / target / product / xxx / obj / ETC / sepolicy_neverallows_intermediates / policy.conf) && (out / host) / linux -x86 / bin / sepolicy-out out / target / product / xxx / obj / ETC / sepolicy_neverallows_intermediates / sepolicy_neverallows.tmp neverallow -w -f out / target / product / xxx / obj / ETC / sepolicy_neverallows_intermediates / policy_2. конф || (echo \ "\" 1> & 2; echo \ "sepolicy-проанализировать не удалось. Это, скорее всего, связано с использованием \" 1> & 2; echo \ "расширенного атрибута в утверждении с невысоким разрешением. Пожалуйста, исправьте \" 1> & 2; echo \ "the policy. \" 1> & 2; выход 1)) && (touch out / target / product / xxx / obj / ETC / sepolicy_neverallows_intermediates / sepolicy_neverallows.tmp) && (mv out / target / product / xxx / obj / ETC / sepolicy_neverallows_intermediates / sepolicy_neverallows.tmp out / target / product / xxx / obj / ETC / sepolicy_neverallows_intermediates / sepolicy_neverallows) "libsepol.report_failure: neverallow в строке 1029 политики системы / sepolicy / public / domain / 143 / public / domain / public / domain / public / domain / public / public / line / 14 / line / domain / public .conf) нарушен с помощью allow verifyusb verifyusb_exe c: file {read getattr map execute точка входа открыта}; libsepol.report_failure: neverallow в строке 952 файла system / sepolicy / public / domain.te (или в строке 14295 policy.conf) нарушен с помощью allow verifyusb verifyusb_exe c: file {execute entrypoint}; libsepol.check_assertions: произошло 2 невыполненных ошибки Ошибка при расширении политики 14:43: 54 Ниндзя не удалось: выход из состояния 1 build / make / core / main.mk: 21: рецепт для цели 'run_soong_ui' не выполнен make: *** [run_soong_ui] Ошибка 1

...