Skip to content

Commit 7a8ba49

Browse files
flintmandanascape
authored andcommitted
init: don't skip starting a service with no domain if permissive
[Adrian DC] Preserve the log while permissive Change-Id: I3f2887930e15d09014c2594141ba4acbbc8d6d9d Former-commit-id: 04f4ac2ff5b711f1df9fcc7ac5941e67fb9f6282
1 parent 5b1de95 commit 7a8ba49

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

init/service.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,16 @@ static Result<std::string> ComputeContextFromExecutable(const std::string& servi
8888
free(new_con);
8989
}
9090
if (rc == 0 && computed_context == mycon.get()) {
91-
return Error() << "File " << service_path << "(labeled \"" << filecon.get()
92-
<< "\") has incorrect label or no domain transition from " << mycon.get()
93-
<< " to another SELinux domain defined. Have you configured your "
94-
"service correctly? https://source.android.com/security/selinux/"
95-
"device-policy#label_new_services_and_address_denials. Note: this "
96-
"error shows up even in permissive mode in order to make auditing "
97-
"denials possible.";
91+
std::string error = StringPrintf(
92+
"File %s (labeled \"%s\") has incorrect label or no domain transition from %s to "
93+
"another SELinux domain defined. Have you configured your "
94+
"service correctly? https://source.android.com/security/selinux/"
95+
"device-policy#label_new_services_and_address_denials",
96+
service_path.c_str(), filecon.get(), mycon.get());
97+
if (security_getenforce() != 0) {
98+
return Error() << error;
99+
}
100+
LOG(ERROR) << error;
98101
}
99102
if (rc < 0) {
100103
return Error() << "Could not get process context";

0 commit comments

Comments
 (0)