From 8d6a8edf595332acbc671895925a8ec1b284b4d9 Mon Sep 17 00:00:00 2001 From: tb Date: Sat, 28 Jan 2023 08:42:03 +0000 Subject: [PATCH] mozilla-firefox embeds a libavcodec that can be triggered by sites doing audio recording. Port over kettenis's fft.asm fix from ffmpeg. ok landry --- www/mozilla-firefox/Makefile | 2 +- .../patch-media_ffvpx_libavcodec_x86_fft_asm | 43 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 www/mozilla-firefox/patches/patch-media_ffvpx_libavcodec_x86_fft_asm diff --git a/www/mozilla-firefox/Makefile b/www/mozilla-firefox/Makefile index 6c172f39b76..9f7ccba3924 100644 --- a/www/mozilla-firefox/Makefile +++ b/www/mozilla-firefox/Makefile @@ -8,7 +8,7 @@ MOZILLA_PROFDATA_TASKID=E6EpiLkcTuGLthcSZ80YWA MOZILLA_BRANCH = release MOZILLA_PROJECT = firefox MOZILLA_CODENAME = browser -REVISION = 0 +REVISION = 1 WRKDIST = ${WRKDIR}/${MOZILLA_DIST}-${MOZILLA_DIST_VERSION:C/b[0-9]*//} HOMEPAGE = https://www.mozilla.org/firefox/ diff --git a/www/mozilla-firefox/patches/patch-media_ffvpx_libavcodec_x86_fft_asm b/www/mozilla-firefox/patches/patch-media_ffvpx_libavcodec_x86_fft_asm new file mode 100644 index 00000000000..117086848ad --- /dev/null +++ b/www/mozilla-firefox/patches/patch-media_ffvpx_libavcodec_x86_fft_asm @@ -0,0 +1,43 @@ +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