Bug 215440 - CIFS: DFS namespaces with non-ASCII symbols cannot be mounted
Summary: CIFS: DFS namespaces with non-ASCII symbols cannot be mounted
Status: RESOLVED DUPLICATE of bug 219083
Alias: None
Product: File System
Classification: Unclassified
Component: CIFS (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: fs_cifs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-29 20:38 UTC by Eugene Korenevsky
Modified: 2024-10-28 10:31 UTC (History)
1 user (show)

See Also:
Kernel Version: 5.16.0-rc6+
Subsystem:
Regression: No
Bisected commit-id:


Attachments
proposed patch which solves mounting (but DOES NOT solve 'ls' at mounted DFS namespace) (1.35 KB, patch)
2021-12-29 21:07 UTC, Eugene Korenevsky
Details | Diff

Description Eugene Korenevsky 2021-12-29 20:38:49 UTC
Windows version of SMB host: Windows Server 2012 R2 x64
Kernel: 5.16.0-rc6+ (git://git.samba.org/sfrench/cifs-2.6, 3d9cb8f7)

Steps to reproduce:

1. At Windows, create DFS namespace with name containing non-ASCII symbols (for example дфс)

2. At Linux SMB client (kernel must be built with CONFIG_CIFS_DFS_UPCALL) execute command

/sbin/mount.cifs //<smb_server>/дфс  /tmp/dfs -o domain=...,user=...,password=...

Result:

mount error(2): No such file or directory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)

CIFS debug log:
------------------
[   35.974420] CIFS: fs/cifs/smb2pdu.c: create/open
[   35.975747] 53fe 424d 0040 0001 0000 0000 0005 000a  .SMB@...........
[   35.976885] 0000 1000 0000 0000 0007 0000 0000 0000  ................
[   35.978060] 00cf 0000 0005 0000 0001 1400 3000 0001  .............0..
[   35.978660] 0000 0000 0000 0000 0000 0000 0000 0000  ................
[   35.979289] 0039 0000 0002 0000 0000 0000 0000 0000  9...............
[   35.984138] 0000 0000 0000 0000 0080 0000 0000 0000  ................
[   35.985301] 0007 0000 0001 0000 0000 0000 0078 002e  ............x...
[   35.987923] 00a8 0000 0018 0000                      ........
[   35.988824] 0057 0049 004e 002d 0054 0043 0049 004e  W.I.N.-.T.C.I.N.
[   35.989946] 0034 004f 0038 0036 0041 0036 004d 005c  4.O.8.6.A.6.M.\.
[   35.991142] 0434 0444 0441 005c 0000 0000 0000 0000  4.D.A.\.........
[   35.992310] 0000 0000 0010 0004 0000 0000 0000 0000  ................
[   35.993301] 4651 6469 0000 0000                      QFid....
[   35.995213] 53fe 424d 0040 0001 0033 c000 0005 000a  .SMB@...3.......
[   36.001437] 0001 1000 0000 0000 0007 0000 0000 0000  ................
[   36.002557] 00cf 0000 0005 0000 0001 1400 3000 0001  .............0..
[   36.003932] 0000 0000 0000 0000 0000 0000 0000 0000  ................
[   36.005044] 09 00 00 00 00 00 00 00 00                       .........
[   36.008112] 53fe 424d 0040 0001 0033 c000 0005 000a  .SMB@...3.......
[   36.009570] 0001 1000 0000 0000 0007 0000 0000 0000  ................
[   36.011227] 00cf 0000 0005 0000 0001 1400 3000 0001  .............0..
[   36.012291] 0000 0000 0000 0000 0000 0000 0000 0000  ................
[   36.012961] 09 00 00 00 00 00 00 00 00                       .........
[   36.013700] CIFS: Status code returned 0xc0000033 STATUS_OBJECT_NAME_INVALID
[   36.017931] CIFS: fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc0000033 to POSIX err -2
[   36.019357] CIFS: fs/cifs/connect.c: mount_get_dfs_conns: marking tcp session as a dfs connection
[   36.021683] CIFS: fs/cifs/dfs_cache.c: dfs_cache_update_tgthint: update target hint - path: \192.168.57.14\дфс
[   36.023004] CIFS: fs/cifs/dfs_cache.c: cache_refresh_path: search path: \192.168.57.14\дфс
[   36.024028] CIFS: fs/cifs/connect.c: is_path_remote: full_path:
[   36.025187] CIFS: fs/cifs/smb2pdu.c: create/open
[   36.025825] 53fe 424d 0040 0001 0000 0000 0005 000a  .SMB@...........
[   36.027054] 0000 1000 0000 0000 0008 0000 0000 0000  ................
[   36.028337] 00cf 0000 0005 0000 0001 1400 3000 0001  .............0..
[   36.035176] 0000 0000 0000 0000 0000 0000 0000 0000  ................
[   36.037074] 0039 0000 0002 0000 0000 0000 0000 0000  9...............
[   36.038376] 0000 0000 0000 0000 0080 0000 0000 0000  ................
[   36.040208] 0007 0000 0001 0000 0000 0000 0078 002e  ............x...
[   36.043445] 00a8 0000 0018 0000                      ........
[   36.045858] 0057 0049 004e 002d 0054 0043 0049 004e  W.I.N.-.T.C.I.N.
[   36.049085] 0034 004f 0038 0036 0041 0036 004d 005c  4.O.8.6.A.6.M.\.
[   36.051757] 0434 0444 0441 005c 0000 0000 0000 0000  4.D.A.\.........
[   36.056501] 0000 0000 0010 0004 0000 0000 0000 0000  ................
[   36.057641] 4651 6469 0000 0000                      QFid....
[   36.060903] 53fe 424d 0040 0001 0033 c000 0005 000a  .SMB@...3.......
[   36.062469] 0001 1000 0000 0000 0008 0000 0000 0000  ................
[   36.064109] 00cf 0000 0005 0000 0001 1400 3000 0001  .............0..
[   36.067893] 0000 0000 0000 0000 0000 0000 0000 0000  ................
[   36.071366] 09 00 00 00 00 00 00 00 00                       .........
[   36.072701] 53fe 424d 0040 0001 0033 c000 0005 000a  .SMB@...3.......
[   36.073492] 0001 1000 0000 0000 0008 0000 0000 0000  ................
[   36.074181] 00cf 0000 0005 0000 0001 1400 3000 0001  .............0..
[   36.074774] 0000 0000 0000 0000 0000 0000 0000 0000  ................
[   36.075615] 09 00 00 00 00 00 00 00 00                       .........
[   36.076335] CIFS: Status code returned 0xc0000033 STATUS_OBJECT_NAME_INVALID
[   36.077102] CIFS: fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc0000033 to POSIX err -2
Comment 1 Eugene Korenevsky 2021-12-29 21:07:37 UTC
Created attachment 300185 [details]
proposed patch which solves mounting (but DOES NOT solve 'ls' at mounted DFS namespace)
Comment 2 Eugene Korenevsky 2021-12-29 21:23:32 UTC
Attached patch (which avoids appending separator if the path is empty) solves mounting problem.

But another problem arises. If we try to 'ls' mounted non-ASCII DFS namespace which contains DFS referrals, we get weird error:

# ls /tmp/x
ls: /tmp/x/dfs: No such file or directory


If we compare Wireshark dumps of 'ls' at ASCII and non-ASCII DFS namespaces, we see the difference:

1. Latin-symbols-only DFS namespace, SMB2 CREATE => OK, returns STATUS_PATH_NOT_COVERED:

166	4.351764	192.168.57.16	192.168.57.14	SMB2	462	Create Request File: WIN-TCIN4O86A6M\dfsns\dfs;GetInfo Request FILE_INFO/SMB2_FILE_ALL_INFO;Close Request
167	4.371416	192.168.57.14	192.168.57.16	SMB2	310	Create Response, Error: STATUS_PATH_NOT_COVERED;GetInfo Response, Error: STATUS_PATH_NOT_COVERED;Close Response, Error: STATUS_PATH_NOT_COVERED

2. non-ASCII DFS namespace, SMB2 CREATE => FAIL, returns STATUS_OBJECT_NAME_INVALID:
171	4.788997	192.168.57.16	192.168.57.14	SMB2	462	Create Request File: WIN-TCIN4O86A6M\дфс\dfs;GetInfo Request FILE_INFO/SMB2_FILE_ALL_INFO;Close Request
172	4.789197	192.168.57.14	192.168.57.16	SMB2	310	Create Response, Error: STATUS_OBJECT_NAME_INVALID;GetInfo Response, Error: STATUS_OBJECT_NAME_INVALID;Close Response, Error: STATUS_OBJECT_NAME_INVALID


For the last case, SMB2 CREATE request for DFS referral and non-ASCII DFS namespace returns STATUS_OBJECT_NAME_INVALID instead of STATUS_PATH_NOT_COVERED (which is totally unexpected by this code https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/cifs/connect.c?h=v5.16-rc7#n3574)
and DFS referral submount fails.

Returning STATUS_OBJECT_NAME_INVALID does not conform to MS-DFSC (see further).

Inspected same workflow of Windows SMB client (listing non-ASCII DSF namespace). Windows SMB client uses different approach, opens DFS referrals in different way and avoids this problem.

But Linux CIFS is affected and this is the problem.

---------------
MS-DFSC 3.1.5.1 I/O Operation to Target Fails with STATUS_PATH_NOT_COVERED
When an I/O operation that is issued to a link target fails with STATUS_PATH_NOT_COVERED
(0xC0000257), the client MUST fail the original I/O request.
When an I/O operation issued to a DFS root target server in step 8 of section 3.1.4.1 fails with
STATUS_PATH_NOT_COVERED (0xC0000257), it indicates that the portion of the DFS namespace
accessed by the client is not contained in the DFS root target server.
Comment 3 Eugene Korenevsky 2022-01-12 17:17:22 UTC
SMB 1.0 ('vers=1.0' mount option) is not affected.
Comment 5 Artem S. Tashkinov 2024-10-28 10:31:54 UTC

*** This bug has been marked as a duplicate of bug 219083 ***

Note You need to log in before you can comment on or make changes to this bug.