Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp446838ybx; Mon, 4 Nov 2019 23:39:00 -0800 (PST) X-Google-Smtp-Source: APXvYqzl0GlhjPFlY4nlyT4lAY5z6o8iCVp6GGvMRz7zehZSekdBOmADNawnbA8Hc4DOMc2w0rDH X-Received: by 2002:a50:fc0a:: with SMTP id i10mr33736551edr.94.1572939540801; Mon, 04 Nov 2019 23:39:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572939540; cv=none; d=google.com; s=arc-20160816; b=I/3JMxgC3UMo8t9bnE5sKesmXZoIYE71a+uVzWFJ+5JBq3VV12m0zTSqbBwtZFGo4F WCDtJknyJas5tks4VuapRx8yIgs9gW2PsQRXfKIo3lSMVJIp5bOiQQWkmMbb8V/Ih5Kp sTfyJ+5zuV+qjJqje0dZThyzF5fP+gYQYYVr2rz7ai5MRwkBoc286iVBsgXnB3aAKJbG CWU4csotx4GK1xVR+eAq+foAtNNVG+mQURSbLvhm9dHVnjmF6L7PJ27+rXmy3MorFuh6 ynmLkEb1KM+dk5JAhvxeUl8z5wq6Lz4qHuBfWFfXmjBDpZWDa1/44HIQ4U2GmTXl0CCu n/gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:dkim-signature; bh=cay3/WnjxU6wm6NbF5bf+wImiPBa6xb0ML2uvLs1A1Q=; b=SRlV4VZtu824E2d3du6SQVQQlbCl/mpw+Us68KFXfffVM7/JJFoYaCne3I3nWEPFs9 zITGFwjZ5uXwtf97t8kwqxLCPXsL6ZUt67y/09ZbofoHSs30tFYp8mjujpwO3fw2c0Y4 Wu2tVJvkvmscVLUR01nxd3hmOlA2lKhplf4971GBOh1YcrbQfvTctIrbd59BzyKkK6Yx mB5C1vtC8c/Nhy19LMgcH5fy1Q131bPNpdf/+OvIYdVrMd98sU/iGVR9LKASnAtCel/D 1oVSD8eGxQrKtorwdCYdslNtGF1NpLF75Bytaf2geJFm4ls9oSVCRWa/2hBpFz24PxU5 6g7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pXCBGTi3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id k12si8931894ede.181.2019.11.04.23.38.36; Mon, 04 Nov 2019 23:39:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pXCBGTi3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S2387952AbfKEHfw (ORCPT + 99 others); Tue, 5 Nov 2019 02:35:52 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:47089 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387648AbfKEHfv (ORCPT ); Tue, 5 Nov 2019 02:35:51 -0500 Received: by mail-lj1-f196.google.com with SMTP id e9so7285512ljp.13; Mon, 04 Nov 2019 23:35:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=cay3/WnjxU6wm6NbF5bf+wImiPBa6xb0ML2uvLs1A1Q=; b=pXCBGTi3guJrHxMjzi4/2tE4H4AOt/1CHXZw1kW1T9jq0whADMepNtLCPc9cFCNPZ5 Pplvm4wE4iZEljvEkhJ4dsBKgR9eo2lZl1aLQQUpX3ivB3YCh0H86jD5/5rffJaRFH6B 2avwu2KxpwVFiCREittkp6YaLrfhYfKo6dNlpfRSWTnvlBJwMKWWbq1U/9YvFihKLsan E4DC25TR9GMQfLzS+Zp5X6Rqf1Mwd5p8lCflZLvQS6EIdna4IUH3JdM1PQZpa/ol6VVp NqxXrBk7DsrdykbhtQ3YJKcH7npe8qaxTVVBkGdej9+3d8il5Omcd5hXYln2LhLG+SxF 6lOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=cay3/WnjxU6wm6NbF5bf+wImiPBa6xb0ML2uvLs1A1Q=; b=PCNIF/RretI8nTSNzYKZ7pfay54Wsf5nYIcqCAP0srzJptTjJKiqwKOMg9McM7iJEo 5Lgp8OSZadi7AGpohjR2tm7TEbB7C87HKUPzbimN8Mnxmwm681gwPFT9k7Jn4/jdefMy uk1A8m8517F/5BDoDlIGgwpjW142HevtuVQ+1XqOZz83A3rbx/UaquL90mmi6Mah+QBP ncu9hAOvlC+A5xKFb2A8yAT5rSzKtyssml3vjVJh8yFhqcKFDwk+AaIZflhdV8kHeb+7 rAsIS0fWBzs4tKT41IMZaouwyLcnmMH9CW6OJebmtYfzhE37vK6yB4y7BxHeUmIJeEbO hJZQ== X-Gm-Message-State: APjAAAX1ztv2tAc5JD494qLgYwZx9Zl9z1yiNv37610L18qCxuNKCuA3 ZPKU+b4xcKdovdi+8IyZRFOpGCxS X-Received: by 2002:a2e:9985:: with SMTP id w5mr15202567lji.162.1572939349337; Mon, 04 Nov 2019 23:35:49 -0800 (PST) Received: from [192.168.1.36] (88-114-211-119.elisa-laajakaista.fi. [88.114.211.119]) by smtp.gmail.com with ESMTPSA id n5sm9711531ljh.54.2019.11.04.23.35.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Nov 2019 23:35:48 -0800 (PST) Subject: Re: [PATCH] Allow restricting permissions in /proc/sys To: "Eric W. Biederman" Cc: Luis Chamberlain , Kees Cook , Alexey Dobriyan , "linux-kernel@vger.kernel.org" , "open list:FILESYSTEMS (VFS and infrastructure)" References: <74a91362-247c-c749-5200-7bdce704ed9e@gmail.com> <87d0e8g5f4.fsf@x220.int.ebiederm.org> <87h83jejei.fsf@x220.int.ebiederm.org> <87tv7jciq3.fsf@x220.int.ebiederm.org> From: Topi Miettinen Message-ID: <1b0f94ef-ab1c-cb79-dd52-954cf0438af1@gmail.com> Date: Tue, 5 Nov 2019 09:35:46 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <87tv7jciq3.fsf@x220.int.ebiederm.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5.11.2019 1.41, Eric W. Biederman wrote: > Topi Miettinen writes: > >> On 4.11.2019 17.44, Eric W. Biederman wrote: >>> Do you have specific examples of the cases where you would like to >>> change the permissions? >> >> Unprivileged applications typically do not need to access most items >> in /proc/sys, so I'd like to gradually find out which are needed. So >> far I've seen no problems with 0500 mode for directories abi, crypto, >> debug, dev, fs, user or vm. > > But if there is no problem in letting everyone access the information > why reduce the permissions? Because information could be useful to an attacker. If there is no problem in not letting everyone access the information why not allow reducing the permissions? There certainly is no need to know. >> I'm also using systemd's InaccessiblePaths to limit access (which >> mounts an inaccessible directory over the path), but that's a bit too >> big hammer. For example there are over 100 files in /proc/sys/kernel, >> perhaps there will be issues when creating a mount for each, and that >> multiplied by a number of services. > > My sense is that if there is any kind of compelling reason to make > world-readable values not world-readable, and it doesn't break anything > (except malicious applications) than a kernel patch is probably the way > to go. With kernel patch, do you propose to change individual sysctls to not world-readable? That surely would help everybody instead of just those who care enough to change /proc/sys permissions. I guess it would also be more effort by an order of magnitude or two to convince each owner of a sysctl to accept the change. > Policy knobs like this on proc tend to break in normal maintenance > because they are not used enough so I am not a big fan of adding policy > knobs just because we can. But the rest of the /proc (except PID tree) allows changing permissions (and also UID and GID), just /proc/sys doesn't. This doesn't seem very logical to me. These code paths have not changed much or at all since the initial version in 2007, so I suppose the maintenance burden has not been overwhelming. By the way, /proc/sys still allows changing the {a,c,m}time. I think those are not backed anywhere, so they probably suffer from same caching problems as my first version of the patch. -Topi