Bug 92401 - Bug in character conversion (with and without cifs_mapchar enabled)
Summary: Bug in character conversion (with and without cifs_mapchar enabled)
Status: NEEDINFO
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: 2015-01-31 09:28 UTC by t.wede
Modified: 2019-02-07 09:55 UTC (History)
6 users (show)

See Also:
Kernel Version: 3.18.x
Tree: Mainline
Regression: Yes


Attachments
cifs downgrade patch to versions of Kernel 3.17.8 (49.70 KB, patch)
2015-01-31 09:28 UTC, t.wede
Details | Diff

Description t.wede 2015-01-31 09:28:54 UTC
Created attachment 165361 [details]
cifs downgrade patch to versions of Kernel 3.17.8

There is a bug in character conversations on clients using cifs.

Files or directories with :, *, ?, >, <, etc. in its name are shown corectly but the access to these files fails. The cifs client can create such files but it is not possible to remove or rename the files.

An access to such files shows an empty file in some circumstances.

My actual solution is to remove all conversion patches since Kernel 3.17.8.

The patch downgrades the cifs module to the state of Kernel 3.17.8 with only the necessary adaptations to work with Kernel 3.18.x.
Comment 1 Alan 2015-02-10 15:34:55 UTC
+smfrench@gmail.com
Comment 2 burnsmellfactory 2015-12-16 07:59:01 UTC
There is a related issue reported in the Samba Bugzilla:
https://bugzilla.samba.org/show_bug.cgi?id=11307
Comment 3 burnsmellfactory 2015-12-16 08:02:00 UTC
This bug is still present in kernel 4.1.12.
Comment 4 Shirish Pargaonkar 2015-12-28 04:07:10 UTC
Looking into this...
Comment 5 Ronnie Sahlberg 2019-02-07 04:16:22 UTC
This is fixed in the current kernel.

$ touch /mnt/foo\<\*\>\?
$ ls -l /mnt/foo\<\*\>\?
-rwxr-xr-x. 1 root root 0 Feb  7 15:15 '/mnt/foo<*>?'
$ echo "Hello World" > /mnt/foo\<\*\>\?
$ cat /mnt/foo\<\*\>\?
Hello World
$ rm /mnt/foo\<\*\>\?
Comment 6 burnsmellfactory 2019-02-07 04:33:46 UTC
(In reply to Ronnie Sahlberg from comment #5)
> This is fixed in the current kernel.
> 
> $ touch /mnt/foo\<\*\>\?
> $ ls -l /mnt/foo\<\*\>\?
> -rwxr-xr-x. 1 root root 0 Feb  7 15:15 '/mnt/foo<*>?'
> $ echo "Hello World" > /mnt/foo\<\*\>\?
> $ cat /mnt/foo\<\*\>\?
> Hello World
> $ rm /mnt/foo\<\*\>\?

Is /mnt/foo/ a CIFS mountpoint?
Comment 7 Ronnie Sahlberg 2019-02-07 04:59:58 UTC
/mnt is an smb mountpoint
foo/</*/>/? is a file in this share

$ mount | grep /mnt
//win16-1/Share on /mnt type cifs (rw,relatime,vers=3.0,cache=strict,username=sahlberg,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.124.198,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,mfsymlinks,noperm,rsize=4194304,wsize=4194304,echo_interval=60,actimeo=1)
Comment 8 Steve French 2019-02-07 09:55:48 UTC
This was resolved and enabled by default for SMB2/SMB3 mounts more than four years ago, but there was this patch which may be important for your use case which certainly should be in by 4.2 kernel.   Make sure your /proc/mounts mount entry for this cifs mount shows "mapposix"

commit bc8ebdc4f54cc944b0ecc0fb0d18b0ffbaab0468
Author: Nakajima Akira <nakajima.akira@nttcom.co.jp>
Date:   Fri Feb 13 15:35:58 2015 +0900

    Fix that several functions handle incorrect value of mapchars
    
    Cifs client has problem with reserved chars filename.
    
    [BUG1] : several functions handle incorrect value of mapchars
    -       cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
    +       cifs_remap(cifs_sb));
    
    [BUG2] : forget to convert reserved chars when creating SymbolicLink.
    -       CIFSUnixCreateSymLink() calls cifs_strtoUTF16
    +       CIFSUnixCreateSymLink() calls cifsConvertToUTF16() with remap
    
    [BUG3] : forget to convert reserved chars when getting SymbolicLink.
    -       CIFSSMBUnixQuerySymLink() calls cifs_strtoUTF16
    +       CIFSSMBUnixQuerySymLink() calls cifsConvertToUTF16() with remap
    
    [BUG4] : /proc/mounts don't show "mapposix" when using mapposix mount option
    +           cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SFM_CHR)
    +               seq_puts(s, ",mapposix");

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