Re: [linux-pm] [PATCH v4] cpuidle: Add a sysfs entry to disablespecific C state for debug purpose.
From: Henrique de Moraes Holschuh
Date: Sun Mar 18 2012 - 09:39:09 EST
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/