Commit 0fdfef9a authored by Steve French's avatar Steve French
Browse files

smb3: simplify code by removing CONFIG_CIFS_SMB311



We really, really want to be encouraging use of secure dialects,
and SMB3.1.1 offers useful security features, and will soon
be the recommended dialect for many use cases. Simplify the code
by removing the CONFIG_CIFS_SMB311 ifdef so users don't disable
it in the build, and create compatibility and/or security issues
with modern servers - many of which have been supporting this
dialect for multiple years.

Also clarify some of the Kconfig text for cifs.ko about
SMB3.1.1 and current supported features in the module.

Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
Acked-by: default avatarAurelien Aptel <aaptel@suse.com>
Reviewed-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
parent 950132af
Loading
Loading
Loading
Loading
+14 −19
Original line number Diff line number Diff line
@@ -16,24 +16,28 @@ config CIFS
	select CRYPTO_DES
	help
	  This is the client VFS module for the SMB3 family of NAS protocols,
	  as well as for earlier dialects such as SMB2.1, SMB2 and the
	  (including support for the most recent, most secure dialect SMB3.1.1)
	  as well as for earlier dialects such as SMB2.1, SMB2 and the older
	  Common Internet File System (CIFS) protocol.  CIFS was the successor
	  to the original dialect, the Server Message Block (SMB) protocol, the
	  native file sharing mechanism for most early PC operating systems.

	  The SMB3 protocol is supported by most modern operating systems and
	  NAS appliances (e.g. Samba, Windows 8, Windows 2012, MacOS).
	  The SMB3 protocol is supported by most modern operating systems
	  and NAS appliances (e.g. Samba, Windows 10, Windows Server 2016,
	  MacOS) and even in the cloud (e.g. Microsoft Azure).
	  The older CIFS protocol was included in Windows NT4, 2000 and XP (and
	  later) as well by Samba (which provides excellent CIFS and SMB3
	  server support for Linux and many other operating systems). Limited
	  support for OS/2 and Windows ME and similar very old servers is
	  provided as well.
	  server support for Linux and many other operating systems). Use of
	  dialects older than SMB2.1 is often discouraged on public networks.
	  This module also provides limited support for OS/2 and Windows ME
	  and similar very old servers.

	  The cifs module provides an advanced network file system client
	  This module provides an advanced network file system client
	  for mounting to SMB3 (and CIFS) compliant servers.  It includes
	  support for DFS (hierarchical name space), secure per-user
	  session establishment via Kerberos or NTLM or NTLMv2,
	  safe distributed caching (oplock), optional packet
	  session establishment via Kerberos or NTLM or NTLMv2, RDMA
	  (smbdirect), advanced security features, per-share encryption,
	  directory leases, safe distributed caching (oplock), optional packet
	  signing, Unicode and other internationalization improvements.

	  In general, the default dialects, SMB3 and later, enable better
@@ -43,7 +47,7 @@ config CIFS
	  than SMB3 mounts. SMB2/SMB3 mount options are also
	  slightly simpler (compared to CIFS) due to protocol improvements.

	  If you need to mount to Samba, Macs or Windows from this machine, say Y.
	  If you need to mount to Samba, Azure, Macs or Windows from this machine, say Y.

config CIFS_STATS
        bool "CIFS statistics"
@@ -201,15 +205,6 @@ config CIFS_NFSD_EXPORT
	  help
	   Allows NFS server to export a CIFS mounted share (nfsd over cifs)

config CIFS_SMB311
	bool "SMB3.1.1 network file system support"
	depends on CIFS
	select CRYPTO_SHA512

	help
	  This enables support for the newest, and most secure dialect, SMB3.11.
	  If unsure, say Y

config CIFS_SMB_DIRECT
	bool "SMB Direct support (Experimental)"
	depends on CIFS=m && INFINIBAND && INFINIBAND_ADDR_TRANS || CIFS=y && INFINIBAND=y && INFINIBAND_ADDR_TRANS=y
+1 −2
Original line number Diff line number Diff line
@@ -275,10 +275,9 @@ skip_rdma:
			server->credits,  server->dialect);
		if (server->sign)
			seq_printf(m, " signed");
#ifdef CONFIG_CIFS_SMB311
		if (server->posix_ext_supported)
			seq_printf(m, " posix");
#endif /* 3.1.1 */

		i++;
		list_for_each(tmp2, &server->smb_ses_list) {
			ses = list_entry(tmp2, struct cifs_ses,
+0 −8
Original line number Diff line number Diff line
@@ -483,20 +483,12 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
		seq_puts(s, ",persistenthandles");
	else if (tcon->use_resilient)
		seq_puts(s, ",resilienthandles");

#ifdef CONFIG_CIFS_SMB311
	if (tcon->posix_extensions)
		seq_puts(s, ",posix");
	else if (tcon->unix_ext)
		seq_puts(s, ",unix");
	else
		seq_puts(s, ",nounix");
#else
	if (tcon->unix_ext)
		seq_puts(s, ",unix");
	else
		seq_puts(s, ",nounix");
#endif /* SMB311 */
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)
		seq_puts(s, ",posixpaths");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID)
+0 −8
Original line number Diff line number Diff line
@@ -191,9 +191,7 @@ enum smb_version {
	Smb_21,
	Smb_30,
	Smb_302,
#ifdef CONFIG_CIFS_SMB311
	Smb_311,
#endif /* SMB311 */
	Smb_3any,
	Smb_default,
	Smb_version_err
@@ -687,12 +685,10 @@ struct TCP_Server_Info {
#endif
	unsigned int	max_read;
	unsigned int	max_write;
#ifdef CONFIG_CIFS_SMB311
	__le16	cipher_type;
	 /* save initital negprot hash */
	__u8	preauth_sha_hash[SMB2_PREAUTH_HASH_SIZE];
	bool	posix_ext_supported;
#endif /* 3.1.1 */
	struct delayed_work reconnect; /* reconnect workqueue job */
	struct mutex reconnect_mutex; /* prevent simultaneous reconnects */
	unsigned long echo_interval;
@@ -886,9 +882,7 @@ struct cifs_ses {
	__u8 smb3signingkey[SMB3_SIGN_KEY_SIZE];
	__u8 smb3encryptionkey[SMB3_SIGN_KEY_SIZE];
	__u8 smb3decryptionkey[SMB3_SIGN_KEY_SIZE];
#ifdef CONFIG_CIFS_SMB311
	__u8 preauth_sha_hash[SMB2_PREAUTH_HASH_SIZE];
#endif /* 3.1.1 */

	/*
	 * Network interfaces available on the server this session is
@@ -997,9 +991,7 @@ struct cifs_tcon {
	bool seal:1;      /* transport encryption for this mounted share */
	bool unix_ext:1;  /* if false disable Linux extensions to CIFS protocol
				for this mount even if server would support */
#ifdef CONFIG_CIFS_SMB311
	bool posix_extensions; /* if true SMB3.11 posix extensions enabled */
#endif /* CIFS_311 */
	bool local_lease:1; /* check leases (only) on local system not remote */
	bool broken_posix_open; /* e.g. Samba server versions < 3.3.2, 3.2.9 */
	bool broken_sparse_sup; /* if server or share does not support sparse */
+1 −10
Original line number Diff line number Diff line
@@ -303,10 +303,8 @@ static const match_table_t cifs_smb_version_tokens = {
	{ Smb_21, SMB21_VERSION_STRING },
	{ Smb_30, SMB30_VERSION_STRING },
	{ Smb_302, SMB302_VERSION_STRING },
#ifdef CONFIG_CIFS_SMB311
	{ Smb_311, SMB311_VERSION_STRING },
	{ Smb_311, ALT_SMB311_VERSION_STRING },
#endif /* SMB311 */
	{ Smb_3any, SMB3ANY_VERSION_STRING },
	{ Smb_default, SMBDEFAULT_VERSION_STRING },
	{ Smb_version_err, NULL }
@@ -1219,12 +1217,10 @@ cifs_parse_smb_version(char *value, struct smb_vol *vol, bool is_smb3)
		vol->ops = &smb30_operations; /* currently identical with 3.0 */
		vol->vals = &smb302_values;
		break;
#ifdef CONFIG_CIFS_SMB311
	case Smb_311:
		vol->ops = &smb311_operations;
		vol->vals = &smb311_values;
		break;
#endif /* SMB311 */
	case Smb_3any:
		vol->ops = &smb30_operations; /* currently identical with 3.0 */
		vol->vals = &smb3any_values;
@@ -3039,7 +3035,6 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info)
		}
	}

#ifdef CONFIG_CIFS_SMB311
	if (volume_info->linux_ext) {
		if (ses->server->posix_ext_supported) {
			tcon->posix_extensions = true;
@@ -3051,7 +3046,6 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info)
			goto out_fail;
		}
	}
#endif /* 311 */

	/*
	 * BB Do we need to wrap session_mutex around this TCon call and Unix
@@ -4005,11 +3999,9 @@ try_mount_again:
		goto remote_path_check;
	}

#ifdef CONFIG_CIFS_SMB311
	/* if new SMB3.11 POSIX extensions are supported do not remap / and \ */
	if (tcon->posix_extensions)
		cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_POSIX_PATHS;
#endif /* SMB3.11 */

	/* tell server which Unix caps we support */
	if (cap_unix(tcon->ses)) {
@@ -4472,11 +4464,10 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid)
		goto out;
	}

#ifdef CONFIG_CIFS_SMB311
	/* if new SMB3.11 POSIX extensions are supported do not remap / and \ */
	if (tcon->posix_extensions)
		cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_POSIX_PATHS;
#endif /* SMB3.11 */

	if (cap_unix(ses))
		reset_cifs_unix_caps(0, tcon, NULL, vol_info);

Loading