1. 03 6月, 2021 5 次提交
    • S
      smb3: when mounting with multichannel include it in requested capabilities · 5a9940b0
      Steve French 提交于
      stable inclusion
      from stable-5.10.36
      commit 796b8263752890976b8df9692852ec8fcb36549a
      bugzilla: 51867
      CVE: NA
      
      --------------------------------
      
      commit 679971e7 upstream.
      
      In the SMB3/SMB3.1.1 negotiate protocol request, we are supposed to
      advertise CAP_MULTICHANNEL capability when establishing multiple
      channels has been requested by the user doing the mount. See MS-SMB2
      sections 2.2.3 and 3.2.5.2
      
      Without setting it there is some risk that multichannel could fail
      if the server interpreted the field strictly.
      Reviewed-By: NTom Talpey <tom@talpey.com>
      Reviewed-by: NShyam Prasad N <sprasad@microsoft.com>
      Cc: <stable@vger.kernel.org> # v5.8+
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NWeilong Chen <chenweilong@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      5a9940b0
    • A
      smb2: fix use-after-free in smb2_ioctl_query_info() · 491b6804
      Aurelien Aptel 提交于
      stable inclusion
      from stable-5.10.36
      commit 5f2adf84624efe2fef48d2501bc3ccf660b280f1
      bugzilla: 51867
      CVE: NA
      
      --------------------------------
      
      commit ccd48ec3 upstream.
      
      * rqst[1,2,3] is allocated in vars
      * each rqst->rq_iov is also allocated in vars or using pooled memory
      
      SMB2_open_free, SMB2_ioctl_free, SMB2_query_info_free are iterating on
      each rqst after vars has been freed (use-after-free), and they are
      freeing the kvec a second time (double-free).
      
      How to trigger:
      
      * compile with KASAN
      * mount a share
      
      $ smbinfo quota /mnt/foo
      Segmentation fault
      $ dmesg
      
       ==================================================================
       BUG: KASAN: use-after-free in SMB2_open_free+0x1c/0xa0
       Read of size 8 at addr ffff888007b10c00 by task python3/1200
      
       CPU: 2 PID: 1200 Comm: python3 Not tainted 5.12.0-rc6+ #107
       Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.14.0-0-g155821a-rebuilt.opensuse.org 04/01/2014
       Call Trace:
        dump_stack+0x93/0xc2
        print_address_description.constprop.0+0x18/0x130
        ? SMB2_open_free+0x1c/0xa0
        ? SMB2_open_free+0x1c/0xa0
        kasan_report.cold+0x7f/0x111
        ? smb2_ioctl_query_info+0x240/0x990
        ? SMB2_open_free+0x1c/0xa0
        SMB2_open_free+0x1c/0xa0
        smb2_ioctl_query_info+0x2bf/0x990
        ? smb2_query_reparse_tag+0x600/0x600
        ? cifs_mapchar+0x250/0x250
        ? rcu_read_lock_sched_held+0x3f/0x70
        ? cifs_strndup_to_utf16+0x12c/0x1c0
        ? rwlock_bug.part.0+0x60/0x60
        ? rcu_read_lock_sched_held+0x3f/0x70
        ? cifs_convert_path_to_utf16+0xf8/0x140
        ? smb2_check_message+0x6f0/0x6f0
        cifs_ioctl+0xf18/0x16b0
        ? smb2_query_reparse_tag+0x600/0x600
        ? cifs_readdir+0x1800/0x1800
        ? selinux_bprm_creds_for_exec+0x4d0/0x4d0
        ? do_user_addr_fault+0x30b/0x950
        ? __x64_sys_openat+0xce/0x140
        __x64_sys_ioctl+0xb9/0xf0
        do_syscall_64+0x33/0x40
        entry_SYSCALL_64_after_hwframe+0x44/0xae
       RIP: 0033:0x7fdcf1f4ba87
       Code: b3 66 90 48 8b 05 11 14 2c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d e1 13 2c 00 f7 d8 64 89 01 48
       RSP: 002b:00007ffef1ce7748 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
       RAX: ffffffffffffffda RBX: 00000000c018cf07 RCX: 00007fdcf1f4ba87
       RDX: 0000564c467c5590 RSI: 00000000c018cf07 RDI: 0000000000000003
       RBP: 00007ffef1ce7770 R08: 00007ffef1ce7420 R09: 00007fdcf0e0562b
       R10: 0000000000000100 R11: 0000000000000246 R12: 0000000000004018
       R13: 0000000000000001 R14: 0000000000000003 R15: 0000564c467c5590
      
       Allocated by task 1200:
        kasan_save_stack+0x1b/0x40
        __kasan_kmalloc+0x7a/0x90
        smb2_ioctl_query_info+0x10e/0x990
        cifs_ioctl+0xf18/0x16b0
        __x64_sys_ioctl+0xb9/0xf0
        do_syscall_64+0x33/0x40
        entry_SYSCALL_64_after_hwframe+0x44/0xae
      
       Freed by task 1200:
        kasan_save_stack+0x1b/0x40
        kasan_set_track+0x1c/0x30
        kasan_set_free_info+0x20/0x30
        __kasan_slab_free+0xe5/0x110
        slab_free_freelist_hook+0x53/0x130
        kfree+0xcc/0x320
        smb2_ioctl_query_info+0x2ad/0x990
        cifs_ioctl+0xf18/0x16b0
        __x64_sys_ioctl+0xb9/0xf0
        do_syscall_64+0x33/0x40
        entry_SYSCALL_64_after_hwframe+0x44/0xae
      
       The buggy address belongs to the object at ffff888007b10c00
        which belongs to the cache kmalloc-512 of size 512
       The buggy address is located 0 bytes inside of
        512-byte region [ffff888007b10c00, ffff888007b10e00)
       The buggy address belongs to the page:
       page:0000000044e14b75 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7b10
       head:0000000044e14b75 order:2 compound_mapcount:0 compound_pincount:0
       flags: 0x100000000010200(slab|head)
       raw: 0100000000010200 ffffea000015f500 0000000400000004 ffff888001042c80
       raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
       page dumped because: kasan: bad access detected
      
       Memory state around the buggy address:
        ffff888007b10b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
        ffff888007b10b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
       >ffff888007b10c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                          ^
        ffff888007b10c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
        ffff888007b10d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
       ==================================================================
      Signed-off-by: NAurelien Aptel <aaptel@suse.com>
      CC: <stable@vger.kernel.org>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NWeilong Chen <chenweilong@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      491b6804
    • S
      cifs: detect dead connections only when echoes are enabled. · 7b9f30f4
      Shyam Prasad N 提交于
      stable inclusion
      from stable-5.10.36
      commit 8a90058752e0b04b3159fa889a7f611b550bf816
      bugzilla: 51867
      CVE: NA
      
      --------------------------------
      
      commit f4916649 upstream.
      
      We can detect server unresponsiveness only if echoes are enabled.
      Echoes can be disabled under two scenarios:
      1. The connection is low on credits, so we've disabled echoes/oplocks.
      2. The connection has not seen any request till now (other than
      negotiate/sess-setup), which is when we enable these two, based on
      the credits available.
      
      So this fix will check for dead connection, only when echo is enabled.
      Signed-off-by: NShyam Prasad N <sprasad@microsoft.com>
      CC: <stable@vger.kernel.org> # v5.8+
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NWeilong Chen <chenweilong@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      7b9f30f4
    • E
      cifs: fix out-of-bound memory access when calling smb3_notify() at mount point · ed8dbc7b
      Eugene Korenevsky 提交于
      stable inclusion
      from stable-5.10.36
      commit 23d7b4a8f77ae1252ac1a0c496ec3b603f85f593
      bugzilla: 51867
      CVE: NA
      
      --------------------------------
      
      commit a637f4ae upstream.
      
      If smb3_notify() is called at mount point of CIFS, build_path_from_dentry()
      returns the pointer to kmalloc-ed memory with terminating zero (this is
      empty FileName to be passed to SMB2 CREATE request). This pointer is assigned
      to the `path` variable.
      Then `path + 1` (to skip first backslash symbol) is passed to
      cifs_convert_path_to_utf16(). This is incorrect for empty path and causes
      out-of-bound memory access.
      
      Get rid of this "increase by one". cifs_convert_path_to_utf16() already
      contains the check for leading backslash in the path.
      
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=212693
      CC: <stable@vger.kernel.org> # v5.6+
      Signed-off-by: NEugene Korenevsky <ekorenevsky@astralinux.ru>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NWeilong Chen <chenweilong@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      ed8dbc7b
    • P
      cifs: Return correct error code from smb2_get_enc_key · 9e4fe771
      Paul Aurich 提交于
      stable inclusion
      from stable-5.10.36
      commit aaa0faa5c28a91c362352d6b35dc3ed10df56fb0
      bugzilla: 51867
      CVE: NA
      
      --------------------------------
      
      commit 83728cbf upstream.
      
      Avoid a warning if the error percolates back up:
      
      [440700.376476] CIFS VFS: \\otters.example.com crypt_message: Could not get encryption key
      [440700.386947] ------------[ cut here ]------------
      [440700.386948] err = 1
      [440700.386977] WARNING: CPU: 11 PID: 2733 at /build/linux-hwe-5.4-p6lk6L/linux-hwe-5.4-5.4.0/lib/errseq.c:74 errseq_set+0x5c/0x70
      ...
      [440700.397304] CPU: 11 PID: 2733 Comm: tar Tainted: G           OE     5.4.0-70-generic #78~18.04.1-Ubuntu
      ...
      [440700.397334] Call Trace:
      [440700.397346]  __filemap_set_wb_err+0x1a/0x70
      [440700.397419]  cifs_writepages+0x9c7/0xb30 [cifs]
      [440700.397426]  do_writepages+0x4b/0xe0
      [440700.397444]  __filemap_fdatawrite_range+0xcb/0x100
      [440700.397455]  filemap_write_and_wait+0x42/0xa0
      [440700.397486]  cifs_setattr+0x68b/0xf30 [cifs]
      [440700.397493]  notify_change+0x358/0x4a0
      [440700.397500]  utimes_common+0xe9/0x1c0
      [440700.397510]  do_utimes+0xc5/0x150
      [440700.397520]  __x64_sys_utimensat+0x88/0xd0
      
      Fixes: 61cfac6f ("CIFS: Fix possible use after free in demultiplex thread")
      Signed-off-by: NPaul Aurich <paul@darkrain42.org>
      CC: stable@vger.kernel.org
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NWeilong Chen <chenweilong@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      9e4fe771
  2. 22 4月, 2021 2 次提交
  3. 19 4月, 2021 4 次提交
  4. 13 4月, 2021 2 次提交
  5. 09 4月, 2021 4 次提交
  6. 09 3月, 2021 3 次提交
  7. 08 2月, 2021 1 次提交
  8. 28 1月, 2021 2 次提交
  9. 12 1月, 2021 3 次提交
  10. 04 12月, 2020 3 次提交
  11. 01 12月, 2020 2 次提交
  12. 16 11月, 2020 4 次提交
    • R
      smb3: Handle error case during offload read path · 12541000
      Rohith Surabattula 提交于
      Mid callback needs to be called only when valid data is
      read into pages.
      
      These patches address a problem found during decryption offload:
            CIFS: VFS: trying to dequeue a deleted mid
      that could cause a refcount use after free:
            Workqueue: smb3decryptd smb2_decrypt_offload [cifs]
      Signed-off-by: NRohith Surabattula <rohiths@microsoft.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      CC: Stable <stable@vger.kernel.org> #5.4+
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      12541000
    • R
      smb3: Avoid Mid pending list corruption · ac873aa3
      Rohith Surabattula 提交于
      When reconnect happens Mid queue can be corrupted when both
      demultiplex and offload thread try to dequeue the MID from the
      pending list.
      
      These patches address a problem found during decryption offload:
               CIFS: VFS: trying to dequeue a deleted mid
      that could cause a refcount use after free:
               Workqueue: smb3decryptd smb2_decrypt_offload [cifs]
      Signed-off-by: NRohith Surabattula <rohiths@microsoft.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      CC: Stable <stable@vger.kernel.org> #5.4+
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      ac873aa3
    • R
      smb3: Call cifs reconnect from demultiplex thread · de9ac0a6
      Rohith Surabattula 提交于
      cifs_reconnect needs to be called only from demultiplex thread.
      skip cifs_reconnect in offload thread. So, cifs_reconnect will be
      called by demultiplex thread in subsequent request.
      
      These patches address a problem found during decryption offload:
           CIFS: VFS: trying to dequeue a deleted mid
      that can cause a refcount use after free:
      
      [ 1271.389453] Workqueue: smb3decryptd smb2_decrypt_offload [cifs]
      [ 1271.389456] RIP: 0010:refcount_warn_saturate+0xae/0xf0
      [ 1271.389457] Code: fa 1d 6a 01 01 e8 c7 44 b1 ff 0f 0b 5d c3 80 3d e7 1d 6a 01 00 75 91 48 c7 c7 d8 be 1d a2 c6 05 d7 1d 6a 01 01 e8 a7 44 b1 ff <0f> 0b 5d c3 80 3d c5 1d 6a 01 00 0f 85 6d ff ff ff 48 c7 c7 30 bf
      [ 1271.389458] RSP: 0018:ffffa4cdc1f87e30 EFLAGS: 00010286
      [ 1271.389458] RAX: 0000000000000000 RBX: ffff9974d2809f00 RCX: ffff9974df898cc8
      [ 1271.389459] RDX: 00000000ffffffd8 RSI: 0000000000000027 RDI: ffff9974df898cc0
      [ 1271.389460] RBP: ffffa4cdc1f87e30 R08: 0000000000000004 R09: 00000000000002c0
      [ 1271.389460] R10: 0000000000000000 R11: 0000000000000001 R12: ffff9974b7fdb5c0
      [ 1271.389461] R13: ffff9974d2809f00 R14: ffff9974ccea0a80 R15: ffff99748e60db80
      [ 1271.389462] FS:  0000000000000000(0000) GS:ffff9974df880000(0000) knlGS:0000000000000000
      [ 1271.389462] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [ 1271.389463] CR2: 000055c60f344fe4 CR3: 0000001031a3c002 CR4: 00000000003706e0
      [ 1271.389465] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [ 1271.389465] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [ 1271.389466] Call Trace:
      [ 1271.389483]  cifs_mid_q_entry_release+0xce/0x110 [cifs]
      [ 1271.389499]  smb2_decrypt_offload+0xa9/0x1c0 [cifs]
      [ 1271.389501]  process_one_work+0x1e8/0x3b0
      [ 1271.389503]  worker_thread+0x50/0x370
      [ 1271.389504]  kthread+0x12f/0x150
      [ 1271.389506]  ? process_one_work+0x3b0/0x3b0
      [ 1271.389507]  ? __kthread_bind_mask+0x70/0x70
      [ 1271.389509]  ret_from_fork+0x22/0x30
      Signed-off-by: NRohith Surabattula <rohiths@microsoft.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      CC: Stable <stable@vger.kernel.org> #5.4+
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      de9ac0a6
    • N
      cifs: fix a memleak with modefromsid · 98128572
      Namjae Jeon 提交于
      kmemleak reported a memory leak allocated in query_info() when cifs is
      working with modefromsid.
      
        backtrace:
          [<00000000aeef6a1e>] slab_post_alloc_hook+0x58/0x510
          [<00000000b2f7a440>] __kmalloc+0x1a0/0x390
          [<000000006d470ebc>] query_info+0x5b5/0x700 [cifs]
          [<00000000bad76ce0>] SMB2_query_acl+0x2b/0x30 [cifs]
          [<000000001fa09606>] get_smb2_acl_by_path+0x2f3/0x720 [cifs]
          [<000000001b6ebab7>] get_smb2_acl+0x75/0x90 [cifs]
          [<00000000abf43904>] cifs_acl_to_fattr+0x13b/0x1d0 [cifs]
          [<00000000a5372ec3>] cifs_get_inode_info+0x4cd/0x9a0 [cifs]
          [<00000000388e0a04>] cifs_revalidate_dentry_attr+0x1cd/0x510 [cifs]
          [<0000000046b6b352>] cifs_getattr+0x8a/0x260 [cifs]
          [<000000007692c95e>] vfs_getattr_nosec+0xa1/0xc0
          [<00000000cbc7d742>] vfs_getattr+0x36/0x40
          [<00000000de8acf67>] vfs_statx_fd+0x4a/0x80
          [<00000000a58c6adb>] __do_sys_newfstat+0x31/0x70
          [<00000000300b3b4e>] __x64_sys_newfstat+0x16/0x20
          [<000000006d8e9c48>] do_syscall_64+0x37/0x80
      
      This patch add missing kfree for pntsd when mounting modefromsid option.
      
      Cc: Stable <stable@vger.kernel.org> # v5.4+
      Signed-off-by: NNamjae Jeon <namjae.jeon@samsung.com>
      Reviewed-by: NAurelien Aptel <aaptel@suse.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      98128572
  13. 24 10月, 2020 4 次提交
    • S
      cifs: update internal module version number · aef0388a
      Steve French 提交于
      To 2.29
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      aef0388a
    • S
      smb3: add some missing definitions from MS-FSCC · 7d03ae4d
      Steve French 提交于
      Add some structures and defines that were recently added to
      the protocol documentation (see MS-FSCC sections 2.3.29-2.3.34).
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      7d03ae4d
    • S
      smb3: remove two unused variables · 6a87266c
      Steve French 提交于
      Fix two unused variables in commit
      "add support for stat of WSL reparse points for special file types"
      Reported-by: Nkernel test robot <lkp@intel.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      6a87266c
    • S
      smb3: add support for stat of WSL reparse points for special file types · 2e4564b3
      Steve French 提交于
      This is needed so when mounting to Windows we do not
      misinterpret various special files created by Linux (WSL) as symlinks.
      An earlier patch addressed readdir.  This patch fixes stat (getattr).
      
      With this patch:
        File: /mnt1/char
        Size: 0          Blocks: 0          IO Block: 16384  character special file
      Device: 34h/52d Inode: 844424930132069  Links: 1     Device type: 0,0
      Access: (0755/crwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
      Access: 2020-10-21 17:46:51.839458900 -0500
      Modify: 2020-10-21 17:46:51.839458900 -0500
      Change: 2020-10-21 18:30:39.797358800 -0500
       Birth: -
        File: /mnt1/fifo
        Size: 0          Blocks: 0          IO Block: 16384  fifo
      Device: 34h/52d Inode: 1125899906842722  Links: 1
      Access: (0755/prwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
      Access: 2020-10-21 16:21:37.259249700 -0500
      Modify: 2020-10-21 16:21:37.259249700 -0500
      Change: 2020-10-21 18:30:39.797358800 -0500
       Birth: -
        File: /mnt1/block
        Size: 0          Blocks: 0          IO Block: 16384  block special file
      Device: 34h/52d Inode: 844424930132068  Links: 1     Device type: 0,0
      Access: (0755/brwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
      Access: 2020-10-21 17:10:47.913103200 -0500
      Modify: 2020-10-21 17:10:47.913103200 -0500
      Change: 2020-10-21 18:30:39.796725500 -0500
       Birth: -
      
      without the patch all show up incorrectly as symlinks with annoying "operation not supported error also returned"
        File: /mnt1/charstat: cannot read symbolic link '/mnt1/char': Operation not supported
      
        Size: 0          Blocks: 0          IO Block: 16384  symbolic link
      Device: 34h/52d Inode: 844424930132069  Links: 1
      Access: (0000/l---------)  Uid: (    0/    root)   Gid: (    0/    root)
      Access: 2020-10-21 17:46:51.839458900 -0500
      Modify: 2020-10-21 17:46:51.839458900 -0500
      Change: 2020-10-21 18:30:39.797358800 -0500
       Birth: -
        File: /mnt1/fifostat: cannot read symbolic link '/mnt1/fifo': Operation not supported
      
        Size: 0          Blocks: 0          IO Block: 16384  symbolic link
      Device: 34h/52d Inode: 1125899906842722  Links: 1
      Access: (0000/l---------)  Uid: (    0/    root)   Gid: (    0/    root)
      Access: 2020-10-21 16:21:37.259249700 -0500
      Modify: 2020-10-21 16:21:37.259249700 -0500
      Change: 2020-10-21 18:30:39.797358800 -0500
       Birth: -
        File: /mnt1/blockstat: cannot read symbolic link '/mnt1/block': Operation not supported
      
        Size: 0          Blocks: 0          IO Block: 16384  symbolic link
      Device: 34h/52d Inode: 844424930132068  Links: 1
      Access: (0000/l---------)  Uid: (    0/    root)   Gid: (    0/    root)
      Access: 2020-10-21 17:10:47.913103200 -0500
      Modify: 2020-10-21 17:10:47.913103200 -0500
      Change: 2020-10-21 18:30:39.796725500 -0500
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Reviewed-by: NRonnie Sahlberg <lsahlber@redhat.com>
      2e4564b3
  14. 23 10月, 2020 1 次提交
    • S
      SMB3: add support for recognizing WSL reparse tags · 13909d96
      Steve French 提交于
      The IO_REPARSE_TAG_LX_ tags originally were used by WSL but they
      are preferred by the Linux client in some cases since, unlike
      the NFS reparse tag (or EAs), they don't require an extra query
      to determine which type of special file they represent.
      
      Add support for readdir to recognize special file types of
      FIFO, SOCKET, CHAR, BLOCK and SYMLINK.  This can be tested
      by creating these special files in WSL Linux and then
      sharing that location on the Windows server and mounting
      to the Windows server to access them.
      
      Prior to this patch all of the special files would show up
      as being of type 'file' but with this patch they can be seen
      with the correct file type as can be seen below:
      
        brwxr-xr-x 1 root root 0, 0 Oct 21 17:10 block
        crwxr-xr-x 1 root root 0, 0 Oct 21 17:46 char
        drwxr-xr-x 2 root root    0 Oct 21 18:27 dir
        prwxr-xr-x 1 root root    0 Oct 21 16:21 fifo
        -rwxr-xr-x 1 root root    0 Oct 21 15:48 file
        lrwxr-xr-x 1 root root    0 Oct 21 15:52 symlink-to-file
      
      TODO: go through all documented reparse tags to see if we can
      reasonably map some of them to directories vs. files vs. symlinks
      and also add support for device numbers for block and char
      devices.
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Reviewed-by: NAurelien Aptel <aaptel@suse.com>
      13909d96