Closed Bug 1802513 Opened 2 years ago Closed 2 years ago

MP3s are decoded using the system's ffmpeg on desktop Linux, instead of the vendored ffmpeg

Categories

(Core :: Audio/Video: Playback, defect)

defect

Tracking

()

RESOLVED FIXED
109 Branch
Tracking Status
firefox108 --- fixed
firefox109 --- fixed

People

(Reporter: padenot, Assigned: gerard-majax)

References

Details

Attachments

(3 files)

Found in https://bugzilla.mozilla.org/show_bug.cgi?id=1796532#c13.

I verified that, e.g. on macOS, the mp3 decoder vendored in Firefox is used (instead of e.g. the OS's decoder, that we also have code for).

It tooks a while to get to the bottom of this, but it's the utility process sandbox that prevents the runtime linker for our ffvpx library to work.

It's failing here: https://searchfox.org/mozilla-central/source/dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp#67, attempting to read /proc/self/exe to get the current binary path.

Alex, do you mind having a look at this?

Flags: needinfo?(lissyx+mozillians)
Assignee: padenot → nobody
Blocks: 1796532

When running Firefox with MOZ_DISABLE_UTILITY_SANDBOX set to 1, ffvpx is used, otherwise, the ffmpeg libraries from the system are used.

An easy way to check this is to profile Firefox with the Firefox Profiler and check where the actual mp3 decoding function are coming from, mozavcodec.so if ffvpx is used, some other path if the system's library are in use.

Flags: needinfo?(lissyx+mozillians)

How much urgent is this?

Jed, what is your take on allowing readlink in Utility sandbox? That seems to be enough. Maybe we should limit it to allowing /proc/self/exe ?

Flags: needinfo?(jld)
Assignee: nobody → lissyx+mozillians

GetDescriptionName() should probably reflect audio decoder being ffmpeg/ffvpx like video does.

(In reply to Alexandre LISSY :gerard-majax from comment #5)

GetDescriptionName() should probably reflect audio decoder being ffmpeg/ffvpx like video does.

I dont really get how it works, but https://searchfox.org/mozilla-central/rev/d2fa2b9615dd8460b079804d0075180f689d2ba6/dom/media/platforms/ffmpeg/ffvpx/moz.build#38 doing the same on audio and playing with sandbox rules shows we have either ffmpeg or ffvpx, so we can test that as well

(In reply to Alexandre LISSY :gerard-majax from comment #4)

Jed, what is your take on allowing readlink in Utility sandbox? That seems to be enough. Maybe we should limit it to allowing /proc/self/exe ?

readlink is already allowed (partially) via the file broker, so it should work to just add a rule for reading /proc/self/exe to the broker policy. (That will also allow opening and reading the executable file, but of course most of it is already mapped into the process.)

Flags: needinfo?(jld)
Attachment #9305601 - Attachment description: Bug 1802513 - Allow readlink() in Utility sandbox for FFVPX r?jld! → Bug 1802513 - Allow readlink(/proc/self/exe) in Utility sandbox for FFVPX r?jld!

Comment on attachment 9305601 [details]
Bug 1802513 - Allow readlink(/proc/self/exe) in Utility sandbox for FFVPX r?jld!

Beta/Release Uplift Approval Request

  • User impact if declined: Wrong version of ffmpeg used
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Actual fix is a one-line change to allow readlink(/proc/self/exe), and it comes with improved testing. It is easy to backout in case of issues.
  • String changes made/needed: N/A
  • Is Android affected?: No
Attachment #9305601 - Flags: approval-mozilla-beta?
Attachment #9305600 - Flags: approval-mozilla-beta?
Attachment #9305602 - Flags: approval-mozilla-beta?
Pushed by alissy@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/177018bf4443 Expose ffmpeg/ffvpx audio r=alwu https://hg.mozilla.org/integration/autoland/rev/c068d136d7a3 Allow readlink(/proc/self/exe) in Utility sandbox for FFVPX r=gcp https://hg.mozilla.org/integration/autoland/rev/e6598d87dcf2 Augment utility audio tests with ffmpeg/ffvpx r=alwu
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 109 Branch

Comment on attachment 9305600 [details]
Bug 1802513 - Expose ffmpeg/ffvpx audio r?alwu!

Approved for 108.0b9

Attachment #9305600 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9305601 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9305602 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: