Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES_EVENT_TYPE_NOTIFY_UNMOUNT: flush the cache off the ES handler thread #778

Merged
merged 1 commit into from
Apr 6, 2022

Conversation

tburgin
Copy link
Contributor

@tburgin tburgin commented Apr 6, 2022

We have seen some instances of com.google.santa.daemon being killed for not responding to ES AUTH messages:

Termination Reason:    Namespace ENDPOINTSECURITY, Code 2 
Thread 2::  Dispatch queue: BBReaderQueue
0   libsystem_kernel.dylib        	       0x189dc88d0 mach_msg_trap + 8
1   libsystem_kernel.dylib        	       0x189dc8d40 mach_msg + 76
2   libxpc.dylib                  	       0x189b57cc4 _xpc_pipe_mach_msg + 56
3   libxpc.dylib                  	       0x189b57554 _xpc_pipe_routine + 356
4   libEndpointSecurity.dylib     	       0x19ac8c404 _es_start_service + 76
5   libEndpointSecurity.dylib     	       0x19ac8c5e8 _es_clear_cache + 44
6   com.google.santa.daemon       	       0x104d601b0 -[SNTCachingEndpointSecurityManager flushCacheNonRootOnly:] + 184
7   com.google.santa.daemon       	       0x104d70ea4 __45-[SNTEndpointSecurityManager establishClient]_block_invoke + 1076
8   libEndpointSecurity.dylib     	       0x19ac90484 BBReader<ESMessageReaderConfig>::handleItems() + 272
9   libEndpointSecurity.dylib     	       0x19ac90260 BBReader<ESMessageReaderConfig>::woke(void*) + 28
10  libdispatch.dylib             	       0x189c421c8 _dispatch_client_callout + 20
11  libdispatch.dylib             	       0x189c45670 _dispatch_continuation_pop + 500
12  libdispatch.dylib             	       0x189c588e0 _dispatch_source_invoke + 1596
13  libdispatch.dylib             	       0x189c49784 _dispatch_lane_serial_drain + 376
14  libdispatch.dylib             	       0x189c4a438 _dispatch_lane_invoke + 444
15  libdispatch.dylib             	       0x189c4b704 _dispatch_workloop_invoke + 1784
16  libdispatch.dylib             	       0x189c54c98 _dispatch_workloop_worker_thread + 648
17  libsystem_pthread.dylib       	       0x189e02360 _pthread_wqthread + 288
18  libsystem_pthread.dylib       	       0x189e01080 start_wqthread + 8

It seems we are deadlocking ourselves if es_clear_cache() needs to spin anything up.

Also clang-format'ed the file.

@tburgin tburgin requested review from russellhancox and mlw April 6, 2022 15:52
@tburgin tburgin merged commit 0be1ca0 into google:main Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants