From owner-freebsd-hackers@freebsd.org Fri May 15 17:34:14 2020 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 936232FB59D for ; Fri, 15 May 2020 17:34:14 +0000 (UTC) (envelope-from jim@netgate.com) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 49NwWV27qsz49lX for ; Fri, 15 May 2020 17:34:14 +0000 (UTC) (envelope-from jim@netgate.com) Received: by mailman.nyi.freebsd.org (Postfix) id 478F92FB59C; Fri, 15 May 2020 17:34:14 +0000 (UTC) Delivered-To: hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 474DC2FB59B for ; Fri, 15 May 2020 17:34:14 +0000 (UTC) (envelope-from jim@netgate.com) Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49NwWT43MYz49lT for ; Fri, 15 May 2020 17:34:13 +0000 (UTC) (envelope-from jim@netgate.com) Received: by mail-ot1-x32a.google.com with SMTP id a68so2503548otb.10 for ; Fri, 15 May 2020 10:34:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=dgm9xRRsSYlBUD34jO9rOYB7RhKEiYIqFoVgqBRIL/I=; b=a5xPImezNQ6cvlh65ialtFPPzygvfDCvWK61g+khnDp92+jbO9oJnFOHaFzYU/gUh7 ow+oDsayyDnU+vO8imNEVlSomwEtAmuWVyeGihnjouqAUY59yUYyfkl8Oh4ZY98N6eA7 Uifru/d5XIaLJqLwZAdZo9WaJXTgOa5/UXr4J3LQtA3fFNqdsuHLAaqTgsuEatjFeZpo M4MShv7HNUUAXdhXbVAUAsqdlr7qk5nE0qHSTziIdJPVdW+vKmrImo8g8TkyxOL1VdrK t9BXDa12cFPmN48YqBWXZftTQECP3/KOYeJtVTp1LlxrpPImWFmrybLqAT2swRwYddJE g9IQ== X-Gm-Message-State: AOAM532lL9c3P2xmoBmnu9aphScC7RJXkhwdFPbEfgt1GUiusGdjYvUV G/E7KJ4wqsyhHkl5SeQvwGB+yQ== X-Google-Smtp-Source: ABdhPJz5hgUejUUzb1pcoxSVhKQxjaomBE2OKs19nA3EHrpUnt+rp2680Mg4eEwfQctoS3OvgLtvVg== X-Received: by 2002:a05:6830:1d88:: with SMTP id y8mr3265310oti.255.1589564052280; Fri, 15 May 2020 10:34:12 -0700 (PDT) Received: from [172.21.0.25] (66-196-7-151.dyn.grandenetworks.net. [66.196.7.151]) by smtp.gmail.com with ESMTPSA id w14sm742888oou.46.2020.05.15.10.34.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 May 2020 10:34:11 -0700 (PDT) From: Jim Thompson Message-Id: <9C0CCC6D-BA3A-4068-BC3B-5B40E7C668E1@netgate.com> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: [HEADSUP] Disallowing read() of a directory fd Date: Fri, 15 May 2020 12:34:10 -0500 In-Reply-To: <35501.1589529102@critter.freebsd.dk> Cc: Kyle Evans , Alan Somers , "Julian H. Stacey" , "freebsd-arch@freebsd.org" , "freebsd-hackers@freebsd.org" To: Poul-Henning Kamp References: <202005142017.04EKH0aA093503@fire.js.berklix.net> <33549.1589488226@critter.freebsd.dk> <35501.1589529102@critter.freebsd.dk> X-Mailer: Apple Mail (2.3608.80.23.2.2) X-Rspamd-Queue-Id: 49NwWT43MYz49lT X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.30 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_DKIM_ALLOW(-0.20)[netgate.com:s=google]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[hackers@freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[netgate.com:+]; DMARC_POLICY_ALLOW(-0.50)[netgate.com,quarantine]; RCVD_IN_DNSWL_NONE(0.00)[a.2.3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-1.80)[ip: (-8.17), ipnet: 2607:f8b0::/32(-0.33), asn: 15169(-0.42), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2020 17:34:14 -0000 > On May 15, 2020, at 2:51 AM, Poul-Henning Kamp = wrote: >=20 > Summary: I'm perfectly fine with read(2) returning error on a > directory *under normal circumstances*, and I think it makes good > sense by protecting a lot of terminals from a lot of binary > garbage. >=20 > But there is absolutely no reason to make it *impossible* for > a competent root to do what competent roots do. In the large, I=E2=80=99m in agreement that read(2) on a directory = should work, at least for if (suser()), but the last sentence here would = allow root to write(2) a directory, too, and that hasn=E2=80=99t been = true for Unix for over 40 years, if ever. Jim