Evince's AppArmor profile prevents opening docs from other apps under Wayland

Bug #1507469 reported by Michael Gratton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
AppArmor
Fix Released
Undecided
Unassigned
2.10
Fix Released
Undecided
Unassigned
apparmor (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Evince fails to run when launched from another app (Nautilus, Ephy, etc) and running under Wayland. For example, nothing appears to happen when double-clicking on a PDF file in Nautilus. Evince is launched, but its Apparmour profile is preventing access to a Wayland socket, hence it immediately exits.

The following is typical of the reported error:

> Oct 19 15:06:40 payens kernel: audit: type=1400 audit(1445227600.333:26): apparmor="DENIED" operation="connect" profile="/usr/bin/evince" name="/run/user/1000/wayland-0" pid=12956 comm="evince" requested_mask="wr" denied_mask="wr" fsuid=1000 ouid=1000

Adding the following lines to it's local Apparmour config and reloading Apparmour fixes the problem:

> owner /run/user/*/wayland-* rw,
> owner /run/user/*/weston-shared-* rw,

ProblemType: Bug
DistroRelease: Ubuntu 15.10
Package: evince 3.16.1-0ubuntu1
ProcVersionSignature: Ubuntu 4.2.0-16.19-generic 4.2.3
Uname: Linux 4.2.0-16-generic x86_64
ApportVersion: 2.19.1-0ubuntu2
Architecture: amd64
CurrentDesktop: GNOME
Date: Mon Oct 19 17:49:19 2015
InstallationDate: Installed on 2015-07-22 (89 days ago)
InstallationMedia: Ubuntu-GNOME 15.04 "Vivid Vervet" - Release amd64 (20150422)
SourcePackage: evince
UpgradeStatus: Upgraded to wily on 2015-08-27 (52 days ago)

Revision history for this message
Michael Gratton (mjog) wrote :
affects: evince (Ubuntu) → apparmor (Ubuntu)
Revision history for this message
Christian Boltz (cboltz) wrote :

/run/user/1000/wayland-0 doesn't sound like an Evince-specific thing. Would it make sense to add it to the X abstraction instead? (restricting it to "owner" probably makes sense)

Revision history for this message
Michael Gratton (mjog) wrote :

I don't think it is Evince-specific either, but that was the only app that I encountered having the issue. It's definitely not X related however since this is Wayland-specific. The "wayland-0" socket naming convention seems to come from libwayland-server, so maybe that's a reasonable package to provide a Wayland abstraction, but then that needs to be included in the Apparmour profiles for GUI programs.

Note also that the socket name may change depending on the server implementation or at runtime via the WAYLAND_DISPLAY environment variable (which works much in the same way as DISPLAY does for X), if that does happen then the same problem will occur. I don't know how to fix that in Apparmour though.

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

I suggest adding a wayland abstraction to apparmor like we currently have for X and mir. Then the evince profile would use '#include <abstractions/wayland>'.

Revision history for this message
Christian Boltz (cboltz) wrote :

While I understand the reason to have a wayland abstraction (yes, wayland != X), this probably also means we'll need to change all profiles that include abstractions/X to also include the wayland abstraction. That's also the reason why I proposed (ab)using abstractions/X - that would mean we don't need to modify lots of profiles.

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

I'm opposed to this for upstream because X != wayland != mir and it is perfectly reasonable for a policy author to not want X when using mir or wayland, for example. I think it would be better to add mir and wayland to the kde and gnome abstractions instead. These already include X so it makes sense that if they also work under an alternate display server, they should include those server's abstractions.

Revision history for this message
Tyler Hicks (tyhicks) wrote :

I'm skipping this change for the 2.11 release because the correct solution is still being discussed between Christian and Jamie.

tags: added: aa-policy
Mathew Hodson (mhodson)
Changed in apparmor (Ubuntu):
importance: Undecided → Low
Revision history for this message
Simon McVittie (smcv) wrote :

There is now an <abstractions/wayland>, which is #include'd by <abstractions/gnome>. It includes weston-shared, but not the Wayland socket itself.

I suspect a better rule for that would be:

owner /run/user/*/wayland-[0-9]* rw,

so that the numbered sockets that are conventionally used are matched more precisely.

The complete set of possible fd-passed shared-memory backing files is more like:

owner /run/user/*/{mesa,mutter,sdl,weston,xwayland}-shared-* rw,

because the Wayland code to create an anonymous backing file for shared memory has been copied and pasted all over the place, with some instances changing the name.

Revision history for this message
Seth Arnold (seth-arnold) wrote :

Thanks Simon,

Committed revision 3590.

Steve Beattie (sbeattie)
Changed in apparmor:
milestone: none → 2.11
Revision history for this message
intrigeri (intrigeri) wrote :

Cherry-picked in Debian's Vcs-Bzr, will be part of the apparmor 2.10.95-7 upload. Thanks everybody!

Christian Boltz (cboltz)
Changed in apparmor:
status: New → Fix Committed
Christian Boltz (cboltz)
Changed in apparmor:
status: Fix Committed → Fix Released
Revision history for this message
intrigeri (intrigeri) wrote :

This was fixed in 2.11.0 so it's fixed in zesty.

summary: - Evince's Apparmour profile prevents opening docs from other apps under
+ Evince's AppArmor profile prevents opening docs from other apps under
Wayland
Changed in apparmor (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.