Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4026202pxb; Wed, 13 Oct 2021 18:51:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6VnkQPDwND1FrLOfiFZExB0kTxL6mOrnTfklW+MJYgo6IMKLJcmxE/XYVvF/iUVaHBndy X-Received: by 2002:a17:906:7a50:: with SMTP id i16mr365984ejo.507.1634176312613; Wed, 13 Oct 2021 18:51:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634176312; cv=none; d=google.com; s=arc-20160816; b=wvJEKfAI3XYB+fFPDywyZG1NB/B+42lbOzX+L/ccyT2L772F5up4exR0f5fl36wd56 bbaiLpR65w2/hlpr9cYsdmkyKMh1UFh1yiH22W59Kt76ubtrL7xt3rFFtzpmLfbUE2dO q0Hp18gzSvKoZknNtPMaxcx4GxYGAqnBco6UeNrW4UhkwX8gIq2BKXCuN5kEvKKdtX3+ 5eT33AlYgOyAMSeUZw5pvjon6MS4Ff6gHuP9JVOTU51ezhFJ/RSVQOVL8hCVWtbpkJS7 i+Pu7hGgmi6RswghXmbZmYP9sK9Kg1vWGgHsab5NqYZu5B4AMxr5oSaw+1Nv0+040+Mv Kxbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:references:in-reply-to:user-agent:subject:to:from:date :dkim-signature; bh=G1Xpwb6SXyk5zbi6Fvi2E0LkOB6JBHLvcrsIpB5EC3g=; b=qZf3ORhYC/MpQngNapNsVgc2F32d3UfvEdTt6sSnPPWrVfHzG0EkIj3+mjmBGIyW0E HolaHuvkrRMNg+AQ+TPIWn+/Sy6iP+J1K+0gW/ywx7FzwuqHeeS9jlT7sNoFRV/sLqsh OFW0B24KECXgxrKj+3hu1XYfibesqPpfre8XY7NNgCxI6bE9F3+pVO4YckeEylg+oezc 4x/poy2KOJi7U45bVsaAP2YQITAMZmuH/AY3ATfI2hGxqt9u4OR6o8EpNq+HVRJEAsUc Oqh6K+mviNNN6R4L0Fa07zMd2ecnL4cf00+hK3lrgQjRnhRtXXiFZ1i+FBIGy4wurvCg JuxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PcrvY23e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w8si2124923ede.307.2021.10.13.18.51.27; Wed, 13 Oct 2021 18:51:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PcrvY23e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229798AbhJNBue (ORCPT + 99 others); Wed, 13 Oct 2021 21:50:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229496AbhJNBud (ORCPT ); Wed, 13 Oct 2021 21:50:33 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46B87C061570 for ; Wed, 13 Oct 2021 18:48:29 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id x130so4086914pfd.6 for ; Wed, 13 Oct 2021 18:48:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:subject:user-agent:in-reply-to:references:message-id :mime-version:content-transfer-encoding; bh=G1Xpwb6SXyk5zbi6Fvi2E0LkOB6JBHLvcrsIpB5EC3g=; b=PcrvY23euf8D5/i4CMCOuiPO8FAKwfmfwcpHZS1+juqDxXXuqna4otkgpmHvXR8Y+2 R/KQ189IJNjEPWnDtRJ6vdS1hTwi5jzN8F4751Z5IyeJWMgInm4EHhoxDVSvZUKsV8hZ 46bitD+AWsF3WigZlnAX0S+95uogXU83gnSxk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:user-agent:in-reply-to :references:message-id:mime-version:content-transfer-encoding; bh=G1Xpwb6SXyk5zbi6Fvi2E0LkOB6JBHLvcrsIpB5EC3g=; b=yTixFvv/l97zPWwm2eSdcx9fe2RbqrTaG2zr3ORtttj1W0PTAPP754b2W641vZu+9h V62kzu/qka3UmFuPcXCEmjUS4xjOK++8Z8X9G9SUMXdnZuWlwoxdMckJnLqISSg7Bqij grRFeECjYs5EOetBH0aFuPZRrDeZsaV2nL6gM+PVjyZMTvFss6/smyWDFK7qlDAl5Yyf 5r6XpLd9lQ3+ajhWJa6lWpW8vIhPFvGHtStoNw7M7Ssni1VQ8r2qWXtSSwxYYueH+YAd IPUbUevOK3PUuoAnCVHEByJ3vuyJK4/Be8Yf0qn3CFK/omIgweSl8yx5Tlnxx703HpPW lB2w== X-Gm-Message-State: AOAM531FUZ/JaieeQJybM/6zimYBuDLTx/sCZQOd81VnV3W3HjFBg+Rf nIKs+HhEhuXxe1LLmkN+gd1bE4Mdz3JRQg== X-Received: by 2002:a05:6a00:a0a:b0:44c:52c9:bf25 with SMTP id p10-20020a056a000a0a00b0044c52c9bf25mr2513803pfh.24.1634176108743; Wed, 13 Oct 2021 18:48:28 -0700 (PDT) Received: from [127.0.0.1] (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id u24sm669808pfm.85.2021.10.13.18.48.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Oct 2021 18:48:28 -0700 (PDT) Date: Wed, 13 Oct 2021 18:48:26 -0700 From: Kees Cook To: Rob Landley , "linux-kernel@vger.kernel.org" , Linux FS Devel Subject: Re: The one and only "permission denied" in find /sys User-Agent: K-9 Mail for Android In-Reply-To: References: Message-ID: <7042EFC5-DA90-4B9A-951A-036889FD89CA@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On October 13, 2021 1:12:16 PM PDT, Rob Landley wrote: >There is exactly one directory in the whole of sysfs that a normal user c= an't >read (at least on my stock devuan laptop): > > $ find /sys -name potato > find: =E2=80=98/sys/fs/pstore=E2=80=99: Permission denied > >It's the "pstore" filesystem, it was explicitly broken by commit d7caa336= 87ce, >and the commit seems to say this was to fix an issue that didn't exist ye= t but >might someday=2E Right, so, the problem did certainly exist: there was a capability check f= or opening the files, which made it difficult for pstore collector tools to= run with sane least privileges=2E Adjusting the root directory was the sim= plest way to keep the files secure by default, and allow a system owner the= ability to delegate collector permissions to a user or group via just a ch= mod on the root directory=2E >Did whatever issue it was concerned about ever actually start happening? = Why did >you not change the permissions on the files _in_ the directory so they we= ren't >world readable instead? Should /dev/shm stop being world ls-able as well? Making the per-file permissions configurable at runtime was more complex f= or little additional gain=2E /dev/shm has the benefit of having an existing permission model for each c= reated file=2E I wouldn't be opposed to a mount option to specify the default file owner/= group, but it makes user space plumbing more difficult (i=2Ee=2E last I che= cked, stuff like systemd tends to just mount kernel filesystems without opt= ions)=2E -Kees --=20 Kees Cook