[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120313204915.GD3260@khazad-dum.debian.net>
Date: Tue, 13 Mar 2012 17:49:15 -0300
From: Henrique de Moraes Holschuh <hmh@....eng.br>
To: Yanmin Zhang <yanmin_zhang@...ux.intel.com>
Cc: ShuoX Liu <shuox.liu@...el.com>,
Deepthi Dharwar <deepthi@...ux.vnet.ibm.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Brown, Len" <len.brown@...el.com>, Ingo Molnar <mingo@...e.hu>,
Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Anvin" <hpa@...or.com>,
"linux-pm@...ts.linux-foundation.org"
<linux-pm@...ts.linux-foundation.org>
Subject: Re: [PATCH V3] cpuidle: Add a sysfs entry to disable specific C
state for debug purpose.
On Tue, 13 Mar 2012, Yanmin Zhang wrote:
> > > > > +static ssize_t store_state_##_name(struct cpuidle_state *state, \
> > > > > + const char *buf, size_t size) \
> > > > > +{ \
> > > > > + int value; \
> > > > > + sscanf(buf, "%d", &value); \
> > > > > + if (value) \
> > > > > + state->disable = 1; \
> > > > > + else \
> > > > > + state->disable = 0; \
> > > > > + return size; \
> > > > > +}
> > > >
> > > > Isn't this missing a check for capabilities? Disabling cpuidle states is
> > > > not something random Joe (and IMHO that does mean random capability-
> > > > restricted Joe root) should be doing...
> > > Sorry. Could you elaborate it?
> >
> > Sure. Should any user be able to disable a C state, therefore causing
> > the system to consume more power?
> Here we use the simple way to check access. Only root could change it.
Yea, but capabilities are supposed to constrain root as well :-)
> > I am pretty sure the answer is NO, in which case you should check for
> > the appropriate user credentials before you allow a write to these
> > "debug" controls to succeed. "capability" here is one of the CAP_*
> > capabilities tested through capable(), which are supposed to limit even
> > root.
> We would add below check.
>
> if (!capable(CAP_SYS_ADMIN))
> return -EPERM;
Looks good.
Thanks!
--
"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