6 ms·
I'm one of the authors on this paper, so ask away if you have questions.
by rwmj 7y ago
I'm one of the authors on this paper, so ask away if you have questions.
- tasubotadas 7y agoWhat is a unikernel and why it's good?
- stingraycharles 7y agoYeah I’m kind of amazed they don’t start out with explaining this. Usually there is at least a one-line explanation. From Wikipedia: “A unikernel is a specialised, single address space machine image constructed by using library operating systems. A developer selects, from a modular stack, the minimal set of libraries which correspond to the OS constructs required for their application to run. These libraries are then compiled with the application and configuration code to build sealed, fixed-purpose images (unikernels) which run directly on a hypervisor or hardware without an intervening OS such as Linux or Windows.”
- awild 7y ago> There has been a resurgence of research sys-tems exploring the idea of the libraryOS, ora unikernel,a model where target application is linked with a special-ized kernel and deployed directly on hardware, virtual orphysical Third paragraph > The unikernel is a cloud-era handle for the classic systemstechnique of linking an application with a library of oper-ating system components (including memory management,scheduler, network stack and device drivers) into a singleflat address space, creating standalone binary image that isbootable directly on (virtual) hardware [22]. The advantageof this approach is that kernel functionality can be special-ized to fit the needs of the target application to increasethe performance of the application or to support it within ahighly restricted execution domain. And second chapter.
- rwmj 7y agohttps://en.wikipedia.org/wiki/Unikernel https://en.wikipedia.org/wiki/Unikernel Whether it's good depends on what you're doing. UKL will[1] allow you to link a regular server application to Linux and then run that single binary on baremetal or in a hypervisor, and give you a decent performance boost over running the application on top of a normal kernel. How much of a performance boost depends a great deal on the program, almost everything will be a few percent faster, and some applications a lot more. [1] I'm using the future tense here because although we do run real programs with it today there's still a bunch of development work to do before it works smoothly. The code is: https://github.com/unikernelLinux https://github.com/unikernelLinux
- radicalbyte 7y agoAs I've always understood it, it's not just performance but also security: there's a lot less code running with your code which cuts the surface area for bugs and thus security holes.
- cma 7y agoWouldn't a crash or other problem in your program potentially corrupt e.g. the kernel tcp stack?
- rwmj 7y agoAs the program and kernel run in a single address space, yes there is no separation from your application corrupting parts of the kernel. I'm not very convinced about the security story around unikernels, but for balance the other side of the argument is that there's much less code around in a unikernel - no shell, no command line tools at all, no compilers or interpreters, just the code required to run the program and talk to the hardware (real or virtual).
- heavenlyblue 7y agoWouldn’t directly linking system calls make every address space more unique and thus make it harder to write (generic) exploits for?
- rwmj 7y agoThe typical problem is that you end up distributing (eg) Apache 2.4.99 compiled for Unikernel on x86-64 via Red Hat Network to a million customers and they're all running the same binary. ASLR helps here ...
- cma 7y agoWith full privilege I think you could directly write to hardware dma locations and look them up in the mmu, etc.
- perbu 7y agoBasically you replace the system calls into the kernel with library calls. So you end up with a single binary that contains both the application as well as the operating system functionality. This can lead to some rather spectacular performance benefits. One thing is that you remove the syscall overhead, but more importantly you can do a lot more optimizations at the compiler/linking steps. You can remove complex code that tries to dynamically model the world with rather plain code that does just what it is supposed to. With IncludeOS (C++17 unikernel) we did make a firewall implementation that instead of using complex data structures relied on preprocessing the rule set and translate it into C++ code. The code to do this was quite simple and resulted in pretty amazing figures wrt number of rules per packet per second. Metaprogramming can sometimes deliver amazing results. Similar things can be done in a traditional kernel as well and we've seen eBPF firewall implementations that are able to get similar numbers. On the flip side eBPF and it's firewall implementation is order of magnitude more complex. However, you can push eBPF code onto the networking card which can be a huge benefit. And ofc you could make a kernel module that implements a specific firewall ruleset and get similar performance without eBPF. I like unikernels because I feel I can understand them better. You can reason about them and they are easier to optimize for very specific workloads. So why aren't we using them? Likely because we know Linux so well and we've invested a lot in it. It runs everywhere and is extremely well supported. Bringing a new operating system to market is challenging, bringing a new operating system with a entirely different architecture is even harder. Even if it, on a purely technical level, could yield better results.
- rwmj 7y agoAnother performance benefit (unsurprising in highsight) comes from removing KPTI and similar Spectre mitigations. These have really made system calls in regular kernels expensive.
- bonzini 7y agoOn the other hand if you run only one application on your VM you can just disable them, because one you have access to the userspace application there is nothing else on the machine to steal via side channel attacks.
- k__ 7y agoThink of it as "Your app runs like an operating system". Instead of installing an OS and installing your app on that OS, the OS is a library you use to talk to the hardware. It's good for two reasons. First security, if you only use the HDD and network, you don't have to include code for display or mouse etc. which could be a security risk. Second, it's faster, because you don't have to do syscalls, since your app IS the OS, syscalls don't need to get out of userspace.
- texascloud 7y agoOnly reading the abstract, are you saying a different branch/fork of Linux could be maintained to be a unikernel?
- Rotten194 7y ago(Not the author) No, the paper describes a small patch to Linux (~20 lines) + modifications to glibc that enable using Linux as a unikernel. Their goal is to have the modifications upstreamed so that Unikernel linux could be a GCC target etc.
- boxed 7y agoI also don't get it. "Linux as a unikernel" does not make sense. The entire point of a unikernel is to not have the OS in every container/VM.
- dodobirdlord 7y agoIf you statically link your software with the kernel, presumably an optimizing compiler will be able to remove most of the kernel from the resulting binary.
- rwmj 7y agoYes. Also LTO becomes possible.
- helldritch 7y agoFor those, like me, who don't know what the acronym LTO is: it's Link-time optimisation, the stage during compilation where the "linker" has all of the object files which make up your program available to it, and is therefor able to optimise across the entire program at once (instead of the individual constituent source files which make up the program). There's a long, detailed PDF about LTO produced by GCC which was useful in helping me to understand exactly how this works here: https://gcc.gnu.org/projects/lto/lto.pdf https://gcc.gnu.org/projects/lto/lto.pdf
- pinopinopino 7y agoReally cool work! Is there really a support layer for Emacs in the kernel? Now the real question. You are statically linking against a modified glibc, so they make calls to your kernel library instead to the system call and you can do some nice optimizations along the way. Which I think make sense. I can see this is cool for things that directly interface to glibc, but do you think this is viable for applications using multiple layers between the kernel and the application?
- rwmj 7y agoAt the moment you must go through glibc. For example issuing SYSENTER or INT 80h will not work. We have only run C applications so far, so I'm unsure how it will all work for servers written in other programming languages. I think applications which rely on complex multi-process middleware (like Java JBoss, etc) will be hard or even impossible to port.
- pinopinopino 7y agoUnderstandable, thanks for your answer!
- bonzini 7y agoYou can always "unikernelize" the JVM. OSv had a kernel-optimized JVM for example.
- elcritch 7y agoThat’d be great for many VMs. I think it’d be interesting to see how the Erlang BEAM would perform in such a scenario. Especially for embedded devices! Yes, sometimes a few dozen micros faster is all that’s needed for many applications to become practical.
- zeckalpha 7y agohttps://github.com/cloudozer/ling/blob/master/README.md https://github.com/cloudozer/ling/blob/master/README.md
- xfs 7y agoIs it correct to think of it as application code running as PID 1 in kernel space? Can I fork or create threads? Can I directly access kernel's internal APIs like a kernel module?
- perbu 7y agoNot quite. Everything runs as PID 0. :-) There are no processes here. Everything runs inside the kernel. You don't have exec(), fork() or similar.
- rwmj 7y ago> Is it correct to think of it as application code running as PID 1 in kernel space? getpid exists and returns a number - in fact it can return any number you like :-) Everything is linked into a single vmlinux which runs in a single address space. (As an aside I'll have to remember to ask Ali if he's thought about what number getpid() should return in UKL - I guess returning 1 would cause least surprise) > Can I fork or create threads? Fork no, threads yes. Threads are implemented using kernel threads. > Can I directly access kernel's internal APIs like a kernel module? Yes, although whether this is a good idea is another matter. Note that it's still Linux so internal APIs are unstable and can go away or change their meaning at any time, so if your application starts to rely on internal APIs you could quickly get into trouble.
- arbarb 7y agoSlight clarification. Yes, UKL has normal kthreads, but all the application code runs using pthreads. And their implementation is unchanged, except the fact that they do function calls instead of syscall.
- joosters 7y agoWhat are the plans regarding multithread / multiprocess support? On the face of it, multiprocess support might seem a bit stupid, but it would greatly help the porting of more complex applications. The 'processes' wouldn't need virtual address space or memory protection, just give them a block of memory and pick a CPU to run the code. If you have multithreading, do you need any scheduling code, or can you just pick a CPU for each thread and leave them to run? What about the kernel's own threads & processes?
- rwmj 7y agoI don't know where things will go in the future, but now: Multiprocess no. fork() will fail. Pthreads works already.
- arbarb 7y agoUKL is multi threaded, not multi process because there is no fork. Plus it's a Unikernel i.e., just one process. You don't need any scheduling code, Linux does it like it does normally for kernel and user threads.
- finnthehuman 7y ago>You don't need any scheduling code, Linux does it like it does normally for kernel and user threads. That's interesting, how does Linux implement it's kernel threads without any scheduling code?
- MaxBarraclough 7y agoWhat do you make of the highly critical Assessing Unikernel Security paper [0]? Have things changed since its publication? [0] https://www.nccgroup.trust/globalassets/our-research/us/whitepapers/2019/ncc_group-assessing_unikernel_security.pdf https://www.nccgroup.trust/globalassets/our-research/us/whit... , from https://news.ycombinator.com/item?id=19738905 https://news.ycombinator.com/item?id=19738905
- rwmj 7y agoI can't read that paper. Firefox says the HSTS cert is wrong. Edit: Thanks for the updated link. UKL can be compiled with usual hardening features like ASLR, stack hardening, RELRO. As I said here (https://news.ycombinator.com/item?id=23202042 https://news.ycombinator.com/item?id=23202042) I'm dubious about the security story around unikernels, but most of the issues in this paper are not relevant to UKL specifically.
- subaru_shoe 7y agoyou wrote this paper but can’t figure out how to solve this issue? really?
- MaxBarraclough 7y agoVery strange, it works fine for me regardless of browser. Mirror: https://web.archive.org/web/20200311095425/https://www.nccgroup.trust/globalassets/our-research/us/whitepapers/2019/ncc_group-assessing_unikernel_security.pdf https://web.archive.org/web/20200311095425/https://www.nccgr...
- eyberg 7y agoYou might enjoy reading my response to that: https://nanovms.com/dev/tutorials/assessing-unikernel-security https://nanovms.com/dev/tutorials/assessing-unikernel-securi...
- MaxBarraclough 7y agoI'll be frank: that article strikes me as weak sauce. It's coy about the identity of the paper it discusses. It's there in the title, and nowhere else, as if that's enough for it to be clear to the reader. Beyond this, the responses offered are not strong. It makes good sense to compare unikernels against conventional GNU/Linux. It's the standard configuration, and it sets the bar. Describing this as a pyschological hump isn't a sensible response. I don't know what advances to things like the networking stack is meant to refer to. The article should be clear and explicit about what part of the paper this is responding to. As it stands it looks like a straw-man. The response to unikernels are un-debuggable makes little sense. Someone can work on a debugger while claiming the current state of debugging is poor. No contradiction there. Downplaying the significance of Data Execution Prevention isn't a convincing defence. Downplaying the significance of ASLR isn't a convincing defence. These are valuable security measures. This excerpt from the conclusion seems to indicate a reluctance to take security concerns seriously at all, as if a security analysis is an emotional attack: there's a thousand little kids out there wanting to crap on anything they can. Security bugs are bugs at the end of the day and all one has to do is look at any random popular github to understand how many bugs we as humans create.
- transpute 7y agoThanks for taking questions. Are there outstanding work items for QEMU being statically linked with a unikernel?
- rwmj 7y agoIt's not really something that anyone in the project has thought about. Running the vmlinux on baremetal is actually more interesting to us.
- wltprgm 7y agoCorrect me if I am wrong, Unikernels are basically allowing binary to run at Ring 0? What do you think about WASM in the kernel with the same high level concept with Unikernel? link in the below https://destroyallsoftware.com/talks/the-birth-and-death-of-javascript https://destroyallsoftware.com/talks/the-birth-and-death-of-...
- rwmj 7y agoI'm not sure I can say anything intelligent about WASM in the regular kernel, but from a UKL point of view we're talking with Enarx and they're going to join us on one of our regular meetings in a few weeks. For more info on Enarx and web assembly see: https://www.youtube.com/watch?v=5wrQSe-IdMI https://www.youtube.com/watch?v=5wrQSe-IdMI
- eyberg 7y agoI'll admit I don't know much about WASM but access to raw sockets and 32bit only sounds extremely limiting. Until those are dealt with wasm will never move past it's current status quo - malware in the browser.
- snvzz 7y agoWhy Linux? Solutions based on Netbsd's rumpkernels exist. There's nothing about unikernels that says Linux.
- rwmj 7y agoLinux is the most mainstream Unix-like server operating system. We're making only minimal changes to Linux and hoping to get them upstream. (The NetBSD rumpkernel is a bit different from this by the way.)
- la6471 7y agoIs the final vision to somehow put together a packager that will put together an application plus UK together to run on any virtual system. Maybe one can extend packer to create this binary similar to how it creates container.Also FaaS providers like AWS lambda or google functions - aren’t they already doing this?
- rwmj 7y agoI wouldn't say the final vision is clear yet, but what I'd like to see would look something like a "liblinux.a", and you would compile your application using your normal compiler, and link it to this library to end up with a vmlinux that would run in a VM or on baremetal. Actually achieving this is tricky: At the moment you need to use special compiler flags and a completely different link line from normal. Then there's the issue of how/whether the library Linux is configured generically or you somehow allow people to set CONFIG_* options.
- MichaelMoser123 7y agoisn't it hard to develop/debug/monitor an application with this approach? I mean you can't just run a debugger as another process and attach to the thing, you can't run tcpdump or strace, nothing of that sort. Also every bad pointer access will require a reboot, wouldn't it? I mean how do you develop an application with this approach?
- rwmj 7y agoAll good questions without a clear answer at the moment. Bad pointers in the application can overwrite kernel data structures because everything runs in a single address space.
- Someone 7y agoThe unikernel idea is 20-ish years old. I think those good questions cannot be much younger. Because of that, I think “without a clear answer at the moment” is worrisome. Are there partial answers to these questions?
- rwmj 7y agoI mean "without a clear answer" for UKL which is only just over a year old and still in active and early development. There will probably be a way to attach gdb at some point.
- marcoperaza 7y agoYou can debug a normal kernel over the network. I imagine you can do the same with a unikernel.
- heavenlyblue 7y ago> Also every bad pointer access will require a reboot, wouldn't it? Hm, isn’t reboot just slightly more complicated than restarting your application? And most of the today’s apps would still require “rebooting” be it a container or a virtual machine
- zarkov99 7y agoHow transparent could the deployment target choice be? Could you deploy roughly the same source code to unikernel and non unikernel targets? Also, what exactly are these enormous performance benefits?
- rwmj 7y agoAbout the source code, all I can really say is that's our aim at the moment - to have the same source compiled for both non-unikernel and UKL targets. Note that really what we're aiming for is to recompile common servers out of the box with no changes, or the minimal changes possible. Performance benefits: In truth we're still measuring this, there is a very smart student at BU who is investigating this and coming up with results for a forthcoming paper which I don't want to preempt too much. Almost all applications should see a small benefit, say of the order of 5%, but it's hoped that some will see a much larger benefit, and that it should be possible to make modest modifications in order to enjoy large benefits (perhaps only compiler and linker flags and such like). These are very much hopes rather than firm promises at the moment.