diff mbox series

cifs: show the "w" bit for writeable /proc/fs/cifs/* files

Message ID CAH2r5mtOJcW0onUrwZ1nCG1pbT0f30Ne40c-Dss+-Lja7e-2dA@mail.gmail.com
State New
Headers show
Series cifs: show the "w" bit for writeable /proc/fs/cifs/* files | expand

Commit Message

Steve French May 24, 2018, 6:55 a.m. UTC
---------- Forwarded message ----------
From: Steve French <smfrench@gmail.com>
Date: Thu, May 24, 2018 at 1:53 AM
Subject: Re: [PATCH] cifs: show the "w" bit for writeable /proc/fs/cifs/* files
To: Ronnie Sahlberg <lsahlber@redhat.com>
Cc: linux-cifs <linux-cifs@vger.kernel.org>


merged into cifs-2.6.git for-next

I also added a patch to allow use to load "smb3" instead of just
"cifs" ("modprobe smb3" will now work not just "modprobe cifs" - we
really want to be encouraging people to use SMB3 and later for
security reasons (among others) and this will allow us to use the more
logical name 'smb3')

https://git.samba.org/?p=sfrench/cifs-2.6.git;a=commit;h=64a051adf5911e8a71a46413c60beaf17ce7143d

On Wed, May 23, 2018 at 11:18 PM, Ronnie Sahlberg <lsahlber@redhat.com> wrote:
>
> RHBZ: 1539612
>
> Lets show the "w" bit for those files have a .write interface to set/enable/...
> the feature.
>
> Reported-by: Xiaoli Feng <xifeng@redhat.com>
> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> ---
>  fs/cifs/cifs_debug.c | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
> index 9d69ea433330..22eb7b3c44fb 100644
> --- a/fs/cifs/cifs_debug.c
> +++ b/fs/cifs/cifs_debug.c
> @@ -500,32 +500,32 @@ cifs_proc_init(void)
>         proc_create("DebugData", 0, proc_fs_cifs, &cifs_debug_data_proc_fops);
>
>  #ifdef CONFIG_CIFS_STATS
> -       proc_create("Stats", 0, proc_fs_cifs, &cifs_stats_proc_fops);
> +       proc_create("Stats", 0644, proc_fs_cifs, &cifs_stats_proc_fops);
>  #endif /* STATS */
> -       proc_create("cifsFYI", 0, proc_fs_cifs, &cifsFYI_proc_fops);
> -       proc_create("traceSMB", 0, proc_fs_cifs, &traceSMB_proc_fops);
> -       proc_create("LinuxExtensionsEnabled", 0, proc_fs_cifs,
> +       proc_create("cifsFYI", 0644, proc_fs_cifs, &cifsFYI_proc_fops);
> +       proc_create("traceSMB", 0644, proc_fs_cifs, &traceSMB_proc_fops);
> +       proc_create("LinuxExtensionsEnabled", 0644, proc_fs_cifs,
>                     &cifs_linux_ext_proc_fops);
> -       proc_create("SecurityFlags", 0, proc_fs_cifs,
> +       proc_create("SecurityFlags", 0644, proc_fs_cifs,
>                     &cifs_security_flags_proc_fops);
> -       proc_create("LookupCacheEnabled", 0, proc_fs_cifs,
> +       proc_create("LookupCacheEnabled", 0644, proc_fs_cifs,
>                     &cifs_lookup_cache_proc_fops);
>  #ifdef CONFIG_CIFS_SMB_DIRECT
> -       proc_create("rdma_readwrite_threshold", 0, proc_fs_cifs,
> +       proc_create("rdma_readwrite_threshold", 0644, proc_fs_cifs,
>                 &cifs_rdma_readwrite_threshold_proc_fops);
> -       proc_create("smbd_max_frmr_depth", 0, proc_fs_cifs,
> +       proc_create("smbd_max_frmr_depth", 0644, proc_fs_cifs,
>                 &cifs_smbd_max_frmr_depth_proc_fops);
> -       proc_create("smbd_keep_alive_interval", 0, proc_fs_cifs,
> +       proc_create("smbd_keep_alive_interval", 0644, proc_fs_cifs,
>                 &cifs_smbd_keep_alive_interval_proc_fops);
> -       proc_create("smbd_max_receive_size", 0, proc_fs_cifs,
> +       proc_create("smbd_max_receive_size", 0644, proc_fs_cifs,
>                 &cifs_smbd_max_receive_size_proc_fops);
> -       proc_create("smbd_max_fragmented_recv_size", 0, proc_fs_cifs,
> +       proc_create("smbd_max_fragmented_recv_size", 0644, proc_fs_cifs,
>                 &cifs_smbd_max_fragmented_recv_size_proc_fops);
> -       proc_create("smbd_max_send_size", 0, proc_fs_cifs,
> +       proc_create("smbd_max_send_size", 0644, proc_fs_cifs,
>                 &cifs_smbd_max_send_size_proc_fops);
> -       proc_create("smbd_send_credit_target", 0, proc_fs_cifs,
> +       proc_create("smbd_send_credit_target", 0644, proc_fs_cifs,
>                 &cifs_smbd_send_credit_target_proc_fops);
> -       proc_create("smbd_receive_credit_max", 0, proc_fs_cifs,
> +       proc_create("smbd_receive_credit_max", 0644, proc_fs_cifs,
>                 &cifs_smbd_receive_credit_max_proc_fops);
>  #endif
>  }
> --
> 2.13.3
>

Comments

ronnie sahlberg May 24, 2018, 7:09 a.m. UTC | #1
I am all for a smb3 module alias, but is it possible to have a
different mount function/wrapper for it so that IF
you "modprobe smb3" then vers=3 is the default and you can NOT select
a lower version ?

I.e.
modprobe smb3
mount -o vers=1,...
=> error


On Thu, May 24, 2018 at 4:55 PM, Steve French <smfrench@gmail.com> wrote:
> ---------- Forwarded message ----------
> From: Steve French <smfrench@gmail.com>
> Date: Thu, May 24, 2018 at 1:53 AM
> Subject: Re: [PATCH] cifs: show the "w" bit for writeable /proc/fs/cifs/* files
> To: Ronnie Sahlberg <lsahlber@redhat.com>
> Cc: linux-cifs <linux-cifs@vger.kernel.org>
>
>
> merged into cifs-2.6.git for-next
>
> I also added a patch to allow use to load "smb3" instead of just
> "cifs" ("modprobe smb3" will now work not just "modprobe cifs" - we
> really want to be encouraging people to use SMB3 and later for
> security reasons (among others) and this will allow us to use the more
> logical name 'smb3')
>
> https://git.samba.org/?p=sfrench/cifs-2.6.git;a=commit;h=64a051adf5911e8a71a46413c60beaf17ce7143d
>
> On Wed, May 23, 2018 at 11:18 PM, Ronnie Sahlberg <lsahlber@redhat.com> wrote:
>>
>> RHBZ: 1539612
>>
>> Lets show the "w" bit for those files have a .write interface to set/enable/...
>> the feature.
>>
>> Reported-by: Xiaoli Feng <xifeng@redhat.com>
>> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
>> ---
>>  fs/cifs/cifs_debug.c | 28 ++++++++++++++--------------
>>  1 file changed, 14 insertions(+), 14 deletions(-)
>>
>> diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
>> index 9d69ea433330..22eb7b3c44fb 100644
>> --- a/fs/cifs/cifs_debug.c
>> +++ b/fs/cifs/cifs_debug.c
>> @@ -500,32 +500,32 @@ cifs_proc_init(void)
>>         proc_create("DebugData", 0, proc_fs_cifs, &cifs_debug_data_proc_fops);
>>
>>  #ifdef CONFIG_CIFS_STATS
>> -       proc_create("Stats", 0, proc_fs_cifs, &cifs_stats_proc_fops);
>> +       proc_create("Stats", 0644, proc_fs_cifs, &cifs_stats_proc_fops);
>>  #endif /* STATS */
>> -       proc_create("cifsFYI", 0, proc_fs_cifs, &cifsFYI_proc_fops);
>> -       proc_create("traceSMB", 0, proc_fs_cifs, &traceSMB_proc_fops);
>> -       proc_create("LinuxExtensionsEnabled", 0, proc_fs_cifs,
>> +       proc_create("cifsFYI", 0644, proc_fs_cifs, &cifsFYI_proc_fops);
>> +       proc_create("traceSMB", 0644, proc_fs_cifs, &traceSMB_proc_fops);
>> +       proc_create("LinuxExtensionsEnabled", 0644, proc_fs_cifs,
>>                     &cifs_linux_ext_proc_fops);
>> -       proc_create("SecurityFlags", 0, proc_fs_cifs,
>> +       proc_create("SecurityFlags", 0644, proc_fs_cifs,
>>                     &cifs_security_flags_proc_fops);
>> -       proc_create("LookupCacheEnabled", 0, proc_fs_cifs,
>> +       proc_create("LookupCacheEnabled", 0644, proc_fs_cifs,
>>                     &cifs_lookup_cache_proc_fops);
>>  #ifdef CONFIG_CIFS_SMB_DIRECT
>> -       proc_create("rdma_readwrite_threshold", 0, proc_fs_cifs,
>> +       proc_create("rdma_readwrite_threshold", 0644, proc_fs_cifs,
>>                 &cifs_rdma_readwrite_threshold_proc_fops);
>> -       proc_create("smbd_max_frmr_depth", 0, proc_fs_cifs,
>> +       proc_create("smbd_max_frmr_depth", 0644, proc_fs_cifs,
>>                 &cifs_smbd_max_frmr_depth_proc_fops);
>> -       proc_create("smbd_keep_alive_interval", 0, proc_fs_cifs,
>> +       proc_create("smbd_keep_alive_interval", 0644, proc_fs_cifs,
>>                 &cifs_smbd_keep_alive_interval_proc_fops);
>> -       proc_create("smbd_max_receive_size", 0, proc_fs_cifs,
>> +       proc_create("smbd_max_receive_size", 0644, proc_fs_cifs,
>>                 &cifs_smbd_max_receive_size_proc_fops);
>> -       proc_create("smbd_max_fragmented_recv_size", 0, proc_fs_cifs,
>> +       proc_create("smbd_max_fragmented_recv_size", 0644, proc_fs_cifs,
>>                 &cifs_smbd_max_fragmented_recv_size_proc_fops);
>> -       proc_create("smbd_max_send_size", 0, proc_fs_cifs,
>> +       proc_create("smbd_max_send_size", 0644, proc_fs_cifs,
>>                 &cifs_smbd_max_send_size_proc_fops);
>> -       proc_create("smbd_send_credit_target", 0, proc_fs_cifs,
>> +       proc_create("smbd_send_credit_target", 0644, proc_fs_cifs,
>>                 &cifs_smbd_send_credit_target_proc_fops);
>> -       proc_create("smbd_receive_credit_max", 0, proc_fs_cifs,
>> +       proc_create("smbd_receive_credit_max", 0644, proc_fs_cifs,
>>                 &cifs_smbd_receive_credit_max_proc_fops);
>>  #endif
>>  }
>> --
>> 2.13.3
>>
>
>
>
> --
> Thanks,
>
> Steve
>
>
>
> --
> Thanks,
>
> Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steve French May 24, 2018, 7:11 a.m. UTC | #2
probably yes - but let's do that as a followon patch.  Similarly am
adding a way to allow setting a minimum dialect as samba has (in
module params)

On Thu, May 24, 2018 at 2:09 AM, ronnie sahlberg
<ronniesahlberg@gmail.com> wrote:
> I am all for a smb3 module alias, but is it possible to have a
> different mount function/wrapper for it so that IF
> you "modprobe smb3" then vers=3 is the default and you can NOT select
> a lower version ?
>
> I.e.
> modprobe smb3
> mount -o vers=1,...
> => error
>
>
> On Thu, May 24, 2018 at 4:55 PM, Steve French <smfrench@gmail.com> wrote:
>> ---------- Forwarded message ----------
>> From: Steve French <smfrench@gmail.com>
>> Date: Thu, May 24, 2018 at 1:53 AM
>> Subject: Re: [PATCH] cifs: show the "w" bit for writeable /proc/fs/cifs/* files
>> To: Ronnie Sahlberg <lsahlber@redhat.com>
>> Cc: linux-cifs <linux-cifs@vger.kernel.org>
>>
>>
>> merged into cifs-2.6.git for-next
>>
>> I also added a patch to allow use to load "smb3" instead of just
>> "cifs" ("modprobe smb3" will now work not just "modprobe cifs" - we
>> really want to be encouraging people to use SMB3 and later for
>> security reasons (among others) and this will allow us to use the more
>> logical name 'smb3')
>>
>> https://git.samba.org/?p=sfrench/cifs-2.6.git;a=commit;h=64a051adf5911e8a71a46413c60beaf17ce7143d
>>
>> On Wed, May 23, 2018 at 11:18 PM, Ronnie Sahlberg <lsahlber@redhat.com> wrote:
>>>
>>> RHBZ: 1539612
>>>
>>> Lets show the "w" bit for those files have a .write interface to set/enable/...
>>> the feature.
>>>
>>> Reported-by: Xiaoli Feng <xifeng@redhat.com>
>>> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
>>> ---
>>>  fs/cifs/cifs_debug.c | 28 ++++++++++++++--------------
>>>  1 file changed, 14 insertions(+), 14 deletions(-)
>>>
>>> diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
>>> index 9d69ea433330..22eb7b3c44fb 100644
>>> --- a/fs/cifs/cifs_debug.c
>>> +++ b/fs/cifs/cifs_debug.c
>>> @@ -500,32 +500,32 @@ cifs_proc_init(void)
>>>         proc_create("DebugData", 0, proc_fs_cifs, &cifs_debug_data_proc_fops);
>>>
>>>  #ifdef CONFIG_CIFS_STATS
>>> -       proc_create("Stats", 0, proc_fs_cifs, &cifs_stats_proc_fops);
>>> +       proc_create("Stats", 0644, proc_fs_cifs, &cifs_stats_proc_fops);
>>>  #endif /* STATS */
>>> -       proc_create("cifsFYI", 0, proc_fs_cifs, &cifsFYI_proc_fops);
>>> -       proc_create("traceSMB", 0, proc_fs_cifs, &traceSMB_proc_fops);
>>> -       proc_create("LinuxExtensionsEnabled", 0, proc_fs_cifs,
>>> +       proc_create("cifsFYI", 0644, proc_fs_cifs, &cifsFYI_proc_fops);
>>> +       proc_create("traceSMB", 0644, proc_fs_cifs, &traceSMB_proc_fops);
>>> +       proc_create("LinuxExtensionsEnabled", 0644, proc_fs_cifs,
>>>                     &cifs_linux_ext_proc_fops);
>>> -       proc_create("SecurityFlags", 0, proc_fs_cifs,
>>> +       proc_create("SecurityFlags", 0644, proc_fs_cifs,
>>>                     &cifs_security_flags_proc_fops);
>>> -       proc_create("LookupCacheEnabled", 0, proc_fs_cifs,
>>> +       proc_create("LookupCacheEnabled", 0644, proc_fs_cifs,
>>>                     &cifs_lookup_cache_proc_fops);
>>>  #ifdef CONFIG_CIFS_SMB_DIRECT
>>> -       proc_create("rdma_readwrite_threshold", 0, proc_fs_cifs,
>>> +       proc_create("rdma_readwrite_threshold", 0644, proc_fs_cifs,
>>>                 &cifs_rdma_readwrite_threshold_proc_fops);
>>> -       proc_create("smbd_max_frmr_depth", 0, proc_fs_cifs,
>>> +       proc_create("smbd_max_frmr_depth", 0644, proc_fs_cifs,
>>>                 &cifs_smbd_max_frmr_depth_proc_fops);
>>> -       proc_create("smbd_keep_alive_interval", 0, proc_fs_cifs,
>>> +       proc_create("smbd_keep_alive_interval", 0644, proc_fs_cifs,
>>>                 &cifs_smbd_keep_alive_interval_proc_fops);
>>> -       proc_create("smbd_max_receive_size", 0, proc_fs_cifs,
>>> +       proc_create("smbd_max_receive_size", 0644, proc_fs_cifs,
>>>                 &cifs_smbd_max_receive_size_proc_fops);
>>> -       proc_create("smbd_max_fragmented_recv_size", 0, proc_fs_cifs,
>>> +       proc_create("smbd_max_fragmented_recv_size", 0644, proc_fs_cifs,
>>>                 &cifs_smbd_max_fragmented_recv_size_proc_fops);
>>> -       proc_create("smbd_max_send_size", 0, proc_fs_cifs,
>>> +       proc_create("smbd_max_send_size", 0644, proc_fs_cifs,
>>>                 &cifs_smbd_max_send_size_proc_fops);
>>> -       proc_create("smbd_send_credit_target", 0, proc_fs_cifs,
>>> +       proc_create("smbd_send_credit_target", 0644, proc_fs_cifs,
>>>                 &cifs_smbd_send_credit_target_proc_fops);
>>> -       proc_create("smbd_receive_credit_max", 0, proc_fs_cifs,
>>> +       proc_create("smbd_receive_credit_max", 0644, proc_fs_cifs,
>>>                 &cifs_smbd_receive_credit_max_proc_fops);
>>>  #endif
>>>  }
>>> --
>>> 2.13.3
>>>
>>
>>
>>
>> --
>> Thanks,
>>
>> Steve
>>
>>
>>
>> --
>> Thanks,
>>
>> Steve
diff mbox series

Patch

From 64a051adf5911e8a71a46413c60beaf17ce7143d Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Wed, 23 May 2018 21:44:53 -0500
Subject: [PATCH 1/2] smb3: add module alias for smb3 to cifs.ko

We really don't want to be encouraging people to use the old
(less secure) cifs dialect (SMB1) and it can be confusing for them
with SMB3 (or later) being recommended but the module name is cifs.

Add a module alias for "smb3" to cifs.ko to make this less confusing.

Signed-off-by: Steve French <smfrench@gmail.com>
---
 fs/cifs/cifsfs.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 62f166270459..645bb88f0ee4 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -899,6 +899,17 @@  struct file_system_type cifs_fs_type = {
 	/*  .fs_flags */
 };
 MODULE_ALIAS_FS("cifs");
+
+struct file_system_type smb3_fs_type = {
+	.owner = THIS_MODULE,
+	.name = "smb3",
+	.mount = cifs_do_mount,
+	.kill_sb = cifs_kill_sb,
+	/*  .fs_flags */
+};
+MODULE_ALIAS_FS("smb3");
+MODULE_ALIAS("smb3");
+
 const struct inode_operations cifs_dir_inode_ops = {
 	.create = cifs_create,
 	.atomic_open = cifs_atomic_open,
@@ -1437,6 +1448,12 @@  init_cifs(void)
 	if (rc)
 		goto out_init_cifs_idmap;
 
+	rc = register_filesystem(&smb3_fs_type);
+	if (rc) {
+		unregister_filesystem(&cifs_fs_type);
+		goto out_init_cifs_idmap;
+	}
+
 	return 0;
 
 out_init_cifs_idmap:
@@ -1467,8 +1484,9 @@  init_cifs(void)
 static void __exit
 exit_cifs(void)
 {
-	cifs_dbg(NOISY, "exit_cifs\n");
+	cifs_dbg(NOISY, "exit_smb3\n");
 	unregister_filesystem(&cifs_fs_type);
+	unregister_filesystem(&smb3_fs_type);
 	cifs_dfs_release_automount_timer();
 #ifdef CONFIG_CIFS_ACL
 	exit_cifs_idmap();
-- 
2.17.0