Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSSpinlock is depreciated #47

Closed
RnbWd opened this issue Jul 22, 2016 · 2 comments
Closed

OSSpinlock is depreciated #47

RnbWd opened this issue Jul 22, 2016 · 2 comments

Comments

@RnbWd
Copy link

RnbWd commented Jul 22, 2016

Is this being used in Docker Mac Beta? I'm running macOS dev beta 3 - and somebody on the forums figured out that the ntpd daemon was causing the vm to hang (the normal behavior is for it to start normally, then after using the network for a few minutes - docker becomes unresponsive. Unloading ntpd - docker f works perfectly fine.

sudo launchctl unload/System/Library/LaunchDaemons/org.ntp.ntpd.plist

So I came here to investigate why this was happening. When I started to compile hyperkit, the build stopped and there was a warning that said something like

OSSpinLock is depreciated in version of macOs

Google searched it - found this article: http://engineering.postmates.com/Spinlocks-Considered-Harmful-On-iOS/

Apparently the command is considered harmful and causes networking issues for iOS and macOS - so in Sierra it's not even allowed to be compiled and potentially causing the hang - it's probably causing issues in all versions of OSX but in Sierra it's debilitating. Unless you killntpd.

So i went into the docs to find what they are replacing OSSpinLock with, and I found an undocumented command in os called os_unfair_lock https://developer.apple.com/reference/os/os_unfair_lock

So I started rewriting hacking on hyperkit (and parts of xhyve) to replace it. I've never actually attempted to program C (or even Objective C) - but just wanted to let ya'll know, and if I get it to compile locally - I'll submit a pull request.

I assume the new API would probably be the most efficient replacement - although there may be other ways around this that don't use unfair_lock - I assume that Apple intends that to be a replacement? But the docs don't say anything about it.

@RnbWd
Copy link
Author

RnbWd commented Jul 24, 2016

I was able to get hyperkit to compile with the new os API - tests pass - but there's an error in the build that indicates something else is also causing the issue with Sierra. Replacing ossspinlock might translate for all macOS - to Yosemite - but I don't know if the new kernel os methods are going to be supported - so at the moment it's just a modification for Sierra. But I'll email docker security just in case there's a security issue here that I'm not aware of.

@waittttting
Copy link

Can you tell me 'os_unfair_lock' in which header files?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants