Reg comments101

Microsoft ❤️ Linux? Microsoft ❤️ running its Windows' SQL Server software on Linux

Embrace, extend, er, enter

In March, when Microsoft announced plans to release SQL Server for Linux, Scott Guthrie, EVP of Microsoft's cloud and enterprise group, said, "This will enable SQL Server to deliver a consistent data platform across Windows Server and Linux, as well as on-premises and cloud."

The release of the first public preview of SQL Server for Linux on Wednesday reveals just how consistent that platform is: It's the Windows version of SQL Server running on the Windows NT kernel as a guest app, more or less.

When Microsoft declared its love for Linux, it appears to have been looking in the mirror.

Microsoft could have ported SQL Server to run as a native Linux application. Instead, it has chosen to use its Drawbridge application sandboxing technology.

SQL Server for Linux runs atop a Drawbridge Windows library OS – a user-mode NT kernel – within a secure container called a picoprocess that communicates with the host Linux operating system through the Drawbridge application binary interface.

In other words, Microsoft's SQL Server for Linux is really the Windows SQL Server executable with a small Windows 8 kernel glued underneath, all running in a normal Linux process.

Drawbridge references can be found in an 8.4MB library found at /opt/mssql/lib/system.sfp. The /opt/mssql/bin/sqlservr binary is really a loader – having studied its code, we found it brings components into a sandbox and performs integrity checks and whitelisting to make sure it is allowed to do so, and then runs the contained SQL Server executable.

The Register asked Microsoft to explain itself but has not heard back.

Virtualization has helped blur the boundaries between operating systems, a trend that's been underway for years. Mac users have been able to boot into Windows through Boot Camp or virtualization software like Parallels. Linux users have been able to run Windows apps using Wine.

More recently, Android users have gained the ability to run Android apps on Chromebooks. And Mirage OS, a project backed by Xen and the Linux Foundation, allows developers to write apps in a native OS like macOS and compile them into a unikernel that runs under the Xen hypervisor.

Containerization has encouraged further levels of abstraction and cross-platform compatibility, even as it distances users from their software. It's difficult to care much about operating systems when many containers get launched and shut down in less than a minute.

Drawbridge containers promise less overhead than traditional virtualization. "The Drawbridge picoprocess interface surfaces threads, private virtual memory, and I/O streams instead of low-level hardware abstractions like CPUs, MMUs, and device registers," Microsoft explains.

"These higher-level abstractions allow for much more efficient implementations of OS code hosted within the picoprocess. These higher-level abstractions also allow for much more efficient resource utilization."

Drawbridge also obviates the labor-intensive process of rewriting Windows applications to use Linux and POSIX calls. It also means, in theory, Microsoft can use this technology to bring its other Windows server applications to Linux with minimal changes, using SQL Server as a starting point.

Where once Linux was a cancer to Microsoft, now Windows is growing inside of Linux. ®

Microsoft SQL Server for Linux reverse-engineered by Chris Williams.

Sponsored: The Joy and Pain of Buying IT - Have Your Say


Biting the hand that feeds IT © 1998–2017