task_for_pid and host_processor_set_priv failing on Yosemite 10.10.5
task_for_pid and host_processor_set_priv failing on Yosemite 10.10.5
- Subject: task_for_pid and host_processor_set_priv failing on Yosemite 10.10.5
- From: Gordo Cath <email@hidden>
- Date: Thu, 02 Jun 2016 14:58:03 -0400
Hi,
I'm working with Yosemite 10.10.5 and am getting an error of invalid argument when i call host_processor_set_priv. Here is the background:
snippet...
pid_t targetPid;
mach_port_t remoteTask=0;
err = task_for_pid(mach_task_self(), targetPid, &remoteTask);
When I tried calling this I got err=5
I tried adding my user to procmod and procview groups but that had no effect. I also tried adding flags to my Info.plist file:
<key>SecTaskAccess</key>
<array>
<string>allowed</string>
<string>safe</string>
</array>
This had no effect.
I'm using the nvram boot-args="kext-dev-mode=1" setting so I don't have to sign.
I also modified taskgated.plist so that it starts up with -p -s at boot time. I check it with the ps command and it is now running with -p -s
. However all these changs have no effect on the issue.
I'm just running as a normal user. I then started down an alternate approach.
mach_port_t me=mach_host_self(); // this works
mach_port_t psDef;
mach_port_t psDefCtl;
kern_return_t k;
processor_set_default(me, &psDef); //Appears to work
k = host_processor_set_priv(me, psDef, &psDefCtl); // Fails ==> k is set to 4 (invalid argument)
If I run as su it runs fine.
Why do I get this error when I want to run as a normal user? How do I get around it? What do I need to do to be able to call host_processor_set_priv or task_for_pid
successfully without being a su? I own both tasks that one I am and the remote task, htey are just separate processes.
Side note:
Over in the authorizations.plist under system.privilege.taskport are a bunch of key/value pairs. Is there any documentation anywhere?
In particular I found a k/v pair of class/allow do I need to add a 'safe' to this somehow? the manpage for taskgated mentions safe being necessary
but I don't see a good way to add it there as I don't know by what mechanism to add it. If the solution is here, do I need to make the value portion an <array> of <string> values?
GC
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden