aboutsummaryrefslogtreecommitdiff
path: root/fs
AgeCommit message (Collapse)AuthorFilesLines
2020-12-14cifs: remove some minor warnings pointed out by kernel test robotSteve French1-0/+4
Correct some trivial warnings caused when new file unc.c was created. For example: In file included from fs/cifs/unc.c:11: >> fs/cifs/cifsproto.h:44:28: warning: 'struct TCP_Server_Info' declared inside parameter list will not be visible outside of this definition or declaration 44 | extern int smb_send(struct TCP_Server_Info *, struct smb_hdr *, Reported-by: kernel test robot <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-14cifs: remove various function description warningsSteve French4-7/+23
When compiling with W=1 I noticed various functions that did not follow proper style in describing (in the comments) the parameters passed in to the function. For example: fs/cifs/inode.c:2236: warning: Function parameter or member 'mode' not described in 'cifs_wait_bit_killable' I did not address the style warnings in two of the six files (connect.c and misc.c) in order to reduce risk of merge conflict with pending patches. We can update those later. Signed-off-by: Steve French <[email protected]>
2020-12-14cifs: Simplify reconnect code when dfs upcall is enabledSamuel Cabrero1-13/+8
Some witness notifications, like client move, tell the client to reconnect to a specific IP address. In this situation the DFS failover code path has to be skipped so clean up as much as possible the cifs_reconnect() code. Signed-off-by: Samuel Cabrero <[email protected]> Reviewed-by: Aurelien Aptel <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-14cifs: Send witness register messages to userspace daemon in echo taskSamuel Cabrero3-0/+22
If the daemon starts after mounting a share, or if it crashes, this provides a mechanism to register again. Signed-off-by: Samuel Cabrero <[email protected]> Reviewed-by: Aurelien Aptel <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-14cifs: Add witness information to debug data dumpSamuel Cabrero3-0/+50
+ Indicate if witness feature is supported + Indicate if witness is used when dumping tcons + Dumps witness registrations. Example: Witness registrations: Id: 1 Refs: 1 Network name: 'fs.fover.ad'(y) Share name: 'share1'(y) \ Ip address: 192.168.103.200(n) Signed-off-by: Samuel Cabrero <[email protected]> Reviewed-by: Aurelien Aptel <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-14cifs: Set witness notification handler for messages from userspace daemonSamuel Cabrero3-0/+99
+ Set a handler for the witness notification messages received from the userspace daemon. + Handle the resource state change notification. When the resource becomes unavailable or available set the tcp status to CifsNeedReconnect for all channels. Signed-off-by: Samuel Cabrero <[email protected]> Reviewed-by: Aurelien Aptel <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-14cifs: Send witness register and unregister commands to userspace daemonSamuel Cabrero5-3/+474
+ Define the generic netlink family commands and message attributes to communicate with the userspace daemon + The register and unregister commands are sent when connecting or disconnecting a tree. The witness registration keeps a pointer to the tcon and has the same lifetime. + Each registration has an id allocated by an IDR. This id is sent to the userspace daemon in the register command, and will be included in the notification messages from the userspace daemon to retrieve from the IDR the matching registration. + The authentication information is bundled in the register message. If kerberos is used the message just carries a flag. Signed-off-by: Samuel Cabrero <[email protected]> Reviewed-by: Aurelien Aptel <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-14cifs: minor updates to KconfigSteve French1-8/+8
Correct references to fs/cifs/README which has been replaced by Documentation/filesystems/admin-guide/cifs/usage.rst, and also correct a typo. Reviewed-by: Aurelien Aptel <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-14cifs: add witness mount option and data structsSamuel Cabrero5-0/+43
Add 'witness' mount option to register for witness notifications. Signed-off-by: Samuel Cabrero <[email protected]> Reviewed-by: Aurelien Aptel <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-14cifs: Register generic netlink familySamuel Cabrero5-1/+114
Register a new generic netlink family to talk to the witness service userspace daemon. Signed-off-by: Samuel Cabrero <[email protected]> Reviewed-by: Aurelien Aptel <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-14cifs: cleanup misc.cSteve French3-57/+68
misc.c was getting a little large, move two of the UNC parsing relating functions to a new C file unc.c which makes the coding of the upcoming witness protocol patch series a little cleaner as well. Suggested-by: Rafal Szczesniak <[email protected]> Reviewed-by: Aurelien Aptel <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-14cifs: minor kernel style fixes for commentsSteve French1-10/+15
Trivial fix for a few comments which didn't follow kernel style Signed-off-by: Steve French <[email protected]>
2020-12-14cifs: Make extract_sharename function publicSamuel Cabrero5-25/+26
Move the function to misc.c Signed-off-by: Samuel Cabrero <[email protected]> Reviewed-by: Aurelien Aptel <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-14cifs: Make extract_hostname function publicSamuel Cabrero3-34/+33
Move the function to misc.c and give it a public header. Signed-off-by: Samuel Cabrero <[email protected]> Reviewed-by: Aurelien Aptel <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-14ovl: unprivieged mountsMiklos Szeredi1-0/+1
Enable unprivileged user namespace mounts of overlayfs. Overlayfs's permission model (*) ensures that the mounter itself cannot gain additional privileges by the act of creating an overlayfs mount. This feature request is coming from the "rootless" container crowd. (*) Documentation/filesystems/overlayfs.txt#Permission model Signed-off-by: Miklos Szeredi <[email protected]>
2020-12-14ovl: do not get metacopy for userxattrMiklos Szeredi1-0/+7
When looking up an inode on the lower layer for which the mounter lacks read permisison the metacopy check will fail. This causes the lookup to fail as well, even though the directory is readable. So ignore EACCES for the "userxattr" case and assume no metacopy for the unreadable file. Signed-off-by: Miklos Szeredi <[email protected]>
2020-12-14ovl: do not fail because of O_NOATIMEMiklos Szeredi1-8/+3
In case the file cannot be opened with O_NOATIME because of lack of capabilities, then clear O_NOATIME instead of failing. Remove WARN_ON(), since it would now trigger if O_NOATIME was cleared. Noticed by Amir Goldstein. Signed-off-by: Miklos Szeredi <[email protected]>
2020-12-14ovl: do not fail when setting origin xattrMiklos Szeredi1-1/+2
Comment above call already says this, but only EOPNOTSUPP is ignored, other failures are not. For example setting "user.*" will fail with EPERM on symlink/special. Ignore this error as well. Signed-off-by: Miklos Szeredi <[email protected]>
2020-12-14ovl: user xattrMiklos Szeredi5-16/+71
Optionally allow using "user.overlay." namespace instead of "trusted.overlay." This is necessary for overlayfs to be able to be mounted in an unprivileged namepsace. Make the option explicit, since it makes the filesystem format be incompatible. Disable redirect_dir and metacopy options, because these would allow privilege escalation through direct manipulation of the "user.overlay.redirect" or "user.overlay.metacopy" xattrs. Signed-off-by: Miklos Szeredi <[email protected]> Reviewed-by: Amir Goldstein <[email protected]>
2020-12-14ovl: simplify file spliceMiklos Szeredi1-44/+2
generic_file_splice_read() and iter_file_splice_write() will call back into f_op->iter_read() and f_op->iter_write() respectively. These already do the real file lookup and cred override. So the code in ovl_splice_read() and ovl_splice_write() is redundant. In addition the ovl_file_accessed() call in ovl_splice_write() is incorrect, though probably harmless. Fix by calling generic_file_splice_read() and iter_file_splice_write() directly. Signed-off-by: Miklos Szeredi <[email protected]>
2020-12-14ovl: make ioctl() safeMiklos Szeredi1-71/+16
ovl_ioctl_set_flags() does a capability check using flags, but then the real ioctl double-fetches flags and uses potentially different value. The "Check the capability before cred override" comment misleading: user can skip this check by presenting benign flags first and then overwriting them to non-benign flags. Just remove the cred override for now, hoping this doesn't cause a regression. The proper solution is to create a new setxflags i_op (patches are in the works). Xfstests don't show a regression. Reported-by: Dmitry Vyukov <[email protected]> Signed-off-by: Miklos Szeredi <[email protected]> Reviewed-by: Amir Goldstein <[email protected]> Fixes: dab5ca8fd9dd ("ovl: add lsattr/chattr support") Cc: <[email protected]> # v4.19
2020-12-14ovl: check privs before decoding file handleMiklos Szeredi2-0/+6
CAP_DAC_READ_SEARCH is required by open_by_handle_at(2) so check it in ovl_decode_real_fh() as well to prevent privilege escalation for unprivileged overlay mounts. [Amir] If the mounter is not capable in init ns, ovl_check_origin() and ovl_verify_index() will not function as expected and this will break index and nfs export features. So check capability in ovl_can_decode_fh(), to auto disable those features. Signed-off-by: Miklos Szeredi <[email protected]>
2020-12-14vfs: verify source area in vfs_dedupe_file_range_one()Miklos Szeredi1-1/+9
Call remap_verify_area() on the source file as well as the destination. When called from vfs_dedupe_file_range() the check as already been performed, but not so if called from layered fs (overlayfs, etc...) Could ommit the redundant check in vfs_dedupe_file_range(), but leave for now to get error early (for fear of breaking backward compatibility). This call shouldn't be performance sensitive. Signed-off-by: Miklos Szeredi <[email protected]>
2020-12-14vfs: move cap_convert_nscap() call into vfs_setxattr()Miklos Szeredi1-6/+11
cap_convert_nscap() does permission checking as well as conversion of the xattr value conditionally based on fs's user-ns. This is needed by overlayfs and probably other layered fs (ecryptfs) and is what vfs_foo() is supposed to do anyway. Signed-off-by: Miklos Szeredi <[email protected]> Acked-by: James Morris <[email protected]>
2020-12-14NFSv4.2/pnfs: Don't use READ_PLUS with pNFS yetTrond Myklebust1-7/+8
We have no way of tracking server READ_PLUS support in pNFS for now, so just disable it. Reported-by: "Mkrtchyan, Tigran" <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2020-12-14NFSv4.2: Deal with potential READ_PLUS data extent buffer overflowTrond Myklebust1-2/+7
If the server returns more data than we have buffer space for, then we need to truncate and exit early. Signed-off-by: Trond Myklebust <[email protected]>
2020-12-14NFSv4.2: Don't error when exiting early on a READ_PLUS buffer overflowTrond Myklebust1-19/+17
Expanding the READ_PLUS extents can cause the read buffer to overflow. If it does, then don't error, but just exit early. Signed-off-by: Trond Myklebust <[email protected]>
2020-12-14NFSv4.2: Handle hole lengths that exceed the READ_PLUS read bufferTrond Myklebust1-0/+6
If a hole extends beyond the READ_PLUS read buffer, then we want to fill just the remaining buffer with zeros. Also ignore eof... Signed-off-by: Trond Myklebust <[email protected]>
2020-12-14NFSv4.2: decode_read_plus_hole() needs to check the extent offsetTrond Myklebust1-3/+21
The server is allowed to return a hole extent with an offset that starts before the offset supplied in the READ_PLUS argument. Ensure that we support that case too. Signed-off-by: Trond Myklebust <[email protected]>
2020-12-14NFSv4.2: decode_read_plus_data() must skip padding after data segmentTrond Myklebust1-1/+3
All XDR opaque object sizes are 32-bit aligned, and a data segment is no exception. Signed-off-by: Trond Myklebust <[email protected]>
2020-12-14NFSv4.2: Ensure we always reset the result->count in decode_read_plus()Trond Myklebust1-0/+1
Signed-off-by: Trond Myklebust <[email protected]>
2020-12-14NFSv4.1: use BITS_PER_LONG macro in nfs4session.hGeliang Tang1-1/+1
Use the existing BITS_PER_LONG macro instead of calculating the value. Signed-off-by: Geliang Tang <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2020-12-14NFSv4.2: improve page handling for GETXATTRFrank van der Linden2-16/+44
XDRBUF_SPARSE_PAGES can cause problems for the RDMA transport, and it's easy enough to allocate enough pages for the request up front, so do that. Also, since we've allocated the pages anyway, use the full page aligned length for the receive buffer. This will allow caching of valid replies that are too large for the caller, but that still fit in the allocated pages. Signed-off-by: Frank van der Linden <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
2020-12-13cifs: get rid of cifs_sb->mountdataRonnie Sahlberg4-18/+12
as we now have a full smb3_fs_context as part of the cifs superblock we no longer need a local copy of the mount options and can just reference the copy in the smb3_fs_context. Signed-off-by: Ronnie Sahlberg <[email protected]> Reviewed-by: Shyam Prasad N <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-13cifs: add an smb3_fs_context to cifs_sbRonnie Sahlberg3-34/+41
and populate it during mount in cifs_smb3_do_mount() Signed-off-by: Ronnie Sahlberg <[email protected]> Reviewed-by: Shyam Prasad N <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-13cifs: remove the devname argument to cifs_compose_mount_optionsRonnie Sahlberg4-22/+9
none of the callers use this argument any more. Signed-off-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-13cifs: switch to new mount apiRonnie Sahlberg10-1281/+1096
See Documentation/filesystems/mount_api.rst for details on new mount API Signed-off-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-13cifs: move cifs_parse_devname to fs_context.cRonnie Sahlberg3-57/+59
Also rename the function from cifs_ to smb3_ Signed-off-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-13cifs: move the enum for cifs parameters into fs_context.hRonnie Sahlberg2-57/+97
No change to logic, just moving the enum of cifs mount parms into a header Signed-off-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-13cifs: rename dup_vol to smb3_fs_context_dup and move it into fs_context.cRonnie Sahlberg3-60/+44
Continue restructuring needed for support of new mount API Signed-off-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-13cifs: rename smb_vol as smb3_fs_context and move it to fs_context.hRonnie Sahlberg12-736/+750
Harmonize and change all such variables to 'ctx', where possible. No changes to actual logic. Signed-off-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-13SMB3.1.1: do not log warning message if server doesn't populate saltSteve French2-5/+16
In the negotiate protocol preauth context, the server is not required to populate the salt (although it is done by most servers) so do not warn on mount. We retain the checks (warn) that the preauth context is the minimum size and that the salt does not exceed DataLength of the SMB response. Although we use the defaults in the case that the preauth context response is invalid, these checks may be useful in the future as servers add support for additional mechanisms. CC: Stable <[email protected]> Reviewed-by: Shyam Prasad N <[email protected]> Reviewed-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-13SMB3.1.1: update comments clarifying SPNEGO info in negprot responseSteve French1-1/+10
Trivial changes to clarify confusing comment about SPNEGO blog (and also one length comparisons in negotiate context parsing). Suggested-by: Tom Talpey <[email protected]> Suggested-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-13cifs: Enable sticky bit with cifsacl mount option.Shyam Prasad N3-12/+35
For the cifsacl mount option, we did not support sticky bits. With this patch, we do support it, by setting the DELETE_CHILD perm on the directory only for the owner user. When sticky bit is not enabled, allow DELETE_CHILD perm for everyone. Signed-off-by: Shyam Prasad N <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-13cifs: Fix unix perm bits to cifsacl conversion for "other" bits.Shyam Prasad N3-73/+155
With the "cifsacl" mount option, the mode bits set on the file/dir is converted to corresponding ACEs in DACL. However, only the ALLOWED ACEs were being set for "owner" and "group" SIDs. Since owner is a subset of group, and group is a subset of everyone/world SID, in order to properly emulate unix perm groups, we need to add DENIED ACEs. If we don't do that, "owner" and "group" SIDs could get more access rights than they should. Which is what was happening. This fixes it. We try to keep the "preferred" order of ACEs, i.e. DENYs followed by ALLOWs. However, for a small subset of cases we cannot maintain the preferred order. In that case, we'll end up with the DENY ACE for group after the ALLOW for the owner. If owner SID == group SID, use the more restrictive among the two perm bits and convert them to ACEs. Also, for reverse mapping, i.e. to convert ACL to unix perm bits, for the "others" bits, we needed to add the masked bits of the owner and group masks to others mask. Updated version of patch fixes a problem noted by the kernel test robot. Reported-by: kernel test robot <[email protected]> Signed-off-by: Shyam Prasad N <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-13SMB3.1.1: remove confusing mount warning when no SPNEGO info on negprot rspSteve French1-4/+12
Azure does not send an SPNEGO blob in the negotiate protocol response, so we shouldn't assume that it is there when validating the location of the first negotiate context. This avoids the potential confusing mount warning: CIFS: Invalid negotiate context offset CC: Stable <[email protected]> Reviewed-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-13SMB3: avoid confusing warning message on mount to AzureSteve French1-1/+2
Mounts to Azure cause an unneeded warning message in dmesg "CIFS: VFS: parse_server_interfaces: incomplete interface info" Azure rounds up the size (by 8 additional bytes, to a 16 byte boundary) of the structure returned on the query of the server interfaces at mount time. This is permissible even though different than other servers so do not log a warning if query network interfaces response is only rounded up by 8 bytes or fewer. CC: Stable <[email protected]> Reviewed-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-13cifs: Fix fall-through warnings for ClangGustavo A. R. Silva3-0/+3
In preparation to enable -Wimplicit-fallthrough for Clang, fix multiple warnings by explicitly adding multiple break/goto statements instead of just letting the code fall through to the next case. Link: https://github.com/KSPP/linux/issues/115 Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Steve French <[email protected]>
2020-12-13ubifs: ubifs_dump_node: Dump all branches of the index nodeZhihao Cheng1-1/+1
An index node can have up to c->fanout branches, all branches should be displayed while dumping index node. Signed-off-by: Zhihao Cheng <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2020-12-13ubifs: ubifs_dump_sleb: Remove unused functionZhihao Cheng2-18/+0
Function ubifs_dump_sleb() is defined but unused, it can be removed. Signed-off-by: Zhihao Cheng <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>