Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 821895 - sys-kernel/gentoo-sources: Unable to mount cifs 1.0 shares with kernel 5.15.0
Summary: sys-kernel/gentoo-sources: Unable to mount cifs 1.0 shares with kernel 5.15.0
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL: https://bugzilla.kernel.org/show_bug....
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-05 08:24 UTC by Davyd McColl
Modified: 2023-02-09 13:13 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
full kernel config for 5.14.15 (config-5.14.15,184.01 KB, text/plain)
2021-11-05 08:26 UTC, Davyd McColl
Details
full kernel config for 5.15.0 (config-5.15.0,185.23 KB, text/plain)
2021-11-05 08:26 UTC, Davyd McColl
Details
SMB1 NTLM backport for kernel 5.15.12 (cifs_smb1_ntlm_backport.patch,31.46 KB, patch)
2022-01-04 15:44 UTC, Robert Schultz
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Davyd McColl 2021-11-05 08:24:36 UTC
After a recent update of gentoo-sources from 5.14.15 to 5.15.0, bringing in my existing .config and running genkernel to produce a new 5.15.0 kernel and rebooting to us that kernel, I'm unable to browse shares on an older media player using CIFS 1.0. Reverting to the 5.14.15 kernel via reboot resolves the issue.

Reproducible: Always

Steps to Reproduce:
I have an /etc/fstab entry like:
//mede8er/mede8er            /mnt/mede8er-smb  cifs    noauto,guest,users,uid=daf,gid=daf,iocharset=utf8,vers=1.0,nobrl 0 0
1. under 5.14.15, as a regular user, `mount /mnt/mede8er-smb` - mount succeeds
2. reboot to 5.15.0, as a regular user, `mount /mnt/mede8er-smb` - mount fails

I see the following in /var/log/syslog:
Nov  3 08:00:00 nea kernel: CIFS: VFS: Use of the less secure dialect vers=1.0 is not recommended unless required for access to very old servers
Nov  3 08:00:00 nea kernel: CIFS: Attempting to mount \\mede8er\mede8er
Nov  3 08:00:00 nea kernel: CIFS: VFS: \\mede8er failed to connect to IPC (rc=-6)
Nov  3 08:00:00 nea kernel: CIFS: VFS: cifs_mount failed w/return code = -6

When I compare kernel configuration for the two kernels, filtering for CIFS, the only difference I see is that the config option CONFIG_CIFS_WEAK_PW_HASH has been removed - I can't select it in `make nconfig` any more and it doesn't appear in the new .config

I'm not sure if it's properly related, but I came across this:
https://x-lore.kernel.org/linux-cifs/20210813195644.937810-3-lsahlber@redhat.com/
which seems to suggest that the logic should be rolled up and selected by CONFIG_CIFS_ALLOW_INSECURE_LEGACY=y (which is set in both kernels)

I'm not sure if this is something that I should be reporting elsewhere? Please advise.
Actual Results:  
Can't mount old CIFS 1.0 media player shares any more under kernel 5.15.0 (gentoo-sources)

Expected Results:  
I should still be able to mount the old CIFS 1.0 shares because I've enabled CONFIG_CIFS_ALLOW_INSECURE_LEGACY=y in my kernel config.
Comment 1 Davyd McColl 2021-11-05 08:26:05 UTC
Created attachment 748719 [details]
full kernel config for 5.14.15
Comment 2 Davyd McColl 2021-11-05 08:26:28 UTC
Created attachment 748722 [details]
full kernel config for 5.15.0
Comment 3 Davyd McColl 2021-11-05 08:27:51 UTC
I'm also not sure about setting the importance for this - it's a blocker for me to use 5.15.0, but 5.15.0 (gentoo-sources) is ~amd64 and I have my older 5.14.15 still installed
Comment 4 Mike Pagano gentoo-dev 2021-11-09 23:36:20 UTC
Does the output of this show anything in 5.15 ?

findmnt --verify --verbose
Comment 5 Davyd McColl 2021-11-10 06:14:13 UTC
`findmnt --verify --verbose` reports for this mount:

/mnt/mede8er-smb
   [ ] target exists
   [ ] FS options: guest,uid=daf,gid=daf,iocharset=utf8,vers=1.0,nobrl
   [ ] userspace options: noauto,users
   [ ] do not check //mede8er/mede8er source (pseudo/net)
   [ ] do not check //mede8er/mede8er FS type (pseudo/net)

attempting `mount /mnt/mede8er-smb` returns:

Retrying with upper case share name
mount error(6): No such device or address
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)


dmesg reports:

[  239.024504] Use of the less secure dialect vers=1.0 is not recommended unless required for access to very old servers

[  239.024505] CIFS: VFS: Use of the less secure dialect vers=1.0 is not recommended unless required for access to very old servers
[  239.024508] CIFS: Attempting to mount \\mede8er\mede8er
[  239.205576] CIFS: VFS: \\mede8er failed to connect to IPC (rc=-6)
[  239.211939] CIFS: VFS: cifs_mount failed w/return code = -6
[  239.211971] Use of the less secure dialect vers=1.0 is not recommended unless required for access to very old servers

[  239.211972] CIFS: VFS: Use of the less secure dialect vers=1.0 is not recommended unless required for access to very old servers
[  239.211987] CIFS: Attempting to mount \\MEDE8ER\MEDE8ER
[  239.237105] CIFS: VFS: \\MEDE8ER failed to connect to IPC (rc=-6)
[  239.243201] CIFS: VFS: cifs_mount failed w/return code = -6
Comment 6 Davyd McColl 2021-11-11 11:14:06 UTC
Update: issue remains in 5.15.1 (I'm not sure where to check for the changelog, so I thought I'd just test and I still can't connect to CIFS 1.0 shares with 5.15.1)
Comment 7 Mike Pagano gentoo-dev 2021-11-15 23:48:31 UTC
You have no sec=<something>. Is it trying to use ntlm ?

ntlm was removed in 5.15 [1]

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=76a3c92ec9e0668e4cd0e9ff1782eb68f61a179c
Comment 8 Davyd McColl 2021-11-16 10:39:05 UTC
As you've noted, I'm not setting `sec=` on the fstab line. According to `man mount.cifs` the default should be ntlmssp.

I tried setting `sec=none` - which worked fine under 5.14.15 - and then rebooted to 5.15.2, where the mount still fails, with the same errors being produced as before.
Comment 9 Davyd McColl 2021-11-21 17:19:16 UTC
update: still persists in 5.15.3
Comment 10 Robert Schultz 2022-01-04 15:44:39 UTC
Created attachment 761299 [details, diff]
SMB1 NTLM backport for kernel 5.15.12

I can't speak to this exact issue, but I needed NTLM support, so I backported the removed CIFS support into a patch that works great on 5.15.12. I've attached it to this issue, in case any future folks want this support added back into the kernel.
Comment 11 Mike Pagano gentoo-dev 2022-01-04 18:01:01 UTC
As upstream no longer supports this in 5.15, closing this bug.
Comment 12 Davyd McColl 2022-01-04 21:39:41 UTC
Thanks for the patch

Upstream, I raised https://bugzilla.kernel.org/show_bug.cgi?id=215375 and it appears as if someone _might_ care, so I'm waiting on a reply there - the commentary so far is that this isn't an upstream abandonment as there was confusion as to why cifs 1.0 shares stopped working after commit 18d04062f83b3eedb64e9f64ede26ee83ae7f152. I'm not sure if that should affect the status of this report.
Comment 13 Mike Pagano gentoo-dev 2022-01-04 23:25:22 UTC
(In reply to Davyd McColl from comment #12)
> Thanks for the patch
> 
> Upstream, I raised https://bugzilla.kernel.org/show_bug.cgi?id=215375 and it
> appears as if someone _might_ care, so I'm waiting on a reply there - the
> commentary so far is that this isn't an upstream abandonment as there was
> confusion as to why cifs 1.0 shares stopped working after commit
> 18d04062f83b3eedb64e9f64ede26ee83ae7f152. I'm not sure if that should affect
> the status of this report.

Excellent, we'll keep an eye on the upstream bug and look at potential backports of any changes.
Comment 14 Davyd McColl 2022-12-02 05:12:48 UTC
Unfortunately, the patch provided by Robert Schultz doesn't apply cleanly any more as of 5.15.80:

Hunk #1 FAILED at 3702.
1 out of 1 hunk FAILED -- saving rejects to file fs/cifs/connect.c.rej
patching file fs/cifs/fs_context.c
patching file fs/cifs/fs_context.h
patching file fs/cifs/sess.c
Hunk #1 succeeded at 826 (offset 28 lines).
Hunk #2 succeeded at 974 (offset 28 lines).
Hunk #3 succeeded at 1702 (offset 28 lines).
patching file fs/cifs/smbencrypt.c
 [ !! ]
 * ERROR: sys-kernel/gentoo-sources-5.15.80::gentoo failed (prepare phase):
 *   patch -p1  failed with /etc/portage/patches/sys-kernel/gentoo-sources/cifs_smb1_ntlm_backport.patch
 * 
 * Call stack:
 *               ebuild.sh, line  122:  Called src_prepare
 *             environment, line 1898:  Called kernel-2_src_prepare
 *             environment, line 1459:  Called eapply_user
 *             environment, line  773:  Called eapply '/etc/portage/patches/sys-kernel/gentoo-sources/cifs_smb1_ntlm_backport.patch'
 *             environment, line  736:  Called _eapply_patch '/etc/portage/patches/sys-kernel/gentoo-sources/cifs_smb1_ntlm_backport.patch'
 *             environment, line  674:  Called __helpers_die 'patch -p1  failed with /etc/portage/patches/sys-kernel/gentoo-sources/cifs_smb1_ntlm_backport.patch'

But fortunately, on the upstream kernel issue (https://bugzilla.kernel.org/show_bug.cgi?id=215375) there appears to have been a fix in the 6.x branch. Is there any possibility of getting that back-ported to 5.15?
Comment 15 Davyd McColl 2022-12-07 05:35:35 UTC
update: I installed 6.0.11 and the upstream fix is in-place: CIFS 1.0 guest shares are mountable. So either stay on 5.15.75 with the patch here, or update to 6.0.11+

Thanks again for the patch.
Comment 16 Mike Pagano gentoo-dev 2022-12-07 13:11:16 UTC
(In reply to Davyd McColl from comment #15)
> update: I installed 6.0.11 and the upstream fix is in-place: CIFS 1.0 guest
> shares are mountable. So either stay on 5.15.75 with the patch here, or
> update to 6.0.11+
> 
> Thanks again for the patch.

I can look to backport the patch to 5.15.X, I will take a look today
Comment 17 Mike Pagano gentoo-dev 2022-12-07 20:44:36 UTC
(In reply to Mike Pagano from comment #16)
> (In reply to Davyd McColl from comment #15)
> > update: I installed 6.0.11 and the upstream fix is in-place: CIFS 1.0 guest
> > shares are mountable. So either stay on 5.15.75 with the patch here, or
> > update to 6.0.11+
> > 
> > Thanks again for the patch.
> 
> I can look to backport the patch to 5.15.X, I will take a look today

Is this all we need?

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/fs/cifs?id=2f6f19c7aaad5005dc75298a413eb0243c5d312d
Comment 18 Davyd McColl 2022-12-19 17:35:42 UTC
I'm not sure at all ):

What I can report is that 6.1.0 is broken wrt CIFS in new and fantastic ways :| mounting and listing files is fine, but any attempt to transfer files ends up stalling - my own software (https://github.com/fluffynuts/bitsplat/) syncs after every write to produce more accurate ETAs and will stall almost immediately. Something like the dolphin file browser will appear to transfer a bit, but it's obviously just filling caches - and will stall after a short time )':
Comment 19 ota 2022-12-29 12:03:16 UTC
I can report that on kernel 6.1.1 I cannot mount cifs version 1.0 shares while on 6.0.11 it works. No changes in settings.
The only difference in logs is that on 6.1.1 the following appears when automounting via fstab:
CIFS: VFS: bogus file nlink value 0

If I try to mount via command line I get:
mount error 20  Not a directory
Comment 20 Mike Pagano gentoo-dev 2022-12-29 16:06:08 UTC
Can you do a bisect between 6.0.11 and 6.1.1 ?
Comment 21 Davyd McColl 2022-12-29 17:13:08 UTC
fwiw, I first saw the new regression(*) in 6.1.0 and I don't have it in 6.0.15, so that might narrow the search a little

if no-one can check it tonight, I might be able to tomorrow, tho my experience from last time is that it will take a while :|

* in 6.1.0+, I can mount without error, but file i/o stalls (my sync program just gets stuck - but that attempts an fsync on every chunk - dolphin will appear to copy a bit and then stall, so it's likely just filling buffers). If I try to touch a new file on the mounted share, touch will segfault!
Comment 22 ota 2023-01-01 12:08:00 UTC
(In reply to Mike Pagano from comment #20)
> Can you do a bisect between 6.0.11 and 6.1.1 ?

Sorry for late reaction. I am not a developer so I had to first understand what bisection exactly means. Now that I know it might be bit time consuming and interacting with my normal use of computer I will first try 6.1.2 and if it persists I will try with as close kernels as possible in spare time. And of course report if I find anything useful. Thanks for the idea.
Comment 23 Davyd McColl 2023-01-01 19:29:59 UTC
6.1.2 installed - same result: can mount a cifs 1.0 share, but attempting to touch a new file on that share segfaults

I guess this really does need a bisect and to be pushed up to kernel devs. I'm a little frustrated at something that worked for 2 decades being broken, but I guess that's just how the cookie crumbles.
Comment 24 Davyd McColl 2023-01-01 21:49:25 UTC
ok, so this is quite interesting:

6.0.15 - no problems
6.0.16 - can mount, touch segfaults, my sync app stalls (probably on first fsync)

So there's quite a tight range there - 6.0.15 works fine, 6.0.16 is properly broken.
Comment 25 Mike Pagano gentoo-dev 2023-01-29 19:12:08 UTC
https://lore.kernel.org/all/CAJjP=Bt52AW_w2sKnM=MbckPkH1hevPMJVWm_Wf+wThmR72YTg@mail.gmail.com/#t

If this is on longer supported by upstream, not sure what we can do here.
Comment 26 Davyd McColl 2023-01-29 19:14:27 UTC
fwiw, 6.1.8 appears to be working properly again, after testing a patch on 6.0.16 ( https://bugzilla.kernel.org/show_bug.cgi?id=216889 ). Upstream appears to be supporting older CIFS clients if they use guest credentials - which suits my purpose - but I'm not sure if they will support older authentication schemes.
Comment 27 Mike Pagano gentoo-dev 2023-01-29 20:32:48 UTC
(In reply to Davyd McColl from comment #26)
> fwiw, 6.1.8 appears to be working properly again, after testing a patch on
> 6.0.16 ( https://bugzilla.kernel.org/show_bug.cgi?id=216889 ). Upstream
> appears to be supporting older CIFS clients if they use guest credentials -
> which suits my purpose - but I'm not sure if they will support older
> authentication schemes.

Great news, glad at least guest mode works.  Thanks for reporting.
Comment 28 ota 2023-02-09 13:13:26 UTC
I can (albeit late) confirm that 6.1.8 fixes the mounting of cifs vers=1.0 shares for me as well.

Thanks to all.