[MPlayer-users] Access to RTC

Brian J. Murrell 47ffa5538e38df93e7f196926991af74 at interlinx.bc.ca
Thu May 9 20:21:02 CEST 2002


On Wed, May 08, 2002 at 11:51:52PM +0200, Horváth István wrote:
> 
> it is beacause probably you are not root,

Well that is a by-product.  Root gets all capabilities.  Not being
root does not mean not having the CAP_SYS_RESOURCE capability and
thusly the ability to alter the rtc.

> so mplayer tries to use 1024 hz
> rtc, but if you see in the /usr/src/linux/drivers/char/rtc.c, there is you
> will see something like this:
>  /*
>                  * We don't really want Joe User enabling more
>                  * than 64Hz of interrupts on a multi-user machine.
>                  */
>                 if ((rtc_freq > 64) && (!capable(CAP_SYS_RESOURCE)))
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^
It is this check that is failing the test, not that the user is not
root.

>                         return -EACCES;
> 
> so the kernel let only max 64hz rtc for a single user, you need to change
> 64 to 1024, and it will work correctly(of course after a kernel
> recompile!)

Well, yes this will work but it's a hack.  The better solution, IMHO
is for mplayer to start suid root and immediately (i.e. the first
lines of main() ) reqlinquish all capabilities not needed and then
shed root.  This is safer than delaying the shedding of root until all
"root needed" operations (i.e. the open of /dev/rtc and the adjustment
to 1024Hz which happens later in the code) are performed.

Of course, even better would be a filesystem that supported the
setting of capabilities on executables, but that is not here (yet).

b.

-- 
Brian J. Murrell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-users/attachments/20020509/2d1e6be9/attachment.pgp>


More information about the MPlayer-users mailing list