Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1270779pxb; Fri, 21 Jan 2022 13:59:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyLm10979jNrAA1wsBBw+yGM0hY17GIDxuOGB1zpLN5i4izDvlh1RBigmTBVUAPG9K+20wM X-Received: by 2002:a17:903:32cd:b0:14b:872:788c with SMTP id i13-20020a17090332cd00b0014b0872788cmr5861745plr.156.1642802354343; Fri, 21 Jan 2022 13:59:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642802354; cv=none; d=google.com; s=arc-20160816; b=IkIeRpidIoQPm5yojscpA2endRLBw4w3WKGaazrNYmh4lKnoKbHUxyqiB3ZK6F2Nbc kikeZ1JBNpk/8ElavOnJNtlHPr0OwpdAqpqV8OVpwbziSwgXwWSY9oipGvp5wGOtCENq 7oAOmlU2xIVOmkxsU+O9SmZzgRGevBo89DoQgwZ0nnS2BPeVFoOoFGVqzNgsTaRptB7r +hbtVWdY5m2h3kW934M78tQB6Bc5cjbZPzTBaZeiLwm4TfRz2nI1Xv5mq0zVrFY3Oosp co3YmvsKZ0BUkpvehb4r2TVr88yiF/pyEPirhpWgzBDw2dkbPa6FzJSibJ2VijB9F+7Z zsPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+EwLT/2jDgcvr2DeZgLKH9n4CqCysJdE2z1e9Aoco+Y=; b=oslgN5X2uGz2ao4HEUvdbf73AMPOiPEN2wP9keJ0+2jRk37daVpRWKnibSb8bLHlkq 5VdnBBuODAAfOGls1C73qy0X7L4FykXwYYnseGF2mHd6BlEm44e7MQVry5bMpXf41pfu sqgoLnawdrgU+PCxmGVT/uk1CHn3I5YzQ8kArHXGSnwExiKFTRcGE24s5ETxKiM7r9yG yhMuC0y/aAuSJDkYkEpQ58ZDVCDimzpzphIcWfmxEHD6ZQAO9KCBS/oSqdxXAEVTMX8V rskm2cgL7F/3SelpJh/FDE4ZLiLY5qarf4I+TIDrmFKbJvVJ/H85/SiitukzFVTwP4Vv Zfzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cGeHy5Yk; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k7si6514897pll.543.2022.01.21.13.59.02; Fri, 21 Jan 2022 13:59:14 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=cGeHy5Yk; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242193AbiATMce (ORCPT + 99 others); Thu, 20 Jan 2022 07:32:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237223AbiATMcd (ORCPT ); Thu, 20 Jan 2022 07:32:33 -0500 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBC76C061574; Thu, 20 Jan 2022 04:32:32 -0800 (PST) Received: by mail-ed1-x52c.google.com with SMTP id j2so27941012edj.8; Thu, 20 Jan 2022 04:32:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=+EwLT/2jDgcvr2DeZgLKH9n4CqCysJdE2z1e9Aoco+Y=; b=cGeHy5YkiSyNGK+p1vG6CVLVXaAWpgHMgA2iL3VtDxeBxfNnWUfTEu2ZcmIuWtZjUi 2GGw7+PUEcTakt6JjD6hwNvVFJgeOgs1JFrIJXRphXUxBKKzEwu4mgZk4GxRNQ+ms5Cm l/TNWmBOi6gVlv/HTQobi/VNUvjJsQ62A5N9pS76dkS58Bj1Tlkb7Z6Oms2GuSnKHv+F FUjNI2GRTFOI+AM9IDk3ov9Z1q/5hk+Ubw7rfeCjTSEQwahxjJTKp96/PJRM0xx8o05e vgFwHDe5Y9lMHa3xdh+mz/EriWYxcQ10kQzm75qBoxa4ersPSPKGIj4lZqviap8sXIFE PV1g== 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:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=+EwLT/2jDgcvr2DeZgLKH9n4CqCysJdE2z1e9Aoco+Y=; b=dG7empm/31ixstGBHh8avY32y3tWflWG2pLx0y91myRFMCOzRi0a8cg5QkdjlDqSQ1 KsIvBb/DkxeYklR6DTe72gYH13aGIgu1xPms/JytY3ubZfJGLDWT+Im6ngC+Ohx072Vs kPsvdZaW83iRy35aTTQpVysYKmbyYxOjz1wKGwQsVfSyq91aIhH0Hy6uQ6ErpikXrNPf /zHtf0ai7JCrAW8vrCtAX+fIolAVYVNZ4vofzRewKQf/Wl/uCywLTiyFiTjpaAbIS2D+ DLWwWy5j/cMn/CzRFAP/87GdrRqg/uJETczro7rim2xnk2Kx5Xn3HkwTbtf1gLoJZ7A3 FMuA== X-Gm-Message-State: AOAM530Mkr+Knq5hd3q82bnUT9uVcDIBYBOMvhZFcq1FEB2yhK/shhzX OUSh2pTavOQQllYmE1A5zA== X-Received: by 2002:a05:6402:26ce:: with SMTP id x14mr18394913edd.147.1642681951589; Thu, 20 Jan 2022 04:32:31 -0800 (PST) Received: from localhost.localdomain ([46.53.254.155]) by smtp.gmail.com with ESMTPSA id w27sm964224ejb.90.2022.01.20.04.32.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 04:32:31 -0800 (PST) Date: Thu, 20 Jan 2022 15:32:29 +0300 From: Alexey Dobriyan To: Christian Brauner Cc: viro@zeniv.linux.org.uk, ebiederm@xmission.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, stephen.s.brennan@oracle.com, legion@kernel.org, cyphar@cyphar.com Subject: Re: [PATCH v2] proc: "mount -o lookup=" support Message-ID: References: <20220119162423.eqbyefywhtzm22tr@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220119162423.eqbyefywhtzm22tr@wittgenstein> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 19, 2022 at 05:24:23PM +0100, Christian Brauner wrote: > On Wed, Jan 19, 2022 at 06:48:03PM +0300, Alexey Dobriyan wrote: > > From 61376c85daab50afb343ce50b5a97e562bc1c8d3 Mon Sep 17 00:00:00 2001 > > From: Alexey Dobriyan > > Date: Mon, 22 Nov 2021 20:41:06 +0300 > > Subject: [PATCH 1/1] proc: "mount -o lookup=..." support > > > > Docker implements MaskedPaths configuration option > > > > https://github.com/estesp/docker/blob/9c15e82f19b0ad3c5fe8617a8ec2dddc6639f40a/oci/defaults.go#L97 > > > > to disable certain /proc files. It overmounts them with /dev/null. > > > > Implement proper mount option which selectively disables lookup/readdir > > in the top level /proc directory so that MaskedPaths doesn't need > > to be updated as time goes on. > > I might've missed this when this was sent the last time so maybe it was > clearly explained in an earlier thread: What's the reason this needs to > live in the kernel? The reasons are: MaskedPaths or equivalents are blacklists, not future proof MaskedPaths is applied at container creation once, lookup= is applied at mount time surely but names aren't required to exist to be filtered (read: some silly ISV module gets loaded, creates /proc entries, containers get them with all security holes) > The MaskedPaths entry is optional so runtimes aren't required to block > anything by default and this mostly makes sense for workloads that run > privileged. > > In addition MaskedPaths is a generic option which allows to hide any > existing path, not just proc. Even in the very docker-specific defaults > /sys/firmware is covered. Sure, the patch is for /proc only. MaskedPaths can't overmount with /dev/null file which doesn't exist yet. > I do see clear value in the subset= and hidepid= options. They are > generally useful independent of opinionated container workloads. I don't > see the same for lookup=. > > An alternative I find more sensible is to add a new value for subset= > that hides anything(?) that only global root should have read/write > access too.