Attached is kettenis's libavcodec patch that fixes the crashes reported
by ratchov. For me it crashed in this function generated by fft.asm:

#0  0x000001524dceba2f in ff_fft_calc_avx () from 
/usr/local/lib/firefox/libmozavcodec.so.122.0

The beta builds provided by landry don't crash since they were not
linked with --execute-only. Please update your builder to a -current
snapshot with the linker change, so that we test the real thing :)

The patch applies as-is to fx 109 and 110b6 and with some fuzz against
thunderbird and seamonkey. I tested it with --execute-only firefox
109.0p0 and 110.0b6. They don't crash. It should also build on i386
(I've not tested that).

The following will all need a version of this patch:

mail/mozilla-thunderbird
www/firefox-esr
www/mozilla-firefox
www/seamonkey
www/tor-browser/browser

Already patched by kettenis:

graphics/ffmpeg.log
x11/mplayer.log

Sorry. I should have noticed this earlier. I can't reconstruct how I
fooled myself into thinking that firefox used ffmpeg...
The x86 assembly FFT implementation uses dispatch tables in .text.  This is
incompatible with x-only so move them into .data.rel.ro where we can have
relocations.  But since they are in the RELRO segment they will be made
read-only by ld.so after relocations have been processed.

Index: media/ffvpx/libavcodec/x86/fft.asm
--- media/ffvpx/libavcodec/x86/fft.asm.orig
+++ media/ffvpx/libavcodec/x86/fft.asm
@@ -457,10 +457,6 @@ DEFINE_ARGS zc, w, n, o1, o3
 %macro FFT_DISPATCH 2; clobbers 5 GPRs, 8 XMMs
     lea r2, [dispatch_tab%1]
     mov r2, [r2 + (%2q-2)*gprsize]
-%ifdef PIC
-    lea r3, [$$]
-    add r2, r3
-%endif
     call r2
 %endmacro ; FFT_DISPATCH
 
@@ -585,12 +581,6 @@ cglobal imdct_calc, 3,5,3
     jl      .loop
     REP_RET
 
-%ifdef PIC
-%define SECTION_REL - $$
-%else
-%define SECTION_REL
-%endif
-
 %macro DECL_FFT 1-2 ; nbits, suffix
 %ifidn %0, 1
 %xdefine fullsuffix SUFFIX
@@ -627,8 +617,10 @@ fft %+ n %+ fullsuffix:
 %endrep
 %undef n
 
+[SECTION .data.rel.ro write]
 align 8
 dispatch_tab %+ fullsuffix: pointer list_of_fft
+__?SECT?__
 %endmacro ; DECL_FFT
 
 %if HAVE_AVX_EXTERNAL

Reply via email to