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


Groups > linux.kernel > #1336746

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-17 21:50 +0100
Message-ID <r3hcS-3fe-3@gated-at.bofh.it> (permalink)
References <r2YMV-7mJ-3@gated-at.bofh.it> <r2YMW-7mJ-21@gated-at.bofh.it> <r3g78-2uR-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Feb 17, 2016 at 11:35 AM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Tue, 16 Feb 2016 17:06:31 -0800 John Stultz <john.stultz@linaro.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?

Somewhat out of necessity. I found due to recent changes (sha1:
caaee6234d0)  to __ptrace_may_access() one must use FSCREDS or
REALCREDS. So PTRACE_MODE_ATTACH on its own won't work. ("What the
heck" was what I thought too when I noticed my test wasn't working :)

Since we're accessing this via a filesystem interface, I picked
FSCREDS.  But if I chose wrong here, please let me know.

>> +     err = kstrtoull(strstrip(buffer), 10, &slack_ns);
>> +     if (err < 0)
>> +             return err;
>
> Use kstrtoull_from_user()?

Ok. I'll rework it to use this.

thanks!
-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