Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
L
libaacs
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • VideoLAN
  • libaacs
  • Issues
  • #1

Closed
Open
Opened Nov 30, 2018 by Marvin Scholz@ePiratContributor
  • Report abuse
  • New issue
Report abuse New issue

libaacs should block mounting/unmounting the disc

On macOS libaacs has to unmount the disc for exclusive access and then mount it again when done with it. Both the mounting and unmounting are non-blocking, which leads to issues especially when mounting the disc again in the end because the function returns before the disc is actually mounted and users of the library then will try to access a not yet mounted device without a way to easily figure out when it is mounted again.

More detailed explanation:

In void device_close(MMCDEV **pp) it calls iokit_mount(mmc);, this function calls a macOS DiskArbitration function to mount the drive with iokit_mount_complete as callback. In this callback mmc is accessed and is_mounted set to 1, but nothing else is done. This seems problematic given that there is no wait for this callback to happen, which means that by the time the callback is executed, mmc might have been freed already. (And of course means that code that runs after will try to access the drive even though it is not yet mounted.)

Additionally it seems that the way is_mounted is set is racy, though probably not as big of a problem given how the code works.

An easy fix would be to block in iokit_mount until the device is actually mounted.

The same issue exists in the unmount function but luckily it seems it is fast enough to not cause an issue.

Related to libbluray#3 (closed)

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
0
Labels
None
Assign labels
  • View project labels
Reference: videolan/libaacs#1