Linux 6.6's in-kernel SMB networking server graduates
The next release of the Linux kernel, 6.6 [will] include the KSMBD in-kernel server for the SMB networking protocol, developed by Samsung's Namjae Jeon.
it has faced considerable security testing and as a result it is no longer marked as experimental.
It's compatible with existing Samba configuration files.
But why is KSMBD important? First off, it promises considerable performance gains and better support for modern features such as Remote Direct Memory Access (RDMA)... KSMBD also adds enhanced security, considerably better performance for both single and multi-thread read/write, better stability, and higher compatibility. In the end, hopefully, this KSMBD will also mean easier share setups in Linux without having to jump through the same hoops one must with the traditional Samba setup.
Even if it was tested extensively, why would I want to run any server in the kernel?
I guess this is to get some kind of parity with nfsd
Yeah, another thing where I never understood why it was in the kernel.
Yeah, not sure about that either. Unless you have some kind of use case where you need every bit of performance out of this, this stuff belongs in user space.
And if performance was an issue, just throw more/better hardware at it.
The above text says that the aim is to do RDMA, to let the NIC access memory directly, but I'd think that existing Linux zero-copy interfaces would be sufficient for that.
https://en.wikipedia.org/wiki/Zero-copy
So I'd think that the target workload has to be one where you can't just fetch a big chunk of pre-existing data, where you have to interject server-generated data in response to small requests, and even the overhead of switching to userspace to generate some kind of server-generated response is too high.
Which seems like a heck of a niche case.
But it obviously got approval from the kernel team.
googles
https://www.kernel.org/doc/html/next/filesystems/smb/ksmbd.html
I guess you could accelerate open and close too.
In all seriousness, I feel like if you're in such a niche situation that you can't afford the overhead of going to userspace for that, (a) there's likely room to optimize your application to request different things and (b) CIFS might not be the best option to be sharing data over the network either.
Oh, so the attack surface is much bigger than I realized. The NIC is probably the last thing I'd want writing directly to memory and bypassing the kernel.
I guess none of this will be enabled in desktop distros or even the majority of server distros...right?
I was under the impression this is already the norm for network equipment because the vast amount of data is no longer processable by the kernel. In fairness though that equipment most likely doesn't really consume the data but rather just forwards.
Shouldn't
io_uring
solve the issues with speed between usermode and kernelmode?Words to live by.
There have been vulnerabilities on the TCP/IP stack on a number of platforms (maybe all?), and that's a rather smaller attack surface.
EDIT: It also looks like ksmbd has already built itself a bit of a security history:
https://access.redhat.com/solutions/6991749
EDIT2: A bad security history:
https://lwn.net/Articles/871866/
Those would worry me if they showed up in a production userspace network filesystem.
I guess if you're just running it in a VM with a passthrough storage device with nothing else running in the VM that could be okay.
Inb4 systemd-smbd
I'm moving to BSD!! Seriously though the Linux kernel shouldn't just continually get more and more bloated... Keep this shit in user space!!