please enable snap mediation support
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pulseaudio (Ubuntu) |
Fix Released
|
High
|
James Henstridge | ||
Xenial |
Fix Released
|
Medium
|
James Henstridge | ||
Bionic |
Fix Released
|
Medium
|
James Henstridge |
Bug Description
[Impact]
Ubuntu 16.10 added rudimentary snap support to disable audio recording if the connecting process was a snap. By Ubuntu 18.04, something changed in the build resulting in 'Enable Snappy support: no' with audio recording no longer being mediated by pulseaudio (access to the pulseaudio socket continued to be mediated by snapd's apparmor policy). This resulted in any application with the pulseaudio interface connected to be able to also record. Ubuntu 16.04 never had mediation patches and always allowed recording when the pulseaudio interface was connected.
To correct this situation but not regress existing behavior, Ubuntu 19.04's pulseaudio was updated patch to allow playback to all connected clients (snaps or not), record by classic snaps (see bug 1787324) and record by strict mode snaps if either the pulseaudio or new-in-snapd-2.41 audio-record interfaces were connected. With this change, snapd is in a position to migrate snaps to the new audio-playback and audio-record interfaces and properly mediate audio recording (see https:/
The patch to pulseaudio consists of adding a module, enabling it in default.pa and then when it is enabled, pulseaudio when faced with a record operation will, when the connecting process is a snap (ie, its security label (ie, apparmor label) starts with 'snap.'), query snapd via its control socket to ask if the snap is classic and if not, whether the pulseaudio or audio-record interfaces are connected. Adjusting pulseaudio in the manner does not require coordination with any release of snapd. It does need a newer version of snapd-glib, which was recently updated to 1.49 in the last SRU.
[Test Case]
IMPORTANT: if updating pulseaudio while the session is running, either need to reboot for the test or kill pulseaudio so it can restart with the new snap policy
For unconfined applications:
$ paplay /usr/share/
yes
$ rm -f /tmp/out.wav ; parecord /tmp/out.wav && echo "yes" # ctrl-c to stop recording
^Cyes
$ paplay /tmp/out.wav && echo "yes"
yes
For confined, non-snap applications:
$ sudo apt-get install evince
$ aa-exec -p /usr/bin/evince -- paplay /usr/share/
$ rm -f /tmp/out.wav ; aa-exec -p /usr/bin/evince -- parecord /tmp/out.wav && echo "yes" # ctrl-c to stop recording
^Cyes
$ aa-exec -p /usr/bin/evince -- paplay /tmp/out.wav && echo "yes"
yes
For classic snaps:
$ sudo snap install test-snapd-
$ snap run --shell test-snapd-
$ cat /proc/self/
snap.test-
$ paplay /usr/share/
yes
$ rm -f /tmp/out.wav ; parecord /tmp/out.wav && echo "yes" # ctrl-c to stop recording
^Cyes
$ paplay /tmp/out.wav && echo "yes"
yes
$ exit # out of snap run --shell
For strict snaps with pulseaudio:
$ sudo snap install test-snapd-
$ sudo snap connect test-snapd-
$ snap connections test-snapd-
Interface Plug Slot Notes
pulseaudio test-snapd-
$ test-snapd-
...
$ sudo cp /usr/share/
$ test-snapd-
xcb_connection_
yes
(note, the xcb_connection_
$ test-snapd-
...
^Cyes
$ test-snapd-
...
yes
For strict snaps with audio-playback/
$ sudo snap refresh core --candidate # make sure have 2.41. 'install' on 16.04
$ sudo snap install test-snapd-
$ snap connections test-snapd-
Interface Plug Slot Notes
audio-playback test-snapd-
audio-record test-snapd-
$ test-snapd-
...
$ sudo cp /usr/share/
$ test-snapd-
xcb_connection_
yes
(note, the xcb_connection_
$ test-snapd-
...
Stream error: Access denied
$ sudo snap connect test-snapd-
$ test-snapd-
...
^Cyes
$ test-snapd-
...
yes
[Regression Potential]
The regression potential consists of pulseaudio playback and record functionality no longer working for snaps and non-snaps. This is easily tested via the test cases. Furthermore, the patches have seen 5 months real world testing since Ubuntu 19.04's release. Note that the patches for 18.04 and 16.04 include the fixes to 19.04 for classic snaps (and the above test cases verify the correct behavior).
# Original summary: pulseaudio built with --enable-snappy but 'Enable Snappy support: no'
# Original description
...
dh_auto_configure -- --enable-x11 --disable-
./configure --build=
...
Enable Ubuntu trust store: no
Enable Snappy support: no
Enable Apparmor: yes
At this point, the patch should probably be dropped, otherwise applications like chromium, etc will no longer be able to record.
Related branches
- Ubuntu Audio Development Team: Pending requested
-
Diff: 2228 lines (+2148/-2)8 files modifieddebian/changelog (+17/-0)
debian/control (+1/-1)
debian/patches/0450-modules-add-snappy-policy-module.patch (+482/-0)
debian/patches/0451-enable-snap-policy-module.patch (+30/-0)
debian/patches/0805-remove-libjson-c-dependency.patch (+1611/-0)
debian/patches/series (+5/-0)
debian/pulseaudio.install (+1/-0)
debian/rules (+1/-1)
- Ubuntu Audio Development Team: Pending requested
-
Diff: 1633 lines (+556/-229)9 files modifieddebian/changelog (+16/-0)
debian/control (+1/-0)
debian/patches/0409-pa-client-peer-credentials.patch (+104/-0)
debian/patches/0700-modules-add-snappy-policy-module.patch (+400/-119)
debian/patches/0701-enable-snap-policy-module.patch (+30/-0)
debian/patches/series (+3/-6)
debian/pulseaudio.install (+1/-1)
debian/rules (+1/-1)
dev/null (+0/-102)
- Ken VanDine: Approve
- Daniel van Vugt: Needs Fixing
-
Diff: 1555 lines (+504/-215)9 files modifieddebian/changelog (+12/-0)
debian/control (+1/-0)
debian/patches/0409-pa-client-peer-credentials.patch (+104/-0)
debian/patches/0700-modules-add-snappy-policy-module.patch (+357/-105)
debian/patches/0701-enable-snap-policy-module.patch (+25/-0)
debian/patches/series (+3/-6)
debian/pulseaudio.install (+1/-1)
debian/rules (+1/-1)
dev/null (+0/-102)
description: | updated |
Changed in pulseaudio (Ubuntu): | |
status: | Incomplete → New |
Changed in pulseaudio (Ubuntu): | |
assignee: | nobody → James Henstridge (jamesh) |
status: | New → In Progress |
description: | updated |
summary: |
- pulseaudio built with --enable-snappy but 'Enable Snappy support: no' + please enable snap mediation support |
description: | updated |
description: | updated |
Changed in pulseaudio (Ubuntu Xenial): | |
status: | In Progress → Triaged |
Changed in pulseaudio (Ubuntu Bionic): | |
status: | In Progress → Triaged |
Changed in pulseaudio (Ubuntu Xenial): | |
assignee: | nobody → James Henstridge (jamesh) |
Changed in pulseaudio (Ubuntu Bionic): | |
assignee: | nobody → James Henstridge (jamesh) |
Changed in pulseaudio (Ubuntu Xenial): | |
importance: | Undecided → Medium |
Changed in pulseaudio (Ubuntu Bionic): | |
importance: | Undecided → Medium |
description: | updated |
Changed in pulseaudio (Ubuntu Xenial): | |
status: | Fix Released → Fix Committed |
Changed in pulseaudio (Ubuntu Bionic): | |
status: | Fix Released → Fix Committed |
description: | updated |
Changed in pulseaudio (Ubuntu): | |
importance: | Undecided → High |
I'm not familiar with the workings of those patches - only basic fixes to make them build OK.
Certainly "Enable Snappy support: no" looks like a bug worth fixing. But I don't know who has the authority to decide about dropping any of those patches.
Also how does this relate to Chromium?