From root@gits.dyndns.org  Tue Feb 13 10:25:24 2001
Return-Path: <root@gits.dyndns.org>
Received: from balzac.cybercable.fr (balzac.cybercable.fr [212.198.0.198])
	by hub.freebsd.org (Postfix) with SMTP id B980437B491
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 13 Feb 2001 10:25:20 -0800 (PST)
Received: (qmail 16325122 invoked from network); 13 Feb 2001 18:25:18 -0000
Received: from d165.dhcp212-231.cybercable.fr (HELO gits.dyndns.org) ([212.198.231.165]) (envelope-sender <root@gits.dyndns.org>)
          by balzac.cybercable.fr (qmail-ldap-1.03) with SMTP
          for <clefevre@poboxes.com>; 13 Feb 2001 18:25:18 -0000
Received: (from root@localhost)
	by gits.dyndns.org (8.11.1/8.11.1) id f1DIPGB78334;
	Tue, 13 Feb 2001 19:25:16 +0100 (CET)
	(envelope-from root)
Message-Id: <200102131825.f1DIPGB78334@gits.dyndns.org>
Date: Tue, 13 Feb 2001 19:25:16 +0100 (CET)
From: Cyrille Lefevre <clefevre@poboxes.com>
Reply-To: clefevre@poboxes.com
To: FreeBSD-gnats-submit@freebsd.org
Cc: clefevre@poboxes.com
Subject: able to mount a pathname > 80 char. but unable to unmount it
X-Send-Pr-Version: 3.2

>Number:         25067
>Category:       kern
>Synopsis:       able to mount a pathname > 80 char. but unable to unmount it
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 13 10:30:02 PST 2001
>Closed-Date:    Sun Jul 31 12:04:50 GMT 2005
>Last-Modified:  Sun Jul 31 12:04:50 GMT 2005
>Originator:     Cyrille Lefevre
>Release:        FreeBSD 4.2-STABLE i386
>Organization:
ACME
>Environment:

FreeBSD gits 4.2-STABLE FreeBSD 4.2-STABLE #7: Tue Jan 23 07:33:34 CET 2001     root@gits:/disk2/4.x-stable/src/sys/compile/CUSTOM  i386

>Description:

	while I was fixing grub-image from the grub port (0.5.96->0.5.96.1),
	I was able to mount a virtual device (vn) to a pathname
	greater than 80 char. and I am unable to unmount it !

>How-To-Repeat:

	# mkdir -p /a/very_very_very_very_very_very_very_very_long_pathname_with_more_than_80_characters
	# dd if=/dev/zero of=/tmp/image.flp bs=1k count=1440
	# vnconfig -c -s labels vn0 /tmp/image.flp
	# disklabel -Brw vn0 auto
	# newfs vn0c
	# mount /dev/vn0c /a/very_very_very_very_very_very_very_very_long_pathname_with_more_than_80_characters
	# df /dev/vn0c
	Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
	/dev/vn0c        1359        1     1250     0%    /a/very_very_very_very_very_very_very_very_long_pathname_with_more_than_80_char
	# cp /boot/loader /a/very_very_very_very_very_very_very_very_long_pathname_with_more_than_80_characters
	# df /dev/vn0c
	Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
	/dev/vn0c        1359      169     1082    14%    /a/very_very_very_very_very_very_very_very_long_pathname_with_more_than_80_char
	# umount -f /a/very_very_very_very_very_very_very_very_long_pathname_with_more_than_80_characters
	umount: /a/very_very_very_very_very_very_very_very_long_pathname_with_more_than_80_characters: not currently mounted
	# umount -f /dev/vn0c
	umount: unmount of /a/very_very_very_very_very_very_very_very_long_pathname_with_more_than_80_char failed: No such file or directory
	# df /dev/vn0c
	Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
	/dev/vn0c        1359      169     1082    14%    /a/very_very_very_very_very_very_very_very_long_pathname_with_more_than_80_char

>Fix:

	none yet.


>Release-Note:
>Audit-Trail:

From: Edwin Groothuis <mavetju@chello.nl>
To: freebsd-gnats-submit@FreeBSD.org
Cc: clefevre@poboxes.com
Subject: Re: kern/25067: able to mount a pathname > 80 char. but unable to unmount it
Date: Sun, 18 Feb 2001 21:56:52 +0100

 > >Fix:
 
 This is a small patch for it:
 
 --- /old/cd9660_vfsops.c     Sun Feb 18 22:28:23 2001
 +++ /usr/src/sys/isofs/cd9660/cd9660_vfsops.c   Sun Feb 18 22:26:51 2001
 @@ -188,6 +188,12 @@ cd9660_mount(mp, path, data, ndp, p)
         mode_t accessmode;
         struct iso_mnt *imp = 0;
  
 +       /*
 +        * Do not allow paths-names bigger than MNAMELEN characters.
 +        */
 +       if (strlen(path) >= MNAMELEN)
 +               return (ENAMETOOLONG);
 +
         if ((mp->mnt_flag & MNT_ROOTFS) != 0) {
                 return (iso_mountroot(mp, p));
         }
 
 --- /old/vfs_syscalls.c      Sun Feb 18 22:28:23 2001
 +++ /usr/src/sys/kern/vfs_syscalls.c    Sun Feb 18 22:27:12 2001
 @@ -133,6 +133,13 @@ mount1(p, uap, segflag)
  
         if (usermount == 0 && (error = suser(p)))
                 return (error);
 +
 +       /*
 +        * Do not allow paths-names bigger than MNAMELEN characters.
 +        */
 +       if (strlen(uap->path) >= MNAMELEN)
 +               return (ENAMETOOLONG);
 +
         /*
          * Do not allow NFS export by non-root users.
          */
 
 
 This works for cdrom-based and for "general" filesystems (ufs,
 msdos, procfs..., actually, everything handled in the kernel)
 
 As soon as you try to mount something like you gave in your example
 now it gives:
 
 [~] root@p6>mount /dev/vn0c /a/very_very_very_very_very_very_very_very_long_pathname_with_more_than_80_characters
 mount: File name too long
 
 Maximum lenght of a mount-path (for i386) is 79 characters (buffer
 is 80, one for the padding 0), for alpha it's 71 characters (untested,
 but I assume it's the same kind of idea)
 
 Edwin
 
 -- 
 Edwin Groothuis   |           Interested in MUDs? Visit Fatal Dimensions:
 mavetju@chello.nl |                     http://fataldimensions.nl.eu.org/
 ------------------+               telnet://fataldimensions.nl.eu.org:4000
 
State-Changed-From-To: open->closed 
State-Changed-By: adrian 
State-Changed-When: Fri Mar 2 07:57:50 PST 2001 
State-Changed-Why:  


Fixed in revision 1.180 (and fixed properly in revision 1.181) 
of src/sys/kern/vfs_syscalls.c . 


http://www.freebsd.org/cgi/query-pr.cgi?pr=25067 
State-Changed-From-To: closed->open 
State-Changed-By: adrian 
State-Changed-When: Sun Mar 4 10:03:43 PST 2001 
State-Changed-Why:  

As someone (Cyrille) rightfully pointed out, I still have to 
MFC this out to RELENG_4. 



Responsible-Changed-From-To: freebsd-bugs-> 
Responsible-Changed-By: adrian 
Responsible-Changed-When: Sun Mar 4 10:03:43 PST 2001 
Responsible-Changed-Why:  
Make sure I mfc my changes 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25067 
Responsible-Changed-From-To: ->adrian 
Responsible-Changed-By: adrian 
Responsible-Changed-When: Sun Mar 4 10:05:56 PST 2001 
Responsible-Changed-Why:  
Hrm. The last attempted change didn't quite reassign the PR to me. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25067 

From: Cyrille Lefevre <root@gits.dyndns.org>
To: freebsd-gnats-submit@FreeBSD.org
Cc: adrian@FreeBSD.org
Subject: Re: kern/25067: able to mount a pathname > 80 char. but unable to unmount
 it
Date: Sat, 17 Mar 2001 04:12:42 +0100 (CET)

 Adrian,
 
 is there any chance to get this PR MFC before 4.3 (sounds good :) is released ?
 
 thanks in advance.
 
 Cyrille.
 --
 home: mailto:clefevre@poboxes.com   UNIX is user-friendly; it's just particular
 work: mailto:Cyrille.Lefevre@edf.fr   about who it chooses to be friends with. 

From: Adrian Chadd <adrian@FreeBSD.org>
To: clefevre@poboxes.com
Cc: freebsd-gnats-submit@FreeBSD.org, adrian@FreeBSD.org
Subject: Re: kern/25067: able to mount a pathname > 80 char. but unable to unmount it
Date: Sat, 17 Mar 2001 16:56:11 +0100

 On Sat, Mar 17, 2001, Cyrille Lefevre wrote:
 > Adrian,
 > 
 > is there any chance to get this PR MFC before 4.3 (sounds good :) is released ?
 > 
 > thanks in advance.
 
 Well, I could, but there were some concerns over how "good" a solution
 it was.
 
 If people don't mind, I'll spark up a patch to enforce the limitation
 for mount() and umount() without my VFS_MOUNT() interface change.
 
 
 
 Adrian
 
 -- 
 Adrian Chadd			"Programming is like sex:
 <adrian@freebsd.org>		   One mistake and you have to support for
 				    a lifetime." -- rec.humor.funny
 
Responsible-Changed-From-To: adrian->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Sep 13 05:44:58 GMT 2004 
Responsible-Changed-Why:  
With bugmeister hat on, reassign from recently inactive committer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25067 
State-Changed-From-To: open->patched 
State-Changed-By: iedowse 
State-Changed-When: Sun Apr 17 22:49:13 GMT 2005 
State-Changed-Why:  

This has been fixed in both 5.x and -CURRENT. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25067 
State-Changed-From-To: patched->closed 
State-Changed-By: matteo 
State-Changed-When: Sun Jul 31 12:04:31 GMT 2005 
State-Changed-Why:  
Fixed and MFCed 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25067 
>Unformatted:
