Alastair’s Place

Software development, Cocoa, Objective-C, life. Stuff like that.

Ptrace() and the “freetards”

It seems some of the “freetard” community has decided that it’s unacceptable that Apple provides even a nod towards copy protection in its operating system. I’m referring, of course, to the PT_DENY_ATTACH flag that can be passed to ptrace() to prevent debugging tools from examining a process.

The fact is that without this type of measure in the operating system, it would be trivial to misuse debugging tools to circumvent copy protection measures in applications, and I don’t just mean iTunes. A lot of shareware and commercial software calls this function to prevent casual debugging of its registration and/or activation code. And that should be no surprise. Casual piracy over the Internet is a huge problem for software developers; it’s much worse than the old problem of people swapping floppy disks or letting their friends have copies of programs that they’ve bought… much worse, because people allow everyone to have copies, which fundamentally undermines the value of software. As a result, those of us who write software for a living have to do something to prevent that from happening.

The very idea that Adam Leventhal, Brendan Gregg et al. have some right to be offended at this feature just beggars belief. It is complete and unmitigated rubbish to suggest that this is about “preventing defects from coming to light” or that it is in some way a slight to Open Source software that Apple has done this (indeed, DTrace is released under the OpenSolaris License, which explicitly allows modifications; it doesn’t disallow modifications that the original developers don’t find politically correct).

It may be true that the current blocking of DTrace has some unintended consequences, in which case Leventhal should file a bug report with Apple, just the same way the rest of us do when we find things that are wrong or that we don’t like. But this business of grandstanding about it because of some anti-copyright ideology is just plain wrong, as is Landon Fuller’s intentional sabotage of PT_DENY_ATTACH, both in ptrace() and DTrace, which, in addition to being immoral1, is probably illegal under DMCA/EUCD.

Update: Landon Fuller says that he’s pro-copyright and even pro-DRM, but in spite of that I get the impression that he still feels that it’s appropriate to publicly distribute a workaround for PT_DENY_ATTACH, in which case I stick by my assertions above.

1 Why immoral? Because by calling ptrace(PT_DENY_ATTACH), the author of a program is making a clear statement that they don’t want their code to be inspected by a debugger, at least not without explicit permission. Publicly distributing a workaround undermines the wishes of the author. Private distribution of the workaround wouldn’t bother me that much, because it would show that Fuller was using his discretion when distributing his kext, rather than handing it to anyone for any purpose.