DYLD_INSERT_LIBRARIES doesn't work for app signed with entitlements on Mountain Lion

前提是你 提交于 2019-12-09 03:34:19

问题


I notice that DYLD_INSERT_LIBRARIES no longer works in Mountion Lion if the application is codesigned with entitlements. For example:

DYLD_INSERT_LIBRARIES=./mylib.dylib /Applications/Safari.app/Contents/MacOS/Safari
  dyld: DYLD_ environment variables being ignored because main executeable is code signed with entitlements.

I know this is probably a new security feature added to Mountion Lion. Anyone knows if there is an alternative way to do similar thing on Mountain Lion? Thanks!


回答1:


There is no way to make DYLD_INSERT_LIBRARIES work on applications of this nature.

dyld strips all DYLD_ environment variables on applications it considers to be restricted, which includes setuid/setgid binaries and those signed with particular entitlements. You can see how this work by looking at the dyld source. In particular, processRestricted is responsible for determining whether the restrictions should be applied and pruneEnvironmentVariables does the special handling of the environment variables.



来源:https://stackoverflow.com/questions/12522837/dyld-insert-libraries-doesnt-work-for-app-signed-with-entitlements-on-mountain

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!