Skip to content

Commit 7fa342b

Browse files
committed
Remove attach-failed-due-to-SIP checks which were not working
The SIP debugserver was calling in attach_failed_due_to_sip haven't worked for a while; remove them. To check this properly we'd need debugsever to call out to codesign(1) to inspect the entitlements, or the equivalant API, and I'm not interested in adding that at this point. SIP is has been the default on macOS for a couple of releases and it's expected behavior now. <rdar://problem/59198052>
1 parent 40d139c commit 7fa342b

File tree

1 file changed

+0
-31
lines changed

1 file changed

+0
-31
lines changed

lldb/tools/debugserver/source/RNBRemote.cpp

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3663,30 +3663,6 @@ static bool process_does_not_exist (nub_process_t pid) {
36633663
return true; // process does not exist
36643664
}
36653665

3666-
static bool attach_failed_due_to_sip (nub_process_t pid) {
3667-
bool retval = false;
3668-
#if defined(__APPLE__) && \
3669-
(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101000)
3670-
3671-
// csr_check(CSR_ALLOW_TASK_FOR_PID) will be nonzero if System Integrity
3672-
// Protection is in effect.
3673-
if (csr_check(CSR_ALLOW_TASK_FOR_PID) == 0)
3674-
return false;
3675-
3676-
if (rootless_allows_task_for_pid(pid) == 0)
3677-
retval = true;
3678-
3679-
int csops_flags = 0;
3680-
int csops_ret = ::csops(pid, CS_OPS_STATUS, &csops_flags,
3681-
sizeof(csops_flags));
3682-
if (csops_ret != -1 && (csops_flags & CS_RESTRICT)) {
3683-
retval = true;
3684-
}
3685-
#endif
3686-
3687-
return retval;
3688-
}
3689-
36903666
// my_uid and process_uid are only initialized if this function
36913667
// returns true -- that there was a uid mismatch -- and those
36923668
// id's may want to be used in the error message.
@@ -4065,13 +4041,6 @@ rnb_err_t RNBRemote::HandlePacket_v(const char *p) {
40654041
"processes.");
40664042
return SendPacket(return_message.c_str());
40674043
}
4068-
if (attach_failed_due_to_sip (pid_attaching_to)) {
4069-
DNBLogError("Attach failed because of SIP protection.");
4070-
std::string return_message = "E96;";
4071-
return_message += cstring_to_asciihex_string("cannot attach "
4072-
"to process due to System Integrity Protection");
4073-
return SendPacket(return_message.c_str());
4074-
}
40754044
}
40764045

40774046
std::string error_explainer = "attach failed";

0 commit comments

Comments
 (0)