Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

support threads on OSX #848

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

support threads on OSX #848

wants to merge 6 commits into from

Conversation

robaho
Copy link

@robaho robaho commented Oct 31, 2018

It's a bit rough, because the OSX thread ID is not a PID, but it does work.

@Kronuz
Copy link

Kronuz commented Nov 20, 2018

Thank you! This is working as advertised! (macOS Mojave)

It does, however, need sudo htop so threads are shown.

@robaho
Copy link
Author

robaho commented Nov 21, 2018

Yes, in order to remove the sudo requirement, there is another OSX API that needs to be used, and the application needs to be signed - possible but a lot more work in the build/packaging phase

@joshuawarner32
Copy link

Hi robaho! This is exciting, thanks! Do you know what that other API you mentioned is, by chance (the one that requires signing)?

@robaho
Copy link
Author

robaho commented Dec 1, 2018

@joshuawarner32 not really a different API, but a different process. see http://os-tres.net/blog/2010/02/17/mac-os-x-and-task-for-pid-mach-call/

It is probably easier to set the setuid bit on the executable like 'top' does.

@joshuawarner32
Copy link

Oh, hmm... based on my (brief, incomplete) testing, it looks like calling task_for_pid requires SIP to be disabled, even when running as root. I didn't try a setuid bit, but I'd be a little surprised if that had different behavior.

Signing could probably work - but having people install a self-signed code signing cert sounds kinda sketchy.

@robaho
Copy link
Author

robaho commented Dec 3, 2018

The code uses task_for_pid now and I don’t have SIP disabled and it works for me.

@joshuawarner32
Copy link

Ah, interesting. I was testing against Google Chrome, which seems to have some additional anti-debugging protections enabled, and does require disabling SIP before listing the threads. When I try other processes on my system, they generally work fine.

@robaho
Copy link
Author

robaho commented Dec 3, 2018

Yea, it certainly isn’t easy to find official docs on this stuff, probably intentionally.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants