[pulseaudio-discuss] Clean up of /tmp/

Colin Guthrie gmane at colin.guthr.ie
Fri Apr 27 03:03:14 PDT 2012

'Twas brillig, and Paul Menzel at 24/04/12 22:24 did gyre and gimble:
> Dear PulseAudio folks,
> looking at the content of `/tmp/` I am seeing a leftover
>     /tmp/pulse-mRPUmdyXxFis
> from an already logged out user. GDM is used as the log in manager on
> this Debian Sid/unstable system.
> This is just the folder with no content, but I am wondering if that
> should be cleaned up too after a log out. Is PulseAudio responsible for
> that?

The reasons for the /tmp/pulse-FOOOOOO folders are two fold:

 1. We need a folder that is not on NFS to store our sockets. Thus we
use $TMPDIR.
 2. We need to create a folder that cannot be DoSed by another user.

e.g. we could use /tmp/pulse-$USER, but if $OTHERUSER is evil they can
mkdir /tmp/pulse-sucker (where the user they want to DoS is "sucker")
and this would cause a loss of sound for the poor sucker.

Hence we use these randomly named folders and keep a symlink to them in
~/.pulse/$MACHINEID-runtime (the $MACHINEID is also needed for NFS btw -
different configs/preferences and such like on different machines).

Anyway, if on next boot, the existing folder pointed to by the symlink
in ~/.pulse still exists and still has appropriate permissions, then all
is well in the world, we reuse it.

So in theory GDM will make use of the folder again at next login.

Anyway, that's the background and reasoning. The correct fix is to use
the XDG_RUNTIME_DIR which is exposed under systemd with it's
pam_systemd.so session module. This will ensure we have a clean base
setup without having to jump through hoops in our code doing something
that should really be made available to us lower in the stack (I'm not
sure all user-applications that use sockets are as careful as ourselves
to avoid such problems, and repeating this kind of logic in lots of
different userspace apps does not seem like much fun!)

So we'll be looking into doing this for PA 3.




Colin Guthrie

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/

More information about the pulseaudio-discuss mailing list