1

I have developed a Mac software (using DiscRecordingFramework and IOKit) that creates hybrid Video-DVD. The resulting DVD is fully compatible with Video-DVD specifications. The hybrid disc hosts HFS+, UDF and ISO filesystems. Now the problem is Mac system automatically mounts HFS+ filesystem but default DVD Player on Mac cannot play a CSS protected movie from HFS+ filesystem. As a workaround I developed a script which mounts UDF filesystem along with HFS+ filesystem. This script actually load UDF2.1 kernel extension and mounts UDF filesystem. This solution worked but it's not desirable as it requires root passwords.

Is it possible to develop a solution which auto detects the hybrid disc and mounts both HFS+ and UDF filesystems? This solution should not compromise the system security. If it requires root passwords once in a lifetime that is OK but if it requires root passwords every time disc is used is not desirable.

Any help would be highly appreciated.

Farooq Zaman
  • 495
  • 1
  • 6
  • 21
  • 1
    I know nothing about Video DVDs, so this may or may not be helpful: do the HFS+/UDF/ISO file systems all reside on the same block device, i.e. /dev/diskXsY or are they on different "partitions"? If there are multiple partitions, you could "grab" the HFS+ one using the the disk arbitration framework, to prevent it from being mounted. Other ideas: 1. ask the user for the password only once and use that to set the setuid bit on your kext loading script. Or 2. create & install a kernel extension that detects these special discs and presents them to the OS in such a way it can handle them. – pmdj Mar 27 '12 at 10:53
  • 1
    Thanks for your quick response. Hybrid disc actually contain two partitions. One ISO partition and the other HFS+ partition. It's important that HFS+ partition mounts first for usability reasons. Both of the options you mentioned sound great. What are the security implications of both these options. Which one is safer than the other? – Farooq Zaman Mar 27 '12 at 11:20
  • 1
    Writing your own kernel extension is difficult, laborious and a security risk, so I don't advise it if there's a non-kernel solution. So that leaves disk arbitration and explicit mounting. Just to clarify my understanding what's going on: at the moment, OSX automatically mounts e.g. /dev/diskXs1 with HFS+, but you additionally need to mount /dev/diskXs2 with UDF/ISO? You need root to mount it via the `mount` utility, but what about `diskutil mount /dev/diskXs2`? That normally works without root permissions. – pmdj Mar 27 '12 at 13:06
  • Regarding the security of marking your script with setuid root: it's definitely a security issue; you'll want to be very strict about the input your script accepts. Reduce the amount the script actually does as root to a minimum, and call it from another script without setuid root. Also make sure the script is only writable by root. – pmdj Mar 27 '12 at 13:09
  • Thanks for your great help. diskutil utility solved my problem. – Farooq Zaman Mar 29 '12 at 07:15
  • Cool, glad you got it sorted! – pmdj Mar 29 '12 at 09:40
  • fz300: I just received an email from someone interested in the software you were developing, but they don't have enough SO reputation to write a comment here. Email me or add some contact info to your profile and I'll put you guys in touch. Message: "Do you have plans to release your Mac software commercially or in another form? Do you have need for beta testers for the software?" – pmdj Mar 27 '13 at 19:03

1 Answers1

1

Summary of the comment thread:

  • diskutil mount doesn't require root permissions, so it's preferable to use that if possible
  • The Disk Arbitration framework can be used to prevent filesystems being mounted, if necessary.
  • If you need to repeatedly perform an action as root and don't want to keep asking for the password, you can put the commands in a script, mark it as owned by root and set the setuid bit. You'll only need root permissions once for this.
  • For serious filesystem and disk trickery, you sometimes can't avoid dropping to the kernel level. An advantage of an installed kext is that it's the earliest possible way to respond to an inserted disk.
pmdj
  • 22,018
  • 3
  • 52
  • 103