From nobody Thu Nov 28 15:48:48 2024 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Xzghz0MhNz5dtSR for ; Thu, 28 Nov 2024 15:49:07 +0000 (UTC) (envelope-from rb@gid.co.uk) Received: from gid2.gid.co.uk (ns0.gid.co.uk [IPv6:2001:470:94de::240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "gid2.gid.co.uk", Issuer "gid2.gid.co.uk" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xzghy06CYz4Kvw for ; Thu, 28 Nov 2024 15:49:05 +0000 (UTC) (envelope-from rb@gid.co.uk) Authentication-Results: mx1.freebsd.org; dkim=none; spf=pass (mx1.freebsd.org: domain of rb@gid.co.uk designates 2001:470:94de::240 as permitted sender) smtp.mailfrom=rb@gid.co.uk; dmarc=pass (policy=none) header.from=gid.co.uk Received: from mx0.gid.co.uk (mx0.gid.co.uk [194.32.164.250]) by gid2.gid.co.uk (8.15.2/8.15.2) with ESMTP id 4ASFn3gZ030119; Thu, 28 Nov 2024 15:49:03 GMT (envelope-from rb@gid.co.uk) Received: from smtpclient.apple ([89.248.30.154]) by mx0.gid.co.uk (8.14.2/8.14.2) with ESMTP id 4ASFmwqP045552; Thu, 28 Nov 2024 15:48:58 GMT (envelope-from rb@gid.co.uk) Content-Type: text/plain; charset=utf-8 List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Subject: Re: RFC: fixing PR#282995 From: rb@gid.co.uk In-Reply-To: Date: Thu, 28 Nov 2024 15:48:48 +0000 Cc: FreeBSD CURRENT , Michael Proto Content-Transfer-Encoding: quoted-printable Message-Id: <4FEA762C-5E0F-4D3F-82D9-DF93CF1BC1F5@gid.co.uk> References: To: Rick Macklem X-Mailer: Apple Mail (2.3776.700.51) X-Spamd-Result: default: False [-3.78 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.98)[-0.981]; DMARC_POLICY_ALLOW(-0.50)[gid.co.uk,none]; R_SPF_ALLOW(-0.20)[+mx:c]; MIME_GOOD(-0.10)[text/plain]; TAGGED_RCPT(0.00)[]; ARC_NA(0.00)[]; FROM_NO_DN(0.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; MIME_TRACE(0.00)[0:+]; APPLE_MAILER_COMMON(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; R_DKIM_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FREEMAIL_TO(0.00)[gmail.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_TLS_LAST(0.00)[]; TO_DN_ALL(0.00)[]; MLMMJ_DEST(0.00)[freebsd-current@FreeBSD.org]; RCPT_COUNT_THREE(0.00)[3] X-Rspamd-Queue-Id: 4Xzghy06CYz4Kvw X-Spamd-Bar: --- > On 28 Nov 2024, at 15:04, Rick Macklem wrote: >=20 > On Thu, Nov 28, 2024 at 4:36=E2=80=AFAM Bob Bishop = wrote: >>=20 >> Hi, >>=20 >>> On 27 Nov 2024, at 21:56, Rick Macklem = wrote: >>>=20 >>> Hi, >>>=20 >>> PR#282995 reports that the "-alldirs" export option is broken, >>> since it allows an export where the directory path is not a mount = point. >>>=20 >>> I'll admit I did not recall this semantic for -alldirs and I now see = it is only >>> documented in the "Examples" section of exports(5). >>>=20 >>> Looking at the code, it appears this was broken between releng1 and >>> releng2.0 (about 30years ago) when the call to mount(2) in mountd.c >>> was changed from using the path in the exports line to using = f_mntonname. >>> (The check for "it is a mount point" depended on mount(2) failing = because >>> the path was not a mount point.) >>>=20 >>> I do believe the semantic is a useful one, >>=20 >> Why? > Suppose /cdrom is where a CD is mounted sometimes. > If this is exported when the CD is not mounted, it will export > the "/" file system. > --> This export is probably not what the sysadmin wanted. > mountd does now generate a warning about this, which > was how the exporter spotted the bug. > For example (the line in /etc/exports): > /cdrom -alldirs > will export "/" to "the world" if /cdrom is not mounted. I will agree that is undesirable. > The example in the exports(5) man page claims the export > line will fail, so "/" would not be exported. This seems like > a better semantic to me. It=E2=80=99s certainly safer but will cause client mounts to fail as = well. It would be nicer to export an empty directory. > rick >=20 >>=20 >>> although making it that way >>> after 30years might be construed as a POLA violation? >>>=20 >>> So, what do others think I should do with this? >>> (A) - Patch mountd to enforce the "must be a mount point when = -alldirs >>> is specified, plus update exports(5) to state this semantic = clearly. >>> or >>> (B) - Patch mountd so that it enforces "must be a mount point when = -alldirs >>> is specified, but only enabled via a new mountd command line = option. >>> --> ie. Leave the default as not enforced, but allow = enforcement based >>> on a new mountd option. >>> - Document this in both exports(5) and mountd(8). >>> or >>> ??? >>=20 >> (C) - Patch mountd so that it enforces "must be a mount point when = -alldirs >> is specified, but provide a new mountd command line option to = restore the old behaviour. >> --> ie. Default as enforced, but allow an override based on a = new mountd option. >> - Document this in both exports(5) and mountd(8). >>=20 >> I think that (A) is too POLA-unfriendly. >>=20 >>> Thanks in advance for your comments, rick >>>=20 >>=20 >> -- >> Bob Bishop >> rb@gid.co.uk >>=20 >>=20 >>=20 >>=20 >=20 -- Bob Bishop rb@gid.co.uk