From patchwork Mon Jun 24 07:11:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 11012429 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AA93513B4 for ; Mon, 24 Jun 2019 07:12:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9208028AF7 for ; Mon, 24 Jun 2019 07:12:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8372428B1E; Mon, 24 Jun 2019 07:12:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A69728885 for ; Mon, 24 Jun 2019 07:12:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727657AbfFXHMJ (ORCPT ); Mon, 24 Jun 2019 03:12:09 -0400 Received: from mail-pf1-f178.google.com ([209.85.210.178]:35027 "EHLO mail-pf1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727426AbfFXHMJ (ORCPT ); Mon, 24 Jun 2019 03:12:09 -0400 Received: by mail-pf1-f178.google.com with SMTP id d126so6973156pfd.2 for ; Mon, 24 Jun 2019 00:12:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=A6uW0hXAqPubh3icQhzVpx2t4ATg1HeTv3nyz8U5pxI=; b=mCSlw9dgDuHeQ+z69PIZglNE3wfxVjYSFWHGiKGvRPnZmWS/jyrFF0FlwcdJ7XbRav vT8TCMzLXMMPlnn3B017v206qkwBaQOEmyypSFUybC54isPH7+M4uBReVXTB7MBo3IR3 AwAglyuxLgvlMnAumtxteFfoXNql1/b//XsbzLnN8LIvf+RJbzxRdd216daMLsqY3QVC YIC9aloOJXJNn82/6N5bvoMpcF8jEWQsDuxbrBvURaF3Q7JS6IKFCmDBoUpO6sttPoMl tXbgAxJf7DXBjNR+gEHV5re6N0zgb9/4udrdDLaJRfAuP4scYw6aeLWCMrFdFGgyNy7W av4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=A6uW0hXAqPubh3icQhzVpx2t4ATg1HeTv3nyz8U5pxI=; b=gTWrcWh4MWiComMFTe2rqZE/RdwBD2GW2VGgPkReZzikStr0DuSagH7p+05+5z/7qX h9RYHY+8goGcFPiMZlys2+fJVlIXJAz71bfJdlp5MMZAJ00BI+WlMRJvDlbogw+ijV2R YeIjJLBc5KZHibF/LtNyfcwKXYlazZyKdxXn/xisApu9S0168W5dyrNHsW97Ogpp+UER vKkQY7zdXQs4UKjIxfG1r5PGOQfa2Jz6/Jx5Y3tdfXBxmS1QkSxLGJ56VVb6ObLOma2A aScpFGxThWv2OBzJhUfHCJeNavi2qhfhO6CLk9kfI8Iys1yauJBr0mkZx9xttnoMcCvw Ndcw== X-Gm-Message-State: APjAAAU3P+qZvY7+Tyisw0363s/PbCDVxbzPb+NzheKjXNTIDbZ06bOV x9Wh9Yb0WfNvKYnRnoxO5XK/29370PXX7557fCeVIbty X-Google-Smtp-Source: APXvYqy3w0+BIgSoEeP0jvigDFlf82PcsV2379Rm6pdGQZI7nqs46p+x5KHIxSR6LXBcjPUkBGyDSDSZqfUZyJcZjco= X-Received: by 2002:a17:90a:2385:: with SMTP id g5mr23633706pje.12.1561360328520; Mon, 24 Jun 2019 00:12:08 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Mon, 24 Jun 2019 02:11:57 -0500 Message-ID: Subject: [SMB3][PATCH] add mount option to allow retrieving POSIX mode from special ACE To: CIFS Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP See e.g. https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/hh509017(v=ws.10) where it describes use of an ACE with special SID S-1-5-88-3 to store the mode. Followon patches will add the support for chmod and query_info (stat) Reviewed-by: Ronnie Sahlberg From 952f30b31c903f8f6f4ca023061c108d16cc6df6 Mon Sep 17 00:00:00 2001 From: Steve French Date: Mon, 24 Jun 2019 02:01:42 -0500 Subject: [PATCH] smb3: add new mount option to retrieve mode from special ACE There is a special ACE used by some servers to allow the mode bits to be stored. This can be especially helpful in scenarios in which the client is trusted, and access checking on the client vs the POSIX mode bits is sufficient. Add mount option to allow enabling this behavior. Follow on patch will add the support to add chmod and queryinfo (stat) support for retrieving the POSIX mode bits from the special ACE, SID: S-1-5-88-3 See e.g. https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/hh509017(v=ws.10) Signed-off-by: Steve French --- fs/cifs/cifs_fs_sb.h | 1 + fs/cifs/cifsfs.c | 2 ++ fs/cifs/cifsglob.h | 2 +- fs/cifs/connect.c | 6 ++++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h index afa56237a0c3..744e48bdcb6c 100644 --- a/fs/cifs/cifs_fs_sb.h +++ b/fs/cifs/cifs_fs_sb.h @@ -52,6 +52,7 @@ #define CIFS_MOUNT_UID_FROM_ACL 0x2000000 /* try to get UID via special SID */ #define CIFS_MOUNT_NO_HANDLE_CACHE 0x4000000 /* disable caching dir handles */ #define CIFS_MOUNT_NO_DFS 0x8000000 /* disable DFS resolving */ +#define CIFS_MOUNT_MODE_FROM_ACE 0x10000000 /* retrieve mode from special ACE */ struct cifs_sb_info { struct rb_root tlink_tree; diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index dc5fd7a648f0..e33da73bd300 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -526,6 +526,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root) seq_puts(s, ",nobrl"); if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_HANDLE_CACHE) seq_puts(s, ",nohandlecache"); + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MODE_FROM_ACE) + seq_puts(s, ",modefromace"); if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) seq_puts(s, ",cifsacl"); if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 16f240911192..2c87547e42ab 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -618,7 +618,7 @@ struct smb_vol { CIFS_MOUNT_MULTIUSER | CIFS_MOUNT_STRICT_IO | \ CIFS_MOUNT_CIFS_BACKUPUID | CIFS_MOUNT_CIFS_BACKUPGID | \ CIFS_MOUNT_UID_FROM_ACL | CIFS_MOUNT_NO_HANDLE_CACHE | \ - CIFS_MOUNT_NO_DFS) + CIFS_MOUNT_NO_DFS | CIFS_MOUNT_MODE_FROM_ACE) /** * Generic VFS superblock mount flags (s_flags) to consider when diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index b8a60060d329..f7bc85775f96 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -175,6 +175,7 @@ static const match_table_t cifs_mount_option_tokens = { { Opt_serverino, "serverino" }, { Opt_noserverino, "noserverino" }, { Opt_rwpidforward, "rwpidforward" }, + { Opt_modeace, "modefromace" }, { Opt_cifsacl, "cifsacl" }, { Opt_nocifsacl, "nocifsacl" }, { Opt_acl, "acl" }, @@ -1830,6 +1831,9 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, case Opt_rwpidforward: vol->rwpidforward = 1; break; + case Opt_modeace: + vol->mode_ace = 1; + break; case Opt_cifsacl: vol->cifs_acl = 1; break; @@ -3976,6 +3980,8 @@ int cifs_setup_cifs_sb(struct smb_vol *pvolume_info, cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NOPOSIXBRL; if (pvolume_info->rwpidforward) cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_RWPIDFORWARD; + if (pvolume_info->mode_ace) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_MODE_FROM_ACE; if (pvolume_info->cifs_acl) cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_ACL; if (pvolume_info->backupuid_specified) { -- 2.20.1