News: 1694448011

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

Linux 6.6's in-kernel SMB networking server graduates

(2023/09/11)


The next release of the Linux kernel, 6.6, has hit release candidate status. As usual, it contains a number of new features, but we think one has more potential ramifications than all the others put together.

Linus Torvalds [1]announced kernel 6.6-rc1 last night, and it includes the [2]KSMBD in-kernel server for the SMB networking protocol, developed by Samsung's Namjae Jeon. We've covered his work a few times on The Reg , including as a [3]possible stand-in maintainer for NTFS3 as well as maintaining [4]support for Microsoft's exFAT disk format .

Samsung is a significant force in the storage market, and Reg sister site Blocks & Files [5]often covers what the chaebŏl is up to . Samsung alone represents some [6]17 percent of South Korean GDP.

[7]

KSMBD has been around for a while. Just before it was first [8]merged into kernel 5.15, LWN [9]offered a good explainer on how the new module worked. Kernel 5.15 itself was a [10]significant release for its NTFS support . The very next month, on Christmas eve of 2022, [11]Linux sysadmins got to enjoy KSMBD's first security exploit . What's changed now is that it has faced considerable [12]security testing and as a result it is no longer marked as experimental .

[13]

[14]

It's been developed with the assistance of the Samba team, which itself [15]documents how to use it. It's compatible with existing Samba configuration files. As the team [16]says :

It is not meant to replace the existing Samba fileserver "smbd", but rather be an extension and will integrate with Samba in the future.

One significant difference that results from including this as part of the kernel, though, is it means that KSMBD therefore is covered by version 2 of the GNU Public licence, or GPL2 for short. Samba itself [17]uses GPL version 3, of which Torvalds is [18]not an admirer .

GPL 3 places tighter restrictions on how code can be used in commercial products. When Samba switched to GPL 3, one result was that Apple [19]dropped Samba from Mac OS X and replaced it with its own, in-house server called SMBX.

This was a significant move, because over time, Mac OS X (as the Reg FOSS desk still tends to call it) has gradually been made more and more reliant on SMB for its network connections. In the release before OS X "Lion," 2009's Mac OS X 10.6, Apple had [20]removed the AppleTalk network protocol, although the separate AppleTalk Filing Protocol (AFP) over TCP/IP remained. In Mac OS X 10.9, Apple [21]switched to using SMB by default.

[22]

Most recently, in 2020, Apple [23]removed the ability to share volumes over the AFP from macOS 11.

So even though macOS [24]is a Unix , and includes support for Unix's own native file-sharing protocol, [25]NFS, the Network File System , it defaults to Microsoft's [26]so-called Common Internet File System instead. With

CIFS SMB right inside the Linux kernel, it is conceivable that over time this might happen over in Linux-land as well.

[27]KSMBD is also important in that placing such core server functionality right inside the kernel represents a significant potential attack surface for crackers. As one [28]comment on Hacker News said "Unless this is formally proven or rewritten in a safer language, you'll have to pay me in solid gold to use such a CVE factory waiting to happen."

[29]Linus Torvalds couldn't find an excuse to hold back Linux 6.5, so here it is

[30]Fed-up Torvalds suggests disabling AMD's 'stupid' performance-killing fTPM RNG

[31]Linux has nearly half of the desktop OS Linux market

[32]Debian dev to the rescue after proposal to remove Itanium from Linux kernel

An ideal candidate for rewriting it in Rust, then, to use the [33]exciting new support . The new [34]bcachefs file system will not be going into kernel 6.6, and its developer is [35]not happy . Perhaps he should hurry up its Rust [36]rewrite , too.

Linux isn't the first Unix to get an in-kernel SMB server, though. OpenSolaris [37]did the same back in 2007 , and it's doing fin— [38]Oh wait. Well, not-so-open [39]Solaris is still around , anyway. ®

Bootnote

Current versions of macOS can still connect to AFP shares on other computers, and just as this vulture was writing the paragraph about the removal of AFP sharing support, his TrueNAS box started quietly burbling as Time Machine began making a backup on the server's ZFS RAIDZ, shared over AFP. However, that too is [40]deprecated and will disappear at some point.

Get our [41]Tech Resources



[1] https://lore.kernel.org/lkml/CAHk-=wgfL1rwyvELk2VwJTtiLNpwxTFeFtStLeAQ-2rTRd34eQ@mail.gmail.com/T/#u

[2] https://github.com/namjaejeon/ksmbd

[3] https://www.theregister.com/2022/04/29/problems_for_the_linux_kernel_ntfs/

[4] https://www.theregister.com/2022/12/20/kernel_62_fs_improvements/

[5] https://blocksandfiles.com/tag/samsung/

[6] https://www.cnbc.com/2020/10/26/south-koreas-lee-kun-hee-who-made-samsung-a-global-powerhouse-dies-at-78.html

[7] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/oses&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=2&c=2ZP@OBa6409qwZ1iR@LVgaAAAAY4&t=ct%3Dns%26unitnum%3D2%26raptor%3Dcondor%26pos%3Dtop%26test%3D0

[8] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e24c567b7ecff1c8b6023a10d7f78256cef742c4

[9] https://lwn.net/Articles/871866/

[10] https://www.theregister.com/2021/11/01/linux_515_kernel_lts/

[11] https://www.theregister.com/2022/12/24/back_to_work_linux_admins/

[12] https://blog.thalium.re/posts/ksmbd-trailer/

[13] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/oses&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=4&c=44ZP@OBa6409qwZ1iR@LVgaAAAAY4&t=ct%3Dns%26unitnum%3D4%26raptor%3Dfalcon%26pos%3Dmid%26test%3D0

[14] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/oses&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=3&c=33ZP@OBa6409qwZ1iR@LVgaAAAAY4&t=ct%3Dns%26unitnum%3D3%26raptor%3Deagle%26pos%3Dmid%26test%3D0

[15] https://wiki.samba.org/index.php/Linux_Kernel_Server

[16] https://samba.plus/blog/detail/ksmbd-a-new-in-kernel-smb-server

[17] https://www.samba.org/samba/docs/GPL.html

[18] https://www.theregister.com/2006/08/18/gpl_3_torvalds/

[19] https://appleinsider.com/articles/11/03/23/inside_mac_os_x_10_7_lion_server_apple_replaces_samba_for_windows_networking_services

[20] https://eclecticlight.co/2015/07/19/rip-appletalk/

[21] https://appleinsider.com/articles/13/06/11/apple-shifts-from-afp-file-sharing-to-smb2-in-os-x-109-mavericks

[22] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/oses&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=4&c=44ZP@OBa6409qwZ1iR@LVgaAAAAY4&t=ct%3Dns%26unitnum%3D4%26raptor%3Dfalcon%26pos%3Dmid%26test%3D0

[23] https://www.macworld.com/article/234926/using-afp-to-share-a-mac-drive-its-time-to-change.html

[24] https://www.opengroup.org/openbrand/register/

[25] https://www.theregister.com/2012/02/29/snia_what_next_nfs/

[26] https://www.theregister.com/2002/03/19/why_microsofts_eu_concession/

[27] https://docs.kernel.org/next/filesystems/cifs/ksmbd.html

[28] https://news.ycombinator.com/item?id=37464475

[29] https://www.theregister.com/2023/08/28/linux_kernel_6_5_debuts/

[30] https://www.theregister.com/2023/07/31/linus_torvalds_ftpm/

[31] https://www.theregister.com/2023/07/18/linux_desktop_debate/

[32] https://www.theregister.com/2023/02/16/itanium_linux_kernel/

[33] https://www.theregister.com/2022/12/09/linux_kernel_61_column/

[34] https://www.theregister.com/2022/03/18/bcachefs/

[35] https://lore.kernel.org/lkml/20230907234001.oe4uypp6anb5vqem@moria.home.lan/

[36] https://lwn.net/Articles/934692/

[37] https://www.theregister.com/2007/11/20/sun_opensolaris_cifs_service/

[38] https://www.theregister.com/2010/08/13/opensolaris_is_dead/

[39] https://www.theregister.com/2022/03/04/solaris_common_build_environments_free/

[40] https://www.truenas.com/docs/scale/scaletutorials/shares/afpmigration/

[41] https://whitepapers.theregister.com/



Paul Crawford

From a cited article:

However, the Samba team has moved active development of the project to the more strict GPLv3 license, which prevents Apple from realistically using the software commercially.

Given samba is a stand alone program, why is this an issue? Do Apple want to change it in some way and make it run only if signed and deny anyone from running an unsigned version?

KMods

teknopaul

This sort of stuff in the Linux kernel used to worry me.

Now it's reassuring.

Huh?

bazza

From the article:

As one comment on Hacker News said "Unless this is formally proven or rewritten in a safer language, you'll have to pay me in solid gold to use such a CVE factory waiting to happen."

Well, I know what they mean, but being paid in solid gold is only of any additional remunerative value if one is given sufficient ounces to be worth more than one's salary!

Age Old Architectural Mistake Coming Home to Roost?

bazza

The only reason to have an SMB server in-kernel is to speed things up. The only reason it gets speeded up, being in the kernel, is because that is where the networking is. If the networking was predominantly out in user space - like it is in FreeBSD, Windows, Mac, literally everything else - they wouldn't have to keep shoe-horning such things into the kernel.

The way this will end is with the Linux kernel being bloated and full of vulnerabilities, whilst network applications / servers not yet ported into it will remain emcumbered. If there were one thing to do to guarantee the future value and correctness of the kernel, it's getting rid of the networking to userland now, before it's too late (if it's not already).

Re: Bootnote

Orv

You can do Time Machine backups to SMB shares -- I have it working for a few dozen computers, backing up to a FreeBSD system with ZFS storage. The settings that worked for me:

Global:

vfs objects = acl_xattr catia fruit streams_xattr

fruit:metadata = stream

fruit:model = MacSamba

fruit:posix_rename = yes

fruit:zero_file_id = yes

And then per share:

fruit:time machine = yes

Each share is restricted using "valid users" to a username unique to each machine, so they can't read each others' backups.

I take timed ZFS snapshots, so that a machine infected by ransomware can't encrypt all of its own backups.

You need to use refquotas to keep things under control, since Time Machine will keep adding backups until the disk is full, then delete the oldest ones. (If you use straight quotas it won't work because deleting files won't delete the snapshots, and thus will never free up any space for the client.)

I've successfully done Migration Assistant restores from this setup. It's slow, but within normal bounds for Time Machine.

Re: Bootnote

Androgynous Cupboard

I have a similar setup and yes it does work. If you're on ZFS, "fruit:resource = xattr" might be of interest - that's how we roll here. It's been a while, but I remember lots of "macOS droppings" all over my filesystem as a result of it trying to store resource forks in standalone files. Less of an issue these days I think, but still. Also see fruit:nfs_aces=no if you've got NFS access to the same folders

The "refquotas" is a great tip, thanks - I see it's specifically a fix if you're using ZFS snapshots, which to my shame I'm not. Noted for next time.

ptribble

"OpenSolaris did the same back in 2007, and it's doing fin— Oh wait."

The in-kernel smb server is still present in illumos, and actively maintained.

The interesting part of that is not so much the SMB server part, but that the use of Windows SIDs is fully integrated into the OS and ZFS, so you can manage ownership and permissions for Windows users natively.

If someone stinks, view it as a reason to help them, not a reason to
avoid them.
-- Larry Wall in <199702111730.JAA28598@wall.org>