Skip to content

Commit 0613ed9

Browse files
committed
Merge tag '5.10-rc-smb3-fixes-part1' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs updates from Steve French: - add support for recognizing special file types (char/block/fifo/ symlink) for files created by Linux on WSL (a format we plan to move to as the default for creating special files on Linux, as it has advantages over the other current option, the SFU format) in readdir. - fix double queries to root directory when directory leases not supported (e.g. Samba) - fix querying mode bits (modefromsid mount option) for special file types - stronger encryption (gcm256), disabled by default until tested more broadly - allow querying owner when server reports 'well known SID' on query dir with SMB3.1.1 POSIX extensions * tag '5.10-rc-smb3-fixes-part1' of git://git.samba.org/sfrench/cifs-2.6: (30 commits) SMB3: add support for recognizing WSL reparse tags cifs: remove bogus debug code smb3.1.1: fix typo in compression flag cifs: move smb version mount options into fs_context.c cifs: move cache mount options to fs_context.ch cifs: move security mount options into fs_context.ch cifs: add files to host new mount api smb3: do not try to cache root directory if dir leases not supported smb3: fix stat when special device file and mounted with modefromsid cifs: Print the address and port we are connecting to in generic_ip_connect() SMB3: Resolve data corruption of TCP server info fields cifs: make const array static, makes object smaller SMB3.1.1: Fix ids returned in POSIX query dir smb3: add dynamic trace point to trace when credits obtained smb3.1.1: do not fail if no encryption required but server doesn't support it cifs: Return the error from crypt_message when enc/dec key not found. smb3.1.1: set gcm256 when requested smb3.1.1: rename nonces used for GCM and CCM encryption smb3.1.1: print warning if server does not support requested encryption type smb3.1.1: add new module load parm enable_gcm_256 ...
2 parents c4728cf + 13909d9 commit 0613ed9

22 files changed

Lines changed: 607 additions & 342 deletions

fs/cifs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cifs-y := trace.o cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o \
1010
cifs_unicode.o nterr.o cifsencrypt.o \
1111
readdir.o ioctl.o sess.o export.o smb1ops.o winucase.o \
1212
smb2ops.o smb2maperror.o smb2transport.o \
13-
smb2misc.o smb2pdu.o smb2inode.o smb2file.o cifsacl.o
13+
smb2misc.o smb2pdu.o smb2inode.o smb2file.o cifsacl.o fs_context.o
1414

1515
cifs-$(CONFIG_CIFS_XATTR) += xattr.o
1616

fs/cifs/asn1.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
530530
return 0;
531531
} else if ((cls != ASN1_CTX) || (con != ASN1_CON)
532532
|| (tag != ASN1_EOC)) {
533-
cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p (%d) exit 0\n",
534-
cls, con, tag, end, *end);
533+
cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p exit 0\n",
534+
cls, con, tag, end);
535535
return 0;
536536
}
537537

@@ -541,8 +541,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
541541
return 0;
542542
} else if ((cls != ASN1_UNI) || (con != ASN1_CON)
543543
|| (tag != ASN1_SEQ)) {
544-
cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p (%d) exit 1\n",
545-
cls, con, tag, end, *end);
544+
cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p exit 1\n",
545+
cls, con, tag, end);
546546
return 0;
547547
}
548548

@@ -552,8 +552,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
552552
return 0;
553553
} else if ((cls != ASN1_CTX) || (con != ASN1_CON)
554554
|| (tag != ASN1_EOC)) {
555-
cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p (%d) exit 0\n",
556-
cls, con, tag, end, *end);
555+
cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p exit 0\n",
556+
cls, con, tag, end);
557557
return 0;
558558
}
559559

@@ -564,8 +564,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
564564
return 0;
565565
} else if ((cls != ASN1_UNI) || (con != ASN1_CON)
566566
|| (tag != ASN1_SEQ)) {
567-
cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p (%d) exit 1\n",
568-
cls, con, tag, end, *end);
567+
cifs_dbg(FYI, "cls = %d con = %d tag = %d sequence_end = %p exit 1\n",
568+
cls, con, tag, sequence_end);
569569
return 0;
570570
}
571571

fs/cifs/cifs_unicode.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,13 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen,
488488
else if (map_chars == SFM_MAP_UNI_RSVD) {
489489
bool end_of_string;
490490

491-
if (i == srclen - 1)
491+
/**
492+
* Remap spaces and periods found at the end of every
493+
* component of the path. The special cases of '.' and
494+
* '..' do not need to be dealt with explicitly because
495+
* they are addressed in namei.c:link_path_walk().
496+
**/
497+
if ((i == srclen - 1) || (source[i+1] == '\\'))
492498
end_of_string = true;
493499
else
494500
end_of_string = false;

fs/cifs/cifsacl.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ id_to_sid(unsigned int cid, uint sidtype, struct cifs_sid *ssid)
338338
goto out_key_put;
339339
}
340340

341-
static int
341+
int
342342
sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,
343343
struct cifs_fattr *fattr, uint sidtype)
344344
{
@@ -359,7 +359,8 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,
359359
return -EIO;
360360
}
361361

362-
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UID_FROM_ACL) {
362+
if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UID_FROM_ACL) ||
363+
(cifs_sb_master_tcon(cifs_sb)->posix_extensions)) {
363364
uint32_t unix_id;
364365
bool is_group;
365366

fs/cifs/cifsfs.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ bool enable_oplocks = true;
7171
bool linuxExtEnabled = true;
7272
bool lookupCacheEnabled = true;
7373
bool disable_legacy_dialects; /* false by default */
74+
bool enable_gcm_256; /* false by default, change when more servers support it */
75+
bool require_gcm_256; /* false by default */
7476
unsigned int global_secflags = CIFSSEC_DEF;
7577
/* unsigned int ntlmv2_support = 0; */
7678
unsigned int sign_CIFS_PDUs = 1;
@@ -104,6 +106,12 @@ MODULE_PARM_DESC(slow_rsp_threshold, "Amount of time (in seconds) to wait "
104106
module_param(enable_oplocks, bool, 0644);
105107
MODULE_PARM_DESC(enable_oplocks, "Enable or disable oplocks. Default: y/Y/1");
106108

109+
module_param(enable_gcm_256, bool, 0644);
110+
MODULE_PARM_DESC(enable_gcm_256, "Enable requesting strongest (256 bit) GCM encryption. Default: n/N/0");
111+
112+
module_param(require_gcm_256, bool, 0644);
113+
MODULE_PARM_DESC(require_gcm_256, "Require strongest (256 bit) GCM encryption. Default: n/N/0");
114+
107115
module_param(disable_legacy_dialects, bool, 0644);
108116
MODULE_PARM_DESC(disable_legacy_dialects, "To improve security it may be "
109117
"helpful to restrict the ability to "

fs/cifs/cifsglob.h

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -195,18 +195,6 @@ struct smb_rqst {
195195
unsigned int rq_tailsz; /* length of last page */
196196
};
197197

198-
enum smb_version {
199-
Smb_1 = 1,
200-
Smb_20,
201-
Smb_21,
202-
Smb_30,
203-
Smb_302,
204-
Smb_311,
205-
Smb_3any,
206-
Smb_default,
207-
Smb_version_err
208-
};
209-
210198
struct mid_q_entry;
211199
struct TCP_Server_Info;
212200
struct cifsFileInfo;
@@ -510,6 +498,8 @@ struct smb_version_operations {
510498
struct fiemap_extent_info *, u64, u64);
511499
/* version specific llseek implementation */
512500
loff_t (*llseek)(struct file *, struct cifs_tcon *, loff_t, int);
501+
/* Check for STATUS_IO_TIMEOUT */
502+
bool (*is_status_io_timeout)(char *buf);
513503
};
514504

515505
struct smb_version_values {
@@ -1954,6 +1944,8 @@ extern bool lookupCacheEnabled;
19541944
extern unsigned int global_secflags; /* if on, session setup sent
19551945
with more secure ntlmssp2 challenge/resp */
19561946
extern unsigned int sign_CIFS_PDUs; /* enable smb packet signing */
1947+
extern bool enable_gcm_256; /* allow optional negotiate of strongest signing (aes-gcm-256) */
1948+
extern bool require_gcm_256; /* require use of strongest signing (aes-gcm-256) */
19571949
extern bool linuxExtEnabled;/*enable Linux/Unix CIFS extensions*/
19581950
extern unsigned int CIFSMaxBufSize; /* max size not including hdr */
19591951
extern unsigned int cifs_min_rcv; /* min size of big ntwrk buf pool */

fs/cifs/cifsproto.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ extern int cifs_set_file_info(struct inode *inode, struct iattr *attrs,
209209
extern int cifs_rename_pending_delete(const char *full_path,
210210
struct dentry *dentry,
211211
const unsigned int xid);
212+
extern int sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,
213+
struct cifs_fattr *fattr, uint sidtype);
212214
extern int cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb,
213215
struct cifs_fattr *fattr, struct inode *inode,
214216
bool get_mode_from_special_sid,

0 commit comments

Comments
 (0)