Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1902815imm; Sat, 23 Jun 2018 05:17:07 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKtUCwiTUtg3tNCip/a9Z6n9F6kLuJU8UGG337tQbTg0LzR9bsDtXL3KB1iVHnOCIcdcQUV X-Received: by 2002:a17:902:8a8c:: with SMTP id p12-v6mr5450713plo.212.1529756227839; Sat, 23 Jun 2018 05:17:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529756227; cv=none; d=google.com; s=arc-20160816; b=jJxHXnhqKvwxfHWvdZWMZCoIHdpZ4rikp2c8zyoBlDafhjJxnp9cv0gQWwd0nVLazG DRTTGz7YXD7JwFIeda5ExPv3BFKs+FYdWPo77bFrwZgste8sOVjmo+eknRLJr48WBNy0 ttJ3gmITPoUyyK16HRhX88OdZorMmjfLa2M7YqpaQUMqzkquBC6JfBVHAUn+OTvOB/PV WHK9jX28zegfnNR1fEsbc05LumGLgmfRX8A2+AFfvL4kBVobJSqoiOSvf/zjOaP7Ix1E 1Px8fyngGG6MRsO4fLxXs8na0XxXRigYhDH9+ZyLNW0lwnRGTCCeyyoSpAOP/N1T1spe Epig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=YIhR7jdFqTSyQn0Rd/9W4PJ6Zcthnc8s+rUENpzuSgA=; b=PV6DIdLSrI+iDhemPFy0DRSoGx8zmNgtmD5ftrmbDw82z7XBH8FFIzOWZOLfUVQUs7 DCdOxru4Gnpc5l4ek0z7vFSruBlbhSyvWGLU34QYwi0mKBHdf/bc8sLcvcPoQeYEacVz CRZwH5DUwo3i/gjEGzdWQ+/LhrqMoo0258VIM2imZReM+UDFqPZEJVYnR6+TmZwfp3Gf urLEJWn+uWk/9ZynP7n7MDNAcsbVwkrVzOpv5A9p/qfw1MW8p+uZ7KRp/oK1BondTDXv iFk8jhCcUI+wrkhE4suWJq7S176Qc/WtaAVoeXXgFDRsPFUmeOKlD+SmVtRemMnNYinB vhOQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u196-v6si7790826pgc.137.2018.06.23.05.16.53; Sat, 23 Jun 2018 05:17:07 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751931AbeFWMQP (ORCPT + 99 others); Sat, 23 Jun 2018 08:16:15 -0400 Received: from terminus.zytor.com ([198.137.202.136]:44303 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751442AbeFWMQO (ORCPT ); Sat, 23 Jun 2018 08:16:14 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w5NCG9nP464393 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 23 Jun 2018 05:16:09 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w5NCG99v464390; Sat, 23 Jun 2018 05:16:09 -0700 Date: Sat, 23 Jun 2018 05:16:09 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Reinette Chatre Message-ID: Cc: hpa@zytor.com, reinette.chatre@intel.com, linux-kernel@vger.kernel.org, mingo@kernel.org, tglx@linutronix.de Reply-To: mingo@kernel.org, tglx@linutronix.de, reinette.chatre@intel.com, linux-kernel@vger.kernel.org, hpa@zytor.com In-Reply-To: <26f4fc25f110bfc07c2d2c8b2c4ee904922fedf7.1529706536.git.reinette.chatre@intel.com> References: <26f4fc25f110bfc07c2d2c8b2c4ee904922fedf7.1529706536.git.reinette.chatre@intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/cache] x86/intel_rdt: Respect read and write access Git-Commit-ID: 21220bb199f7d65c8f0a63ac7d3209e40fbdd706 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 21220bb199f7d65c8f0a63ac7d3209e40fbdd706 Gitweb: https://git.kernel.org/tip/21220bb199f7d65c8f0a63ac7d3209e40fbdd706 Author: Reinette Chatre AuthorDate: Fri, 22 Jun 2018 15:42:09 -0700 Committer: Thomas Gleixner CommitDate: Sat, 23 Jun 2018 13:03:45 +0200 x86/intel_rdt: Respect read and write access By default, if the opener has CAP_DAC_OVERRIDE, a kernfs file can be opened regardless of RW permissions. Writing to a kernfs file will thus succeed even if permissions are 0000. It's required to restrict the actions that can be performed on a resource group from userspace based on the mode of the resource group. This restriction will be done through a modification of the file permissions. That is, for example, if a resource group is locked then the user cannot add tasks to the resource group. For this restriction through file permissions to work it has to be ensured that the permissions are always respected. To do so the resctrl filesystem is created with the KERNFS_ROOT_EXTRA_OPEN_PERM_CHECK flag that will result in open(2) failing with -EACCESS regardless of CAP_DAC_OVERRIDE if the permission does not have the respective read or write access. Signed-off-by: Reinette Chatre Signed-off-by: Thomas Gleixner Cc: fenghua.yu@intel.com Cc: tony.luck@intel.com Cc: vikas.shivappa@linux.intel.com Cc: gavin.hindman@intel.com Cc: jithu.joseph@intel.com Cc: dave.hansen@intel.com Cc: hpa@zytor.com Link: https://lkml.kernel.org/r/26f4fc25f110bfc07c2d2c8b2c4ee904922fedf7.1529706536.git.reinette.chatre@intel.com --- arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c index fef92b939f0f..6eb716765a3f 100644 --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c @@ -2545,7 +2545,8 @@ static int __init rdtgroup_setup_root(void) int ret; rdt_root = kernfs_create_root(&rdtgroup_kf_syscall_ops, - KERNFS_ROOT_CREATE_DEACTIVATED, + KERNFS_ROOT_CREATE_DEACTIVATED | + KERNFS_ROOT_EXTRA_OPEN_PERM_CHECK, &rdtgroup_default); if (IS_ERR(rdt_root)) return PTR_ERR(rdt_root);