[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20120318133854.GA27981@khazad-dum.debian.net>
Date: Sun, 18 Mar 2012 10:38:54 -0300
From: Henrique de Moraes Holschuh <hmh@....eng.br>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: shuox.liu@...el.com,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Yanmin Zhang <yanmin_zhang@...ux.intel.com>,
Mark Brown <broonie@...nsource.wolfsonmicro.com>,
"Brown, Len" <len.brown@...el.com>, Ingo Molnar <mingo@...e.hu>,
Greg KH <gregkh@...uxfoundation.org>,
"H. Peter Anvin" <hpa@...or.com>, andi.kleen@...el.com,
Thomas Gleixner <tglx@...utronix.de>,
"linux-pm@...ts.linux-foundation.org"
<linux-pm@...ts.linux-foundation.org>
Subject: Re: [linux-pm] [PATCH v4] cpuidle: Add a sysfs entry to disable
specific C state for debug purpose.
On Fri, 16 Mar 2012, Andrew Morton wrote:
> > +#define define_store_state_function(_name) \
> > +static ssize_t store_state_##_name(struct cpuidle_state *state, \
> > + const char *buf, size_t size) \
> > +{ \
> > + long value; \
> > + if (!capable(CAP_SYS_ADMIN)) \
> > + return -EPERM; \
>
> Is the capability check required? The 0644 permissions aren't sufficient?
That depends. Without capable(), restricted root (one which had its
capabilities dropped) can disable idle states.
If you want to restrict something to "root only", IMHO it should be
using capable(), as restricted root really doesn't qualify for "root
only" things.
If you wanted to restrict it to "owner only" OTOH, then yes, the
capable() check (especially with the very coarse set of capabilities we
currently have) might not be desireable.
However, if we had a power-management capability, it would be best to
use that one instead of CAP_SYS_ADMIN (aka "the new root" as LWN called
it).
--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists