Bug 71649

Summary: pulseaudio won't run when home directory is mounted with CIFS
Product: PulseAudio Reporter: Maarten Jacobs <maarten256>
Component: coreAssignee: pulseaudio-bugs
Status: RESOLVED MOVED QA Contact: pulseaudio-bugs
Severity: normal    
Priority: medium CC: lennart, maarten256
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Maarten Jacobs 2013-11-15 14:54:00 UTC
I'm fairly sure this is a duplicate of an existing bug as I'm not the first to experience this issue... However I have not been able to find a record of this bug on Bugzilla.

When a user's home directory is crossmounted on a linux machine from another host using CIFS, pulseaudio will not start as pulseaudio cannot set the necessary permissions on the .config/pulse directory (CIFS doesn't allow permissions).

I have put together a quick fix that tests whether the filesystem is a CIFS filesystem, and returns early from the procedure "pa_make_secure_dir" to prevent pulseaudio to fail:

--- core-util.c	2013-11-14 23:05:47.709911713 -0500
+++ core-util.c.orig	2013-11-14 23:10:28.314384314 -0500
@@ -37,7 +37,6 @@
 #include <ctype.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/vfs.h>
 #include <dirent.h>
 
 #ifdef HAVE_LANGINFO_H
@@ -224,7 +223,6 @@
  * already exist, however. */
 int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid, bool update_perms) {
     struct stat st;
-    struct statfs stfs;
     int r, saved_errno;
     bool retry = true;
 
@@ -283,14 +281,6 @@
     if (!update_perms)
         return 0;
 
-    if (fstatfs(fd, &stfs) < 0) {
-        pa_assert_se(pa_close(fd) >= 0);
-        goto fail;
-    }
-
-    if (stfs.f_type == 0xFF534D42)
-        return 0;
-
 #ifdef HAVE_FCHOWN
     if (uid == (uid_t) -1)
         uid = getuid();

I have tested this on my installation (Linux Mint 14 32-bit) and it appears to work. I don't know how to submit the fix properly so I'm hoping somebody will see this and help guide me on this.
Comment 1 Tanu Kaskinen 2013-11-18 08:11:16 UTC
If you know the basics of using git, then this page should allow you to submit the patch "the correct way": http://www.freedesktop.org/wiki/Software/PulseAudio/HowToUseGitSendEmail/

However, the patch is simple enough for me (or someone else) to apply manually, so formatting issues aren't a problem. A bigger problem may be that some of the maintainers has to find the time to figure out the security implications of the patch. If I recall correctly, the "secure directory creation" is a complex area with plenty of room for subtle security bugs.

The patch has now been added to http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Software/PulseAudio/PatchStatus/ so it won't be forgotten.
Comment 2 Maarten Jacobs 2013-11-18 15:51:44 UTC
Hi Tanu,

Thanks for that! I do agree that this would break the security model that is built into this particular area of the code. However, without some sort of change this won't work with CIFS mounted home directories.

In the same area of the code there are escapes (through compiler directives) for compiling the code in a Windows environment - which also precludes the ability to set the right permissions on the directories.

I'm pretty sure that my "fix" needs to be reviewed in detail and probably improved upon, but it does give one the necessary tools to allow the code to figure out that it is trying to create this directory on a CIFS home directory... With all the permission shortcomings that entails.
Comment 3 Alexander E. Patrakov 2014-04-26 09:27:05 UTC
I believe that the issue is worked around in the current git by a different patch (f2f5dffb1). Could you please verify this?
Comment 4 bz 2015-05-12 20:48:18 UTC
I would like to confirm the bug.
The pulseaudio version is 1:4.0-0ubuntu11.1
It seams that redhat had implemented a workaround : https://rhn.redhat.com/errata/RHBA-2015-0419.html
Comment 5 GitLab Migration User 2018-07-30 09:58:26 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/140.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.