From owner-freebsd-bugs@FreeBSD.ORG Sat Jan 1 18:13:27 2011 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DEE4A106564A; Sat, 1 Jan 2011 18:13:26 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id 7B88A8FC0C; Sat, 1 Jan 2011 18:13:26 +0000 (UTC) Received: from c122-106-165-206.carlnfd1.nsw.optusnet.com.au (c122-106-165-206.carlnfd1.nsw.optusnet.com.au [122.106.165.206]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p01IDGlM008415 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 2 Jan 2011 05:13:19 +1100 Date: Sun, 2 Jan 2011 05:13:16 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Roger Leigh In-Reply-To: <201101011746.p01Hk5UQ008490@red.freebsd.org> Message-ID: <20110102050301.B1641@besplex.bde.org> References: <201101011746.p01Hk5UQ008490@red.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-bugs@freebsd.org, freebsd-gnats-submit@freebsd.org Subject: Re: bin/153600: Path length restrictions in mount/umount tools prevent filesystem mount/unmount X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Jan 2011 18:13:27 -0000 On Sat, 1 Jan 2011, Roger Leigh wrote: > t@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 >> Description: > When mount is asked to mount a filesystem on a node whose absolute path is longer than 85 characters in length, the mount fails. Umount also fails under some circumstances, though the testcase attached below doesn't show this. > ... >> Fix: > I suspect that the mount/umount tools are using a fixed-length buffer and/or are truncating the path at some point. > > The mount(2) manual page documents the max path length at 1023 characters, and the maximum length of any single component at 255 characters. These limits have not been exceeded, unless the documentation is incorrect. > > The practical upper limit of 80-85 characters demonstrated in this bug report is very low. The documented [ENAMETOOLONG] limit in mount(2) is sensible, but does not appear to reflect the practical reality at the present time. If the 80-85 character limit could be eliminated to allow this to work as documented, this would remove a significant limitation in the FreeBSD system which is breaking software which requires longer paths to function. Mount name lengths are in practice limited to (MNAMELEN - 1) = 87. See . This isn't easy to fix, since MNAMELEN is in critical APIs (mainly struct statfs). struct statfs has already been changed once too often. MNAMELEN used to be (80 - 2 * sizeof(long)), which is 80 or 72, but was changed to 88. MNAMELEN is of course mentioned in statfs(2), but it isn't mentioned in mount(2) because it doesn't apply to the actual mount operation but only to determining what is mounted using statfs(2). The buffer gets truncated at mount time by mount in the kernel copying the file name to the statfs buffer with blind truncation. In practice, this means that you should never use the feature of mounting pathnames with length between MNAMELEN and (PATH_MAX - 1), since it is too hard to manage the resulting mountpoints. Bruce