[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALAqxLVBgh2gZu1R8NguqoLjA+1VkHAraH5DguA3MTU2zNk0ig@mail.gmail.com>
Date: Wed, 17 Feb 2016 12:51:17 -0800
From: John Stultz <john.stultz@...aro.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Kees Cook <keescook@...omium.org>,
Thomas Gleixner <tglx@...utronix.de>,
Arjan van de Ven <arjan@...ux.intel.com>,
lkml <linux-kernel@...r.kernel.org>,
Oren Laadan <orenl@...lrox.com>,
Ruchi Kandoi <kandoiruchi@...gle.com>,
Rom Lemarchand <romlem@...roid.com>,
Android Kernel Team <kernel-team@...roid.com>
Subject: Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface
On Wed, Feb 17, 2016 at 12:18 PM, Andrew Morton
<akpm@...ux-foundation.org> wrote:
> On Wed, 17 Feb 2016 12:09:08 -0800 Kees Cook <keescook@...omium.org> wrote:
>
>> On Wed, Feb 17, 2016 at 11:35 AM, Andrew Morton
>> <akpm@...ux-foundation.org> wrote:
>> > On Tue, 16 Feb 2016 17:06:31 -0800 John Stultz <john.stultz@...aro.org> 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!
Other uses may be using a combination PTRACE_MODE_ATTACH|PTRACE_MODE_FSCREDS.
>> > 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.
Ok. Reworking the patch to use that as well.
Andrew: I saw you added these to -mm already. Would you prefer a fixup
patch ontop, or should I just send out a folded down v3 of the
patchset?
thanks
-john
Powered by blists - more mailing lists