Error Building Lineage 17.1 for Oneplus 6 - sepolicy

Search This thread

n0velti

New member
Dec 18, 2020
2
0
Hey xda I've been stuck on this problem for a whileo_O researched everywhere with no luck.

I have the kernel and device tree for my oneplus 6. I'm trying to flash Lineage 17.1 on it. I run a normal lunch and make which goes fine but then I get this sepolicy error:

Code:
[ 32% 33487/102384] build out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows
FAILED: out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows
/bin/bash -c "(ASAN_OPTIONS=detect_leaks=0 out/host/linux-x86/bin/checkpolicy -M -c         30 -o out/target/product/oneplus/obj/ETC/sepolicy_never
allows_intermediates/sepolicy_neverallows.tmp out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/policy.conf ) && (out/host/linux-x8
6/bin/sepolicy-analyze out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows.tmp neverallow -w -f out/target/produ
ct/oneplus/obj/ETC/sepolicy_neverallows_intermediates/policy_2.conf ||       ( echo \"\" 1>&2;         echo \"sepolicy-analyze failed. This is most likely
due to the use\" 1>&2;         echo \"of an expanded attribute in a neverallow assertion. Please fix\" 1>&2;         echo \"the policy.\" 1>&2;
    exit 1 ) ) && (touch out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows.tmp ) && (mv out/target/product/one
plus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows.tmp out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy
_neverallows )"
vendor/oneplus/sdm845-common/sepolicy/private/hal_fod_sdm845.te:2:ERROR 'attribute hal_lineage_fod_server is not declared' at token ';' on line 48698:
typeattribute hal_fod_sdm845 hal_lineage_fod_server;
#line 2
checkpolicy:  error(s) encountered while parsing configuration
[ 32% 33490/102384] build out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy
FAILED: out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy
/bin/bash -c "(ASAN_OPTIONS=detect_leaks=0 out/host/linux-x86/bin/checkpolicy -M -c         30 -o out/target/product/oneplus/obj/ETC/sepolicy.recov
ery_intermediates/sepolicy.tmp out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy.recovery.conf ) && (out/host/linux-x86/bin/s
epolicy-analyze out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy.tmp permissive > out/target/product/oneplus/obj/ETC/sepolic
y.recovery_intermediates/sepolicy.permissivedomains ) && (if [ \"eng\" = \"user\" -a -s out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermedia
tes/sepolicy.permissivedomains ]; then         echo \"==========\" 1>&2;         echo \"ERROR: permissive domains not allowed in user builds\" 1
>&2;         echo \"List of invalid domains:\" 1>&2;         cat out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy
.permissivedomains 1>&2;         exit 1;         fi ) && (mv out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy
.tmp out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy )"
vendor/oneplus/sdm845-common/sepolicy/private/hal_fod_sdm845.te:2:ERROR 'attribute hal_lineage_fod_server is not declared' at token ';' on line 51970:
typeattribute hal_fod_sdm845 hal_lineage_fod_server;
#line 2
checkpolicy:  error(s) encountered while parsing configuration
22:18:03 ninja failed with: exit status 1

#### failed to build some targets (02:10:23 (hh:mm:ss)) ####

The error seems to indicate that I'm missing an attribute declaration hal_lineage_fod_server in one of my files. Is this correct? Here's my hal_fod_sdm845.te file :

Code:
type hal_fod_sdm845, coredomain, domain;
hal_server_domain(hal_fod_sdm845, hal_lineage_fod)

type hal_fod_sdm845_exec, system_file_type, exec_type, file_type;
init_daemon_domain(hal_fod_sdm845)

# Allow access to the HALs
hal_client_domain(hal_fod_sdm845, hal_fingerprint)

# Allow binder communication with hal_display_default
binder_call(hal_fod_sdm845, hal_display_default)

# Allow binder communication with hal_fingerprint
binder_call(hal_fod_sdm845, hal_fingerprint)

# Allow hal_fod_sdm845 to hal_display_hwservice
allow hal_fod_sdm845 hal_display_hwservice:hwservice_manager find;

# Allow hal_fod_sdm845 to hal_fingerprint_hwservice
allow hal_fod_sdm845 hal_fingerprint_hwservice:hwservice_manager find;

# Allow hal_fod_sdm845 to read and write to sysfs_fod
allow hal_fod_sdm845 sysfs_fod:file rw_file_perms;


How do I go about solving this error?
Thanks :)

ps im a complete virgin when it comes to HAL and sepolicy dev on android or linux in general.
 

LMAO-guy

Member
Nov 4, 2017
48
26
21
Visakhapatnam
Samsung Galaxy M31
Hey xda I've been stuck on this problem for a whileo_O researched everywhere with no luck.

I have the kernel and device tree for my oneplus 6. I'm trying to flash Lineage 17.1 on it. I run a normal lunch and make which goes fine but then I get this sepolicy error:

Code:
[ 32% 33487/102384] build out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows
FAILED: out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows
/bin/bash -c "(ASAN_OPTIONS=detect_leaks=0 out/host/linux-x86/bin/checkpolicy -M -c         30 -o out/target/product/oneplus/obj/ETC/sepolicy_never
allows_intermediates/sepolicy_neverallows.tmp out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/policy.conf ) && (out/host/linux-x8
6/bin/sepolicy-analyze out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows.tmp neverallow -w -f out/target/produ
ct/oneplus/obj/ETC/sepolicy_neverallows_intermediates/policy_2.conf ||       ( echo \"\" 1>&2;         echo \"sepolicy-analyze failed. This is most likely
due to the use\" 1>&2;         echo \"of an expanded attribute in a neverallow assertion. Please fix\" 1>&2;         echo \"the policy.\" 1>&2;
    exit 1 ) ) && (touch out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows.tmp ) && (mv out/target/product/one
plus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows.tmp out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy
_neverallows )"
vendor/oneplus/sdm845-common/sepolicy/private/hal_fod_sdm845.te:2:ERROR 'attribute hal_lineage_fod_server is not declared' at token ';' on line 48698:
typeattribute hal_fod_sdm845 hal_lineage_fod_server;
#line 2
checkpolicy:  error(s) encountered while parsing configuration
[ 32% 33490/102384] build out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy
FAILED: out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy
/bin/bash -c "(ASAN_OPTIONS=detect_leaks=0 out/host/linux-x86/bin/checkpolicy -M -c         30 -o out/target/product/oneplus/obj/ETC/sepolicy.recov
ery_intermediates/sepolicy.tmp out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy.recovery.conf ) && (out/host/linux-x86/bin/s
epolicy-analyze out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy.tmp permissive > out/target/product/oneplus/obj/ETC/sepolic
y.recovery_intermediates/sepolicy.permissivedomains ) && (if [ \"eng\" = \"user\" -a -s out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermedia
tes/sepolicy.permissivedomains ]; then         echo \"==========\" 1>&2;         echo \"ERROR: permissive domains not allowed in user builds\" 1
>&2;         echo \"List of invalid domains:\" 1>&2;         cat out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy
.permissivedomains 1>&2;         exit 1;         fi ) && (mv out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy
.tmp out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy )"
vendor/oneplus/sdm845-common/sepolicy/private/hal_fod_sdm845.te:2:ERROR 'attribute hal_lineage_fod_server is not declared' at token ';' on line 51970:
typeattribute hal_fod_sdm845 hal_lineage_fod_server;
#line 2
checkpolicy:  error(s) encountered while parsing configuration
22:18:03 ninja failed with: exit status 1

#### failed to build some targets (02:10:23 (hh:mm:ss)) ####

The error seems to indicate that I'm missing an attribute declaration hal_lineage_fod_server in one of my files. Is this correct? Here's my hal_fod_sdm845.te file :

Code:
type hal_fod_sdm845, coredomain, domain;
hal_server_domain(hal_fod_sdm845, hal_lineage_fod)

type hal_fod_sdm845_exec, system_file_type, exec_type, file_type;
init_daemon_domain(hal_fod_sdm845)

# Allow access to the HALs
hal_client_domain(hal_fod_sdm845, hal_fingerprint)

# Allow binder communication with hal_display_default
binder_call(hal_fod_sdm845, hal_display_default)

# Allow binder communication with hal_fingerprint
binder_call(hal_fod_sdm845, hal_fingerprint)

# Allow hal_fod_sdm845 to hal_display_hwservice
allow hal_fod_sdm845 hal_display_hwservice:hwservice_manager find;

# Allow hal_fod_sdm845 to hal_fingerprint_hwservice
allow hal_fod_sdm845 hal_fingerprint_hwservice:hwservice_manager find;

# Allow hal_fod_sdm845 to read and write to sysfs_fod
allow hal_fod_sdm845 sysfs_fod:file rw_file_perms;


How do I go about solving this error?
Thanks :)

ps im a complete virgin when it comes to HAL and sepolicy dev on android or linux in general.
Sir please help if u fixed this error