Bug 1731371 - Downloaded Widevine plugin do have wrong SELinux label
Summary: Downloaded Widevine plugin do have wrong SELinux label
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: firefox
Version: 32
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Martin Stransky
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-07-19 09:31 UTC by Bastien Nocera
Modified: 2022-10-05 12:56 UTC (History)
15 users (show)

Fixed In Version: firefox-82.0-4.fc32 firefox-82.0-4.fc33 firefox-82.0-4.fc31 firefox-105.0.2-1.fc38
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-10-21 19:58:53 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Missing space in test (463 bytes, patch)
2020-10-21 18:57 UTC, Daniel Crisman
no flags Details | Diff

Description Bastien Nocera 2019-07-19 09:31:11 UTC
firefox-68.0-4.fc30.x86_64

plugin-container crashes when loading the Widevine plugin when this plugin has been installed through Firefox itself, due to SELinux refusing to load the file. I could replicate this going either to Prime Video or Netflix.

Jul 18 18:02:33 classic audit[26922]: AVC avc:  denied  { execute } for  pid=26922 comm="plugin-containe" path="/home/hadess/.mozilla/firefox/giyttnoj.default/gmp-widevinecdm/4.10.1196.0/libwidevinecdm.so" dev=>
Jul 18 18:02:33 classic audit[26922]: ANOM_ABEND auid=1000 uid=1000 gid=1000 ses=2 subj=unconfined_u:unconfined_r:mozilla_plugin_t:s0-s0:c0.c1023 pid=26922 comm="plugin-containe" exe="/usr/lib64/firefox/plugin->
Jul 18 18:02:33 classic kernel: plugin-containe[26922]: segfault at 0 ip 00007fad59cca826 sp 00007ffd33e55f20 error 6 in libxul.so[7fad588e1000+36bd000]
Jul 18 18:02:33 classic kernel: Code: 00 00 00 00 00 00 00 0f 0b 4c 8d 05 3c 45 7d 02 4c 89 00 c7 04 25 00 00 00 00 00 00 00 00 0f 0b 48 8d 3d 55 45 7d 02 48 89 38 <c7> 04 25 00 00 00 00 00 00 00 00 0f 0b 48 8d>
Jul 18 18:02:33 classic firefox.desktop[1741]: ###!!! [Parent][MessageChannel::Call] Error: Channel error: cannot send/recv

Process 26922 (plugin-containe) of user 1000 dumped core.

Stack trace of thread 26922:
#0  0x00007fad59cca826 n/a (libxul.so)
#1  0x00007fad5a8852c3 n/a (libxul.so)
#2  0x00007fad5a7f2bbb n/a (libxul.so)
#3  0x00007fad5a8873c5 n/a (libxul.so)
#4  0x00007fad58a52551 n/a (libxul.so)
#5  0x00007fad5af5fa81 n/a (libxul.so)
#6  0x00007fad5af967cc n/a (libxul.so)
#7  0x00007fad5aa8eba9 n/a (libxul.so)
#8  0x00007fad5901150e n/a (libxul.so)
#9  0x000055ee2bd68e8c n/a (plugin-container)
#10 0x00007fad57bdbf33 __libc_start_main (libc.so.6)
#11 0x000055ee2bd54fee _start (plugin-container)

Stack trace of thread 26925:
#0  0x00007fad57cadfad syscall (libc.so.6)
#1  0x00007fad5aa8f72b epoll_wait (libxul.so)
#2  0x00007fad5aa8f65b n/a (libxul.so)
#3  0x00007fad5aa8f4b9 n/a (libxul.so)
#4  0x00007fad5aa8ec73 n/a (libxul.so)
#5  0x00007fad5aa8eba9 n/a (libxul.so)
#6  0x00007fad5aa8da8e n/a (libxul.so)
#7  0x00007fad5aa8d98b n/a (libxul.so)
#8  0x00007fad5e0795a2 start_thread (libpthread.so.0)
#9  0x00007fad57cb3303 __clone (libc.so.6)

I can't gather a useful backtrace because running gdb on this backtrace eats through 16GB of RAM and leaves my machine unusable for ours.

Running restorecon on ~/.mozilla fixes the problem. See:
https://bazile.org/writing/2019/watching_hulu_and_prime_video_in_firefox_on_fedora.html

(is there a bug open about ~/.mozilla being used rather than ~/.local/share or ~/.config?)

Comment 1 Ben Cotton 2020-04-30 21:17:29 UTC
This message is a reminder that Fedora 30 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 30 on 2020-05-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '30'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 30 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 2 Robin Gierse 2020-06-08 18:35:30 UTC
I can replicate this completely and it took me a whole week to figure this out. And I didn't check, but I am sure I had the very same issue on F31.

Shouldn't someone be able to address this somehow? Can I help somehow?

Comment 3 Martin Stransky 2020-06-08 18:51:25 UTC
Frankly I have no idea. Adding selinux keyword to make it visible to SELinux folks.

Comment 4 Robin Gierse 2020-06-11 18:34:17 UTC
I copied my firefox from a F31 box to a freshly installed F32 box, but as the plugin is installed afterwards I would think there should be no correlation, right?

Comment 5 Martin Stransky 2020-06-13 07:55:21 UTC
(In reply to John Smith from comment #4)
> I copied my firefox from a F31 box to a freshly installed F32 box, but as
> the plugin is installed afterwards I would think there should be no
> correlation, right?

Do you have any SELinux error messages?

Can you:

- create a new profile?
- try Mozilla binaries?

See https://fedoraproject.org/wiki/How_to_debug_Firefox_problems?rd=Bug_info_Firefox for more info.

Comment 6 Robin Gierse 2020-06-13 09:50:09 UTC
(In reply to Martin Stransky from comment #5)
> (In reply to John Smith from comment #4)
> > I copied my firefox from a F31 box to a freshly installed F32 box, but as
> > the plugin is installed afterwards I would think there should be no
> > correlation, right?
> 
> Do you have any SELinux error messages?
> 
> Can you:
> 
> - create a new profile?
> - try Mozilla binaries?
> 
> See
> https://fedoraproject.org/wiki/
> How_to_debug_Firefox_problems?rd=Bug_info_Firefox for more info.

Hi Martin, sorry for the confusion.
I meant to write 'Firefox Profile" not hust "Firefox. I installed Firefox from the official Fedora repos.
I had the exact same issue as Bastien descibed in the original issue and I already solved it using his hint with restorecon.
But yes, I saw the very same "AVC denied" message he described. New profile didn't work though, for me it was definitely SELinux.

I just thought I would give a heads up, as this might an issue for users. Hope my information is helpful.

Comment 7 Martin Stransky 2020-06-14 05:54:35 UTC
Okay, Thanks.

Comment 8 Bastien Nocera 2020-06-16 08:56:45 UTC
(In reply to Martin Stransky from comment #7)
> Okay, Thanks.

Unless I'm mistaken, it's still broken, so reopening.

Comment 9 Robin Gierse 2020-06-17 17:38:23 UTC
+1 Bastien, as long as we can not pinpoint this to be a user error this should be addressed.

Comment 10 Martin Stransky 2020-09-13 18:41:53 UTC
Hm I suspect that's about wrong SELinux label of files which are downloaded by Firefox itself (the widevine plugin).
the files are downloaded to user profile, like the one from Bastien's example:

/home/hadess/.mozilla/firefox/giyttnoj.default/gmp-widevinecdm/4.10.1196.0/libwidevinecdm.so

but I'm not sure how to handle that.

Comment 11 Martin Stransky 2020-09-13 18:45:19 UTC
I think it may be possible to run restorecon on a specified directory (gmp-widevinecdm from current profile) and it should be run after the plugin download. Not sure if restorecon can be launched from Firefox itself.

Comment 12 Robin Gierse 2020-09-16 16:31:16 UTC
So this might be a task for the Firefox devs? @Martin Stransky is there a line of communication between Fedora and Mozilla that could be facilitated? Or should someone just open an issue with them?

Comment 13 Martin Stransky 2020-09-23 07:28:54 UTC
(In reply to John Smith from comment #12)
> So this might be a task for the Firefox devs? @Martin Stransky is there a
> line of communication between Fedora and Mozilla that could be facilitated?
> Or should someone just open an issue with them?

Mozilla does not do any system integration and SELinux fixes. This is Fedora specific issue and SELinux issue. The user profile needs to be re-labeled somehow.

Comment 14 Martin Stransky 2020-09-23 07:30:18 UTC
I wonder if we can run SELinux relabel for the whole ~/.mozilla/firefox directory in ff startup script?

Comment 15 Martin Stransky 2020-09-23 07:59:53 UTC
Added to firefox-81.0-6.

Comment 16 Noah Friedman 2020-10-11 03:30:25 UTC
Whoever added the call to `restorecon ... &` to /usr/bin/firefox: this is leaving zombie processes around since the shell that started it isn't around to reap it.

Change it from 

# When Firefox is not running, restore SELinux labels for profile files
# (rhbz#1731371)
if [ $MOZILLA_DOWN -ne 0 ]; then
  if [ `getenforce` != "Disabled" ]; then
    restorecon -vr ~/.mozilla/firefox/* &
  fi
fi



to


# When Firefox is not running, restore SELinux labels for profile files
# (rhbz#1731371)
if [ $MOZILLA_DOWN -ne 0 ]; then
  if [ `getenforce` != "Disabled" ]; then
    (restorecon -vr ~/.mozilla/firefox/* &)
  fi
fi

Comment 17 el reporto 2020-10-12 06:30:28 UTC Comment hidden (spam)
Comment 18 Martin Stransky 2020-10-12 13:09:19 UTC
Guys, I'm not very skilled in the SELinux stuff so I'd use any help here.
Thanks.

Comment 19 Robin Gierse 2020-10-13 10:13:20 UTC
I am neither great with SELinux nor have I ever packaged software. But as far as I understand the last anwers the fix from Noah should address the situation with the zombies and although I see el reportos point I think it might not be the worst problem, as a system with enabled SELinux probably also has getenforce?

Comment 20 Martin Stransky 2020-10-16 14:50:17 UTC
I added the () to 82.0-2 builds, Thanks. I also added a check if getneforce is present and the relabel is performed in that case only.

Comment 21 Noah Friedman 2020-10-16 16:13:39 UTC
Thanks.

Regarding el reporto's comment, there is a supported way to run restorecond in user sessions, and /etc/selinux/restorecond_user.conf includes ~/.config/* by default, but firefox still uses ~/.mozilla.  Considering that the cache files moved to $XDG_CACHE_HOME quite some time ago, it seems like the firefox profiles should move to $XDG_CONFIG_HOME too, but in the meantime maybe best practice would be to add ~/.mozilla to restorecond_user.conf and to advise running restorecond in user mode (restorecond -u) when a new session starts.  I don't think applications were really meant to be responsible for handling relabeling on their own.

Comment 22 Martin Stransky 2020-10-16 17:29:39 UTC
restorecond is provided by policycoreutils-restorecond package. Is that supposed to be installed by default? Because I don't have it on my system (Fedora 32) and I use a default workspace installation. Anyway, let's report that against policycoreutils-restorecond to include ~/.mozilla there. Thanks for the advice!

Comment 23 Martin Stransky 2020-10-16 17:33:10 UTC
(In reply to Martin Stransky from comment #22)
> restorecond is provided by policycoreutils-restorecond package. Is that
> supposed to be installed by default? Because I don't have it on my system
> (Fedora 32) and I use a default workspace installation. Anyway, let's report
> that against policycoreutils-restorecond to include ~/.mozilla there. Thanks
> for the advice!

Filed as Bug 1888994.

Comment 24 Fedora Update System 2020-10-20 07:16:07 UTC
FEDORA-2020-aba1d14e9e has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-aba1d14e9e

Comment 25 Fedora Update System 2020-10-20 07:16:09 UTC
FEDORA-2020-de83d27335 has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2020-de83d27335

Comment 26 Nicolas Mailhot 2020-10-20 08:54:10 UTC
Not sure it is a good idea to restorecon stuff behind the admin’s back, but anyway

$ firefox
/usr/bin/firefox: ligne 186: [Enforcing : commande introuvable

Your shell test is missing a space

Comment 27 Fedora Update System 2020-10-20 14:24:04 UTC
FEDORA-2020-c82e86cde0 has been pushed to the Fedora 33 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-c82e86cde0`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-c82e86cde0

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 28 Fedora Update System 2020-10-20 18:50:17 UTC
FEDORA-2020-de83d27335 has been pushed to the Fedora 31 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-de83d27335`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-de83d27335

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 29 Fedora Update System 2020-10-20 19:00:41 UTC
FEDORA-2020-aba1d14e9e has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-aba1d14e9e`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-aba1d14e9e

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 30 Daniel Crisman 2020-10-21 18:57:11 UTC
Created attachment 1723287 [details]
Missing space in test

Seconding comment 26, there is a missing space in shell test.

Comment 31 Fedora Update System 2020-10-21 19:58:53 UTC
FEDORA-2020-aba1d14e9e has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 32 Fedora Update System 2020-10-23 22:17:46 UTC
FEDORA-2020-c82e86cde0 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 33 Fedora Update System 2020-10-23 22:47:22 UTC
FEDORA-2020-de83d27335 has been pushed to the Fedora 31 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 34 Fedora Update System 2022-10-05 12:47:07 UTC
FEDORA-2022-f0988ea008 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2022-f0988ea008

Comment 35 Fedora Update System 2022-10-05 12:56:37 UTC
FEDORA-2022-f0988ea008 has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.