by zx2c4 · 5y ago · 0 comments
A big part of the WireGuard project since the beginning has been trying to figure out how to do high security tunneling that also performs acceptably. It's easy to do one without the other, but doing them both together has meant thinking about a lot of fundamentals, from the protocol state machines on up. It's hard to do tunneling in the kernel at high speed while still maintaining a strong security posture. That's a principal challenge the project endeavors to solve.
More generally, it's worth noting that cryptographers also care about performance quite a bit in things like symmetric crypto. We know well how to make a good cipher now, but making one that also performs at increasingly high speeds remains an open area of research, with whole conferences, such as FSE, devoted to it.
Legacy VPN protocols fare terribly against WireGuard on what should be the most important concern, of design and implementation security. But the reasons why are, though obvious to people with domain expertise, subtle enough that you can't mic-drop them in a conversation and expect to overcome the standard "but it's standard" objection in favor of IPSEC.
Performance has been a potent tool of persuasion for WireGuard. I've convinced people based on WireGuard speed that I don't think I could have persuaded based on security.
If the goal is getting people off fetid 1990s-grade cryptography and C code, WireGuard's performance is an indirect force towards that goal. It was smart to focus on it, because people obviously care a lot about it. It's great to see a security project where simplicity and performance line up with improved security.
Oh dear me, getting IPSEC to work did not win it any admiration from me. Of course, what I was doing with it would have been better served by TLS with server and client certificates, but the other end were telcos so sure, I can setup IPSEC and cry myself to sleep.
I wonder if we shouldn't standardize something very similar to wireguard as a general successor of ipsec.
Something like wireguard + iana/ietf considerations.
I am already using it for production purposes where both endpoints are Linux, though.
With regards to the WireGuard for Windows client, though, whether we'll put the time in to develop such a WFP driver and integrate it there I guess is still up in the air, like many feature wishlist items are.
It's also arguably more difficult to do a given task in the kernel than in userland, code for the kernel is much more security-sensitive and even subtle bugs can be detrimental to overall system performance (or even exploitable).
Best thing would be to fix the OS instead of piling up kludges.
https://arstechnica.com/gadgets/2020/03/wireguard-vpn-makes-...
https://www.freebsd.org/cgi/man.cgi?query=ipsec&sektion=4&fo...
By mapping the same buffer into both processes, or moving it from one process to the other, depending on security needs. Mapping the buffer into multiple memory spaces is how a kernel VPN driver would accomplish the same thing.
> as little context switching as the design allows
A raw context switch only costs 20 nanoseconds for a round trip. And it's only a few more to save the normal registers. The rest is up to kernel design. So it sure sounds like it's the kernel's fault if putting tasks like that outside the kernel is too expensive. Especially since one context switch can process as many packets as you want.
Flushing TLBs. Flushing caches. Etc etc.
Fixing that is the point of, for example, io_uring in Linux. I don't know if Windows has an equivalent. Perhaps not, thus a kernel driver. But there is nothing mysterious about solving that problem.
* Dynamic loading of drivers is no longer an issue, the kernel already knows how to dynamically load processes anyway and a driver is just another proces. No need for special 'kernel maintainers' for drivers, or for drivers to be open source (in case of the Linux kernel).
* Much better system stability, since drivers can do no harm. Kernel architecture can be simpler too.
* Much simpler drivers. Instead of strict cooperation rules the kernel can just pre-empt them when needed.
Unfortunately it appears there is no credible effort in developing a mainstream microkernel OS at this time. Nonetheless, the few I've worked with in the past were amazing and I'd love to see this idea come back.
So microkernels are dead, performance buries them deeper and deeper.