Crash in [@ MediaLibvaCaps::CheckAttribList] (RDD crash, Linux, KDE neon)
Categories
(Core :: Audio/Video: Playback, defect)
Tracking
()
People
(Reporter: Sylvestre, Assigned: karlt)
References
Details
(4 keywords, Whiteboard: [adv-main137+r][adv-esr128.9+r] )
Crash Data
Attachments
(1 file, 6 external files, 2 obsolete files)
|
70.92 KB,
text/plain
|
Details |
Crash report: https://crash-stats.mozilla.org/report/index/22ece291-fcd1-458d-a19b-5e4c60230820
Reason: SIGSEGV / SI_KERNEL
Top 10 frames of crashing thread:
0 iHD_drv_video.so MediaLibvaCaps::CheckAttribList obj-x86_64-linux-gnu/media_driver/media_driver/linux/common/ddi/media_libva_caps.cpp:475
1 iHD_drv_video.so MediaLibvaCaps::CreateConfig obj-x86_64-linux-gnu/media_driver/media_driver/linux/common/ddi/media_libva_caps.cpp:2313
2 libva.so.2 vaCreateConfig va/va/va.c:934
3 libmozavcodec.so vaCreateConfig media/mozva/mozva.c:278
3 libmozavcodec.so vaapi_decode_make_config media/ffvpx/libavcodec/vaapi_decode.c:547
4 libmozavcodec.so ff_vaapi_decode_init media/ffvpx/libavcodec/vaapi_decode.c:680
5 libmozavcodec.so hwaccel_init media/ffvpx/libavcodec/decode.c:1235
5 libmozavcodec.so ff_get_format media/ffvpx/libavcodec/decode.c:1373
6 libmozavcodec.so get_pixel_format media/ffvpx/libavcodec/av1dec.c:611
6 libmozavcodec.so av1_receive_frame_internal media/ffvpx/libavcodec/av1dec.c:1228
I have often OOM issue on this system
Comment 1•3 years ago
|
||
The severity field is not set for this bug.
:jimm, could you have a look please?
For more information, please visit BugBot documentation.
Comment 2•3 years ago
|
||
Sylvestre, can you share about:support of the machine on which you see this?
| Reporter | ||
Comment 3•3 years ago
|
||
| Reporter | ||
Updated•3 years ago
|
Comment 4•3 years ago
|
||
Martin, is this something you know of? Crash when attempting to decode AV1 with an intel HW decoder.
Comment 5•3 years ago
|
||
These crashes, including the one in comment 0, are happening on the jemalloc poison value, 0xe5e5e5e5e5e5e5f5, indicating a use-after-free.
Comment 6•3 years ago
|
||
(In reply to Paul Adenot (:padenot) from comment #4)
Martin, is this something you know of? Crash when attempting to decode AV1 with an intel HW decoder.
No idea. Sylvestre, can you reproduce it? For instance do you have an AV1 clip which can trigger it?
Comment 8•3 years ago
•
|
||
Two reports, RDD crash in an intel driver on Linux. Only one user who can't reproduce. I guess we could block this driver but since we're not seeing this 'in the wild', might be worth simply monitoring.
Comment 9•3 years ago
|
||
The severity field is not set for this bug.
:jimm, could you have a look please?
For more information, please visit BugBot documentation.
Updated•3 years ago
|
Updated•3 years ago
|
Comment 10•3 years ago
|
||
This was happening rather frequently late in August, but it hasn't occurred since September 11, so let's just close this, given that it sounds like there are no ideas for paths forward here.
Updated•3 years ago
|
Comment 11•1 year ago
|
||
This has been present at a low level the whole 6 month crash window I can see, but really took off again a month ago in 136 nightlies, all with Intel graphics. No particular driver version: 24.0.9.0 is the most common (about a third of the crashes), but there are some 22.x, 23.x, and newer 24.x versions represented.
I don't see any 137 nightly crashes yet so maybe this is an alternate presentation of something we fixed. The stacks still look like comment 0
bp-b263c8e3-9e7c-4d05-8120-ecd9c0250204
Apart from the driver-specific top of the stack, they also look very much like the nVidia crash bug 1946407
Comment 12•1 year ago
|
||
The severity field for this bug is set to S3. However, the bug is flagged with the sec-high keyword.
:jimm, could you consider increasing the severity of this security bug?
For more information, please visit BugBot documentation.
Updated•1 year ago
|
Comment 13•1 year ago
|
||
| Assignee | ||
Comment 15•1 year ago
|
||
This is about the lifetime of a VADriverVTable. Gecko or ffmpeg might plausibly be influencing the lifetime through vaTerminate(VADisplay).
Martin, do you know whether the default false value of "media.ffmpeg.vaapi.enabled" means that only users that have enabled this feature under development would be using the code involved here?
Or might ffmpeg/ffvpx bypass this pref?
Comment 16•1 year ago
|
||
(In reply to Karl Tomlinson (:karlt) from comment #15)
This is about the lifetime of a
VADriverVTable. Gecko or ffmpeg might plausibly be influencing the lifetime throughvaTerminate(VADisplay).Martin, do you know whether the default
falsevalue of "media.ffmpeg.vaapi.enabled" means that only users that have enabled this feature under development would be using the code involved here?
Or might ffmpeg/ffvpx bypass this pref?
media.ffmpeg.vaapi.enabled is here from historical reasons, we may remove it.
VA-API decoding on Linux follows 'media.hardware-video-decoding.enabled' pref and it's enabled by default on recent MESA and AMD/Intel drivers.
| Assignee | ||
Comment 17•1 year ago
|
||
DdiMediaProtected::FreeInstances() deletes all DdiMediaProtected pointees of the singleton map DdiMediaProtected::_impl. The pointers are reset to null, but this is not atomic. DdiMediaProtected is not reference counted.
DdiMediaProtected::GetInstance() will return a DdiMediaProtected* from _impl if non-null or create a new DdiMediaProtected. The key is apparently always DDI_PROTECTED_CONTENT.
DdiMediaProtected::FreeInstances() is called from DdiMedia_Terminate(), an implementation of vaTerminate(), with media_libva.cpp's singleton GlobalMutex is held. This prevents concurrency of FreeInstances() calls, but the mutex is not held during GetInstance() calls. GlobalMutex is also held during DdiMedia_InitMediaContext(), but this is not when GetInstance() calls are made.
When GetInstance() and FreeInstances() run on different threads GetInstance() can fetch a DdiMediaProtected* before it is deleted.
The driver seems to think that only one VADisplay will be in use concurrently.
| Assignee | ||
Comment 18•1 year ago
|
||
vaTerminate() is triggered on destruction of Gecko's implementation of a VAAPI AVHWDeviceContext.
When two of these exist concurrently, vaTerminate() may be called for one while the other is in use for calls into libva.
Perhaps a single VADisplay can be shared between AVHWDeviceContext objects so that vaTerminate() is not called until libva is unused.
This is hoping that nothing else will use libva from the same process.
| Assignee | ||
Comment 19•1 year ago
•
|
||
I don't know when the Intel driver became used by default.
Anything that changed the frequency or timing of decoder destruction may have changed the likelihood of the race running badly.
| Assignee | ||
Comment 20•1 year ago
|
||
Bug 1752494 enabled this for Nightly and bug 1777430 for release.
| Assignee | ||
Comment 21•1 year ago
|
||
Updated•1 year ago
|
| Assignee | ||
Comment 22•1 year ago
|
||
Updated•1 year ago
|
Updated•1 year ago
|
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 23•1 year ago
•
|
||
Comment on attachment 9468838 [details]
Bug 1850615 Share the same libva handle across all FFmpegVideoDecoders r?stransky
Security Approval Request
- How easily could an exploit be constructed based on the patch?: The UaF involves a race where there is a short window of opportunity between the
delete()ion of the vtable object and the nulling of its pointer on the same thread.
The crash occurs in the Remote Data Decoder process which is sandboxed.
Content could most likely influence the timing of thedelete()and the concurrent reference. - Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?: No
- Which branches (beta, release, and/or ESR) are affected by this flaw, and do the release status flags reflect this affected/unaffected state correctly?: Beta, Release, ESR115, ESR128, and yes
- If not all supported branches, which bug introduced the flaw?: Bug 1777430
- Do you have backports for the affected branches?: No
- If not, how different, hard to create, and risky will they be?: There will be some merge conflicts to resolve due to the size of the patch, but the relevant code has not changed in behavior, so additional risk is not significant.
- How likely is this patch to cause regressions; how much testing does it need?: Due to the interaction with third party libraries and the size of the patches, this would benefit from some Nightly exposure.
- Is the patch ready to land after security approval is given?: Yes
- Is Android affected?: No
| Assignee | ||
Updated•1 year ago
|
Comment 24•1 year ago
|
||
Comment on attachment 9468839 [details]
Bug 1850615 Share the same VADisplay across all FFmpegVideoDecoders r?stransky
Approved to land and request uplift when ready
Comment 25•1 year ago
|
||
Comment on attachment 9468838 [details]
Bug 1850615 Share the same libva handle across all FFmpegVideoDecoders r?stransky
Approved to land and request uplift when ready
Comment 26•1 year ago
|
||
Comment 27•1 year ago
|
||
Comment 28•1 year ago
|
||
https://hg.mozilla.org/mozilla-central/rev/b34601c7751d
https://hg.mozilla.org/mozilla-central/rev/9d547b90a407
Comment 29•1 year ago
|
||
The patch landed in nightly and beta is affected.
:karlt, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval. Also, don't forget to request an uplift for the patches in the regressions caused by this fix.
- If no, please set
status-firefox137towontfix.
For more information, please visit BugBot documentation.
Comment 30•1 year ago
•
|
||
With the latest trunk I'm getting (on debug):
[20727] Assertion failure: int32_t(mRefCnt) > 0 (dup release), at /home/komat/src2/dom/media/platforms/ffmpeg/VALibWrapper.cpp:128
#6 0x00007f4dc111774b in MOZ_CrashSequence (aAddress=0x0, aLine=128) at /home/komat/src2/objdir-opt/dist/include/mozilla/Assertions.h:267
#7 mozilla::VADisplayHolder::MaybeDestroy (this=0x7f4db83e8740) at /home/komat/src2/dom/media/platforms/ffmpeg/VALibWrapper.cpp:128
#8 0x00007f4dc111184b in mozilla::VADisplayHolder::Release (this=0x7f4db83e8740) at /home/komat/src2/dom/media/platforms/ffmpeg/VALibWrapper.h:59
#9 0x00007f4db0e35f6d in hwdevice_ctx_free (opaque=<optimized out>, data=0x7f4db83e6740 "H\262\351\260M\177") at /home/komat/src2/media/ffvpx/libavutil/hwcontext.c:153
#10 0x00007f4db0e2a3f1 in buffer_replace (dst=<optimized out>, src=0x0) at /home/komat/src2/media/ffvpx/libavutil/buffer.c:133
#11 av_buffer_unref (buf=<optimized out>) at /home/komat/src2/media/ffvpx/libavutil/buffer.c:144
#12 0x00007f4db0889cb6 in ff_codec_close (avctx=0x7f4dcb971000) at /home/komat/src2/media/ffvpx/libavcodec/avcodec.c:484
#13 0x00007f4db0889ea9 in avcodec_close (avctx=0x7f4dcbdc9760 <_IO_stdfile_2_lock>) at /home/komat/src2/media/ffvpx/libavcodec/avcodec.c:503
#14 0x00007f4dc1100f12 in mozilla::FFmpegDataDecoder<46465650>::ProcessShutdown (this=this@entry=0x7f4db83f0a00) at /home/komat/src2/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp:280
#15 0x00007f4dc110bdd1 in mozilla::FFmpegVideoDecoder<46465650>::ProcessShutdown (this=0x7f4db83f0a00) at /home/komat/src2/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp:1785
#16 0x00007f4dc111300b in mozilla::FFmpegDataDecoder<46465650>::Shutdown()::$_0::operator()() const (this=0x7f4d9886f070) at /home/komat/src2/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp:153
#17 mozilla::detail::ProxyFunctionRunnable<mozilla::FFmpegDataDecoder<46465650>::Shutdown()::$_0, mozilla::MozPromise<bool, bool, false> >::Run (this=0x7f4d989a1ec0) at /home/komat/src2/objdir-opt/dist/include/mozilla/MozPromise.h:1821
Open video clip from disk and close Firefox window with alt+f4.
Comment 31•1 year ago
|
||
Looks like experimental media testing on Linux got it too:
https://treeherder.mozilla.org/jobs?repo=try&revision=476d03954ae80ac04be77d2d54b22a94f06f74bf&selectedTaskRun=V2m_44soR2iVEILhF5kfRg.0
| Assignee | ||
Comment 32•1 year ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D239856
Updated•1 year ago
|
| Assignee | ||
Comment 33•1 year ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D239857
Updated•1 year ago
|
Comment 34•1 year ago
|
||
beta Uplift Approval Request
- User impact if declined: sec-high
- Code covered by automated testing: no
- Fix verified in Nightly: no
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: n/a
- Risk associated with taking this patch: moderate
- Explanation of risk level: The size of the patches and the interaction with third party libraries means there is some risk affecting Linux-only video playback.
- String changes made/needed: None
- Is Android affected?: no
| Comment hidden (typo) |
Updated•1 year ago
|
| Comment hidden (typo) |
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
| Assignee | ||
Comment 37•1 year ago
|
||
Updated•1 year ago
|
| Assignee | ||
Comment 38•1 year ago
|
||
Updated•1 year ago
|
Comment 39•1 year ago
|
||
esr128 Uplift Approval Request
- User impact if declined: sec-high
- Code covered by automated testing: no
- Fix verified in Nightly: no
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: n/a
- Risk associated with taking this patch: moderate
- Explanation of risk level: The size of the patches and the interaction with third party libraries means there is some risk affecting Linux-only video playback.
- String changes made/needed: none
- Is Android affected?: no
Updated•1 year ago
|
Updated•1 year ago
|
Comment 40•1 year ago
|
||
| uplift | ||
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Comment 41•1 year ago
|
||
| uplift | ||
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
| Assignee | ||
Updated•1 year ago
|
Updated•1 year ago
|
Description
•