[Samba] Great article on Samba symlink fixes at Linux Weekly News !

Jeremy Allison jra at samba.org
Sun Feb 13 18:52:52 UTC 2022


On Sun, Feb 13, 2022 at 10:55:11AM -0600, Patrick Goetz via samba wrote:
>OK, so my question is if all the internal functions have been switched 
>to use file handles rather than paths, how is it possible to re-enable 
>SMB1?

We use stat (path-based) (soon to be statx) to do a quick test for
existence (this can be raced), but as soon as we are gathering data
to return to the client we open using O_PATH (on Linux at least)
and use handle-based functions which cannot be raced. There is
no guarentee of atomicity of existence in the filesystem (a object
can be created or deleted by another process at any time) so
the quick check isn't a security problem.

All re-enabling SMB1 means is that we have to do many, many
more opens then we do in SMB2. For SMB1 every time the client
sends a pathname to query or modify we must open the target
internally and then close again afterwards.

The protect against races code is inside the open code path,
which is expensive.

In SMB2 the client will explicitly request an open and then
use the returned handle for all queries/modifications.



More information about the samba mailing list