Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package nodejs-electron for openSUSE:Factory checked in at 2022-10-26 12:42:46 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/nodejs-electron (Old) and /work/SRC/openSUSE:Factory/.nodejs-electron.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "nodejs-electron" Wed Oct 26 12:42:46 2022 rev:39 rq:1031231 version:21.1.1 Changes: -------- --- /work/SRC/openSUSE:Factory/nodejs-electron/nodejs-electron.changes 2022-10-14 15:42:42.155934761 +0200 +++ /work/SRC/openSUSE:Factory/.nodejs-electron.new.2275/nodejs-electron.changes 2022-10-26 12:42:47.577723986 +0200 @@ -1,0 +2,29 @@ +Sun Oct 23 12:54:08 UTC 2022 - Bruno Pitrus <brunopit...@hotmail.com> +- Enable LTO on x64 (Tumbleweed and Fedora only) now that it works correctly. + * add seccomp_bpf-no-lto.patch +- Do not build some chromium features unused in Electron. +- Remove upstream's tinkering with optimization flags. + * change chromium-102-compiler.patch +- Remove upstream's warning suppression + * change chromium-102-compiler.patch + * add -Wno-class-memaccess due to log spam + * add -Wno-error=narrowing due to non-compliant generated code +- Add -DIS_SERIAL_ENABLED_PLATFORM to work around upstream C++ ODR error. +- Build main binary as PIE instead of PIC. + * change chromium-102-compiler.patch + * add fpic.patch +- Compile with gcc11 (was 10) on Leap now that it's available. +- Add backported patches + * compact_enc_det_generated_tables-Wnarrowing.patch + * half_float-Wstrict-aliasing.patch + * ipcz-buffer_id-Wnarrowing.patch + * select_file_dialog_linux_kde-Wodr.patch + * string_hasher-type-pun-UB-causes-heap-corruption.patch + * unzip-Wsubobject-linkage.patch + * web_contents_impl-Wsubobject-linkage.patch +- Add patches to fix C++ bugs and submit them upstream + * swiftshader-Constants-Wstrict-aliasing.patch + * swiftshader-Half-Wstrict-aliasing.patch + * v8_initializer-PageAllocator-fpermissive.patch + +------------------------------------------------------------------- New: ---- compact_enc_det_generated_tables-Wnarrowing.patch fpic.patch half_float-Wstrict-aliasing.patch ipcz-buffer_id-Wnarrowing.patch seccomp_bpf-no-lto.patch select_file_dialog_linux_kde-Wodr.patch string_hasher-type-pun-UB-causes-heap-corruption.patch swiftshader-Constants-Wstrict-aliasing.patch swiftshader-Half-Wstrict-aliasing.patch unzip-Wsubobject-linkage.patch v8_initializer-PageAllocator-fpermissive.patch web_contents_impl-Wsubobject-linkage.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nodejs-electron.spec ++++++ --- /var/tmp/diff_new_pack.fRIbca/_old 2022-10-26 12:42:51.317731993 +0200 +++ /var/tmp/diff_new_pack.fRIbca/_new 2022-10-26 12:42:51.321732002 +0200 @@ -96,13 +96,17 @@ #Mold succeeds on ix86 but seems to produce corrupt binaries (no build-id) %bcond_with mold +%ifnarch %ix86 %arm aarch64 +# OBS does not have enough powerful machines to build with LTO on aarch64. -%if 0%{without clang} -#LTO on GCC is broken. -#Electron crashes on selecting any text. see https://gist.github.com/brjsp/80620a5a0be9efbee6b9154cb127879d for the stack trace. +%if (0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150600 || 0%{?fedora}) +%bcond_without lto +%else %bcond_with lto +%endif + %else -%bcond_without lto +%bcond_with lto %endif @@ -232,6 +236,7 @@ # PATCHES for openSUSE-specific things Patch0: chromium-102-compiler.patch +Patch1: fpic.patch Patch3: gcc-enable-lto.patch Patch5: chromium-norar.patch Patch6: chromium-vaapi.patch @@ -298,6 +303,7 @@ Patch2029: electron-16-webpack-fix-openssl-3.patch Patch2030: v8-icu69-FormattedNumberRange-no-default-constructible.patch Patch2031: partition_alloc-no-lto.patch +Patch2032: seccomp_bpf-no-lto.patch # PATCHES that should be submitted upstream verbatim or near-verbatim @@ -322,6 +328,16 @@ Patch3075: std_lib_extras-missing-intptr_t.patch Patch3076: gtk_ui_platform_stub-incomplete-type-LinuxInputMethodContext.patch Patch3077: argument_spec-missing-isnan-isinf.patch +Patch3078: select_file_dialog_linux_kde-Wodr.patch +Patch3079: web_contents_impl-Wsubobject-linkage.patch +Patch3080: compact_enc_det_generated_tables-Wnarrowing.patch +Patch3081: string_hasher-type-pun-UB-causes-heap-corruption.patch +Patch3082: ipcz-buffer_id-Wnarrowing.patch +Patch3083: swiftshader-Half-Wstrict-aliasing.patch +Patch3084: swiftshader-Constants-Wstrict-aliasing.patch +Patch3085: half_float-Wstrict-aliasing.patch +Patch3086: unzip-Wsubobject-linkage.patch +Patch3087: v8_initializer-PageAllocator-fpermissive.patch %if %{with clang} BuildRequires: clang @@ -342,7 +358,6 @@ %if %{with system_crc32c} BuildRequires: cmake(Crc32c) %endif -BuildRequires: cups-devel %if %{with system_double_conversion} BuildRequires: double-conversion-devel %endif @@ -368,7 +383,6 @@ %endif BuildRequires: libbsd-devel BuildRequires: libpng-devel -BuildRequires: libtiff-devel %if %{with system_nvctrl} BuildRequires: libXNVCtrl-devel %endif @@ -503,7 +517,6 @@ BuildRequires: pkgconfig(libcurl) BuildRequires: pkgconfig(libdrm) BuildRequires: pkgconfig(libevent) -BuildRequires: pkgconfig(libffi) %if %{with system_jxl} BuildRequires: pkgconfig(libjxl) %endif @@ -533,7 +546,6 @@ %endif BuildRequires: pkgconfig(nspr) >= 4.9.5 BuildRequires: pkgconfig(nss) >= 3.26 -BuildRequires: pkgconfig(ogg) BuildRequires: pkgconfig(opus) >= 1.3.1 BuildRequires: pkgconfig(pangocairo) BuildRequires: pkgconfig(re2) @@ -558,11 +570,11 @@ %endif %if %{without clang} %if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150600 || 0%{?fedora} -BuildRequires: gcc >= 10 -BuildRequires: gcc-c++ >= 10 +BuildRequires: gcc >= 11 +BuildRequires: gcc-c++ >= 11 %else -BuildRequires: gcc10 -BuildRequires: gcc10-c++ +BuildRequires: gcc11-PIE +BuildRequires: gcc11-c++ %endif %endif %if %{with pipewire} @@ -686,6 +698,10 @@ #some Fedora ports still try to build with LTO ARCH_FLAGS=$(echo "%optflags"|sed 's/-f[^ ]*lto[^ ]*//g' ) +#Work around an upstream ODR issue. +#Remove this once https://bugs.chromium.org/p/chromium/issues/detail?id=1375049 gets fixed. +ARCH_FLAGS="$ARCH_FLAGS -DIS_SERIAL_ENABLED_PLATFORM" + @@ -706,18 +722,22 @@ export CFLAGS="${CXXFLAGS}" # Google has a bad coding style, using a macro `NOTREACHED()` that is not properly detected by GCC -# multiple times throughout the codebase. It is not possible to redefine the macro to __builtin_unreachable, +# multiple times throughout the codebase (including generated code). It is not possible to redefine the macro to __builtin_unreachable, # as it has an astonishing syntax, behaving like an ostream (in debug builds it is supposed to trap and print an error message) export CXXFLAGS="${CXXFLAGS} -Wno-error=return-type" -# As of 19.0.8, export_gin_v8platform_pageallocator_for_usage_outside_of_the_gin.patch -# introduces non-conformant C++ code (redefinition of PageAllocator) -# This is an Electron-specific problem that does not appear in Chromium. -export CXXFLAGS="${CXXFLAGS} -fpermissive" +# [ 8947s] gen/third_party/blink/renderer/bindings/modules/v8/v8_gpu_sampler_descriptor.h:212:39: error: narrowing conversion of '4294967295' from 'unsigned int' to 'float' [-Wnarrowing] +# [ 8947s] 212 | float member_lod_max_clamp_{0xffffffff}; +# I have no idea where this code is generated, and it is not something that needs a critical fix. +# Remove this once upstream issues a proper patch. +export CXXFLAGS="${CXXFLAGS} -Wno-error=narrowing" + +# A bunch of memcpy'ing of JSObject in V8 runs us into ???Logfile got too big, killed job.??? +export CXXFLAGS="${CXXFLAGS} -Wno-class-memaccess" # REDUCE DEBUG for C++ as it gets TOO large due to ???heavy hemplate use in Blink???. See symbol_level below and chromium-102-compiler.patch export CXXFLAGS="$(echo ${CXXFLAGS} | sed -e 's/-g / /g' -e 's/-g$//g')" -%ifarch %ix86 %arm +%ifnarch x86_64 export CFLAGS="$(echo ${CFLAGS} | sed -e 's/-g /-g1 /g' -e 's/-g$/-g1/g')" %endif @@ -725,8 +745,6 @@ export LDFLAGS="%{?build_ldflags}" - - %if %{with clang} @@ -742,13 +760,17 @@ %ifarch %ix86 %arm #try to reduce memory -#%%if %{with gold} -#export LDFLAGS="${LDFLAGS} -Wl,--no-map-whole-files -Wl,--no-keep-memory -Wl,--no-keep-files-mapped" -#%%else -#export LDFLAGS="${LDFLAGS} -Wl,--no-keep-memory -Wl,--hash-size=30 -Wl,--reduce-memory-overheads" -#%%endif +%if %{without lld} + +%if %{with gold} +export LDFLAGS="${LDFLAGS} -Wl,--no-map-whole-files -Wl,--no-keep-memory -Wl,--no-keep-files-mapped" +%else +export LDFLAGS="${LDFLAGS} -Wl,--no-keep-memory -Wl,--hash-size=30 -Wl,--reduce-memory-overheads" %endif +%endif #without lld +%endif #ifarch ix86 arm + @@ -759,11 +781,11 @@ export NM=gcc-nm export RANLIB=gcc-ranlib %else -export CC=gcc-10 -export CXX=g++-10 -export AR=gcc-ar-10 -export NM=gcc-nm-10 -export RANLIB=gcc-ranlib-10 +export CC=gcc-11 +export CXX=g++-11 +export AR=gcc-ar-11 +export NM=gcc-nm-11 +export RANLIB=gcc-ranlib-11 %endif # endif with clang @@ -787,8 +809,17 @@ %if %{with lto} && %{without clang} # reduce the threads for linking even more due to LTO eating ton of memory _link_threads=$(((%{jobs} - 2))) + %ifarch aarch64 _link_threads=1 + +%if %{with gold} +export LDFLAGS="${LDFLAGS} -Wl,--no-map-whole-files -Wl,--no-keep-memory -Wl,--no-keep-files-mapped" +%else +export LDFLAGS="${LDFLAGS} -Wl,--no-keep-memory -Wl,--hash-size=30 -Wl,--reduce-memory-overheads" +%endif + + %endif test "$_link_threads" -le 0 && _link_threads=1 export LDFLAGS="$LDFLAGS -flto=$_link_threads --param lto-max-streaming-parallelism=1" @@ -1010,7 +1041,11 @@ # symbol_level=0 disable debug # blink (HTML engine) and v8 (js engine) are template-heavy, trying to compile them with full debug leads to linker errors %ifnarch %ix86 %arm aarch64 +%if %{without lto} myconf_gn+=" symbol_level=2" +%else +myconf_gn+=" symbol_level=1" +%endif myconf_gn+=" blink_symbol_level=1" myconf_gn+=" v8_symbol_level=1" %endif @@ -1026,12 +1061,18 @@ %endif myconf_gn+=" use_kerberos=true" + +# do not build some chrome features not used by electron myconf_gn+=" enable_vr=false" myconf_gn+=" optimize_webui=false" myconf_gn+=" enable_reading_list=false" myconf_gn+=" enable_reporting=false" myconf_gn+=" build_with_tflite_lib=false" myconf_gn+=" safe_browsing_mode=0" +myconf_gn+=" enable_captive_portal_detection=false" +myconf_gn+=" enable_browser_speech_service=false" +myconf_gn+=" enable_speech_service=false" +myconf_gn+=" enable_screen_ai_service=false" #Do not build Chromecast myconf_gn+=" enable_remoting=false" @@ -1151,7 +1192,8 @@ ninja -v %{?_smp_mflags} -C out/Release chromium_licenses ninja -v %{?_smp_mflags} -C out/Release copy_headers -ninja -v %{?_smp_mflags} -C out/Release electron +# dump the linker command line (if any) in case of failure +ninja -v %{?_smp_mflags} -C out/Release electron || (cat out/Release/*.rsp | sed 's/ /\n/g' && false) ++++++ chromium-102-compiler.patch ++++++ --- /var/tmp/diff_new_pack.fRIbca/_old 2022-10-26 12:42:51.397732164 +0200 +++ /var/tmp/diff_new_pack.fRIbca/_new 2022-10-26 12:42:51.401732173 +0200 @@ -1,3 +1,15 @@ +SUSE: Disable the following: +* Optimizer flags. Anything other than straight -O2 isn't well tested (either more or less optimization) + * -flto still needs to be handled by gn as it needs to be disabled for some targets, + and global CFLAGS go at the end of the commandline +* Submodel options (-march and friends). Upstream notoriously forces SSE3 despite the code not requiring it. + * note that cpu options for ARM are currently left in, as they do not seem to do harm and V8 needs to know the exact target anyway +* Debuginfo format. Upstream seems to force something that is not recognized by rpmbuild. + * per-target debuginfo level is left in as it is still useful (-g2 everywhere does not work) +* Emitting code for the PIC model. It is needed in case of shared libraries, but results in a larger executable (and Electron is already enormous) + It should be enabled individually on code that gets into separate libraries (and we know when to do it ??? otherwise we're getting linker error) + + From 307a0f63dd9b118f4b8470ed3d7567e81fdb7a6d Mon Sep 17 00:00:00 2001 From: Mike Gilbert <flop...@gentoo.org> Date: Fri, 22 Apr 2022 09:05:24 +0000 @@ -11,7 +23,7 @@ index d40843b..b92f03b 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn -@@ -286,9 +286,7 @@ +@@ -274,9 +274,7 @@ configs += [ # See the definitions below. @@ -21,7 +33,31 @@ ":compiler_codegen", ":compiler_deterministic", ] -@@ -522,31 +520,6 @@ +@@ -305,7 +303,12 @@ + if (!is_win) { + # Common POSIX compiler flags setup. + # -------------------------------- +- cflags += [ "-fno-strict-aliasing" ] # See http://crbug.com/32204 ++ # To future SUSE maintainers: Do not re-enable this, you will save yourself hours of debugging! ++ # This is an optimizer flag, not a C dialect flag to make GCC behave like clang. ++ # Despite what the -Wlto-type-mismatch warning text tells you, enabling this will NOT fix miscompiles, ++ # and seems to cause other problems in GCC12. See https://bugs.chromium.org/p/chromium/issues/detail?id=1373615#c6 ++ # ANY BUGS DUE TO ALIASING SHOULD BE FIXED IN CODE, AND THE PATCHES SENT UPSTREAM! ++ # cflags += [ "-fno-strict-aliasing" ] # See http://crbug.com/32204 + + # Stack protection. + if (is_apple) { +@@ -432,9 +435,6 @@ + # Linux/Android/Fuchsia common flags setup. + # --------------------------------- + if (is_linux || is_chromeos || is_android || is_fuchsia) { +- asmflags += [ "-fPIC" ] +- cflags += [ "-fPIC" ] +- ldflags += [ "-fPIC" ] + + if (!is_clang) { + # Use pipes for communicating between sub-processes. Faster. +@@ -527,31 +527,6 @@ ldflags += [ "-Wl,-z,keep-text-section-prefix" ] } @@ -53,7 +89,7 @@ # Rust compiler setup (for either clang or rustc). if (enable_rust) { defines += [ "RUST_ENABLED" ] -@@ -880,7 +853,8 @@ +@@ -862,7 +837,8 @@ # without using everything that "compiler" brings in. Options that # tweak code generation for a particular CPU do not belong here! # See "compiler_codegen", below. @@ -63,7 +99,7 @@ cflags = [] ldflags = [] defines = [] -@@ -1232,45 +1206,6 @@ +@@ -1227,45 +1203,6 @@ } } @@ -109,7 +145,17 @@ # Tells the compiler not to use absolute paths when passing the default # paths to the tools it invokes. We don't want this because we don't # really need it and it can mess up the goma cache entries. -@@ -1615,7 +1541,7 @@ +@@ -1400,7 +1337,8 @@ + # Collects all warning flags that are used by default. This is used as a + # subconfig of both chromium_code and no_chromium_code. This way these + # flags are guaranteed to appear on the compile command line after -Wall. +-config("default_warnings") { ++config("default_warnings") { } ++config("xdefault_warnings") { + cflags = [] + cflags_c = [] + cflags_cc = [] +@@ -1597,7 +1535,7 @@ defines = [ "_HAS_NODISCARD" ] } } else { @@ -118,7 +164,7 @@ if (treat_warnings_as_errors) { cflags += [ "-Werror" ] -@@ -1624,10 +1550,6 @@ +@@ -1606,10 +1544,6 @@ # well. ldflags = [ "-Werror" ] } @@ -129,7 +175,7 @@ # In Chromium code, we define __STDC_foo_MACROS in order to get the # C99 macros on Mac and Linux. -@@ -1636,16 +1558,6 @@ +@@ -1618,16 +1552,6 @@ "__STDC_FORMAT_MACROS", ] @@ -146,7 +192,27 @@ if (is_mac) { cflags_objc = [ "-Wobjc-missing-property-synthesis" ] cflags_objcc = [ "-Wobjc-missing-property-synthesis" ] -@@ -2035,7 +1948,8 @@ +@@ -1887,7 +1811,8 @@ + # gcc 4.9 and earlier had no way of suppressing this warning without + # suppressing the rest of them. Here we centralize the identification of + # the gcc 4.9 toolchains. +-config("no_incompatible_pointer_warnings") { ++config("no_incompatible_pointer_warnings") { } ++config("xno_incompatible_pointer_warnings") { + cflags = [] + if (is_clang) { + cflags += [ "-Wno-incompatible-pointer-types" ] +@@ -1990,7 +1915,8 @@ + } + } + +-config("default_stack_frames") { ++config("default_stack_frames") { } ++config("xdefault_stack_frames") { + if (is_posix || is_fuchsia) { + if (enable_frame_pointers) { + cflags = [ "-fno-omit-frame-pointer" ] +@@ -2017,7 +1943,8 @@ } # Default "optimization on" config. @@ -156,7 +222,7 @@ if (is_win) { if (chrome_pgo_phase != 2) { # Favor size over speed, /O1 must be before the common flags. -@@ -2073,7 +1987,8 @@ +@@ -2055,7 +1982,8 @@ } # Turn off optimizations. @@ -166,7 +232,7 @@ if (is_win) { cflags = [ "/Od", # Disable optimization. -@@ -2113,7 +2028,8 @@ +@@ -2095,7 +2023,8 @@ # Turns up the optimization level. On Windows, this implies whole program # optimization and link-time code generation which is very expensive and should # be used sparingly. @@ -176,7 +242,7 @@ if (is_nacl && is_nacl_irt) { # The NaCl IRT is a special case and always wants its own config. # Various components do: -@@ -2146,7 +2062,8 @@ +@@ -2128,7 +2057,8 @@ # # TODO(crbug.com/621335) - rework how all of these configs are related # so that we don't need this disclaimer. @@ -186,7 +252,7 @@ if (is_nacl && is_nacl_irt) { # The NaCl IRT is a special case and always wants its own config. # Various components do: -@@ -2172,7 +2089,8 @@ +@@ -2154,7 +2084,8 @@ } } @@ -196,7 +262,7 @@ cflags = [ "-O1" ] + common_optimize_on_cflags rustflags = [ "-Copt-level=1" ] ldflags = common_optimize_on_ldflags -@@ -2291,7 +2209,8 @@ +@@ -2273,7 +2204,8 @@ } # Full symbols. @@ -206,7 +272,7 @@ if (is_win) { if (is_clang) { cflags = [ "/Z7" ] # Debug information in the .obj files. -@@ -2419,7 +2338,8 @@ +@@ -2398,7 +2330,8 @@ # Minimal symbols. # This config guarantees to hold symbol for stack trace which are shown to user # when crash happens in unittests running on buildbot. @@ -216,7 +282,7 @@ if (is_win) { # Functions, files, and line tables only. cflags = [] -@@ -2492,7 +2412,8 @@ +@@ -2470,7 +2403,8 @@ # This configuration contains function names only. That is, the compiler is # told to not generate debug information and the linker then just puts function # names in the final debug information. ++++++ compact_enc_det_generated_tables-Wnarrowing.patch ++++++ ++++ 2539 lines (skipped) ++++++ fpic.patch ++++++ Build targets which go in shared libraries as PIC to avoid linker error Use -fpic for code which goes only in dlls (gives smaller code), -fPIC for code which goes in both dlls and main executable --- a/third_party/angle/BUILD.gn +++ b/third_party/angle/BUILD.gn @@ -119,6 +119,8 @@ # This config is applied to internal Angle targets (not pushed to dependents). config("internal_config") { + cflags = ["-fPIC", "-fno-semantic-interposition"] + asmflags = ["-fPIC", "-fno-semantic-interposition"] include_dirs = [ "include", "src", --- a/third_party/angle/src/third_party/volk/BUILD.gn +++ b/third_party/angle/src/third_party/volk/BUILD.gn @@ -13,6 +13,8 @@ } source_set("volk") { + cflags = ["-fPIC", "-fno-semantic-interposition"] + asmflags = ["-fPIC", "-fno-semantic-interposition"] sources = [ "volk.c", "volk.h", --- a/third_party/swiftshader/BUILD.gn +++ b/third_party/swiftshader/BUILD.gn @@ -15,9 +15,9 @@ import("src/Reactor/reactor.gni") config("swiftshader_config") { - cflags = [] + cflags = ["-fpic", "-fno-semantic-interposition"] defines = [] - asmflags = [] + asmflags = ["-fpic", "-fno-semantic-interposition"] if (is_clang) { cflags += [ "-Wno-shadow" ] --- a/third_party/swiftshader/third_party/SPIRV-Tools/BUILD.gn +++ b/third_party/swiftshader/third_party/SPIRV-Tools/BUILD.gn @@ -356,7 +356,8 @@ ":spvtools_include_gen_dirs", ] - cflags = [] + cflags = ["-fpic", "-fno-semantic-interposition"] + asmflags = ["-fpic", "-fno-semantic-interposition"] if (is_clang) { cflags += [ "-Wno-implicit-fallthrough", --- a/third_party/vulkan-deps/spirv-tools/src/BUILD.gn +++ b/third_party/vulkan-deps/spirv-tools/src/BUILD.gn @@ -356,7 +356,8 @@ ":spvtools_include_gen_dirs", ] - cflags = [] + cflags = ["-fpic", "-fno-semantic-interposition"] + asmflags = ["-fpic", "-fno-semantic-interposition"] if (is_clang) { cflags += [ "-Wno-implicit-fallthrough", --- a/third_party/vulkan_memory_allocator/BUILD.gn +++ b/third_party/vulkan_memory_allocator/BUILD.gn @@ -35,6 +35,8 @@ } source_set("vulkan_memory_allocator") { + cflags = ["-fPIC", "-fno-semantic-interposition"] + asmflags = ["-fPIC", "-fno-semantic-interposition"] sources = [ "include/vk_mem_alloc.h", "vma.cpp", --- a/third_party/zlib/google/BUILD.gn +++ b/third_party/zlib/google/BUILD.gn @@ -40,6 +40,8 @@ # This allows other users of Chromium's zlib library, but don't use Chromium's # //base, to reuse some boilerplate code. static_library("compression_utils_portable") { + cflags = ["-fPIC", "-fno-semantic-interposition"] + asmflags = ["-fPIC", "-fno-semantic-interposition"] sources = [ "compression_utils_portable.cc", "compression_utils_portable.h", ++++++ gcc-enable-lto.patch ++++++ --- /var/tmp/diff_new_pack.fRIbca/_old 2022-10-26 12:42:51.537732464 +0200 +++ /var/tmp/diff_new_pack.fRIbca/_new 2022-10-26 12:42:51.541732472 +0200 @@ -36,36 +36,9 @@ + cflags = [ "-flto=auto" ] +} + - config("default_stack_frames") { + config("default_stack_frames") { } + config("xdefault_stack_frames") { if (is_posix || is_fuchsia) { - if (enable_frame_pointers) { Index: electron-17.1.0/sandbox/linux/BUILD.gn =================================================================== ---- electron-17.1.0.orig/sandbox/linux/BUILD.gn 2022-03-07 17:20:37.288839348 +0100 -+++ electron-17.1.0/sandbox/linux/BUILD.gn 2022-03-09 08:25:02.250701641 +0100 -@@ -245,6 +245,9 @@ component("seccomp_bpf") { - "//build:chromeos_buildflags", - "//sandbox:sandbox_buildflags", - ] -+ if (gcc_lto) { -+ configs -= [ "//build/config/compiler:gcc_lto" ] -+ } - - if (is_android) { - sources += [ -Index: chromium-96.0.4664.93/base/BUILD.gn -=================================================================== ---- a/base/BUILD.gn -+++ b/base/BUILD.gn -@@ -1986,6 +1986,10 @@ - } - } - -+ if (gcc_lto) { -+ configs -= [ "//build/config/compiler:gcc_lto" ] -+ } -+ - if (use_partition_alloc) { - sources += [ - "allocator/partition_allocator/address_pool_manager_unittest.cc", ++++++ half_float-Wstrict-aliasing.patch ++++++ --- src/ui/gfx/half_float.cc.orig 2022-10-12 18:06:39.635381500 +0200 +++ src/ui/gfx/half_float.cc 2022-10-19 21:43:26.484063300 +0200 @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <cstring> + #include "ui/gfx/half_float.h" namespace gfx { @@ -9,7 +11,9 @@ void FloatToHalfFloat(const float* input, HalfFloat* output, size_t num) { for (size_t i = 0; i < num; i++) { float tmp = input[i] * 1.9259299444e-34f; - uint32_t tmp2 = *reinterpret_cast<uint32_t*>(&tmp) + (1 << 12); + uint32_t tmp2; + std::memcpy(&tmp2, &tmp, 4); + tmp2 += (1 << 12); output[i] = (tmp2 & 0x80000000UL) >> 16 | (tmp2 >> 13); } } ++++++ ipcz-buffer_id-Wnarrowing.patch ++++++ --- src/third_party/ipcz/src/ipcz/buffer_id.h.old 2022-10-12 18:06:37.711387200 +0200 +++ src/third_party/ipcz/src/ipcz/buffer_id.h 2022-10-19 20:24:24.333015000 +0200 @@ -16,7 +16,7 @@ // either side of the NodeLink. using BufferId = StrongAlias<class BufferIdTag, uint64_t>; -constexpr BufferId kInvalidBufferId{~0}; +constexpr BufferId kInvalidBufferId{UINT64_MAX}; } // namespace ipcz ++++++ partition_alloc-no-lto.patch ++++++ --- /var/tmp/diff_new_pack.fRIbca/_old 2022-10-26 12:42:51.605732609 +0200 +++ /var/tmp/diff_new_pack.fRIbca/_new 2022-10-26 12:42:51.605732609 +0200 @@ -2,13 +2,15 @@ --- src/base/allocator/partition_allocator/BUILD.gn.old 2022-10-01 13:53:03.367797474 +0200 +++ src/base/allocator/partition_allocator/BUILD.gn 2022-10-05 14:23:53.999860356 +0200 -@@ -51,6 +51,22 @@ +@@ -51,6 +51,24 @@ } } -+source_set("partition_alloc_asm") { ++static_library("partition_alloc_asm") { + defines = [ "PA_PCSCAN_STACK_SUPPORTED" ] -+ cflags = [ "-fno-lto" ] ++ if (gcc_lto) { ++ configs -= [ "//build/config/compiler:gcc_lto" ] ++ } + if (current_cpu == "x64") { + sources = [ "starscan/stack/asm/x64/push_registers_asm.cc" ] + } else if (current_cpu == "x86") { ++++++ seccomp_bpf-no-lto.patch ++++++ --- src/sandbox/linux/BUILD.gn.old 2022-10-12 18:06:31.399406000 +0200 +++ src/sandbox/linux/BUILD.gn 2022-10-22 11:55:59.621396300 +0200 @@ -196,6 +196,28 @@ } } +static_library("seccomp_bpf_asm") { + sources = [ + "seccomp-bpf/syscall.cc", + "seccomp-bpf/syscall.h", + ] + defines = [ "SANDBOX_IMPLEMENTATION" ] + public_deps = [ + ":sandbox_services_headers", + "//sandbox:sandbox_export", + ] + deps = [ + ":sandbox_services", + "//base", + "//base/third_party/dynamic_annotations", + "//build:chromeos_buildflags", + "//sandbox:sandbox_buildflags", + ] + if (gcc_lto) { + configs -= [ "//build/config/compiler:gcc_lto" ] + } +} + component("seccomp_bpf") { sources = [ "bpf_dsl/bpf_dsl.cc", @@ -227,8 +247,6 @@ "seccomp-bpf/die.h", "seccomp-bpf/sandbox_bpf.cc", "seccomp-bpf/sandbox_bpf.h", - "seccomp-bpf/syscall.cc", - "seccomp-bpf/syscall.h", "seccomp-bpf/trap.cc", "seccomp-bpf/trap.h", ] @@ -240,6 +258,7 @@ ] deps = [ ":sandbox_services", + ":seccomp_bpf_asm", "//base", "//base/third_party/dynamic_annotations", "//build:chromeos_buildflags", ++++++ select_file_dialog_linux_kde-Wodr.patch ++++++ --- src/ui/shell_dialogs/select_file_dialog_linux_kde.cc.orig 2022-10-12 18:06:39.715381291 +0200 +++ src/ui/shell_dialogs/select_file_dialog_linux_kde.cc 2022-10-15 10:35:05.417119106 +0200 @@ -198,7 +198,7 @@ return base::GetAppOutput(command_line, &kdialog_version); } -SelectFileDialogLinuxKde* NewSelectFileDialogLinuxKde( +SelectFileDialog* NewSelectFileDialogLinuxKde( SelectFileDialog::Listener* listener, std::unique_ptr<ui::SelectFilePolicy> policy, base::nix::DesktopEnvironment desktop, ++++++ string_hasher-type-pun-UB-causes-heap-corruption.patch ++++++ --- src/third_party/blink/renderer/platform/wtf/text/string_hasher.h.orig 2022-10-12 18:06:32.355403100 +0200 +++ src/third_party/blink/renderer/platform/wtf/text/string_hasher.h 2022-10-19 18:34:04.317886800 +0200 @@ -22,6 +22,9 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_TEXT_STRING_HASHER_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_TEXT_STRING_HASHER_H_ +#include <cstring> +#include <type_traits> + #include "base/dcheck_is_on.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_uchar.h" @@ -92,38 +95,22 @@ template <typename T, UChar Converter(T)> void AddCharactersAssumingAligned(const T* data, unsigned length) { - DCHECK(!has_pending_character_); - - bool remainder = length & 1; - length >>= 1; - - while (length--) { - AddCharactersAssumingAligned(Converter(data[0]), Converter(data[1])); - data += 2; - } - - if (remainder) - AddCharacter(Converter(*data)); + AddCharactersAssumingAligned_internal<T, Converter>(reinterpret_cast<const unsigned char*>(data),length); } template <typename T> void AddCharactersAssumingAligned(const T* data, unsigned length) { - AddCharactersAssumingAligned<T, DefaultConverter>(data, length); + AddCharactersAssumingAligned_internal<T>(reinterpret_cast<const unsigned char*>(data),length); } template <typename T, UChar Converter(T)> void AddCharacters(const T* data, unsigned length) { - if (has_pending_character_ && length) { - has_pending_character_ = false; - AddCharactersAssumingAligned(pending_character_, Converter(*data++)); - --length; - } - AddCharactersAssumingAligned<T, Converter>(data, length); + AddCharacters_internal<T, Converter>(reinterpret_cast<const unsigned char*>(data),length); } template <typename T> void AddCharacters(const T* data, unsigned length) { - AddCharacters<T, DefaultConverter>(data, length); + AddCharacters_internal<T>(reinterpret_cast<const unsigned char*>(data),length); } unsigned HashWithTop8BitsMasked() const { @@ -158,14 +145,12 @@ template <typename T, UChar Converter(T)> static unsigned ComputeHashAndMaskTop8Bits(const T* data, unsigned length) { - StringHasher hasher; - hasher.AddCharactersAssumingAligned<T, Converter>(data, length); - return hasher.HashWithTop8BitsMasked(); + return ComputeHashAndMaskTop8Bits_internal<T, Converter>(reinterpret_cast<const unsigned char*>(data), length); } template <typename T> static unsigned ComputeHashAndMaskTop8Bits(const T* data, unsigned length) { - return ComputeHashAndMaskTop8Bits<T, DefaultConverter>(data, length); + return ComputeHashAndMaskTop8Bits_internal<T>(reinterpret_cast<const unsigned char*>(data), length); } template <typename T, UChar Converter(T)> @@ -186,7 +171,7 @@ // bits in StringImpl and hash strings consistently, but I don't see why // we'd want that for general memory hashing. DCHECK(!(length % 2)); - return ComputeHashAndMaskTop8Bits<UChar>(static_cast<const UChar*>(data), + return ComputeHashAndMaskTop8Bits_internal<UChar>(static_cast<const unsigned char*>(data), length / sizeof(UChar)); } @@ -202,6 +187,65 @@ static UChar DefaultConverter(UChar character) { return character; } static UChar DefaultConverter(LChar character) { return character; } + template <typename T, UChar Converter(T)> + void AddCharactersAssumingAligned_internal(const unsigned char* data, unsigned length) { + DCHECK(!has_pending_character_); + + static_assert(std::is_pod<T>::value, "we only support hashing POD types"); + bool remainder = length & 1; + length >>= 1; + + while (length--) { + T data_converted[2]; + std::memcpy(data_converted, data, sizeof(T)*2); + AddCharactersAssumingAligned(Converter(data_converted[0]), Converter(data_converted[1])); + data += sizeof(T)*2; + } + + if (remainder) { + T data_converted; + std::memcpy(&data_converted, data, sizeof(T)); + AddCharacter(Converter(data_converted)); + } + } + + template <typename T> + void AddCharactersAssumingAligned_internal(const unsigned char* data, unsigned length) { + AddCharactersAssumingAligned_internal<T, DefaultConverter>(data, length); + } + + template <typename T, UChar Converter(T)> + void AddCharacters_internal(const unsigned char* data, unsigned length) { + static_assert(std::is_pod<T>::value, "we only support hashing POD types"); + + if (has_pending_character_ && length) { + has_pending_character_ = false; + T data_converted; + std::memcpy(&data_converted, data, sizeof(T)); + AddCharactersAssumingAligned(pending_character_, Converter(data_converted)); + data += sizeof(T); + --length; + } + AddCharactersAssumingAligned_internal<T, Converter>(data, length); + } + + template <typename T> + void AddCharacters_internal(const unsigned char* data, unsigned length) { + AddCharacters_internal<T, DefaultConverter>(data, length); + } + + template <typename T, UChar Converter(T)> + static unsigned ComputeHashAndMaskTop8Bits_internal(const unsigned char* data, unsigned length) { + StringHasher hasher; + hasher.AddCharactersAssumingAligned_internal<T, Converter>(data, length); + return hasher.HashWithTop8BitsMasked(); + } + + template <typename T> + static unsigned ComputeHashAndMaskTop8Bits_internal(const unsigned char* data, unsigned length) { + return ComputeHashAndMaskTop8Bits_internal<T, DefaultConverter>(data, length); + } + unsigned AvalancheBits() const { unsigned result = hash_; ++++++ swiftshader-Constants-Wstrict-aliasing.patch ++++++ --- src/third_party/swiftshader/src/Pipeline/Constants.cpp.orig 2022-10-12 18:07:57.855149000 +0200 +++ src/third_party/swiftshader/src/Pipeline/Constants.cpp 2022-10-19 21:36:18.341533500 +0200 @@ -306,7 +306,9 @@ for(int i = 0; i <= 0xFFFF; i++) { - half2float[i] = (float)reinterpret_cast<half &>(i); + half i_float; + std::memcpy(&i_float, &i, sizeof(half)); + half2float[i] = static_cast<float>(i_float); } } ++++++ swiftshader-Half-Wstrict-aliasing.patch ++++++ --- src/third_party/swiftshader/src/System/Half.hpp.orig 2022-10-12 18:07:57.859149000 +0200 +++ src/third_party/swiftshader/src/System/Half.hpp 2022-10-19 21:30:33.133940800 +0200 @@ -19,6 +19,7 @@ #include <algorithm> #include <cmath> +#include <cstring> namespace sw { @@ -194,7 +195,8 @@ const unsigned int float32MinNormfloat11 = 0x38800000; const unsigned int float32MinDenormfloat11 = 0x35000080; - const unsigned int float32Bits = *reinterpret_cast<unsigned int *>(&fp32); + unsigned int float32Bits; + std::memcpy(&float32Bits, &fp32, 4); const bool float32Sign = (float32Bits & float32SignMask) == float32SignMask; unsigned int float32Val = float32Bits & float32ValueMask; @@ -273,7 +275,8 @@ const unsigned int float32MinNormfloat10 = 0x38800000; const unsigned int float32MinDenormfloat10 = 0x35800040; - const unsigned int float32Bits = *reinterpret_cast<unsigned int *>(&fp32); + unsigned int float32Bits; + std::memcpy(&float32Bits, &fp32, 4); const bool float32Sign = (float32Bits & float32SignMask) == float32SignMask; unsigned int float32Val = float32Bits & float32ValueMask; --- src/third_party/swiftshader/src/System/Half.cpp.orig 2022-10-12 18:07:57.859149000 +0200 +++ src/third_party/swiftshader/src/System/Half.cpp 2022-10-19 22:47:18.573634800 +0200 @@ -14,11 +14,14 @@ #include "Half.hpp" +#include <cstring> + namespace sw { half::half(float fp32) { - unsigned int fp32i = *(unsigned int *)&fp32; + unsigned int fp32i; + std::memcpy(&fp32i, &fp32, 4); unsigned int sign = (fp32i & 0x80000000) >> 16; unsigned int abs = fp32i & 0x7FFFFFFF; @@ -51,7 +54,7 @@ half::operator float() const { unsigned int fp32i; - + float ret; int s = (fp16i >> 15) & 0x00000001; int e = (fp16i >> 10) & 0x0000001F; int m = fp16i & 0x000003FF; @@ -61,8 +64,8 @@ if(m == 0) { fp32i = s << 31; - - return (float &)fp32i; + std::memcpy(&ret, &fp32i, 4); + return ret; } else { @@ -82,7 +85,8 @@ fp32i = (s << 31) | (e << 23) | m; - return (float &)fp32i; + std::memcpy(&ret, &fp32i, 4); + return ret; } half &half::operator=(float f) ++++++ unzip-Wsubobject-linkage.patch ++++++ --- src/components/services/unzip/public/cpp/unzip.cc.old 2022-10-12 18:06:29.371412000 +0200 +++ src/components/services/unzip/public/cpp/unzip.cc 2022-10-19 21:52:31.365276500 +0200 @@ -29,11 +29,6 @@ #include "mojo/public/cpp/bindings/self_owned_receiver.h" namespace unzip { -namespace { - -std::string Redact(const base::FilePath& path) { - return LOG_IS_ON(INFO) ? "'" + path.AsUTF8Unsafe() + "'" : "(redacted)"; -} class UnzipParams : public base::RefCounted<UnzipParams>, public unzip::mojom::UnzipFilter, @@ -100,6 +95,12 @@ UnzipCallback callback_; }; +namespace { + +std::string Redact(const base::FilePath& path) { + return LOG_IS_ON(INFO) ? "'" + path.AsUTF8Unsafe() + "'" : "(redacted)"; +} + class DetectEncodingParams : public base::RefCounted<DetectEncodingParams> { public: DetectEncodingParams(mojo::PendingRemote<mojom::Unzipper> unzipper, --- src/components/services/unzip/public/cpp/unzip.h.old 2022-10-12 18:06:29.371412000 +0200 +++ src/components/services/unzip/public/cpp/unzip.h 2022-10-19 21:50:20.576045300 +0200 @@ -52,9 +52,7 @@ const base::FilePath& zip_file, GetExtractedInfoCallback result_callback); -namespace { class UnzipParams; -} // Class that wraps the unzip service to manage the lifetime of its // mojo conncections to enable cancellation, etc. ++++++ v8_initializer-PageAllocator-fpermissive.patch ++++++ --- a/gin/public/v8_platform.h +++ b/gin/public/v8_platform.h @@ -29,8 +29,8 @@ // so we can be sure that the allocator used employs security features such as // enabling Arm's Branch Target Instructions for executable pages. This is // verified in the tests for gin::PageAllocator. - PageAllocator* GetPageAllocator() override; - static PageAllocator* PageAllocator(); + gin::PageAllocator* GetPageAllocator() override; + static gin::PageAllocator* PageAllocator(); void OnCriticalMemoryPressure() override; v8::ZoneBackingAllocator* GetZoneBackingAllocator() override; #endif ++++++ web_contents_impl-Wsubobject-linkage.patch ++++++ --- src/content/browser/web_contents/web_contents_impl.h.orig 2022-10-12 18:11:24.194407371 +0200 +++ src/content/browser/web_contents/web_contents_impl.h 2022-10-15 11:00:48.215200372 +0200 @@ -103,9 +103,7 @@ } // namespace service_manager namespace content { -namespace { class JavaScriptDialogDismissNotifier; -} enum class PictureInPictureResult; class BeforeUnloadBlockingDelegate; // content_browser_test_utils_internal.h class BrowserPluginEmbedder; --- src/content/browser/web_contents/web_contents_impl.cc.orig 2022-10-12 18:11:52.102315425 +0200 +++ src/content/browser/web_contents/web_contents_impl.cc 2022-10-15 14:52:19.403874437 +0200 @@ -284,32 +284,6 @@ CloseCallback callback_; }; -// This is a small helper class created while a JavaScript dialog is showing -// and destroyed when it's dismissed. Clients can register callbacks to receive -// a notification when the dialog is dismissed. -class JavaScriptDialogDismissNotifier { - public: - JavaScriptDialogDismissNotifier() = default; - - JavaScriptDialogDismissNotifier(const JavaScriptDialogDismissNotifier&) = - delete; - JavaScriptDialogDismissNotifier& operator=( - const JavaScriptDialogDismissNotifier&) = delete; - - ~JavaScriptDialogDismissNotifier() { - for (auto& callback : callbacks_) { - std::move(callback).Run(); - } - } - - void NotifyOnDismiss(base::OnceClosure callback) { - callbacks_.push_back(std::move(callback)); - } - - private: - std::vector<base::OnceClosure> callbacks_; -}; - bool FrameCompareDepth(RenderFrameHostImpl* a, RenderFrameHostImpl* b) { return a->GetFrameDepth() < b->GetFrameDepth(); } @@ -551,6 +525,32 @@ } // namespace +// This is a small helper class created while a JavaScript dialog is showing +// and destroyed when it's dismissed. Clients can register callbacks to receive +// a notification when the dialog is dismissed. +class JavaScriptDialogDismissNotifier { + public: + JavaScriptDialogDismissNotifier() = default; + + JavaScriptDialogDismissNotifier(const JavaScriptDialogDismissNotifier&) = + delete; + JavaScriptDialogDismissNotifier& operator=( + const JavaScriptDialogDismissNotifier&) = delete; + + ~JavaScriptDialogDismissNotifier() { + for (auto& callback : callbacks_) { + std::move(callback).Run(); + } + } + + void NotifyOnDismiss(base::OnceClosure callback) { + callbacks_.push_back(std::move(callback)); + } + + private: + std::vector<base::OnceClosure> callbacks_; +}; + CreatedWindow::CreatedWindow() = default; CreatedWindow::CreatedWindow(std::unique_ptr<WebContentsImpl> contents, GURL target_url)