Public bug reported:

Switching to the Mozilla Team PPA's firefox
(159.0+build1-0ubuntu0.26.04.1~mt1) from Mozilla's own package from
packages.mozilla.org (159.0~build1) on Ubuntu 26.04 makes Firefox crash
at startup.

The PPA package installs /etc/apparmor.d/usr.bin.firefox, an enforcing
profile named "firefox" (debian/usr.bin.firefox.apparmor.14.10). Its
preinst disables the profile only on a fresh install, or on an upgrade
from a version before 3.7~a1~hg20091203. For dpkg, replacing Mozilla's
package is an upgrade from 159.0~build1, so the profile is left enabled.
/etc/apparmor.d/disable/ stays empty and postinst loads the profile
right away.

Ubuntu's apparmor package (5.0.2-0ubuntu1~26.04.1) ships
/etc/apparmor.d/firefox with a profile of the same name, "firefox", with
flags=(unconfined) and the userns rule which Firefox's sandbox needs.
Both files define the same profile, so whichever is loaded last wins:
postinst replaces Ubuntu's profile in the kernel, and at boot
usr.bin.firefox is loaded after firefox.

Under the old profile, the kernel log shows denials (profile="firefox")
for:

- file_lock on the profile directory under ~/.config/mozilla/firefox/
- mknod of /run/user/1000/wayland-proxy-*
- capability 21 (sys_admin)
- exec of /usr/bin/bwrap by gly-hdl-loader (glycin image loaders)
- ptrace between Firefox processes
- D-Bus calls to the gvfs metadata service

GTK then aborts with Gtk:ERROR in gtkiconhelper.c
(ensure_surface_for_gicon) because the icon cannot be loaded, and
Firefox crashes.

Steps to reproduce:

1. On Ubuntu 26.04, install firefox from https://packages.mozilla.org/apt.
2. Add ppa:mozillateam/ppa, pin firefox to it, and upgrade firefox to the PPA's 
version.
3. Start Firefox.

Expected: Firefox runs under Ubuntu's "firefox" profile from the
apparmor package, as it does with Mozilla's package and with a fresh
install of the PPA package.

Actual: Firefox runs under the profile from usr.bin.firefox and crashes
at startup.

Workaround:

```
sudo ln -s /etc/apparmor.d/usr.bin.firefox 
/etc/apparmor.d/disable/usr.bin.firefox
sudo apparmor_parser -R /etc/apparmor.d/usr.bin.firefox
sudo apparmor_parser -r /etc/apparmor.d/firefox
```

Suggested fix: since the apparmor package ships its own "firefox"
profile, the PPA package could stop shipping usr.bin.firefox altogether.
It would drop the file from firefox.install.in, drop the AppArmor blocks
from preinst and postinst, remove the conffile with `rm_conffile
/etc/apparmor.d/usr.bin.firefox` in a debian/firefox.maintscript, and
reload /etc/apparmor.d/firefox in postinst so the old profile does not
stay loaded until a reboot. I carry a local patch which drops the
profile and all its handling in the maintainer scripts, without the
conffile removal since my systems were cleaned up by hand, and can
attach it. A smaller fix would be for preinst to call disable_profile on
every upgrade, not only on upgrades from before 3.7: it acts only when
/etc/apparmor.d/usr.bin.firefox does not exist yet, which is the case
when the previous package, like Mozilla's, did not ship it.

** Affects: firefox (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: apparmor ppa resolute

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2172775

Title:
  [PPA] firefox enables its outdated usr.bin.firefox AppArmor profile
  when upgrading from Mozilla's .deb, and Firefox crashes at startup

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/2172775/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to