From 9c6caf061d0865db11ae11dfcc1614a1f9abca61 Mon Sep 17 00:00:00 2001 From: yangxianzhao Date: Thu, 23 Nov 2023 15:44:29 +0800 Subject: [PATCH] Update to firefox-115.4.0-1.el7_9 --- CVE-2023-44488-libvpx.patch | 127 ++++++++++++++++++ download | 5 +- ...refs.js => firefox-redhat-default-prefs.js | 4 +- firefox.spec | 86 ++++++------ 4 files changed, 170 insertions(+), 52 deletions(-) create mode 100644 CVE-2023-44488-libvpx.patch rename firefox-anolis-default-prefs.js => firefox-redhat-default-prefs.js (92%) diff --git a/CVE-2023-44488-libvpx.patch b/CVE-2023-44488-libvpx.patch new file mode 100644 index 0000000..79e5235 --- /dev/null +++ b/CVE-2023-44488-libvpx.patch @@ -0,0 +1,127 @@ +From 263682c9a29395055f3b3afe2d97be1828a6223f Mon Sep 17 00:00:00 2001 +From: Jerome Jiang +Date: Thu, 30 Jun 2022 13:48:56 -0400 +Subject: [PATCH] Fix bug with smaller width bigger size + +Fixed previous patch that clusterfuzz failed on. + +Bug: webm:1642 +Change-Id: If0e08e72abd2e042efe4dcfac21e4cc51afdfdb9 +--- + test/resize_test.cc | 11 +++-------- + vp9/common/vp9_alloccommon.c | 13 ++++++------- + vp9/encoder/vp9_encoder.c | 27 +++++++++++++++++++++++++-- + 3 files changed, 34 insertions(+), 17 deletions(-) + +diff --git a/test/resize_test.cc b/test/resize_test.cc +index fd1c2a92de6..20ad2229b46 100644 +--- a/test/resize_test.cc ++++ b/test/resize_test.cc +@@ -102,11 +102,8 @@ void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w, + if (frame < 30) { + return; + } +- if (frame < 100) { +- *w = initial_w * 7 / 10; +- *h = initial_h * 16 / 10; +- return; +- } ++ *w = initial_w * 7 / 10; ++ *h = initial_h * 16 / 10; + return; + } + if (frame < 10) { +@@ -559,9 +556,7 @@ TEST_P(ResizeRealtimeTest, TestExternalResizeWorks) { + } + } + +-// TODO(https://crbug.com/webm/1642): This causes a segfault in +-// init_encode_frame_mb_context(). +-TEST_P(ResizeRealtimeTest, DISABLED_TestExternalResizeSmallerWidthBiggerSize) { ++TEST_P(ResizeRealtimeTest, TestExternalResizeSmallerWidthBiggerSize) { + ResizingVideoSource video; + video.flag_codec_ = true; + video.smaller_width_larger_size_ = true; +diff --git a/vp9/common/vp9_alloccommon.c b/vp9/common/vp9_alloccommon.c +index e53883f621d..9e73e40ea09 100644 +--- a/vp9/common/vp9_alloccommon.c ++++ b/vp9/common/vp9_alloccommon.c +@@ -135,13 +135,6 @@ int vp9_alloc_context_buffers(VP9_COMMON *cm, int width, int height) { + cm->free_mi(cm); + if (cm->alloc_mi(cm, new_mi_size)) goto fail; + } +- +- if (cm->seg_map_alloc_size < cm->mi_rows * cm->mi_cols) { +- // Create the segmentation map structure and set to 0. +- free_seg_map(cm); +- if (alloc_seg_map(cm, cm->mi_rows * cm->mi_cols)) goto fail; +- } +- + if (cm->above_context_alloc_cols < cm->mi_cols) { + vpx_free(cm->above_context); + cm->above_context = (ENTROPY_CONTEXT *)vpx_calloc( +@@ -156,6 +149,12 @@ int vp9_alloc_context_buffers(VP9_COMMON *cm, int width, int height) { + cm->above_context_alloc_cols = cm->mi_cols; + } + ++ if (cm->seg_map_alloc_size < cm->mi_rows * cm->mi_cols) { ++ // Create the segmentation map structure and set to 0. ++ free_seg_map(cm); ++ if (alloc_seg_map(cm, cm->mi_rows * cm->mi_cols)) goto fail; ++ } ++ + if (vp9_alloc_loop_filter(cm)) goto fail; + + return 0; +diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c +index 69a4e3c314f..e3ba294c32f 100644 +--- a/vp9/encoder/vp9_encoder.c ++++ b/vp9/encoder/vp9_encoder.c +@@ -2047,6 +2047,17 @@ static void alloc_copy_partition_data(VP9_COMP *cpi) { + } + } + ++static void free_copy_partition_data(VP9_COMP *cpi) { ++ vpx_free(cpi->prev_partition); ++ cpi->prev_partition = NULL; ++ vpx_free(cpi->prev_segment_id); ++ cpi->prev_segment_id = NULL; ++ vpx_free(cpi->prev_variance_low); ++ cpi->prev_variance_low = NULL; ++ vpx_free(cpi->copied_frame_cnt); ++ cpi->copied_frame_cnt = NULL; ++} ++ + void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) { + VP9_COMMON *const cm = &cpi->common; + RATE_CONTROL *const rc = &cpi->rc; +@@ -2126,6 +2137,8 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) { + new_mi_size = cm->mi_stride * calc_mi_size(cm->mi_rows); + if (cm->mi_alloc_size < new_mi_size) { + vp9_free_context_buffers(cm); ++ vp9_free_pc_tree(&cpi->td); ++ vpx_free(cpi->mbmi_ext_base); + alloc_compressor_data(cpi); + realloc_segmentation_maps(cpi); + cpi->initial_width = cpi->initial_height = 0; +@@ -2144,8 +2157,18 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) { + update_frame_size(cpi); + + if (last_w != cpi->oxcf.width || last_h != cpi->oxcf.height) { +- memset(cpi->consec_zero_mv, 0, +- cm->mi_rows * cm->mi_cols * sizeof(*cpi->consec_zero_mv)); ++ vpx_free(cpi->consec_zero_mv); ++ CHECK_MEM_ERROR( ++ &cm->error, cpi->consec_zero_mv, ++ vpx_calloc(cm->mi_rows * cm->mi_cols, sizeof(*cpi->consec_zero_mv))); ++ ++ vpx_free(cpi->skin_map); ++ CHECK_MEM_ERROR( ++ &cm->error, cpi->skin_map, ++ vpx_calloc(cm->mi_rows * cm->mi_cols, sizeof(cpi->skin_map[0]))); ++ ++ free_copy_partition_data(cpi); ++ alloc_copy_partition_data(cpi); + if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ) + vp9_cyclic_refresh_reset_resize(cpi); + rc->rc_1_frame = 0; diff --git a/download b/download index c6b0ae3..166fffd 100644 --- a/download +++ b/download @@ -1,8 +1,7 @@ 9b999bdcf031e29a4d8ce2b6f17e778e cbindgen-vendor.tar.xz -49936050e7c7505c72d8d62fcbc5bb3c firefox-115.3.1esr.processed-source.tar.xz -4a883ca1d2a16e4c82a75c6425199ae3 firefox-langpacks-115.3.1esr-20230929.tar.xz +d5642fea03bb23621bdf2dc15180d2e9 firefox-115.4.0esr.processed-source.tar.xz +128855d07f1b2afa9e1f1da302f07522 firefox-langpacks-115.4.0esr-20231017.tar.xz b3c1d2ea615cb0195f4f62b005773262 mochitest-python.tar.gz 7b35b9a003996b1f1dbc3cd936a609f2 nspr-4.35.0-1.el8_1.src.rpm 3fdd30cefe44a98c424cb3aeca73f2b3 nss-3.90.0-3.el8_1.src.rpm 5c2f6d790957733c5f0d06f8caea3b0d nss-3.90.0-3.el9_0.src.rpm -6611e41665de11dd80b2ff5f1f40ee03 rust-cbindgen.tar.gz diff --git a/firefox-anolis-default-prefs.js b/firefox-redhat-default-prefs.js similarity index 92% rename from firefox-anolis-default-prefs.js rename to firefox-redhat-default-prefs.js index e24ebbd..cdb98dd 100644 --- a/firefox-anolis-default-prefs.js +++ b/firefox-redhat-default-prefs.js @@ -14,8 +14,8 @@ pref("browser.shell.checkDefaultBrowser", false); pref("network.manage-offline-status", true); pref("extensions.shownSelectionUI", true); pref("ui.SpellCheckerUnderlineStyle", 1); -pref("startup.homepage_override_url", "https://openanolis.cn"); -pref("startup.homepage_welcome_url", "https://openanolis.cn"); +pref("startup.homepage_override_url", "%HOMEPAGE%"); +pref("startup.homepage_welcome_url", "%HOMEPAGE%"); pref("browser.startup.homepage", "data:text/plain,browser.startup.homepage=file:///%PREFIX%/share/doc/HTML/index.html"); pref("media.gmp-gmpopenh264.autoupdate",true); pref("media.gmp-gmpopenh264.enabled",false); diff --git a/firefox.spec b/firefox.spec index 0fe0b50..6fd54ac 100644 --- a/firefox.spec +++ b/firefox.spec @@ -1,5 +1,4 @@ -%define anolis_release .0.1 -%global flatpak 1 +%define homepage %(grep '^HOME_URL\s*=' /etc/os-release | sed 's/^HOME_URL\s*=//;s/^\s*"//;s/"\s*$//') %global disable_toolsets 0 # Produce debug (non-optimized) package build. Suitable for debugging only @@ -67,7 +66,7 @@ end} %global nspr_version_max 4.36 %global nss_version 3.90 %global nss_version_max 3.91 -#%global rust_version 1.66 +%global rust_version 1.66 %global system_libvpx 0 # Toolsets setup @@ -91,11 +90,11 @@ end} %endif %if 0%{?rhel} == 7 - %global use_dts 1 + %global use_dts 1 %global use_llvm_ts 1 %global use_nodejs_scl 1 %global nodejs_build_req rh-nodejs10-nodejs - %global llvm_version 11.0 + %global llvm_version 11.0 %global use_python3_scl 1 %endif @@ -115,8 +114,8 @@ end} %endif -%global mozappdir %{_libdir}/firefox -%global langpackdir %{mozappdir}/browser/extensions +%global mozappdir %{_libdir}/firefox +%global langpackdir %{mozappdir}/browser/extensions %define bundled_install_path %{mozappdir}/bundled %global pre_version esr # Workaround the dreaded "upstream source file changed content" rpminspect failure. @@ -133,8 +132,8 @@ end} Summary: Mozilla Firefox Web browser Name: firefox -Version: 115.3.1 -Release: 1%{anolis_release}%{?dist} +Version: 115.4.0 +Release: 1%{?dist} URL: https://www.mozilla.org/firefox/ License: MPLv1.1 or GPLv2+ or LGPLv2+ @@ -149,7 +148,7 @@ ExcludeArch: %{ix86} %endif %endif %if 0%{?rhel} == 7 -ExcludeArch: s390 ppc +ExcludeArch: aarch64 s390 ppc %endif # We can't use the official tarball as it contains some test files that use @@ -159,12 +158,12 @@ ExcludeArch: s390 ppc # Link to original tarball: https://archive.mozilla.org/pub/firefox/releases/%%{version}%%{?pre_version}/source/firefox-%%{version}%%{?pre_version}.source.tar.xz Source0: firefox-%{version}%{?pre_version}%{?buildnum}.processed-source.tar.xz %if %{with langpacks} -Source1: firefox-langpacks-%{version}%{?pre_version}-20230929.tar.xz +Source1: firefox-langpacks-%{version}%{?pre_version}-20231017.tar.xz %endif Source2: cbindgen-vendor.tar.xz Source3: process-official-tarball Source10: firefox-mozconfig -Source12: firefox-anolis-default-prefs.js +Source12: firefox-redhat-default-prefs.js Source20: firefox.desktop Source21: firefox.sh.in Source23: firefox.1 @@ -186,7 +185,6 @@ Source401: nss-setup-flags-env.inc Source402: nspr-4.35.0-1.el8_1.src.rpm Source403: nss-3.90.0-3.el8_1.src.rpm Source404: nss-3.90.0-3.el9_0.src.rpm -Source405: rust-cbindgen.tar.gz # ---- RHEL specific patches --- # -- Downstream only -- @@ -232,6 +230,9 @@ Patch155: rhbz-1354671.patch # GENDIFF_DIFF_ARGS=-U0 gendiff firefox-xxxx .firefox-tests-reftest Patch201: firefox-tests-xpcshell-freeze.patch +# ---- Security patches ---- +Patch301: CVE-2023-44488-libvpx.patch + # BUILD REQURES/REQUIRES %if %{?system_nss} && !0%{?bundle_nss} BuildRequires: pkgconfig(nspr) >= %{nspr_version} @@ -326,7 +327,7 @@ BuildRequires: llvm-toolset-%{llvm_version}-llvm-devel %endif %if 0%{?use_rust_ts} -#BuildRequires: rust-toolset +BuildRequires: rust-toolset-%{rust_version} %endif # Bundled nss/nspr requirement @@ -976,15 +977,15 @@ to run Firefox explicitly on X11. %prep echo "Build environment" echo "--------------------------------------------" -echo "dist %{?dist}" -echo "RHEL 8 minor version: %{?rhel_minor_version}" -echo "bundle_nss %{?bundle_nss}" -echo "system_nss %{?system_nss}" -echo "use_rust_ts %{?use_rust_ts}" -echo "use_dts %{?use_dts}" -echo "use_nodejs_scl %{?use_nodejs_scl}" -echo "use_llvm_ts %{?use_llvm_ts}" -echo "use_python3_scl %{?use_python3_scl}" +echo "dist %{?dist}" +echo "RHEL minor version: %{?rhel_minor_version}" +echo "bundle_nss %{?bundle_nss}" +echo "system_nss %{?system_nss}" +echo "use_rust_ts %{?use_rust_ts}" +echo "use_dts %{?use_dts}" +echo "use_nodejs_scl %{?use_nodejs_scl}" +echo "use_llvm_ts %{?use_llvm_ts}" +echo "use_python3_scl %{?use_python3_scl}" echo "--------------------------------------------" %setup -q -n %{name}-%{version} @@ -1037,6 +1038,11 @@ echo "--------------------------------------------" # ---- Test patches ---- %patch -P201 -p1 -b .firefox-tests-xpcshell-freeze +# ---- Security patches ---- +cd media/libvpx/libvpx +%patch -P301 -p1 -b .CVE-2023-44488-libvpx +cd - + %{__rm} -f .mozconfig %{__cp} %{SOURCE10} .mozconfig %{__cp} %{SOURCE24} mozilla-api-key @@ -1211,7 +1217,7 @@ source scl_source enable gcc-toolset-12 source scl_source enable devtoolset-%{dts_version} %endif %if 0%{?use_rust_ts} -source scl_source enable rust-toolset +source scl_source enable rust-toolset-%{rust_version} %endif %if 0%{?use_nodejs_scl} source scl_source enable rh-nodejs10 @@ -1236,24 +1242,8 @@ which python3 mkdir -p my_rust_vendor cd my_rust_vendor %{__tar} xf %{SOURCE2} -cd .. -mkdir rust-cbindgen -cd rust-cbindgen -%{__tar} xf %{SOURCE405} -mkdir -p %{_buildrootdir}/cargo -export CACHE_DIR=%{_buildrootdir}/cargo -CARGO_HOME=$CACHE_DIR RUSTUP_HOME=$CACHE_DIR -%ifarch aarch64 -cp -r rust-cbindgen/rust-cbindgen-aarch64/* $CACHE_DIR -%endif -%ifarch x86_64 -cp -r rust-cbindgen/rust-cbindgen-x86_64/* $CACHE_DIR -%endif -export PATH=$CACHE_DIR/bin/:$PATH -export LD_LIBRARY_PATH=$CACHE_DIR/lib:$LD_LIBRARY_PATH -##rustup default stable -rustc --version -cat > %{_buildrootdir}/cargo/config < .cargo/config <> %{buildroot}%{mozappdir}/defaults/preferences/all-redhat.js @@ -1736,9 +1727,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog -* Fri Nov 10 2023 yangxianzhao - 115.3.1-1.0.1 -- rebrand: rebrand to anolis -- fix build error +* Tue Oct 17 2023 Eike Rathke - 115.4.0-1 +- Update to 115.4.0 build1 +- Add fix for CVE-2023-44488 +- Set homepage from os-release HOME_URL * Fri Sep 29 2023 Eike Rathke - 115.3.1-1 - Update to 115.3.1 -- Gitee