From patchwork Mon Mar 3 11:09:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juri Lelli X-Patchwork-Id: 25602 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f199.google.com (mail-ob0-f199.google.com [209.85.214.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 30E4A20540 for ; Mon, 3 Mar 2014 11:09:52 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id wo20sf18968485obc.6 for ; Mon, 03 Mar 2014 03:09:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=AcdGoXIqHmq0TbJ7mOvP2E+dPw6Xjz7ysNZKXHx09Jw=; b=G5taZWVXcL70kelEsmFGCNS6kkgT72oVyfTLnAaxJNQSnNWP7ci3AgwuNgICxMD4Fq OmgnbLyoKeDQVy/g0lTP7/ZPDHbVtfTaezyjBWpcg2Z1AF4u/tdicdxAFN5R91vADrlX 9r4gqYLEBAlPrqV645sMwkGODFLpXmEpEly+dcNEmLnN8saLBmP0/v1x46mPeq0OE5VT 89VfVw3SETlF4J2guLBUW9mEvLk4tFg+mMvvWFFOH/CcisBA1+A9Pe2IkuHJlqDhCdvg rBC9EKy+TpSjrJXZOpGKCY+yu3dHhTYQmR7T03Qk4MFhHNW4Kk0n1uayyT2h0S1tFnKD IPlg== X-Gm-Message-State: ALoCoQmZq5bKWp0671V1BnYUCk/og/ET71altIMpUzI0P3OK5ixm3+lribDT3wGZIQzLZkJcoxjk X-Received: by 10.50.8.3 with SMTP id n3mr10578878iga.0.1393844991671; Mon, 03 Mar 2014 03:09:51 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.37.135 with SMTP id r7ls2231088qgr.25.gmail; Mon, 03 Mar 2014 03:09:51 -0800 (PST) X-Received: by 10.220.175.198 with SMTP id bb6mr6460886vcb.31.1393844991536; Mon, 03 Mar 2014 03:09:51 -0800 (PST) Received: from mail-ve0-x235.google.com (mail-ve0-x235.google.com [2607:f8b0:400c:c01::235]) by mx.google.com with ESMTPS id uc1si4552126vcb.128.2014.03.03.03.09.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Mar 2014 03:09:51 -0800 (PST) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::235 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::235; Received: by mail-ve0-f181.google.com with SMTP id oy12so1412632veb.12 for ; Mon, 03 Mar 2014 03:09:51 -0800 (PST) X-Received: by 10.58.235.129 with SMTP id um1mr17076804vec.17.1393844991454; Mon, 03 Mar 2014 03:09:51 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.130.193 with SMTP id u1csp46994vcs; Mon, 3 Mar 2014 03:09:50 -0800 (PST) X-Received: by 10.66.163.2 with SMTP id ye2mr7441322pab.110.1393844990570; Mon, 03 Mar 2014 03:09:50 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k7si10298883pbl.221.2014.03.03.03.09.49; Mon, 03 Mar 2014 03:09:49 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754442AbaCCLJj (ORCPT + 26 others); Mon, 3 Mar 2014 06:09:39 -0500 Received: from mail-ea0-f178.google.com ([209.85.215.178]:56108 "EHLO mail-ea0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753964AbaCCLJh (ORCPT ); Mon, 3 Mar 2014 06:09:37 -0500 Received: by mail-ea0-f178.google.com with SMTP id a15so4319931eae.37 for ; Mon, 03 Mar 2014 03:09:36 -0800 (PST) X-Received: by 10.15.76.135 with SMTP id n7mr38332318eey.36.1393844976418; Mon, 03 Mar 2014 03:09:36 -0800 (PST) Received: from neville.retis (nat-cataldo.sssup.it. [193.205.81.5]) by mx.google.com with ESMTPSA id u6sm48627805eep.11.2014.03.03.03.09.34 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Mar 2014 03:09:35 -0800 (PST) From: Juri Lelli To: mingo@redhat.com, peterz@infradead.org Cc: linux-kernel@vger.kernel.org, Juri Lelli Subject: [PATCH] sched/deadline: Normal users can't set/change SCHED_DEADLINE policy Date: Mon, 3 Mar 2014 12:09:21 +0100 Message-Id: <1393844961-18097-1-git-send-email-juri.lelli@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Original-Sender: juri.lelli@gmail.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::235 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (bad format) header.i=@gmail.com; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Deny the use of SCHED_DEADLINE policy to unprivileged users. Even if root users can set the policy for normal users, we don't want the latter to be able to change their parameters (safest behavior). Cc: Ingo Molnar Cc: Peter Zijlstra Signed-off-by: Juri Lelli --- kernel/sched/core.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 6edbef2..dbed360 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3338,6 +3338,15 @@ recheck: return -EPERM; } + /* + * can't set/change SCHED_DEADLINE policy at all for now + * (safest behavior); in the future we would like to allow + * unprivileged DL tasks to increase their relative deadline + * or reduce their runtime (both ways reducing utilization) + */ + if (dl_policy(policy)) + return -EPERM; + /* * Treat SCHED_IDLE as nice 20. Only allow a switch to * SCHED_NORMAL if the RLIMIT_NICE would normally permit it.