s m b 3 1 1
play

S + M B 3. 1 1 Steve French Principal Software Engineer - PowerPoint PPT Presentation

State of the SMB3.11 POSIX Extensions S + M B 3. 1 1 Steve French Principal Software Engineer Azure Storage - Microsoft Legal Statement This work represents the views of the author(s) and does not necessarily reflect the views of


  1. State of the SMB3.11 POSIX Extensions S + M B 3. 1 1 Steve French Principal Software Engineer Azure Storage - Microsoft

  2. Legal Statement – This work represents the views of the author(s) and does not necessarily reflect the views of Microsoft – Linux is a registered trademark of Linus Torvalds. – Other company, product, and service names may be trademarks or service marks of others.

  3. Outline ● What is POSIX? ● Why do these extensions matter? ● Demo ● What if we don't have them? – What works? – Some history: CIFS Extensions – Alternatives ● Some details ● What if Linux continues to extend, to improve?

  4. POSIX != Linux (Linux API is much bigger)

  5. Linux is BIG ● Currently 293 Linux syscalls! vs ● About 100 POSIX API calls

  6. Motivations for Extensions ● Linux Apps work! – Case sensitivity e.g. is required for the kernel to build on Linux – (And Linux and other posix-like operating systems want posix behavior for files whether on premise or in cloud) ● Improve common situations where customers have Linux and Windows and Mac clients accessing the same data ● Deprecation of CIFS – make sure extensions work with most secure, most optimal SMB3.1.1 dialect

  7. What could you try today? ● For obvious reasons, these experimental changes are not turned on by default so … – With current mainline Linux (4.18-rc) – You must mount with “vers=3.11” – AND also specify new mount option “posix” – Only a few limited protocol features (posix open context request) can be tried but although small change it is VERY useful and enough to experiment with and test various apps ● JRA has a tree on samba.org (git.samba.org/jra/samba/.git in branch “master-smb2”) with prototype server code

  8. Note the new mount option “posix” vs “nounix” (in default SMB3.11 mount)

  9. Mode bits on create and case sensitivity work!

  10. Rename works with POSIX extensions!

  11. Details – Negotiate Request (w/POSIX)

  12. Details (continued) – Neg response

  13. Details continued – Create (POSIX) req

  14. Details continued – create response

  15. What works ● Without Extensions – Demo

  16. Other Alternatives: AAPL

  17. Note that Apple create context (AAPL) can be used for some of this

  18. And the response:

  19. CIFS Unix/POSIX Extensions ● What was wrong with what we had? – Remember CIFS Deprecation? – And not just due to WannaCry … ● SMB3 is really good … ● Apple SMB2/SMB3 create context does handle case sensitivity, but not all POSIX compatibility issues

  20. Client Perspective ● What about the Linux Kernel? – What does it really need from SMB3 to be optimal…? – Not just to do 'cool' things: compile kernel on SMB3 mount, boot linux (show blazing performance …!) – For all key features: SMB3 >= CIFS with/Unix Extensions ● We are not asking user to go backwards – Can we extend them as Linux API moves ● (Did we mention that mount API and fsinfo/statfs BOTH are changing – see Al Viro’s git tree … and that statx was added last year and Linux continues to evolve ...)

  21. The challenges of Create/Rename/ Delete

  22. The challenges of POSIX inode metadata ● What do we need to be able to return? ● What about mode bits and ACLs?

  23. The Challenges of POSIX locking

  24. The Challenges of POSIX FS info

  25. Remember JRA’s Server Perspective? ● Learn from the mistakes of SMB1 Unix extensions. – Security issues paramount. – Remove the possibility of server-followed symlinks ● Break interoperability with NFS :-(, but necessary. ● Minimum Necessary Change (with apologies to Asimov’s “ The End of Eternity ”). – Fewer changes to the protocol the better. – Use the fact that we have experience with Samba in sharing between Windows and UNIX SMB connections.

  26. Server Perspective Continued.. ● Server-followed symlinks that the client can create have been a security disaster in Samba. ● Server-following symlinks is a useful holdover from ancient times, when admin-created symlinks gave great flexibility to setups. – As soon as clients gained the ability via UNIX extensions to create symlinks, disaster strikes. – Failed design decision to store these as real symlinks on the server filesystem. ● Convenience for dual NFS / SMB1 servers. ● THIS MUST NOT BE ALLOWED FOR SMB2+

  27. Server Perspective Continued.. ● The key for SMB2 UNIX extensions is to allow simultaneous Windows and UNIX handles – using SMB2 create contexts. – Adding UNIX extension create context turns on POSIX behavior for this handle only. – Allows client code to probe for POSIX behavior – SMB2 specifies unknown create contexts are ignored. – The Samba server already has to handle this case in serving POSIX and non-POSIX client simultaneously. ● Leads to new Negotiate context requirement from the server. – That way a client can determine if a server could support POSIX behavior on a handle, but choses not to. – POSIX servers may expose POSIX behaviors or deny them depending on pathname (crossing mount points).

  28. Server Perspective Continued.. ● The rest of the changes are relatively small. ● One new info level needed to cope with POSIX stat returns. ● Keep protocol as close to “native” Windows as possible. – Map POSIX ‘mode’ into Windows ACL encoding. – No POSIX ACLs – return everything as Windows ACLs. – No POSIX uid/gids – return everything as Windows SIDs. ● Client systems must cope with mapping SIDs anyway. ● Filename handling (POSIX specific, case sensitive) is the largest change. No access to Windows streams. – If you want a Windows stream handle, open a Windows stream handle. – Keep USC2 encoding (no change from Windows). UTF-8 would be nice, but not strictly required so drop it. ● Allow server to associate modified behavior on a per-handle basis.

  29. Proposed SMB3 POSIX Extensions ● Negotiate Protocol – SMB3.1.1 (or later required) ● POSIX Negotiate Context 0x100 ● Version is implied by the context (in case extensions are revised in the future to a version 2 or 3 …) but there is a reserved field that can be used in emergency – If POSIX open contexts not supported, negotiate context must be ignored – If POSIX open contexts supported for some files then negotiate context is returned, but server must fail opens with POSIX contexts for files where POSIX is not supported (rather than ignoring the POSIX context) ● Tree Connect – in future dialects tree connect contexts may allow more granularity in allowing servers to tell clients which shares they can't use POSIX opens on

  30. POSIX Extension Requirements ● If server returns a POSIX create context on an open: – It supports case sensitive names on this path – It supports POSIX unlink/rename semantics on this file – It supports advisory (POSIX) locking on this file. ● Actually they are “OFD” not “POSIX” locks (see e.g. https://gavv.github.io/blog/file-locks/#emulating-open-file-descri ption-locks ) – NEED TO VERIFY : PATH names are not remapped (no SFU remap needed for * and \ and > and < and : …). UCS2 converted directly to UTF-8 and server supports POSIX pathnames

  31. Other ● Hardlinks use the Windows setinfo call (already used by cifs.ko etc) ● Symlinks are client-only (opaque to server) can use “mfsymlinks” (as Mac and cifs.ko already do) or the Windows NFS symlink reparse point. Servers do not follow these symlinks (for obvious security reasons) ● Other linux extensions, e.g. fallocate are mapped to existing SMB3 operations where possible

  32. Proposed POSIX Extensions ● Create/Open – New POSIX create context ● If POSIX supported then context must be returned on all opens for which POSIX create context was sent (or open should be failed) ● It is allowed to have POSIX and non-POSIX opens on the same file ● It is allowed to have some files in a server which are POSIX and some which are not

  33. POSIX open/create context resp. ● __u32 number_of_hardlinks ● __u32 flags; / * 0000001 FLAG_REPARSE * / ● __u32 perms; / * mode & ~S_IFMT * / ● struct dom_sid sid_owner; / * variable length * / ● struct dom_sid sid_group; / * variable length * /

  34. SMB2/SMB3 Create Contexts We define a new context name for this new CreateContext to distinguish it from others like MxAc and RqLs and a buffer to include POSIX Information in request and response SMB2_CREATE_TAG_POSIX = "\x93\xAD\x25\x50\x9C\xB4\x11\xE7\xB4\x23\x83\xDE\x96\x8B\xCD\x7C"

  35. Proposed POSIX Infolevels ● Query/SetInfo and Query_DIR – Level 0x64 SMB2_FIND_POSIX_INFORMATION – Payload variable (Max = 216 bytes) ● Timestamps ● File size ● Dos attributes ● U64 Inode number ● U32 device id ● U32 zero ● Struct posix_create_context_response

Recommend


More recommend