5 ms·
I was the same way until one day, I tried to run gdb on iTunes, and gdb segfaulted. I did some research and found that Apple added extra code to the OS just to
by jrockway 14y ago
I was the same way until one day, I tried to run gdb on iTunes, and gdb segfaulted. I did some research and found that Apple added extra code to the OS just to prevent someone from doing exactly that. They spent additional engineering effort just to lock me out of my own computer. (I still wonder what data collection they were trying to hide.)
Anyway, that was the day I deleted OS X and switched back to Linux forever. (I even ran Rockbox on my iPod until I replaced it with a $30 Sansa device with 10x the features.)
- majke 14y ago> I tried to run gdb on iTunes, and gdb segfaulted. Whoo, any links please? I'd like gdb to crash on my programs as well!
- malandrew 14y agoFor the naive: why?
- comex 14y agoCall ptrace with PT_DENY_ATTACH (it's actually documented).
- tedunangst 14y agoBesides Apple's nefarious Dr. Evil world domination uses, it can also be used to protect programs from each other. If your browser denies ptrace, it will prevent rogue programs from reading your passwords out of its memory.
- comex 14y agoNot really, since a program wanting to circumvent it can just attach before the call is made, or use other mechanisms to read process memory.
- tedunangst 14y agook, true, you have get there before the bad guys.
- mikeash 14y agoTrivially worked around by starting the program in gdb and running these commands before you run the program: b ptrace commands return 0 cont end (In short, every time the app calls ptrace, return a 0 to the caller without executing any ptrace code, and automatically resume execution. Since apps almost never use ptrace for anything else, it's workable to just short-circuit every single call like this rather than trying to check for PT_DENY_ATTACH.)
- ajross 14y agoClearly, one has to agree that this is a poorly designed API feature with a huge hole that provides no real security. Apple still, however, designed it into their product and tried to use it to prevent user inspection of system state.
- mikeash 14y agoI can only assume that they're following the letter of their contract with media companies to include anti-debugger measures, while not really trying very hard. Just to be clear, I'm not trying to defend Apple here, just telling people how they can get around this if they feel like debugging iTunes or whatever.
- nitrogen 14y agoI wonder if the above gdb script counts as circumvention of a technological measure under the DMCA.
- Osmium 14y agoPlaying devil's advocate here, but what's the media store like on your typical Linux distribution? The reason Apple has to go to such draconian measures is to please their content providers. Without doing so, you wouldn't have an iTunes store with such a wide variety of content. Apple's margins from content sales are slim; they push content to sell devices. As they've shown with music in the past, they'll get rid of DRM if the content providers allow it. So it's not entirely fair to blame Apple for that one.
- njharman 14y ago> typical media store There are several BitTorrent clients to choose from!
- caf 14y agoThe content providers seem happy with iTunes running on Windows without such protection.
- pyre 14y agoWhen Apple first signed on the labels, iTunes didn't run on Windows. Do we know when these protections first showed up? Was it Apple's way of appeasing the labels before they gained enough mass that the labels couldn't ignore them?
- caf 14y agoI don't know about the debug protections, but according to Wikipedia's timeline, it was only a matter of 6 months between iTunes Store appearing and iTunes becoming available for Windows.
- desas 14y agoThe amazon store is pretty goood
- adambyrtek 14y ago7digital[1] is great for music, and they don't use any DRM. [1] http://www.7digital.com/ http://www.7digital.com/
- ciniglio 14y agoI would guess that the gdb thing is to prevent cracking of their DRM, not to hide some PII tracking. Do you know if you can attach gdb to something like Xbox Music (Zune)?
- recoiledsnake 14y agoLooks like you can attach a debugger to Zune, but if you try to play DRM'ed files when doing so, it will fail with an error. http://blogs.technet.com/b/askperf/archive/2009/02/24/windows-7-zune-and-the-case-of-the-mysterious-debugger.aspx http://blogs.technet.com/b/askperf/archive/2009/02/24/window...
- eridius 14y agoYou seem to be very confused. The facility that blocks gdb is part of the standard ptrace APIs. It was not extra code that Apple added. In any case, there's also a very simple explanation that should be obvious to anyone who thinks about it as to why Apple did this: because iTunes deals with DRM. A one-line change to block debugging is something I'd absolutely expect any app that uses DRM'd content to do.
- ajross 14y agoPT_DENY_ATTACH certainly isn't part of any standard. It's absolutely a Darwin-specific feature, and is thus "extra code that Apple added", and they presumably did it for exactly this application. And no, other DRM-aware apps on other OSes don't do this. So... who's very confused?
- justincormack 14y agoUbuntu also restricts use of ptrace for security reasons although it shouldn't affect gdb https://wiki.ubuntu.com/SecurityTeam/Roadmap/KernelHardening#ptrace_Protection https://wiki.ubuntu.com/SecurityTeam/Roadmap/KernelHardening...
- ajross 14y agoYes, but critically in Linux you can turn it off as the administrator of the system. It affects security but not inspectability. Regardless, my response was simply to the idea that Apple was "following standards" when they clearly weren't.
- vetinari 14y agoIn Ubuntu, it's user overridable (i.e. machine owner is in control). In Darwin/OSX, it is not (i.e. machine vendor is in control).
- ReadyNSet 14y agoActually iTunes on Windows also calls IsDebuggerAttached and exits for YES. This though can be easily by passed by hooking the function call.