Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1336858

Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface

From John Stultz <john.stultz@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface
Date 2016-02-18 00:00 +0100
Message-ID <r3jeG-4Do-9@gated-at.bofh.it> (permalink)
References (2 earlier) <r3g78-2uR-25@gated-at.bofh.it> <r3gAa-2Xm-1@gated-at.bofh.it> <r3gJQ-31I-15@gated-at.bofh.it> <r3iLE-4sg-19@gated-at.bofh.it> <r3j51-4A2-55@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Feb 17, 2016 at 2:45 PM, Kees Cook <keescook@chromium.org> wrote:
> On Wed, Feb 17, 2016 at 2:29 PM, John Stultz <john.stultz@linaro.org> wrote:
>> On Wed, Feb 17, 2016 at 12:18 PM, Andrew Morton
>> <akpm@linux-foundation.org> wrote:
>>> On Wed, 17 Feb 2016 12:09:08 -0800 Kees Cook <keescook@chromium.org> wrote:
>>>> On Wed, Feb 17, 2016 at 11:35 AM, Andrew Morton
>>>> > 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.
>>
>> So I've gone ahead and addressed this and the other feedback you had.
>> But this bit made me realize that I may have missed a key aspect to
>> the interface that Android needs.
>>
>> In particular, the whole point here is to allow a controlling task to
>> modify other tasks' timerslack to limit background tasks' power usage
>> (and to modify them back to normal when the background tasks become
>> foreground tasks). Note that on android different tasks run as
>> different users.
>>
>> Currently, the controlling process has minimally elevated privileges
>> (CAP_SYS_NICE). The initial review suggested those privileges should
>> be higher (PTRACE_MODE_ATTACH), which I've implemented.  However, I'm
>> realizing that by moving to the proc interface, the filesystem
>> permissions here put yet another barrier in the way.
>>
>> While the 600 permissions makes initial sense, it does limit these
>> controlling tasks with extra privileges (though not root) from
>> modifying the timerslack, since they cannot open the file to begin
>> with.
>>
>> So.... Does world writable (plus the PTRACE_MODE_ATTACH_FSCREDS check)
>> make more sense here?  Or is there a better way for a system to tweak
>> the default permissions for procfs entries? (And if so, does that
>> render the PTRACE_MODE_ATTACH... check unnecessary?).
>>
>> Apologies. I'm fighting a head-cold, so I'm not feeling particularly sharp here.
>
> Is timerslack sensitive at all? You could add the ptrace test to the
> _show function too, maybe. Then 0666 would solve the open issue
> without leaking the timerslack.

I don't see how timerslack would be sensitive, but probably many
mistakes start out that way, so not being cavalier about it seems
wise.  :)

Ok. Sounds like you and Andrew are on the same page wrt 666 +
PTRACE_MODE_ATTACH, and that seems like it would be workable.

I'll get that implemented here shortly.

Thanks so much again for the feedback! Really appreciate it!
-john

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] Extend timer_slack_ns to u64 on 32bit systems & add /proc/<pid>/timerslack_ns John Stultz <john.stultz@linaro.org> - 2016-02-17 02:10 +0100
  [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface John Stultz <john.stultz@linaro.org> - 2016-02-17 02:10 +0100
    Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface Andrew Morton <akpm@linux-foundation.org> - 2016-02-17 20:40 +0100
      Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface Kees Cook <keescook@chromium.org> - 2016-02-17 21:10 +0100
        Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface Andrew Morton <akpm@linux-foundation.org> - 2016-02-17 21:20 +0100
          Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface John Stultz <john.stultz@linaro.org> - 2016-02-17 22:00 +0100
            Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface Andrew Morton <akpm@linux-foundation.org> - 2016-02-17 22:10 +0100
          Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface John Stultz <john.stultz@linaro.org> - 2016-02-17 23:30 +0100
            Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface Andrew Morton <akpm@linux-foundation.org> - 2016-02-17 23:50 +0100
            Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface Kees Cook <keescook@chromium.org> - 2016-02-17 23:50 +0100
              Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface John Stultz <john.stultz@linaro.org> - 2016-02-18 00:00 +0100
      Re: [PATCH 2/2] proc: Add /proc/<pid>/timerslack_ns interface John Stultz <john.stultz@linaro.org> - 2016-02-17 21:50 +0100
    [PATCH] proc: /proc/<pid>/timerslack_ns permissions fixes John Stultz <john.stultz@linaro.org> - 2016-02-18 07:00 +0100
      Re: [PATCH] proc: /proc/<pid>/timerslack_ns permissions fixes Kees Cook <keescook@chromium.org> - 2016-02-18 19:00 +0100

csiph-web