Bug 490887

Summary: CIFS: kernel panic if mounting a symlink
Product: Red Hat Enterprise Linux 5 Reporter: Konstantin Khorenko <khorenko>
Component: kernelAssignee: Jeff Layton <jlayton>
Status: CLOSED DUPLICATE QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: medium Docs Contact:
Priority: low    
Version: 5.3CC: jlayton, rwheeler, steved
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-04-22 18:57:35 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Konstantin Khorenko 2009-03-18 13:04:13 UTC
OpenVZ linux kernel team has found that mounting CIFS subdirectory (allowed by POSIX extensions enabled by default) which is a symlink on the CIFS server leads to the kernel panic.

2.6.18-128.1.1

How reproducible:
* assume server HOSTNAME shares the directory A via CIFS
* assume A has a symlink S inside
* following commands will crash the client node:
  # mount -t cifs //HOSTNAME/A/S /mnt
  # cd /mnt

1) This crash can be avoided by disabling POSIX extensions before mounting:
  # modprobe cifs
  # echo 0 > /proc/fs/cifs/LinuxExtensionsEnabled

2) Another workaround:
   CIFS POSIX extensions can be disabled for single mount by undocumnted option "nounix":
  # mount -t cifs //HOSTNAME/A/S /mnt -o nounix

3) The long-term workaround might be in disabling by default POSIX extensions in kernel:
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 4c1c4f3..0005d16 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -63,7 +63,7 @@ int cifsERROR = 1;
 int traceSMB = 0;
 unsigned int oplockEnabled = 1;
 unsigned int experimEnabled = 0;
-unsigned int linuxExtEnabled = 1;
+unsigned int linuxExtEnabled = 0;
 unsigned int lookupCacheEnabled = 1;
 unsigned int multiuser_mount = 0;
 unsigned int extended_security = CIFSSEC_DEF;

Hope this helps.

Comment 1 Jeff Layton 2009-03-19 17:38:24 UTC
This seems to be fixed in the latest series of patches that I have queued up for RHEL5. The latest patchset makes the kernel return an error when you try to mount a symlink like this (-EINVAL, I think). Most likely, it got fixed when some other problems with directly mounting DFS referrals got fixed.

If you have someplace you can do so, could you confirm whether you're still able to reproduce this with the test kernels I have here:

    http://people.redhat.com/jlayton/

Comment 2 Konstantin Khorenko 2009-03-20 17:13:49 UTC
Confirm, this issue is fixed in 2.6.18-135.el5.jtltest.69 kernel.

# uname -a
Linux hostname 2.6.18-135.el5.jtltest.69 #1 SMP Wed Mar 18 11:25:06 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

# mount -t cifs //host/dir/symlink /mnt
Password:
mount error 22 = Invalid argument
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)
#

Thank you, hope this will be included into release kernel soon.

Comment 5 Jeff Layton 2009-04-22 18:57:35 UTC

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