Re: [linux-audio-dev] jack and setuid

From: Jonathan Woithe <jwoithe@email-addr-hidden>
Date: Mon Nov 07 2005 - 01:15:12 EET

Hi Conrad

> > In contrast, using the rtlimits approach can be as simple as grabbing
> > set_rtlimits and compiling it (assuming one has a kernel >= 2.6.13
> > installed of course). Configuring userspace is via a single simple text
> > file (documented in the source distribution). Using it then boils down to
> > doing things like
> >
> > set_rtlimits -r /usr/local/bin/jackd ...
> > set_rtlimits -r /usr/local/bin/ardour
>
> yes jonathan, in my opinion its easier to set up set_rtlimits than lsm
> but i thought, set_rtlimits gives me the same right as a normal user as when i
> am root. right?

Not quite. Set_rtlimits gives selected programs (as configured in
/etc/set_rtlimits.conf) permission to request elevated levels of certain
resource limits, but that's all. Running something as root certainly gives
you permission to do this too, but it also enables a lot of other things
which are arguably not appropriate for audio-related software. :)

> But on my system, when i started jackd as normal user as you wrote above.
> in the config file i only changed the username into soundroom
> ------------------------
> soundroom@email-addr-hidden:~/src$ set_rtlimits -r /usr/local/bin/jackd -R -dalsa
> jackd 0.100.0
> [..] JACK compiled with System V SHM support.
> cannot lock down memory for jackd (Cannot allocate memory)
> loading driver ..
> creating alsa driver ... hw:0|hw:0|1024|2|48000|0|0|nomon|swmeter|-|32bit
> control device hw:0
> ALSA: Cannot open PCM device alsa_pcm for capture. Falling back to
> playback-only mode
> configuring for 48000Hz, period = 1024 frames, buffer = 2 periods
> nperiods = 2 for playback
> JACK: unable to mlock() port buffers: Cannot allocate memory
> jack main caught signal 2
> no message buffer overruns

The issues you're having here have nothing to do with set_rtlimits. In
fact, the lack of any messages associated with realtime priorities indicates
that set_rtlimits is doing exactly what it's meant to do. The problems are
related to permissions of other things.

The "cannot lock down memory for jackd" message tells you that jackd (or
more generally the user running jackd) doesn't have sufficient permission to
lock into memory the amount being requested by jackd. This is configured
using the standard resource limit mechanism provided by your system
(although for convenience the next set_rtlimits release will include support
for this resource limit too). Look for the "locked-in-memory address space"
limit, or words to that effect. If your system uses PAM it's configured
from PAM's configuration file (I can't provide further details here since I
don't use PAM). If not (eg: you run Slackware) /etc/limits (man limits) is
your friend. From memory I think I found 20MB sufficient for most of my
needs, but your mileage may vary.

The "Cannot open PCM device" means the user running jackd can't open the
ALSA device files under /dev/. You will need to arrange for
permissions/ownership of these device files to be set sufficient to allow
the jackd user to open them read-write. Many people set the group owner of
the device files to a new group which they create for the purpose ("audio"
for example) and then allow group rw access. There are many other ways,
however.

Feel free to contact me off-list for further details.

Regards
  jonathan
Received on Mon Nov 7 04:15:05 2005

This archive was generated by hypermail 2.1.8 : Mon Nov 07 2005 - 04:15:05 EET