From owner-freebsd-fs@FreeBSD.ORG Mon Sep 23 22:35:39 2013 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 13544CE5 for ; Mon, 23 Sep 2013 22:35:39 +0000 (UTC) (envelope-from sean_bruno@yahoo.com) Received: from nm12-vm10.bullet.mail.gq1.yahoo.com (nm12-vm10.bullet.mail.gq1.yahoo.com [98.136.218.139]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 840FA2EE0 for ; Mon, 23 Sep 2013 22:35:38 +0000 (UTC) Received: from [98.137.12.57] by nm12.bullet.mail.gq1.yahoo.com with NNFMP; 23 Sep 2013 22:33:24 -0000 Received: from [98.136.164.64] by tm2.bullet.mail.gq1.yahoo.com with NNFMP; 23 Sep 2013 22:33:24 -0000 Received: from [127.0.0.1] by smtp226.mail.gq1.yahoo.com with NNFMP; 23 Sep 2013 22:33:24 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1379975604; bh=+cFQShgLQBetOY66iUapGjmJHKzf83APIGBf5Du5iCU=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Subject:From:Reply-To:To:Cc:In-Reply-To:References:Content-Type:Date:Message-ID:Mime-Version:X-Mailer; b=AiE+eC8s68SOy0w6uYwFp+EnMHvC7fCfuWSrvhJUTj29n02YKHaRE5ajsypkHEJ8ZqiTtJ0EHzNHOpXfG8dkWriZY11sslLV4pNQs7E7HvlWjA7Zx+IjUE8WDq7kfYZL6xjmm7Zx+yvZREo3DJmGKg2vPuJ7tx3bUmQ+lcTEdvU= X-Yahoo-Newman-Id: 13541.75021.bm@smtp226.mail.gq1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: LD6tuVUVM1mD_AcDWPA8Amb1fhH9PmuUdWUAtXpkuXbAC6v Z7aM_PsUkeB.B6srPfqR16igpNLmDfNGSakAEKM1zuVXR86Vr936IkzYqUcF BaQ.HslLZEI8olMieDocKhNhXFVhucw5Gm9iRtNXEUlrgsoS8uh7oYG.0SFH yFo3T_CIUsd657i9_pziVurHq9GotsCRyz7fUgJ10SS85Hz1u64_czFNFTiR Dg3FG4Ol6LH3rhlC_XP8xrpc8.GjW.vW.Z124_CW2rqXKB4cwtSyETsT2sCS 2XUViWUuwmIdDDZ_iu820bZjxJTA3dNdFK6T99jPplpGOPFIhyA3m7ab6HOl VyFr5hOwb64CfmKFbdi4K9yF6FWsBQbIE6Z9YeMZuLdqhtz.3rUu6.FYVJDr s1M_bH2qnKI851On8j5HRqr5cZAiUdEE7VHZUjV2FjTn2oRfUAbYh4cEiNGI vk6KtVx1Dzmes3RXfgzst_yFb1Vf6eWxxGgqr_Xgrb5L5Ijy1vEfmB5zcShh Mj9t8SJZVai618wCMcBhkvj2872DVCoeKbwCVw5.FYoNKIAVR5pGm6l1Vjld 6Ig-- X-Yahoo-SMTP: u5BKR6OswBC_iZJVfGRoMkTIpc8pEA4- X-Rocket-Received: from [10.73.160.242] (sean_bruno@209.131.62.116 with ) by smtp226.mail.gq1.yahoo.com with SMTP; 23 Sep 2013 22:33:20 +0000 UTC Subject: Re: kern/vfs_mount.c vfs_donmount() checks of MFSNAMELEN From: Sean Bruno To: Kirk McKusick In-Reply-To: <201309231802.r8NI2KmF083133@chez.mckusick.com> References: <201309231802.r8NI2KmF083133@chez.mckusick.com> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-5AbKzWkXOapOU3sB4/Oo" Date: Mon, 23 Sep 2013 15:33:19 -0700 Message-ID: <1379975599.1593.10.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Cc: freebsd-fs X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: sbruno@freebsd.org List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Sep 2013 22:35:39 -0000 --=-5AbKzWkXOapOU3sB4/Oo Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable On Mon, 2013-09-23 at 11:02 -0700, Kirk McKusick wrote: > > So, I'm confused by this check: > >=20 > > if (fstypelen >=3D MFSNAMELEN - 1 || fspathlen >=3D MNAMELEN - > 1) { > > error =3D ENAMETOOLONG; > > goto bail; > > } > >=20 > > MFSNAMELEN is 16, why do we check against >=3D MFSNAMELEN - 1? Why > dont > > we check against (> MFSNAMELEN - 1) or (>=3D MFSNAMELEN)? Is a 14 > > character fstypelen with a "\0" at the end considered too long? > >=20 > > Sean > >=20 > > p.s. e.g. mount -t fuse.glusterfs ... >=20 > I agree with you. It should either be (> MFSNAMELEN - 1) or (>=3D > MFSNAMELEN). >=20 > Kirk McKusick=20 Not sure if we should adjust MNAMELEN or not too while we're at it, I need to do a bit more of a code audit before thunking that one. Propsed patch to set fstyplen check: Index: sys/kern/vfs_mount.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/kern/vfs_mount.c (revision 255831) +++ sys/kern/vfs_mount.c (working copy) @@ -656,7 +656,7 @@ * variables will fit in our mp buffers, including the * terminating NUL. */ - if (fstypelen >=3D MFSNAMELEN - 1 || fspathlen >=3D MNAMELEN - 1) { + if (fstypelen >=3D MFSNAMELEN || fspathlen >=3D MNAMELEN - 1) { error =3D ENAMETOOLONG; goto bail; } --=-5AbKzWkXOapOU3sB4/Oo Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (FreeBSD) iQEcBAABAgAGBQJSQMGvAAoJEBkJRdwI6BaHimIIAIr5zfdMeMcwtPltANSNazEo T9XvxkgZtNs3GnvmPoY6WdlD6g2gUPIRWs9Ue+xzlwAsvMvFzrISOBj26nLdq17g T2x/S1usoqT5BRPjsXBo1pchLDWDk6171nx/OS3vAd0fzKQ9etO4ziwV2rerMBBO Oe80L3m/tBZo/e20ZSD/+B7eNsGHR1JDOwqfxTw0Utpnc3UUfYpnymiNIMyESrfR iUTFuOurcHG2vpncDyhy6rDn7i4oeZLn6dHRcubVm9ZNeuiHibzo8vdVOrgtNS8T FL+munqot5VSwYTN9i4SQ7ry0Nx77geo232B0wN74ao6fUz0pHvgdOBHLE3TFGA= =CiU4 -----END PGP SIGNATURE----- --=-5AbKzWkXOapOU3sB4/Oo--