Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firefox 60+ fails to run content processes #1765

Closed
johnp opened this issue Feb 7, 2018 · 21 comments
Closed

Firefox 60+ fails to run content processes #1765

johnp opened this issue Feb 7, 2018 · 21 comments
Labels
bug Something isn't working

Comments

@johnp
Copy link

johnp commented Feb 7, 2018

Firefox Nightly doesn't seem to be able to start child processes / no tabs loading websites (except about:-stuff, which AFAIK runs in the parent process), crashing them instead:

https://crash-stats.mozilla.com/report/index/288d3c2b-c0be-4a85-af97-b294f0180207

I suspect bug 1401062 to be the issue, but don't know how to debug further.

firejail latest master / 0.9.53 on Fedora 27, works with --noprofile.

@smitsohu
Copy link
Collaborator

smitsohu commented Feb 7, 2018

Thanks for your report. Could you please check briefly if it works when you replace seccomp in /etc/firejail/firefox.profile with the long seccomp.drop line from qutebrowser profile?

@johnp
Copy link
Author

johnp commented Feb 7, 2018

No, doesn't work, but I just saw that a fresh firefox profile works fine. I'll check my preferences to see what's triggering the issue...

@johnp
Copy link
Author

johnp commented Feb 7, 2018

I verified via mozregression that bug 140162 is the issue. (pushlog)

Ok, now I tried again several times and a fresh profile doesn't work either, but --safe-mode does.

@SkewedZeppelin
Copy link
Collaborator

We'll probably eventually need to remove seccomp and add caps.keep sys_chroot,sys_admin like chromium.profile as mentioned in #1414.

@smitsohu smitsohu added the bug Something isn't working label Feb 26, 2018
@smitsohu
Copy link
Collaborator

smitsohu commented Mar 17, 2018

It seems that three options are causing problems: noroot, seccomp and apparmor. They work just fine in some distributions (Arch, Debian) and are breaking Firefox in others (Fedora, Ubuntu), depending on how distributions handle unprivileged user namespaces.

@johnp Can you please comment out these lines in your Firefox profile and give it a try? Instead of disabling seccomp altogether, you can also replace it with this long line:

seccomp.drop @clock,@cpu-emulation,@debug,@module,@obsolete,@raw-io,@reboot,@resources,@swap,acct,add_key,bpf,fanotify_init,io_cancel,io_destroy,io_getevents,io_setup,io_submit,ioprio_set,kcmp,keyctl,mount,name_to_handle_at,nfsservctl,ni_syscall,open_by_handle_at,personality,pivot_root,process_vm_readv,ptrace,remap_file_pages,request_key,setdomainname,sethostname,syslog,umount,umount2,userfaultfd,vhangup,vmsplice

If you want to double-check: Adding chroot to the seccomp.drop line should crash Firefox again.

@johnp
Copy link
Author

johnp commented Mar 18, 2018

@smitsohu Yes, works with noroot, seccomp and apparmor commented out and with the seccomp.drop line together with noroot and apparmor commented out. Adding chroot makes Firefox unusable again.

@m0n5t3r
Copy link

m0n5t3r commented Mar 23, 2018

on Ubuntu 16.04 (and firejail 0.9.52 from ppa:deki/firejail) I had to drop pivot-root from the seccomp line above (original issue: I was seeing blank windows, closing them didn't end the firefox program, but it would crash later in libmozsandbox.so - I assume it does some sort of chroot-ing on its own and needs that capability).

it works for me with noroot in there, btw. (and there is no apparmor line in my version of firejail)

@smitsohu
Copy link
Collaborator

Thanks @m0n5t3r for the data point.

With regard to the Apparmor policy: Firefox crashes when it can't write to /proc/[pid]/uid_map, gid_map or setgroups.

@Vincent43
Copy link
Collaborator

With regard to the Apparmor policy: Firefox crashes when it can't write to /proc/[pid]/uid_map, gid_map or setgroups.

That never happened to me. Is this new nightly thing?

@smitsohu
Copy link
Collaborator

@Vincent43 Yep, it's only Nightly (for now).

@Vincent43
Copy link
Collaborator

Ok, we can fix it with adding owner /proc/[0-9]*/{uid_map,gid_map,setgroups} w, to firejail apparmor profile.

@smitsohu
Copy link
Collaborator

smitsohu commented Mar 29, 2018

Someone an idea why noroot is breaking it?

It seems the user mapping goes a wrong way with noroot, /proc/[firefoxPID]/* files are not owned by the user but by nobody inside the sandbox. EDIT: That might also be the reason why shell none is causing problems in #1847. Actually both options seem to break Firefox only jointly.

Another question is if this should be fixed in nightly/dev profiles, or directly in firefox-common.inc.

@johnp johnp changed the title Firefox Nightly fails to run content processes Firefox 60+ fails to run content processes Mar 30, 2018
@Vincent43
Copy link
Collaborator

Vincent43 commented Apr 5, 2018

I think we should remove noroot,seccomp,shell from firefox-common.inc otherwise it will be broken again after firefox 60 release (firejail releases are't that often).

@smitsohu
Copy link
Collaborator

smitsohu commented Apr 5, 2018

It should be sufficient to either disable noroot or shell none, I guess we have a choice here. Also since most of seccomp works well, how about a seccomp.drop line in firefox-common?

Btw, I still see problems only with chroot and have not been able to replicate the issue with pivot_root yet. Maybe I'm missing a condition?

EDITED: @Vincent43 but yes, I would agree to fix directly in firefox-common. palemon and basilisk could then get their own profiles without redirection.

@Vincent43
Copy link
Collaborator

I don't think seccomp is worth to keep when firefox rolls its own seccomp filter (and this is probably reason why it's breaking). We can trust upstream knowing which calls should be allowed. We don't use it in chromium profile already.

In my understanding norootbehavior differs on various distros (on some doesn't cause problems) so maybe disabling shell is better option.

@Fred-Barclay
Copy link
Collaborator

I'd prefer to have at least seccomp.drop. We may have to get rid of it entirely some day for Firefox, but for now I think we ought to keep seccomp around in some form.

We should probably drop shell none instead of noroot too. We can always control exactly which shells are present, and what can be called through them, with private-bin even without shell none.

@smitsohu
Copy link
Collaborator

smitsohu commented Apr 5, 2018

seccomp.drop should still be useful since the Firefox parent process runs without any sandbox AFAIK, similar to the situation with Chromium.

Mozilla has spoken out against a SUID sandbox because it breaks support for downloading and running Firefox as a regular user, without installation, something Chromium has never attempted to support. As a consequence, seccomp.drop should do the job also in the foreseeable future.

+1 for disabling shell none.

@Fred-Barclay
Copy link
Collaborator

This should hopefully be fixed in upstream now.
seccomp was replaced with the string @smitsohu provided in #1765 (comment)

After a brief discussion, pivot_root was left in as neither @smitsohu nor I were able to reproduce any issues with it (I tested firefox nightly and beta on Mint 18.2).

shell none was also commented out.

@pizzadude
Copy link
Contributor

pizzadude commented Apr 9, 2018

@Fred-Barclay it isn't fixed for me

I had to fix it manually, by commenting out:
nogroups

and possibly:
noroot
apparmor
(but not sure if those need to be commented out)

and disable-mnt because i have downloads folder in /media but that's unrelated

and this is on debian sid with firefox nightly and firejail latest git

Edit:
After testing again, it turns out I need to disable a few more settings, but I don't know which ones, so it looks like this:

https://pastebin.com/raw/GQx3BVyA
(there's more to the seccomp line, but it's truncated because i copy/pasted from nano)

which ones are the most important security wise?

@Fred-Barclay
Copy link
Collaborator

Fred-Barclay commented Apr 9, 2018

@pizzadude we had to change a few other settings for apparmor. Can you build from the latests source and test again?
Thanks!
Fred

@pizzadude
Copy link
Contributor

@Fred-Barclay
It works fine when I comment tracelog out. It seems tracelog is the culprit. I'm not sure why. (not a programmer)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants