Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Oct 2011 07:36:10 GMT
From:      Garrett Cooper <yanegomi@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/161481: mount fails with ENAMETOOLONG with path shorter than 255 // 1023 characters
Message-ID:  <201110110736.p9B7aAP4083318@red.freebsd.org>
Resent-Message-ID: <201110110740.p9B7e1s6005258@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         161481
>Category:       kern
>Synopsis:       mount fails with ENAMETOOLONG with path shorter than 255 // 1023 characters
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 11 07:40:01 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Garrett Cooper
>Release:        10-CURRENT
>Organization:
n/a
>Environment:
FreeBSD fallout.local 10.0-CURRENT FreeBSD 10.0-CURRENT #2 r226242M: Mon Oct 10 20:50:51 PDT 2011     gcooper@fallout.local:/usr/obj/usr/src/sys/FALLOUT  amd64
>Description:
mount(2) claims that it should fail with ENAMETOOLONG if the path is <= 255 or 1023 characters:

     [ENAMETOOLONG]     A component of a pathname exceeded 255 characters, or
                        the entire length of a path name exceeded 1023 charac-
                        ters.

In practice, that isn't true:

# mount -t nullfs -o noatime /nfs/scratch/freenas-2/freenas/projects/freenas8-plugins/obj.amd64/ports/distfiles /nfs/scratch/freenas-2/freenas/projects/freenas8-plugins/obj.amd64/_.w/usr/ports/distfiles
mount_nullfs: File name too long
# echo mount -t nullfs -o noatime /nfs/scratch/freenas-2/freenas/projects/freenas8-plugins/obj.amd64/ports/distfiles/ /nfs/scratch/freenas-2/freenas/projects/freenas8-plugins/obj.amd64/_.w/usr/ports/distfiles | awk '{ print length($(NF - 1)), length($NF) }'
83 90
#

It's failing a bounds check in nmount and its callees. I've seen this issue with both nullfs and UFS, so it's most likely a problem in vfs_mount.c, etc.

I've seen this issue on 8.2-RELEASE (FreeNAS), as well as 9-CURRENT and 10-CURRENT.
>How-To-Repeat:
#!/bin/sh

set -e

mkdir -p /nfs/scratch/freenas-2/freenas/projects/freenas8-plugins/obj.amd64/_.w/usr/ports/distfiles/
md=$(mdconfig -a -t swap -s 512m)
newfs /dev/$md
mount /dev/$md /nfs/scratch/freenas-2/freenas/projects/freenas8-plugins/obj.amd64/_.w/usr/ports/distfiles/
>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201110110736.p9B7aAP4083318>