From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965459AbcBQUSP (ORCPT ); Wed, 17 Feb 2016 15:18:15 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:50152 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964970AbcBQUSO (ORCPT ); Wed, 17 Feb 2016 15:18:14 -0500 Date: Wed, 17 Feb 2016 12:18:13 -0800 From: Andrew Morton To: Kees Cook Cc: John Stultz , Thomas Gleixner , Arjan van de Ven , lkml , Oren Laadan , Ruchi Kandoi , Rom Lemarchand , Android Kernel Team Subject: Re: [PATCH 2/2] proc: Add /proc//timerslack_ns interface Message-Id: <20160217121813.8a49986ebf66cedaf43e901b@linux-foundation.org> In-Reply-To: References: <1455671191-32105-1-git-send-email-john.stultz@linaro.org> <1455671191-32105-3-git-send-email-john.stultz@linaro.org> <20160217113547.6487174b9c6d365927095080@linux-foundation.org> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 17 Feb 2016 12:09:08 -0800 Kees Cook wrote: > On Wed, Feb 17, 2016 at 11:35 AM, Andrew Morton > wrote: > > On Tue, 16 Feb 2016 17:06:31 -0800 John Stultz wrote: > > > >> This patch provides a proc/PID/timerslack_ns interface which > >> exposes a task's timerslack value in nanoseconds and allows it > >> to be changed. > >> > >> This allows power/performance management software to set timer > >> slack for other threads according to its policy for the thread > >> (such as when the thread is designated foreground vs. background > >> activity) > >> > >> If the value written is non-zero, slack is set to that value. > >> Otherwise sets it to the default for the thread. > >> > >> This interface checks that the calling task has permissions to > >> to use PTRACE_MODE_ATTACH_FSCREDS on the target task, so that we > >> can ensure arbitrary apps do not change the timer slack for other > >> apps. > > > > hm. What the heck is PTRACE_MODE_ATTACH_FSCREDS and why was it chosen? > > This says the writer needs to have ptrace "attach" level of access, > and that it should be checked with fscreds, as is the standard for > most /proc things like that. The only place where PTRACE_MODE_ATTACH_FSCREDS is used in all of Linux is /prc/pid/stack. Makes me curious! > > The procfs file's permissions are 0644, yes? So a process's > > timer_slack is world-readable? hm. > > This should be 600, IMO. Sounds safer.