From 1ac98cc080c5d2d687e5d0271574dda4dc33876e Mon Sep 17 00:00:00 2001 From: psykose Date: Sun, 12 Jun 2022 01:28:11 +0000 Subject: [PATCH] electron: new ptrcport --- electron/APKBUILD | 380 ++++++++++++++++++ ...-fenced_frame_utils-include.patch.chromium | 26 ++ ...ium-102-regex_pattern-array.patch.chromium | 15 + ...rtualCursor-standard-layout.patch.chromium | 216 ++++++++++ ...-revert-drop-of-system-java.patch.chromium | 15 + .../chromium-use-alpine-target.patch.chromium | 24 ++ electron/credentials-header.patch.chromium | 11 + .../default-pthread-stacksize.patch.chromium | 45 +++ electron/elf-arm.patch.chromium | 11 + ...issing-cstdint-include-musl.patch.chromium | 11 + electron/fix-narrowing-cast.patch.chromium | 53 +++ electron/fix-unittests-sandbox.patch.chromium | 11 + electron/gdbinit.patch.chromium | 21 + ...dd-utility-for-std-exchange.patch.chromium | 28 ++ electron/libxml-unbundle.patch.chromium | 11 + electron/media-base.patch.chromium | 10 + electron/memory-tagging-arm64.patch.chromium | 18 + electron/musl-crashpad.patch.chromium | 25 ++ electron/musl-fixes.patch.chromium | 221 ++++++++++ electron/musl-hacks.patch.chromium | 98 +++++ electron/musl-libc++.patch.chromium | 51 +++ electron/musl-sandbox.patch.chromium | 176 ++++++++ electron/musl-stat.patch.chromium | 12 + electron/musl-tid-caching.patch.chromium | 81 ++++ ...onic-pthread-cont_timedwait.patch.chromium | 22 + electron/nasm.patch.chromium | 11 + electron/no-execinfo.patch.chromium | 75 ++++ electron/no-getcontext.patch.chromium | 26 ++ electron/no-mallinfo.patch.chromium | 99 +++++ electron/python-jinja-3.10.patch.electron | 22 + electron/quiche-arena-size.patch.chromium | 11 + ...ove-no-opaque-pointers-flag.patch.chromium | 19 + electron/remove-strip_binary.patch.chromium | 32 ++ electron/resolver.patch.chromium | 36 ++ ...t-use-ffile-compilation-dir.patch.chromium | 48 +++ ...roll-src-third_party-ffmpeg.patch.chromium | 287 +++++++++++++ electron/scoped-file.patch.chromium | 31 ++ electron/system-node.patch.electron | 53 +++ electron/vector-const.patch.electron | 109 +++++ 39 files changed, 2451 insertions(+) create mode 100644 electron/APKBUILD create mode 100644 electron/chromium-102-fenced_frame_utils-include.patch.chromium create mode 100644 electron/chromium-102-regex_pattern-array.patch.chromium create mode 100644 electron/chromium-VirtualCursor-standard-layout.patch.chromium create mode 100644 electron/chromium-revert-drop-of-system-java.patch.chromium create mode 100644 electron/chromium-use-alpine-target.patch.chromium create mode 100644 electron/credentials-header.patch.chromium create mode 100644 electron/default-pthread-stacksize.patch.chromium create mode 100644 electron/elf-arm.patch.chromium create mode 100644 electron/fix-missing-cstdint-include-musl.patch.chromium create mode 100644 electron/fix-narrowing-cast.patch.chromium create mode 100644 electron/fix-unittests-sandbox.patch.chromium create mode 100644 electron/gdbinit.patch.chromium create mode 100644 electron/iwyu-add-utility-for-std-exchange.patch.chromium create mode 100644 electron/libxml-unbundle.patch.chromium create mode 100644 electron/media-base.patch.chromium create mode 100644 electron/memory-tagging-arm64.patch.chromium create mode 100644 electron/musl-crashpad.patch.chromium create mode 100644 electron/musl-fixes.patch.chromium create mode 100644 electron/musl-hacks.patch.chromium create mode 100644 electron/musl-libc++.patch.chromium create mode 100644 electron/musl-sandbox.patch.chromium create mode 100644 electron/musl-stat.patch.chromium create mode 100644 electron/musl-tid-caching.patch.chromium create mode 100644 electron/musl-v8-monotonic-pthread-cont_timedwait.patch.chromium create mode 100644 electron/nasm.patch.chromium create mode 100644 electron/no-execinfo.patch.chromium create mode 100644 electron/no-getcontext.patch.chromium create mode 100644 electron/no-mallinfo.patch.chromium create mode 100644 electron/python-jinja-3.10.patch.electron create mode 100644 electron/quiche-arena-size.patch.chromium create mode 100644 electron/remove-no-opaque-pointers-flag.patch.chromium create mode 100644 electron/remove-strip_binary.patch.chromium create mode 100644 electron/resolver.patch.chromium create mode 100644 electron/revert-use-ffile-compilation-dir.patch.chromium create mode 100644 electron/roll-src-third_party-ffmpeg.patch.chromium create mode 100644 electron/scoped-file.patch.chromium create mode 100644 electron/system-node.patch.electron create mode 100644 electron/vector-const.patch.electron diff --git a/electron/APKBUILD b/electron/APKBUILD new file mode 100644 index 0000000..7b59820 --- /dev/null +++ b/electron/APKBUILD @@ -0,0 +1,380 @@ +# Maintainer: psykose +pkgname=electron +pkgver=19.0.4 +pkgrel=0 +_gitrev=def1ec7f991df8e47f00c6fcbe68ece68d09107a +_chromium=102.0.5005.115 +_depot_tools=9b9f451addeb3ad230e9385d5e2c20cd1632c491 +pkgdesc="Electron" +url="https://github.com/electron/electron" +arch="" # no auto build +[ "$MAGIC" = "1" ] && arch="x86_64" +license="MIT" +depends="gtk+3.0 so:libudev.so.1 xdg-utils" +makedepends=" + alsa-lib-dev + bash + bsd-compat-headers + bzip2-dev + c-ares-dev + cairo-dev + clang-dev + clang-extra-tools + cups-dev + curl-dev + dbus-glib-dev + eudev-dev + ffmpeg-dev + findutils + flac-dev + flex + freetype-dev + gperf + gtk+3.0-dev + gn + gzip + harfbuzz-dev + hunspell-dev + http-parser-dev + hwids-usb + java-jdk + jpeg-dev + jsoncpp-dev + krb5-dev + lcms2-dev + libarchive-tools + libbsd-dev + libcap-dev + libevent-dev + libexif-dev + libgcrypt-dev + libgnome-keyring-dev + libjpeg-turbo-dev + libnotify-dev + libpng-dev + libusb-dev + libva-dev + libwebp-dev + libxcomposite-dev + libxcursor-dev + libxinerama-dev + libxml2-dev + libxrandr-dev + libxscrnsaver-dev + libxslt-dev + linux-headers + lld + mesa-dev + nghttp2-dev + ninja + nodejs + nss-dev + opus-dev + pciutils-dev + perl + pipewire-dev + pulseaudio-dev + py3-httplib2 + py3-parsing + py3-six + python3 + pythonispython3 + re2-dev + snappy-dev + speex-dev + sqlite-dev + xcb-proto + yarn + zlib-dev + " +source="chromium-102-fenced_frame_utils-include.patch.chromium + chromium-102-regex_pattern-array.patch.chromium + chromium-VirtualCursor-standard-layout.patch.chromium + chromium-revert-drop-of-system-java.patch.chromium + chromium-use-alpine-target.patch.chromium + credentials-header.patch.chromium + default-pthread-stacksize.patch.chromium + elf-arm.patch.chromium + fix-missing-cstdint-include-musl.patch.chromium + fix-narrowing-cast.patch.chromium + fix-unittests-sandbox.patch.chromium + gdbinit.patch.chromium + iwyu-add-utility-for-std-exchange.patch.chromium + libxml-unbundle.patch.chromium + media-base.patch.chromium + memory-tagging-arm64.patch.chromium + musl-crashpad.patch.chromium + musl-fixes.patch.chromium + musl-hacks.patch.chromium + musl-libc++.patch.chromium + musl-sandbox.patch.chromium + musl-stat.patch.chromium + musl-tid-caching.patch.chromium + musl-v8-monotonic-pthread-cont_timedwait.patch.chromium + nasm.patch.chromium + no-execinfo.patch.chromium + no-getcontext.patch.chromium + no-mallinfo.patch.chromium + quiche-arena-size.patch.chromium + remove-no-opaque-pointers-flag.patch.chromium + remove-strip_binary.patch.chromium + resolver.patch.chromium + revert-use-ffile-compilation-dir.patch.chromium + roll-src-third_party-ffmpeg.patch.chromium + scoped-file.patch.chromium + system-node.patch.electron + python-jinja-3.10.patch.electron + vector-const.patch.electron + " +builddir="$srcdir" +options="!check suid" + +prepare() { + git clone --branch=${_chromium} --depth=1 \ + https://chromium.googlesource.com/chromium/src.git + + git clone https://github.com/electron/electron.git + + ( + git clone --depth 1 -b main https://chromium.googlesource.com/chromium/tools/depot_tools.git + cd depot_tools + git fetch --depth 1 origin $_depot_tools + git checkout $_depot_tools + ) + + export PATH="$PATH:$srcdir/depot_tools" + + echo "solutions = [ + { + \"name\": \"src/electron\", + \"url\": \"file://$srcdir/electron@$_gitrev\", + \"deps_file\": \"DEPS\", + \"managed\": False, + \"custom_deps\": { + \"src\": None, + }, + \"custom_vars\": {}, + }, + ]" > .gclient + + python3 depot_tools/gclient.py sync \ + --with_branch_heads \ + --with_tags \ + --nohooks + + python3 src/build/landmines.py + python3 src/build/util/lastchange.py -o src/build/util/LASTCHANGE + python3 src/build/util/lastchange.py -m GPU_LISTS_VERSION \ + --revision-id-only --header src/gpu/config/gpu_lists_version.h + python3 src/build/util/lastchange.py -m SKIA_COMMIT_HASH \ + -s src/third_party/skia --header src/skia/ext/skia_commit_hash.h + ln -sfv /usr/bin/clang-format src/buildtools/linux64/clang-format + mkdir -p src/third_party/node/linux/node-linux-x64/bin + ln -sfv /usr/bin/node src/third_party/node/linux/node-linux-x64/bin/node + python3 src/third_party/depot_tools/download_from_google_storage.py \ + --no_resume --extract --no_auth --bucket chromium-nodejs \ + -s src/third_party/node/node_modules.tar.gz.sha1 + python3 src/tools/download_optimization_profile.py \ + --newest_state=src/chrome/android/profiles/newest.txt \ + --local_state=src/chrome/android/profiles/local.txt \ + --output_name=src/chrome/android/profiles/afdo.prof \ + --gs_url_base=chromeos-prebuilt/afdo-job/llvm + python3 src/electron/script/apply_all_patches.py \ + src/electron/patches/config.json + ln -sfv /usr/bin/java src/third_party/jdk/current/bin/java + + ( + cd src/electron + yarn install --frozen-lockfile + ) + + ( + cd src/third_party/node + npm ci + ) + + ( + # chromium + cd src + + for patch in "$srcdir"/*.patch.chromium; do + patch -Np1 < "$patch" + done + + for patch in "$srcdir"/*.patch.electron; do + patch -Np1 < "$patch" + done + + local use_system=" + ffmpeg + flac + fontconfig + freetype + harfbuzz-ng + libdrm + libevent + libjpeg + libpng + libwebp + libxml + libxslt + opus + re2 + snappy + " + + for _lib in $use_system libjpeg_turbo; do + msg "Removing buildscripts for system provided $_lib" + find . -type f -path "*third_party/$_lib/*" \ + \! -path "*third_party/$_lib/chromium/*" \ + \! -path "*third_party/$_lib/google/*" \ + \! -path './third_party/libxml/*' \ + \! -path './third_party/pdfium/third_party/freetype/include/pstables.h' \ + \! -path './third_party/harfbuzz-ng/utils/hb_scoped.h' \ + \! -regex '.*\.\(gn\|gni\|isolate\|py\)' \ + -delete + done + + + # https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/9JX1N2nf4PU/discussion + touch chrome/test/data/webui/i18n_process_css_test.html + # Use the file at run time instead of effectively compiling it in + sed 's|//third_party/usb_ids/usb.ids|/usr/share/hwdata/usb.ids|g' \ + -i services/device/public/cpp/usb/BUILD.gn + + + python3 build/linux/unbundle/replace_gn_files.py --system-libraries \ + $use_system + python3 third_party/libaddressinput/chromium/tools/update-strings.py + + # prevent annoying errors when regenerating gni + sed -i 's,^update_readme$,#update_readme,' \ + third_party/libvpx/generate_gni.sh + + # allow system dependencies in "official builds" + sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \ + tools/generate_shim_headers/generate_shim_headers.py + ) +} + +_gn_flags() { + echo "$@" +} + +build() { + cd src + + export CHROMIUM_BUILDTOOLS_PATH="$srcdir/src/buildtools" + export CC=clang + export CXX=clang++ + export AR=ar + export NM=nm + export LD=clang + + export CFLAGS="$CFLAGS -Wno-unknown-warning-option" + export CXXFLAGS="$CXXFLAGS -Wno-unknown-warning-option" + + _gn_args=$(_gn_flags \ + import\(\"//electron/build/args/release.gn\"\) \ + custom_toolchain=\"//build/toolchain/linux/unbundle:default\" \ + host_toolchain=\"//build/toolchain/linux/unbundle:default\" \ + blink_symbol_level=0 \ + build_with_tflite_lib=false \ + chrome_pgo_phase=0 \ + clang_use_chrome_plugins=false \ + disable_fieldtrial_testing_config=true \ + enable_hangout_services_extension=true \ + enable_nacl=false \ + enable_precompiled_headers=false \ + enable_vr=false \ + fatal_linker_warnings=false \ + ffmpeg_branding=\"Chrome\" \ + icu_use_data_file=true \ + is_cfi=false \ + is_clang=true \ + is_component_build=false \ + is_debug=false \ + is_official_build=true \ + link_pulseaudio=true \ + proprietary_codecs=true \ + rtc_use_pipewire=true \ + symbol_level=0 \ + treat_warnings_as_errors=false \ + use_allocator=\"none\" \ + use_allocator_shim=false \ + use_cfi_icall=false \ + use_cups=true \ + use_custom_libcxx=false \ + use_gnome_keyring=false \ + use_gold=false \ + use_lld=true \ + use_pulseaudio=true \ + use_sysroot=false \ + use_system_freetype=true \ + use_system_harfbuzz=true \ + use_system_lcms2=true \ + use_system_libdrm=true \ + use_system_libjpeg=true \ + use_system_libpng=true \ + use_system_zlib=true \ + use_thin_lto=false \ + usr_vaapi=true \ + ) + + gn gen out/Release --args="$_gn_args" + + ninja -C out/Release electron + strip -s out/Release/electron + ninja -C out/Release electron_dist_zip +} + +package() { + mkdir -p "$pkgdir"/usr/lib/electron "$pkgdir"/usr/bin + + bsdtar -xf src/out/Release/dist.zip -C "$pkgdir"/usr/lib/electron + + chmod u+s "$pkgdir"/usr/lib/electron/chrome-sandbox + + ln -sfv /usr/lib/electron/electron "$pkgdir"/usr/bin/electron +} + +sha512sums=" +459910ac11dfd2953240a72836aac55c33d914906194897b38328f482173a101930cad1656906df0bc1c903d41199eee8089f474f5d8b056cfb12c8f2b0acffb chromium-102-fenced_frame_utils-include.patch.chromium +a6f066e0cbb4e0644733b48013f150647b3c431dc5ebcbff611b3214c86739726208874f67cb339140045e7934e7636f7514bd7aec603545d47c7ab6ca205be4 chromium-102-regex_pattern-array.patch.chromium +0fc131ef4ad32964815744080f40cc2566c70da1cd4ddaf1da8456d1c86e67e3ebf38f43208d17d40b646744e8e662f5b314e236a1c90bc6f8b936313e42a3cf chromium-VirtualCursor-standard-layout.patch.chromium +c4654d5b23c6f5d9502507e534fe1951d6749c62251e49b6adfe10d1569431e7f7a5a6fa5ff09ec30984415ced27a5e20985df8c91295de34af3c84557fa5b91 chromium-revert-drop-of-system-java.patch.chromium +ded02360a36283973b9abb4150de3d964749a58017fbbd9f09fb6cb29ec97a8ac99ccadd953633bbb7eb9ec77a078f4df9de5f624d1580f33446ceba5fd3a3f6 chromium-use-alpine-target.patch.chromium +274858323d040ac8c51bac90b6ef91bb075d7b8d92d73952ed700c10a8bae2c2115fb2a9cc6912de79be226c141d7106839fc3486e22c0206e75cb6d8ff65ee6 credentials-header.patch.chromium +22da17c649ae9845d6a174187f2b666245a10db8a997169fc214c430fbba10143cfb57f8f6ece5acf856cd9ea09f293a1aca90cdf3e64fd9423b78beac53f517 default-pthread-stacksize.patch.chromium +9b1441fe42421ef9ead86a5143bf997d989bd53a8969cdfdf4e0c45f847efc8c1d127e15fb05e2ef5dbefbb228cbdc2849404d74997ca56265599e12e5efd6e4 elf-arm.patch.chromium +8bebf4a9d5225c6e47edc5b07c4b97be24a45cc221f49632836915ceeb4ecb69b7f79a31ea7f82171cde3443f45fec541f409892542cf1014e81aa6acd01566d fix-missing-cstdint-include-musl.patch.chromium +e60f381c557a15598d71e33b7aacc63be4a8e17b16cdd95047df5e5e9577ad925864ffd64597d5dbc9a4516de13b3f17c26099b36692165df8c66b1b4d399ce9 fix-narrowing-cast.patch.chromium +54f07ee9d85577e284e04460e79132fa6769251ceb045561cea811dde0369e9e4cdbcf26566235b0d12c649be4d46fea294f7c6a4e2a75109dc3282e6e7d7993 fix-unittests-sandbox.patch.chromium +82f2bd4aa613e792d3af6e7a8632e0920cf48504a7572fb97d5480ea182fa125fe526e7df1ce4311b5d139a3f78da0f0b54605fbd09d7cd43135906a7639e47f gdbinit.patch.chromium +4d268992ddb341e70f4e730c82c676c0c95b3958bc9553bbe83383cebde7373c79a8e9aeef47c7af2add8353263b02ccfd7e5bd864f544a584361a02d30374ec iwyu-add-utility-for-std-exchange.patch.chromium +17b54042c58cd448c7e26dca1504bb48d85fdd7c2385930e639c283493a5e430923041f01cde5a5dfaa32fbb7f0a645baca55b202d56d3f245fb4febdf026da2 libxml-unbundle.patch.chromium +599f5ef338b5797e04436bdc88921c31365d2dea2613d40053be6e774f654e2889efb0c0bd55c2c5044a6805510fbc337da555971169a75d584fac93e18256ac media-base.patch.chromium +63e5b25c49af484964b3ac723da1c2f348812572a2e24ad412d2fb9eb7eec9ddc0e76568e76d1f352cdc562bc5003c93e04ee519a82e8568f48484d1682e237f memory-tagging-arm64.patch.chromium +2e5a83826239849d096aead033eb519338b84e6fbbf58abfcd7cfe40d0b3070b66bcc825ec84406484d73d1a333f1b9d23a8ab44987ab5c8b187076c84cd668b musl-crashpad.patch.chromium +9fbfeb1f52e48658f46e55db29de02b554f24ae79f46bbd89bbf05c20f538c9bb3c8624a6e27907d13d6717e5f55a332b13577d8672539662c90c9a10109b94a musl-fixes.patch.chromium +20b6931937ae792ddf4e1be7f0cbf0f0931b0afce9f6528b7ae5edb1bb2db070438caa8edc94e915e1e5ab1a191789129877d0353fe8976f537df3775dd3ab5d musl-hacks.patch.chromium +a361989c7ff4a285ed36c499e4fe1e97ed8d904a9b92f8d3c01b056b469490b7d215b6edb803ba3b0955633f58f3682d4fb60cc710cba68153a6b23df3ba7ba9 musl-libc++.patch.chromium +ef43fa90b05e2407b6daa822193121cdeef6ee9068175572f0928f156f186be9c77539dfa06863adfaa25afd498ec1b5081f9e476543616f9472b9033fd921dc musl-sandbox.patch.chromium +0c0d3ed0a8f2bcecb2bf4eb56130fcd71031bb63744fb56e1b5a6b9dfbe16680607ff592e24602fe045b819509a70556e240b6fe0e876710977d60185f682df4 musl-stat.patch.chromium +a018cf58b9e34f73d588961f2f9a36de67267060fb2e77ebc562974c6c92a59009161e374cf9bbdc35e8bf1a7e90f0b90117a0d494dcd2e2bb2f5e6534925d0b musl-tid-caching.patch.chromium +556cc2ba28184a75745f13c673605327f5be590be179eb3f941dc0abded854a814e5da1432a28fb8d4dcdcd66ffd4c94ee1a8824d2cd93b632f48e9310dbc3fa musl-v8-monotonic-pthread-cont_timedwait.patch.chromium +7957aae04e8ef3badbc98c982ba1acb1b9ef5e665440116c704512f11554d7b64ba3643b7ff7d00476a6686324033b0cf762deb78ce798619226380953b9dc9c nasm.patch.chromium +7aa351e79c29de63972f1f16fbab0465b2569bc0a22174780988e0cdfe4fcaff3c664dd277937bb33f2b77f108d20afa8720c427524b09d26074f9cf6807e147 no-execinfo.patch.chromium +e8675aff9fccd8b58cc839ef1d9e0e022d66aa94f72baa72e7acf92ceb2691f6a7907cc60ec3a87f894efdd639a3dec7fe702c97d446fcdea99452caec57e002 no-getcontext.patch.chromium +c741fafab758a675f7007a450df7d9acfe05149f4ce6dd4cf82dc6e97ddcd6b5b4a6b8e09820c2ad3ea62487f30b34d848739908e95ca8a31ca5baeb7cb9d0d7 no-mallinfo.patch.chromium +c7fc8a1a079224b9ed6a1f8331cef901833bec04f337fa122381e0a65a1acdd529368f6653dc6d03475381659e07e6e31dd2ec0530257606480f06d15faf3aaf quiche-arena-size.patch.chromium +c8e892e36e7292cd6db36017fff994a0fbc00dd83ea9010422c21cd56da89c9eddd1712e4ff4b3fec354fa595ce3cc403b96fc13525e74fe6538461d5c2d9b50 remove-no-opaque-pointers-flag.patch.chromium +91dafba2138175b6618ec4c96c7ea39f3a26f6a09b69adabad4f9355dd84d436f3de3274b31465d5f46deeb452fde64e4cfbbda0bb4ed7e9a25d953e1b73e5d2 remove-strip_binary.patch.chromium +cd7719c30518aeb659e9b7dc126241f897afe1a231e601271b63ba170e811a93b514c4d2a77680cdf0c846f81fa6db766ac619aa200efb32cbdfff6732a63893 resolver.patch.chromium +2fdd0b2fd403dd4440533288f7e08bb8480702c42c7571ea764aac18ba5eaf72494793c77e4244991d12f45e5acfceae0772995b11d323916c07cb53c43a2f59 revert-use-ffile-compilation-dir.patch.chromium +128ec0fd14349e065c8bb0910d53cbea7423182a06e06f7b7765f3cba1e5ba5e7a8bccbcdab079335b5235abb7bf0d46dee21ecc8c221be7e1c5c6d9795f958e roll-src-third_party-ffmpeg.patch.chromium +8d11b2ba811fdd6280784bfafcef073238324941b4c33e7c9a5ccfde8506242d06e5136d697f047bab3838b43a666f1da404af7b4f4ff9a0c6bf6bdb8448e5b2 scoped-file.patch.chromium +26a8e4040e69f335a7104f42d012b9d933a40985b33a7be02add27a801c097c5a2be4c6e69faf9175ce8945210ae4c5592ecad2123ccff2beee5473194a765e3 system-node.patch.electron +e05180199ee1d559e4e577cedd3e589844ecf40d98a86321bf1bea5607b02eeb5feb486deddae40e1005b644550331f6b8500177aa7e79bcb3750d3c1ceb76c3 python-jinja-3.10.patch.electron +89a5d6ff62071247595d22a9512ef32d53ac35ab60ae7e64c198fd3dffecaaeb35134d42edb53540d9000a62007821fe8e9bb3e5602b116b1fc28eefd3fe851b vector-const.patch.electron +" diff --git a/electron/chromium-102-fenced_frame_utils-include.patch.chromium b/electron/chromium-102-fenced_frame_utils-include.patch.chromium new file mode 100644 index 0000000..81304f5 --- /dev/null +++ b/electron/chromium-102-fenced_frame_utils-include.patch.chromium @@ -0,0 +1,26 @@ +Patch-Source: https://github.com/stha09/chromium-patches/blob/chromium-102-patchset-6/chromium-102-fenced_frame_utils-include.patch +From 7c135a291184b59a59643ed6a8c40b4405ac0175 Mon Sep 17 00:00:00 2001 +From: Stephan Hartmann +Date: Wed, 27 Apr 2022 16:01:01 +0000 +Subject: [PATCH] IWYU: add cstring for std::strlen in fenced_frame_utils + +--- + third_party/blink/common/fenced_frame/fenced_frame_utils.cc | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/third_party/blink/common/fenced_frame/fenced_frame_utils.cc b/third_party/blink/common/fenced_frame/fenced_frame_utils.cc +index 9e2d3ad..68f4823 100644 +--- a/third_party/blink/common/fenced_frame/fenced_frame_utils.cc ++++ b/third_party/blink/common/fenced_frame/fenced_frame_utils.cc +@@ -4,6 +4,8 @@ + + #include "third_party/blink/public/common/fenced_frame/fenced_frame_utils.h" + ++#include ++ + #include "base/guid.h" + #include "base/strings/string_util.h" + +-- +2.35.1 + diff --git a/electron/chromium-102-regex_pattern-array.patch.chromium b/electron/chromium-102-regex_pattern-array.patch.chromium new file mode 100644 index 0000000..a6c1f89 --- /dev/null +++ b/electron/chromium-102-regex_pattern-array.patch.chromium @@ -0,0 +1,15 @@ +Patch-Source: https://github.com/stha09/chromium-patches/blob/chromium-102-patchset-6/chromium-102-regex_pattern-array.patch +--- a/components/autofill/core/browser/BUILD.gn ++++ b/components/autofill/core/browser/BUILD.gn +@@ -54,6 +54,11 @@ action("regex_patterns_inl_h") { + } + + static_library("browser") { ++ if (is_clang) { ++ cflags = [ ++ "-fbracket-depth=1000", ++ ] ++ } + sources = [ + "address_normalization_manager.cc", + "address_normalization_manager.h", diff --git a/electron/chromium-VirtualCursor-standard-layout.patch.chromium b/electron/chromium-VirtualCursor-standard-layout.patch.chromium new file mode 100644 index 0000000..721e194 --- /dev/null +++ b/electron/chromium-VirtualCursor-standard-layout.patch.chromium @@ -0,0 +1,216 @@ +diff --git a/sql/recover_module/btree.cc b/sql/recover_module/btree.cc +index 9ecaafe..839318a 100644 +--- a/sql/recover_module/btree.cc ++++ b/sql/recover_module/btree.cc +@@ -135,16 +135,25 @@ + "Move the destructor to the .cc file if it's non-trival"); + #endif // !DCHECK_IS_ON() + +-LeafPageDecoder::LeafPageDecoder(DatabasePageReader* db_reader) noexcept +- : page_id_(db_reader->page_id()), +- db_reader_(db_reader), +- cell_count_(ComputeCellCount(db_reader)), +- next_read_index_(0), +- last_record_size_(0) { ++void LeafPageDecoder::Initialize(DatabasePageReader* db_reader) { ++ DCHECK(db_reader); + DCHECK(IsOnValidPage(db_reader)); ++ page_id_ = db_reader->page_id(); ++ db_reader_ = db_reader; ++ cell_count_ = ComputeCellCount(db_reader); ++ next_read_index_ = 0; ++ last_record_size_ = 0; + DCHECK(DatabasePageReader::IsValidPageId(page_id_)); + } + ++void LeafPageDecoder::Reset() { ++ db_reader_ = nullptr; ++ page_id_ = 0; ++ cell_count_ = 0; ++ next_read_index_ = 0; ++ last_record_size_ = 0; ++} ++ + bool LeafPageDecoder::TryAdvance() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(CanAdvance()); +diff --git a/sql/recover_module/btree.h b/sql/recover_module/btree.h +index d76d076..33114b0 100644 +--- a/sql/recover_module/btree.h ++++ b/sql/recover_module/btree.h +@@ -102,7 +102,7 @@ + // + // |db_reader| must have been used to read an inner page of a table B-tree. + // |db_reader| must outlive this instance. +- explicit LeafPageDecoder(DatabasePageReader* db_reader) noexcept; ++ explicit LeafPageDecoder() noexcept = default; + ~LeafPageDecoder() noexcept = default; + + LeafPageDecoder(const LeafPageDecoder&) = delete; +@@ -150,6 +150,15 @@ + // read as long as CanAdvance() returns true. + bool TryAdvance(); + ++ // Initialize with DatabasePageReader ++ void Initialize(DatabasePageReader* db_reader); ++ ++ // Reset internal DatabasePageReader ++ void Reset(); ++ ++ // True if DatabasePageReader is valid ++ bool IsValid() { return (db_reader_ != nullptr); } ++ + // True if the given reader may point to an inner page in a table B-tree. + // + // The last ReadPage() call on |db_reader| must have succeeded. +@@ -163,14 +172,14 @@ + static int ComputeCellCount(DatabasePageReader* db_reader); + + // The number of the B-tree page this reader is reading. +- const int64_t page_id_; ++ int64_t page_id_; + // Used to read the tree page. + // + // Raw pointer usage is acceptable because this instance's owner is expected + // to ensure that the DatabasePageReader outlives this. +- DatabasePageReader* const db_reader_; ++ DatabasePageReader* db_reader_; + // Caches the ComputeCellCount() value for this reader's page. +- const int cell_count_ = ComputeCellCount(db_reader_); ++ int cell_count_; + + // The reader's cursor state. + // +diff --git a/sql/recover_module/cursor.cc b/sql/recover_module/cursor.cc +index 0029ff9..42548bc 100644 +--- a/sql/recover_module/cursor.cc ++++ b/sql/recover_module/cursor.cc +@@ -26,7 +26,7 @@ + int VirtualCursor::First() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + inner_decoders_.clear(); +- leaf_decoder_ = nullptr; ++ leaf_decoder_.Reset(); + + AppendPageDecoder(table_->root_page_id()); + return Next(); +@@ -36,18 +36,18 @@ + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + record_reader_.Reset(); + +- while (!inner_decoders_.empty() || leaf_decoder_.get()) { +- if (leaf_decoder_.get()) { +- if (!leaf_decoder_->CanAdvance()) { ++ while (!inner_decoders_.empty() || leaf_decoder_.IsValid()) { ++ if (leaf_decoder_.IsValid()) { ++ if (!leaf_decoder_.CanAdvance()) { + // The leaf has been exhausted. Remove it from the DFS stack. +- leaf_decoder_ = nullptr; ++ leaf_decoder_.Reset(); + continue; + } +- if (!leaf_decoder_->TryAdvance()) ++ if (!leaf_decoder_.TryAdvance()) + continue; + +- if (!payload_reader_.Initialize(leaf_decoder_->last_record_size(), +- leaf_decoder_->last_record_offset())) { ++ if (!payload_reader_.Initialize(leaf_decoder_.last_record_size(), ++ leaf_decoder_.last_record_offset())) { + continue; + } + if (!record_reader_.Initialize()) +@@ -99,13 +99,13 @@ + int64_t VirtualCursor::RowId() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(record_reader_.IsInitialized()); +- DCHECK(leaf_decoder_.get()); +- return leaf_decoder_->last_record_rowid(); ++ DCHECK(leaf_decoder_.IsValid()); ++ return leaf_decoder_.last_record_rowid(); + } + + void VirtualCursor::AppendPageDecoder(int page_id) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); +- DCHECK(leaf_decoder_.get() == nullptr) ++ DCHECK(!leaf_decoder_.IsValid()) + << __func__ + << " must only be called when the current path has no leaf decoder"; + +@@ -113,7 +113,7 @@ + return; + + if (LeafPageDecoder::IsOnValidPage(&db_reader_)) { +- leaf_decoder_ = std::make_unique(&db_reader_); ++ leaf_decoder_.Initialize(&db_reader_); + return; + } + +diff --git a/sql/recover_module/cursor.h b/sql/recover_module/cursor.h +index afcd690..b15c31d 100644 +--- a/sql/recover_module/cursor.h ++++ b/sql/recover_module/cursor.h +@@ -129,7 +129,7 @@ + std::vector> inner_decoders_; + + // Decodes the leaf page containing records. +- std::unique_ptr leaf_decoder_; ++ LeafPageDecoder leaf_decoder_; + + SEQUENCE_CHECKER(sequence_checker_); + }; +diff --git a/sql/recover_module/pager.cc b/sql/recover_module/pager.cc +index 58e75de..5fe9620 100644 +--- a/sql/recover_module/pager.cc ++++ b/sql/recover_module/pager.cc +@@ -23,8 +23,7 @@ + "ints are not appropriate for representing page IDs"); + + DatabasePageReader::DatabasePageReader(VirtualTable* table) +- : page_data_(std::make_unique(table->page_size())), +- table_(table) { ++ : page_data_(), table_(table) { + DCHECK(table != nullptr); + DCHECK(IsValidPageSize(table->page_size())); + } +@@ -57,8 +56,8 @@ + std::numeric_limits::max(), + "The |read_offset| computation above may overflow"); + +- int sqlite_status = +- RawRead(sqlite_file, read_size, read_offset, page_data_.get()); ++ int sqlite_status = RawRead(sqlite_file, read_size, read_offset, ++ const_cast(page_data_.data())); + + // |page_id_| needs to be set to kInvalidPageId if the read failed. + // Otherwise, future ReadPage() calls with the previous |page_id_| value +diff --git a/sql/recover_module/pager.h b/sql/recover_module/pager.h +index 0e388ddc..99314e3 100644 +--- a/sql/recover_module/pager.h ++++ b/sql/recover_module/pager.h +@@ -5,6 +5,7 @@ + #ifndef SQL_RECOVER_MODULE_PAGER_H_ + #define SQL_RECOVER_MODULE_PAGER_H_ + ++#include + #include + #include + +@@ -70,7 +71,7 @@ + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK_NE(page_id_, kInvalidPageId) + << "Successful ReadPage() required before accessing pager state"; +- return page_data_.get(); ++ return page_data_.data(); + } + + // The number of bytes in the page read by the last ReadPage() call. +@@ -137,7 +138,7 @@ + int page_id_ = kInvalidPageId; + // Stores the bytes of the last page successfully read by ReadPage(). + // The content is undefined if the last call to ReadPage() did not succeed. +- const std::unique_ptr page_data_; ++ const std::array page_data_; + // Raw pointer usage is acceptable because this instance's owner is expected + // to ensure that the VirtualTable outlives this. + VirtualTable* const table_; diff --git a/electron/chromium-revert-drop-of-system-java.patch.chromium b/electron/chromium-revert-drop-of-system-java.patch.chromium new file mode 100644 index 0000000..117a50f --- /dev/null +++ b/electron/chromium-revert-drop-of-system-java.patch.chromium @@ -0,0 +1,15 @@ +This was dropped for some reason in 6951c37cecd05979b232a39e5c10e6346a0f74ef +--- a/third_party/closure_compiler/compiler.py 2021-05-20 04:17:53.000000000 +0200 ++++ b/third_party/closure_compiler/compiler.py 2021-05-20 04:17:53.000000000 +0200 +@@ -13,8 +13,9 @@ + + + _CURRENT_DIR = os.path.join(os.path.dirname(__file__)) +-_JAVA_PATH = os.path.join(_CURRENT_DIR, "..", "jdk", "current", "bin", "java") +-assert os.path.isfile(_JAVA_PATH), "java only allowed in android builds" ++_JAVA_BIN = "java" ++_JDK_PATH = os.path.join(_CURRENT_DIR, "..", "jdk", "current", "bin", "java") ++_JAVA_PATH = _JDK_PATH if os.path.isfile(_JDK_PATH) else _JAVA_BIN + + class Compiler(object): + """Runs the Closure compiler on given source files to typecheck them diff --git a/electron/chromium-use-alpine-target.patch.chromium b/electron/chromium-use-alpine-target.patch.chromium new file mode 100644 index 0000000..8282aca --- /dev/null +++ b/electron/chromium-use-alpine-target.patch.chromium @@ -0,0 +1,24 @@ +--- ./build/config/compiler/BUILD.gn ++++ ./build/config/compiler/BUILD.gn +@@ -752,8 +752,8 @@ + } + } else if (current_cpu == "arm") { + if (is_clang && !is_android && !is_nacl) { +- cflags += [ "--target=arm-linux-gnueabihf" ] +- ldflags += [ "--target=arm-linux-gnueabihf" ] ++ cflags += [ "--target=armv7-alpine-linux-musleabihf" ] ++ ldflags += [ "--target=armv7-alpine-linux-musleabihf" ] + } + if (!is_nacl) { + cflags += [ +@@ -766,8 +766,8 @@ + } + } else if (current_cpu == "arm64") { + if (is_clang && !is_android && !is_nacl && !is_fuchsia) { +- cflags += [ "--target=aarch64-linux-gnu" ] +- ldflags += [ "--target=aarch64-linux-gnu" ] ++ cflags += [ "--target=aarch64-alpine-linux-musl" ] ++ ldflags += [ "--target=aarch64-alpine-linux-musl" ] + } + } else if (current_cpu == "mipsel" && !is_nacl) { + ldflags += [ "-Wl,--hash-style=sysv" ] diff --git a/electron/credentials-header.patch.chromium b/electron/credentials-header.patch.chromium new file mode 100644 index 0000000..840bd2a --- /dev/null +++ b/electron/credentials-header.patch.chromium @@ -0,0 +1,11 @@ +--- ./sandbox/linux/services/credentials.h.orig ++++ ./sandbox/linux/services/credentials.h +@@ -14,6 +14,8 @@ + #include + #include + ++#include ++ + #include "sandbox/linux/system_headers/capability.h" + #include "sandbox/sandbox_export.h" + diff --git a/electron/default-pthread-stacksize.patch.chromium b/electron/default-pthread-stacksize.patch.chromium new file mode 100644 index 0000000..74ebc76 --- /dev/null +++ b/electron/default-pthread-stacksize.patch.chromium @@ -0,0 +1,45 @@ +--- ./base/threading/platform_thread_linux.cc ++++ ./base/threading/platform_thread_linux.cc +@@ -186,7 +186,8 @@ + + size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) { + #if !defined(THREAD_SANITIZER) +- return 0; ++ // use 2mb to avoid running out of space. This is what android uses ++ return 2 * (1 << 20); + #else + // ThreadSanitizer bloats the stack heavily. Evidence has been that the + // default stack size isn't enough for some browser tests. +--- ./base/threading/platform_thread_unittest.cc.orig ++++ ./base/threading/platform_thread_unittest.cc +@@ -420,7 +420,7 @@ + ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && \ + !defined(THREAD_SANITIZER)) || \ + (BUILDFLAG(IS_ANDROID) && !defined(ADDRESS_SANITIZER)) +- EXPECT_EQ(0u, stack_size); ++ EXPECT_EQ(2u << 20, stack_size); + #else + EXPECT_GT(stack_size, 0u); + EXPECT_LT(stack_size, 20u * (1 << 20)); +--- ./chrome/browser/shutdown_signal_handlers_posix.cc ++++ ./chrome/browser/shutdown_signal_handlers_posix.cc +@@ -187,11 +187,19 @@ + g_shutdown_pipe_read_fd = pipefd[0]; + g_shutdown_pipe_write_fd = pipefd[1]; + #if !defined(ADDRESS_SANITIZER) ++# if defined(__GLIBC__) + const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2; ++# else ++ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2 * 8; // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k ++# endif + #else ++# if defined(__GLIBC__) + // ASan instrumentation bloats the stack frames, so we need to increase the + // stack size to avoid hitting the guard page. + const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4; ++# else ++ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4 * 8; // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k ++# endif + #endif + ShutdownDetector* detector = new ShutdownDetector( + g_shutdown_pipe_read_fd, std::move(shutdown_callback), task_runner); diff --git a/electron/elf-arm.patch.chromium b/electron/elf-arm.patch.chromium new file mode 100644 index 0000000..3799dc9 --- /dev/null +++ b/electron/elf-arm.patch.chromium @@ -0,0 +1,11 @@ +--- ./v8/src/base/cpu.cc.orig ++++ ./v8/src/base/cpu.cc +@@ -16,7 +16,7 @@ + #if V8_OS_QNX + #include // cpuinfo + #endif +-#if V8_OS_LINUX && (V8_HOST_ARCH_PPC || V8_HOST_ARCH_PPC64) ++#if V8_OS_LINUX && (V8_HOST_ARCH_PPC || V8_HOST_ARCH_PPC64 || V8_HOST_ARCH_ARM) + #include + #endif + #if V8_OS_AIX diff --git a/electron/fix-missing-cstdint-include-musl.patch.chromium b/electron/fix-missing-cstdint-include-musl.patch.chromium new file mode 100644 index 0000000..47e536f --- /dev/null +++ b/electron/fix-missing-cstdint-include-musl.patch.chromium @@ -0,0 +1,11 @@ +Patch-Source: https://github.com/void-linux/void-packages/blob/378db3cf5087877588aebaaa8ca3c9d94dfb54e0/srcpkgs/chromium/patches/fix-missing-cstdint-include-musl.patch +--- a/net/third_party/quiche/src/quiche/http2/adapter/window_manager.h ++++ b/net/third_party/quiche/src/quiche/http2/adapter/window_manager.h +@@ -3,6 +3,7 @@ + + #include + ++#include + #include + + #include "common/platform/api/quiche_export.h" diff --git a/electron/fix-narrowing-cast.patch.chromium b/electron/fix-narrowing-cast.patch.chromium new file mode 100644 index 0000000..afd42a1 --- /dev/null +++ b/electron/fix-narrowing-cast.patch.chromium @@ -0,0 +1,53 @@ +--- a/base/files/file_util_linux.cc ++++ b/base/files/file_util_linux.cc +@@ -23,14 +23,14 @@ + + // Not all possible |statfs_buf.f_type| values are in linux/magic.h. + // Missing values are copied from the statfs man page. +- switch (statfs_buf.f_type) { ++ switch (static_cast(statfs_buf.f_type)) { + case 0: + *type = FILE_SYSTEM_0; + break; + case EXT2_SUPER_MAGIC: // Also ext3 and ext4 + case MSDOS_SUPER_MAGIC: + case REISERFS_SUPER_MAGIC: +- case static_cast(BTRFS_SUPER_MAGIC): ++ case BTRFS_SUPER_MAGIC: + case 0x5346544E: // NTFS + case 0x58465342: // XFS + case 0x3153464A: // JFS +@@ -40,14 +40,14 @@ + *type = FILE_SYSTEM_NFS; + break; + case SMB_SUPER_MAGIC: +- case static_cast(0xFF534D42): // CIFS ++ case 0xFF534D42: // CIFS + *type = FILE_SYSTEM_SMB; + break; + case CODA_SUPER_MAGIC: + *type = FILE_SYSTEM_CODA; + break; +- case static_cast(HUGETLBFS_MAGIC): +- case static_cast(RAMFS_MAGIC): ++ case HUGETLBFS_MAGIC: ++ case RAMFS_MAGIC: + case TMPFS_MAGIC: + *type = FILE_SYSTEM_MEMORY; + break; +--- a/base/system/sys_info_posix.cc ++++ b/base/system/sys_info_posix.cc +@@ -100,10 +100,10 @@ + if (HANDLE_EINTR(statfs(path.value().c_str(), &stats)) != 0) + return false; + +- switch (stats.f_type) { ++ switch (static_cast(stats.f_type)) { + case TMPFS_MAGIC: +- case static_cast(HUGETLBFS_MAGIC): +- case static_cast(RAMFS_MAGIC): ++ case HUGETLBFS_MAGIC: ++ case RAMFS_MAGIC: + return true; + } + return false; diff --git a/electron/fix-unittests-sandbox.patch.chromium b/electron/fix-unittests-sandbox.patch.chromium new file mode 100644 index 0000000..e11face --- /dev/null +++ b/electron/fix-unittests-sandbox.patch.chromium @@ -0,0 +1,11 @@ +--- ./sandbox/linux/syscall_broker/broker_file_permission_unittest.cc.orig ++++ ./sandbox/linux/syscall_broker/broker_file_permission_unittest.cc +@@ -134,7 +134,7 @@ + #endif + + const int kNumberOfBitsInOAccMode = 2; +- static_assert(O_ACCMODE == ((1 << kNumberOfBitsInOAccMode) - 1), ++ static_assert(O_ACCMODE == (((1 << kNumberOfBitsInOAccMode) - 1) | O_PATH), + "incorrect number of bits"); + // check every possible flag and act accordingly. + // Skipping AccMode bits as they are present in every case. diff --git a/electron/gdbinit.patch.chromium b/electron/gdbinit.patch.chromium new file mode 100644 index 0000000..39d3464 --- /dev/null +++ b/electron/gdbinit.patch.chromium @@ -0,0 +1,21 @@ +--- ./tools/gdb/gdbinit.orig ++++ ./tools/gdb/gdbinit +@@ -50,17 +50,7 @@ + + def set_src_dir(compile_dir): + global src_dir +- git = subprocess.Popen( +- ['git', '-C', compile_dir, 'rev-parse', '--show-toplevel'], +- stdout=subprocess.PIPE, +- stderr=subprocess.PIPE) +- src_dir, _ = git.communicate() +- if git.returncode: +- return +- if isinstance(src_dir, str): +- src_dir = src_dir.rstrip() +- else: +- src_dir = src_dir.decode('utf-8').rstrip() ++ src_dir = os.path.abspath(os.getcwd()) + + load_libcxx_pretty_printers(src_dir) + diff --git a/electron/iwyu-add-utility-for-std-exchange.patch.chromium b/electron/iwyu-add-utility-for-std-exchange.patch.chromium new file mode 100644 index 0000000..b79206d --- /dev/null +++ b/electron/iwyu-add-utility-for-std-exchange.patch.chromium @@ -0,0 +1,28 @@ +Patch-Source: https://chromium-review.googlesource.com/c/chromium/src/+/3604643 +From 9dd0503835dc875807ab63efb1f477bffed2a852 Mon Sep 17 00:00:00 2001 +From: Stephan Hartmann +Date: Mon, 25 Apr 2022 23:18:30 +0000 +Subject: [PATCH] IWYU: add utility for std::exchange + +Bug: 957519 +Change-Id: I307d520fdc34d2452018ed32a505e7e519739410 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3604643 +Reviewed-by: Wez +Commit-Queue: Stephan Hartmann +Cr-Commit-Position: refs/heads/main@{#995855} +--- + base/third_party/symbolize/symbolize.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/base/third_party/symbolize/symbolize.h b/base/third_party/symbolize/symbolize.h +index 99029a968d5..278078f6071 100644 +--- a/base/third_party/symbolize/symbolize.h ++++ b/base/third_party/symbolize/symbolize.h +@@ -61,6 +61,7 @@ + #ifdef HAVE_SYMBOLIZE + + #include ++#include + + #if defined(__ELF__) // defined by gcc + #if defined(__OpenBSD__) diff --git a/electron/libxml-unbundle.patch.chromium b/electron/libxml-unbundle.patch.chromium new file mode 100644 index 0000000..2644823 --- /dev/null +++ b/electron/libxml-unbundle.patch.chromium @@ -0,0 +1,11 @@ +Patch-Source: https://chromium-review.googlesource.com/c/chromium/src/+/3488058 +--- a/build/linux/unbundle/libxml.gn ++++ b/build/linux/unbundle/libxml.gn +@@ -19,6 +19,7 @@ static_library("libxml_utils") { + ":xml_reader", + ":xml_writer", + "//base/test:test_support", ++ "//services/data_decoder:lib", + "//services/data_decoder:xml_parser_fuzzer_deps", + ] + sources = [ diff --git a/electron/media-base.patch.chromium b/electron/media-base.patch.chromium new file mode 100644 index 0000000..99b881f --- /dev/null +++ b/electron/media-base.patch.chromium @@ -0,0 +1,10 @@ +--- ./media/base/subsample_entry.h ++++ ./media/base/subsample_entry.h +@@ -9,6 +9,7 @@ + #include + + #include ++#include + + #include "media/base/media_export.h" + diff --git a/electron/memory-tagging-arm64.patch.chromium b/electron/memory-tagging-arm64.patch.chromium new file mode 100644 index 0000000..6072698 --- /dev/null +++ b/electron/memory-tagging-arm64.patch.chromium @@ -0,0 +1,18 @@ +--- ./base/allocator/partition_allocator/tagging.cc.orig ++++ ./base/allocator/partition_allocator/tagging.cc +@@ -19,15 +19,6 @@ + #define PR_GET_TAGGED_ADDR_CTRL 56 + #define PR_TAGGED_ADDR_ENABLE (1UL << 0) + +-#if BUILDFLAG(IS_LINUX) +-#include +- +-// Linux headers already provide these since v5.10. +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) +-#define HAS_PR_MTE_MACROS +-#endif +-#endif +- + #ifndef HAS_PR_MTE_MACROS + #define PR_MTE_TCF_SHIFT 1 + #define PR_MTE_TCF_NONE (0UL << PR_MTE_TCF_SHIFT) diff --git a/electron/musl-crashpad.patch.chromium b/electron/musl-crashpad.patch.chromium new file mode 100644 index 0000000..387deea --- /dev/null +++ b/electron/musl-crashpad.patch.chromium @@ -0,0 +1,25 @@ +diff --git a/third_party/crashpad/crashpad/util/linux/ptracer.cc b/third_party/crashpad/crashpad/util/linux/ptracer.cc +index c6c9229..a5336b6 100644 +--- ./third_party/crashpad/crashpad/util/linux/ptracer.cc ++++ ./third_party/crashpad/crashpad/util/linux/ptracer.cc +@@ -26,6 +26,7 @@ + + #if defined(ARCH_CPU_X86_FAMILY) + #include ++#include + #endif + + namespace crashpad { +diff --git a/third_party/crashpad/crashpad/util/linux/thread_info.h b/third_party/crashpad/crashpad/util/linux/thread_info.h +index 5b55c24..08cec52 100644 +--- ./third_party/crashpad/crashpad/util/linux/thread_info.h ++++ ./third_party/crashpad/crashpad/util/linux/thread_info.h +@@ -273,7 +273,7 @@ union FloatContext { + "Size mismatch"); + #elif defined(ARCH_CPU_ARMEL) + static_assert(sizeof(f32_t::fpregs) == sizeof(user_fpregs), "Size mismatch"); +-#if !defined(__GLIBC__) ++#if defined(OS_ANDROID) + static_assert(sizeof(f32_t::vfp) == sizeof(user_vfp), "Size mismatch"); + #endif + #elif defined(ARCH_CPU_ARM64) diff --git a/electron/musl-fixes.patch.chromium b/electron/musl-fixes.patch.chromium new file mode 100644 index 0000000..da2c115 --- /dev/null +++ b/electron/musl-fixes.patch.chromium @@ -0,0 +1,221 @@ +--- ./third_party/lss/linux_syscall_support.h.orig ++++ ./third_party/lss/linux_syscall_support.h +@@ -1127,6 +1127,12 @@ + #ifndef __NR_fallocate + #define __NR_fallocate 285 + #endif ++ ++#undef __NR_pread ++#define __NR_pread __NR_pread64 ++#undef __NR_pwrite ++#define __NR_pwrite __NR_pwrite64 ++ + /* End of x86-64 definitions */ + #elif defined(__mips__) + #if _MIPS_SIM == _MIPS_SIM_ABI32 +--- ./third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h.orig ++++ ./third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h +@@ -37,6 +37,10 @@ + #include "common/memory.h" + #include "google_breakpad/common/minidump_format.h" + ++#if !defined(__GLIBC__) ++ #define _libc_fpstate _fpstate ++#endif ++ + namespace google_breakpad { + + // Wraps platform-dependent implementations of accessors to ucontext_t structs. +--- ./third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h.orig ++++ ./third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h +@@ -36,6 +36,7 @@ + #include + #include + #include ++#include + + #include "common/memory_range.h" + +--- ./sandbox/linux/suid/process_util.h.orig ++++ ./sandbox/linux/suid/process_util.h +@@ -11,6 +11,14 @@ + #include + #include + ++// Some additional functions ++# define TEMP_FAILURE_RETRY(expression) \ ++ (__extension__ \ ++ ({ long int __result; \ ++ do __result = (long int) (expression); \ ++ while (__result == -1L && errno == EINTR); \ ++ __result; })) ++ + // This adjusts /proc/process/oom_score_adj so the Linux OOM killer + // will prefer certain process types over others. The range for the + // adjustment is [-1000, 1000], with [0, 1000] being user accessible. +--- ./sandbox/linux/seccomp-bpf/trap.cc.orig 2020-04-12 08:26:40.184159217 -0400 ++++ ./sandbox/linux/seccomp-bpf/trap.cc 2020-04-12 08:46:16.737191222 -0400 +@@ -174,7 +174,7 @@ + // If the version of glibc doesn't include this information in + // siginfo_t (older than 2.17), we need to explicitly copy it + // into an arch_sigsys structure. +- memcpy(&sigsys, &info->_sifields, sizeof(sigsys)); ++ memcpy(&sigsys, &info->__sifields, sizeof(sigsys)); + #endif + + #if defined(__mips__) +diff --git a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc +--- ./chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc.orig ++++ ./chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc +@@ -59,7 +59,9 @@ + // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch + // of lacros-chrome is complete. + #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) ++#if defined(__GLIBC__) + #include ++#endif + + #include "base/linux_util.h" + #include "base/strings/string_split.h" +@@ -321,7 +323,7 @@ + void RecordLinuxGlibcVersion() { + // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch + // of lacros-chrome is complete. +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) ++#if defined(__GLIBC__) || BUILDFLAG(IS_CHROMEOS_LACROS) + base::Version version(gnu_get_libc_version()); + + UMALinuxGlibcVersion glibc_version_result = UMA_LINUX_GLIBC_NOT_PARSEABLE; +--- ./services/device/serial/serial_io_handler_posix.cc.orig 2019-07-03 10:57:32.568171835 -0400 ++++ ./services/device/serial/serial_io_handler_posix.cc 2019-07-03 10:57:16.867983031 -0400 +@@ -6,6 +6,7 @@ + + #include + #include ++#include + + #include + #include +diff --git a/third_party/ots/include/opentype-sanitiser.h b/third_party/ots/include/opentype-sanitiser.h +--- ./third_party/ots/src/include/opentype-sanitiser.h ++++ ./third_party/ots/src/include/opentype-sanitiser.h +@@ -20,6 +20,7 @@ typedef unsigned __int64 uint64_t; + #define htonl(x) _byteswap_ulong (x) + #define htons(x) _byteswap_ushort (x) + #else ++#include + #include + #include + #endif +--- ./base/logging.cc.orig ++++ ./base/logging.cc +@@ -592,8 +592,7 @@ + + LogMessage::~LogMessage() { + size_t stack_start = stream_.tellp(); +-#if !defined(OFFICIAL_BUILD) && !BUILDFLAG(IS_NACL) && !defined(__UCLIBC__) && \ +- !BUILDFLAG(IS_AIX) ++#if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && defined(__GLIBC__) + if (severity_ == LOGGING_FATAL && !base::debug::BeingDebugged()) { + // Include a stack trace on a fatal, unless a debugger is attached. + base::debug::StackTrace stack_trace; +--- ./third_party/blink/renderer/platform/wtf/stack_util.cc.orig ++++ ./third_party/blink/renderer/platform/wtf/stack_util.cc +@@ -28,7 +28,7 @@ + // FIXME: On Mac OSX and Linux, this method cannot estimate stack size + // correctly for the main thread. + +-#elif defined(__GLIBC__) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FREEBSD) || \ ++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FREEBSD) || \ + BUILDFLAG(IS_FUCHSIA) + // pthread_getattr_np() can fail if the thread is not invoked by + // pthread_create() (e.g., the main thread of blink_unittests). +@@ -96,7 +96,7 @@ + } + + void* GetStackStart() { +-#if defined(__GLIBC__) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FREEBSD) || \ ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FREEBSD) || \ + BUILDFLAG(IS_FUCHSIA) + pthread_attr_t attr; + int error; +--- ./third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Signals.inc.orig 2019-06-18 11:51:17.000000000 -0400 ++++ ./third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Signals.inc 2019-07-03 12:32:50.938758186 -0400 +@@ -25,7 +25,7 @@ + #include "llvm/Support/raw_ostream.h" + #include + #include +-#if HAVE_EXECINFO_H ++#if HAVE_EXECINFO_H && defined(__GLIBC__) + # include // For backtrace(). + #endif + #if HAVE_SIGNAL_H +@@ -52,6 +52,7 @@ + #include + #else + #undef HAVE__UNWIND_BACKTRACE ++#undef HAVE_BACKTRACE + #endif + #endif + +--- ./third_party/nasm/nasmlib/realpath.c.orig 2019-07-03 12:23:05.021949895 -0400 ++++ ./third_party/nasm/nasmlib/realpath.c 2019-07-03 12:24:24.246862665 -0400 +@@ -49,7 +49,7 @@ + + #include "nasmlib.h" + +-#ifdef HAVE_CANONICALIZE_FILE_NAME ++#if defined(__GLIBC__) + + /* + * GNU-specific, but avoids the realpath(..., NULL) +--- ./third_party/perfetto/include/perfetto/ext/base/thread_utils.h ++++ ./third_party/perfetto/include/perfetto/ext/base/thread_utils.h +@@ -29,7 +29,7 @@ + #include + #endif + +-#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) ++#if 1 + #include + #endif + +@@ -58,7 +58,7 @@ inline bool MaybeSetThreadName(const std::string& name) { + + inline bool GetThreadName(std::string& out_result) { + char buf[16] = {}; +-#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) ++#if 1 + if (prctl(PR_GET_NAME, buf) != 0) + return false; + #else +--- ./net/dns/public/scoped_res_state.cc.orig ++++ ./net/dns/public/scoped_res_state.cc +@@ -13,7 +13,7 @@ + namespace net { + + ScopedResState::ScopedResState() { +-#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_FUCHSIA) ++#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_FUCHSIA) || defined(_GNU_SOURCE) + // Note: res_ninit in glibc always returns 0 and sets RES_INIT. + // res_init behaves the same way. + memset(&_res, 0, sizeof(_res)); +@@ -25,16 +25,8 @@ + } + + ScopedResState::~ScopedResState() { +-#if !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA) +- +- // Prefer res_ndestroy where available. +-#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD) +- res_ndestroy(&res_); +-#else +- res_nclose(&res_); +-#endif // BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD) +- +-#endif // !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA) ++ // musl res_init() doesn't actually do anything ++ // no destruction is necessary as no memory has been allocated + } + + bool ScopedResState::IsValid() const { diff --git a/electron/musl-hacks.patch.chromium b/electron/musl-hacks.patch.chromium new file mode 100644 index 0000000..93db25a --- /dev/null +++ b/electron/musl-hacks.patch.chromium @@ -0,0 +1,98 @@ +--- ./base/debug/stack_trace.cc ++++ ./base/debug/stack_trace.cc +@@ -168,7 +168,7 @@ + + #if BUILDFLAG(CAN_UNWIND_WITH_FRAME_POINTERS) + uintptr_t GetStackEnd() { +-#if BUILDFLAG(IS_ANDROID) ++#if BUILDFLAG(IS_ANDROID) || (defined(OS_LINUX) && !defined(__GLIBC__)) + // Bionic reads proc/maps on every call to pthread_getattr_np() when called + // from the main thread. So we need to cache end of stack in that case to get + // acceptable performance. +@@ -234,8 +234,10 @@ + defined(MEMORY_SANITIZER) + // Sanitizer configurations (ASan, TSan, MSan) emit unsymbolized stacks. + return false; +-#else ++#elif defined(__GLIBC__) + return true; ++#else ++ return false; + #endif + } + +@@ -251,7 +253,9 @@ + } + + void StackTrace::OutputToStream(std::ostream* os) const { ++#if defined(__GLIBC__) && !defined(_AIX) + OutputToStreamWithPrefix(os, nullptr); ++#endif + } + + std::string StackTrace::ToString() const { +@@ -259,7 +263,7 @@ + } + std::string StackTrace::ToStringWithPrefix(const char* prefix_string) const { + std::stringstream stream; +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + OutputToStreamWithPrefix(&stream, prefix_string); + #endif + return stream.str(); +--- ./net/socket/udp_socket_posix.cc ++++ ./net/socket/udp_socket_posix.cc +@@ -1191,7 +1191,7 @@ + msg_iov->push_back({const_cast(buffer->data()), buffer->length()}); + msgvec->reserve(buffers.size()); + for (size_t j = 0; j < buffers.size(); j++) +- msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, nullptr, 0, 0}, 0}); ++ msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, 0, 0, 0}, 0}); + int result = HANDLE_EINTR(Sendmmsg(fd, &msgvec[0], buffers.size(), 0)); + SendResult send_result(0, 0, std::move(buffers)); + if (result < 0) { +--- ./base/debug/elf_reader.cc.orig ++++ ./base/debug/elf_reader.cc +@@ -149,7 +149,12 @@ + strtab_addr = static_cast(dynamic_iter->d_un.d_ptr) + + reinterpret_cast(relocation_offset); + #else +- strtab_addr = reinterpret_cast(dynamic_iter->d_un.d_ptr); ++ if (dynamic_iter->d_un.d_ptr < relocation_offset) { ++ strtab_addr = static_cast(dynamic_iter->d_un.d_ptr) + ++ reinterpret_cast(relocation_offset); ++ } else { ++ strtab_addr = reinterpret_cast(dynamic_iter->d_un.d_ptr); ++ } + #endif + } else if (dynamic_iter->d_tag == DT_SONAME) { + soname_strtab_offset = dynamic_iter->d_un.d_val; +--- ./mojo/public/c/system/thunks.cc.orig ++++ ./mojo/public/c/system/thunks.cc +@@ -100,7 +100,8 @@ + base::ScopedAllowBlocking allow_blocking; + base::NativeLibraryOptions library_options; + #if !defined(ADDRESS_SANITIZER) && !defined(THREAD_SANITIZER) && \ +- !defined(MEMORY_SANITIZER) && !defined(LEAK_SANITIZER) ++ !defined(MEMORY_SANITIZER) && !defined(LEAK_SANITIZER) && \ ++ defined(RTLD_DEEPBIND) + // Sanitizer builds cannnot support RTLD_DEEPBIND, but they also disable + // allocator shims, so it's unnecessary there. + library_options.prefer_own_symbols = true; +--- ./base/native_library_unittest.cc.orig ++++ ./base/native_library_unittest.cc +@@ -121,6 +121,7 @@ + #if !defined(OS_ANDROID) && !defined(THREAD_SANITIZER) && \ + !defined(MEMORY_SANITIZER) + ++#if defined(RTLD_DEEPBIND) + // Verifies that the |prefer_own_symbols| option satisfies its guarantee that + // a loaded library will always prefer local symbol resolution before + // considering global symbols. +@@ -156,6 +157,7 @@ + EXPECT_EQ(2, NativeLibraryTestIncrement()); + EXPECT_EQ(3, NativeLibraryTestIncrement()); + } ++#endif // defined(RTLD_DEEPBIND) + + #endif // !defined(OS_ANDROID) diff --git a/electron/musl-libc++.patch.chromium b/electron/musl-libc++.patch.chromium new file mode 100644 index 0000000..4316a7b --- /dev/null +++ b/electron/musl-libc++.patch.chromium @@ -0,0 +1,51 @@ +--- ./buildtools/third_party/libc++/trunk/include/locale ++++ ./buildtools/third_party/libc++/trunk/include/locale +@@ -10,6 +10,15 @@ + #ifndef _LIBCPP_LOCALE + #define _LIBCPP_LOCALE + ++// musl doesn't define _l (with locale) variants of functions, as it only supports UTF-8. ++// we can simply make macros that will call the non-localated ones if we're using musl, or rather not-using something that has the _l ones. ++// couldn't find anything glibc #defines when it creates strtoull_l (that it doesn't undefine a few lines later), so let's test against glibc and glibc-likes. ++// almost all glibc-likes define __GNU_LIBRARY__ for compatibility ++#ifndef __GNU_LIBRARY__ ++#define strtoull_l(A, B, C, LOC) strtoull(A,B,C) ++#define strtoll_l(A, B, C, LOC) strtoll(A,B,C) ++#endif ++ + /* + locale synopsis + +--- ./buildtools/third_party/libc++/trunk/src/locale.cpp ++++ ./buildtools/third_party/libc++/trunk/src/locale.cpp +@@ -1019,11 +1019,11 @@ + return low; + } + +-#if defined(__EMSCRIPTEN__) ++// #if defined(__EMSCRIPTEN__) + extern "C" const unsigned short ** __ctype_b_loc(); + extern "C" const int ** __ctype_tolower_loc(); + extern "C" const int ** __ctype_toupper_loc(); +-#endif ++// #endif + + #ifdef _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE + const ctype::mask* +@@ -1127,12 +1127,10 @@ + #elif defined(_AIX) + return (const unsigned int *)__lc_ctype_ptr->obj->mask; + #else +- // Platform not supported: abort so the person doing the port knows what to +- // fix +-# warning ctype::classic_table() is not implemented +- printf("ctype::classic_table() is not implemented\n"); +- abort(); +- return NULL; ++// not sure any other libc like this exists, but there is no way to differentiate musl as of right now ++// to be fair, with the change above, this should always work ++// also, #warning is a gcc extension ++ return (const unsigned long *)*__ctype_b_loc(); + #endif + } + #endif diff --git a/electron/musl-sandbox.patch.chromium b/electron/musl-sandbox.patch.chromium new file mode 100644 index 0000000..4fe0098 --- /dev/null +++ b/electron/musl-sandbox.patch.chromium @@ -0,0 +1,176 @@ +diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc ./sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc +index ff5a1c0..da56b9b 100644 +--- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc ++++ ./sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc +@@ -139,21 +139,11 @@ namespace sandbox { + // present (as in newer versions of posix_spawn). + ResultExpr RestrictCloneToThreadsAndEPERMFork() { + const Arg flags(0); +- +- // TODO(mdempsky): Extend DSL to support (flags & ~mask1) == mask2. +- const uint64_t kAndroidCloneMask = CLONE_VM | CLONE_FS | CLONE_FILES | +- CLONE_SIGHAND | CLONE_THREAD | +- CLONE_SYSVSEM; +- const uint64_t kObsoleteAndroidCloneMask = kAndroidCloneMask | CLONE_DETACHED; +- +- const uint64_t kGlibcPthreadFlags = +- CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_THREAD | +- CLONE_SYSVSEM | CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID; +- const BoolExpr glibc_test = flags == kGlibcPthreadFlags; +- +- const BoolExpr android_test = +- AnyOf(flags == kAndroidCloneMask, flags == kObsoleteAndroidCloneMask, +- flags == kGlibcPthreadFlags); ++ const int required = CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | ++ CLONE_THREAD | CLONE_SYSVSEM; ++ const int safe = CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID | ++ CLONE_DETACHED; ++ const BoolExpr thread_clone_ok = (flags&~safe)==required; + + // The following two flags are the two important flags in any vfork-emulating + // clone call. EPERM any clone call that contains both of them. +@@ -163,7 +153,7 @@ ResultExpr RestrictCloneToThreadsAndEPERMFork() { + AnyOf((flags & (CLONE_VM | CLONE_THREAD)) == 0, + (flags & kImportantCloneVforkFlags) == kImportantCloneVforkFlags); + +- return If(IsAndroid() ? android_test : glibc_test, Allow()) ++ return If(thread_clone_ok, Allow()) + .ElseIf(is_fork_or_clone_vfork, Error(EPERM)) + .Else(CrashSIGSYSClone()); + } +diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc ./sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc +index d9d1882..0567557 100644 +--- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc ++++ ./sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc +@@ -392,6 +392,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) { + #if defined(__i386__) + case __NR_waitpid: + #endif ++ case __NR_set_tid_address: + return true; + case __NR_clone: // Should be parameter-restricted. + case __NR_setns: // Privileged. +@@ -404,7 +405,6 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) { + #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) + case __NR_set_thread_area: + #endif +- case __NR_set_tid_address: + case __NR_unshare: + #if !defined(__mips__) && !defined(__aarch64__) + case __NR_vfork: +@@ -514,6 +514,8 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) { + case __NR_mlock: + case __NR_munlock: + case __NR_munmap: ++ case __NR_mremap: ++ case __NR_membarrier: + return true; + case __NR_madvise: + case __NR_mincore: +@@ -531,7 +533,6 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) { + case __NR_modify_ldt: + #endif + case __NR_mprotect: +- case __NR_mremap: + case __NR_msync: + case __NR_munlockall: + case __NR_readahead: +diff --git a/sandbox/linux/system_headers/arm64_linux_syscalls.h ./sandbox/linux/system_headers/arm64_linux_syscalls.h +index 59d0eab..7ae7002 100644 +--- a/sandbox/linux/system_headers/arm64_linux_syscalls.h ++++ ./sandbox/linux/system_headers/arm64_linux_syscalls.h +@@ -1063,4 +1063,8 @@ + #define __NR_memfd_create 279 + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier 283 ++#endif ++ + #endif // SANDBOX_LINUX_SYSTEM_HEADERS_ARM64_LINUX_SYSCALLS_H_ +diff --git a/sandbox/linux/system_headers/arm_linux_syscalls.h ./sandbox/linux/system_headers/arm_linux_syscalls.h +index 1addd53..7843b5e 100644 +--- a/sandbox/linux/system_headers/arm_linux_syscalls.h ++++ ./sandbox/linux/system_headers/arm_linux_syscalls.h +@@ -1385,6 +1385,10 @@ + #define __NR_memfd_create (__NR_SYSCALL_BASE+385) + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier (__NR_SYSCALL_BASE+389) ++#endif ++ + // ARM private syscalls. + #if !defined(__ARM_NR_BASE) + #define __ARM_NR_BASE (__NR_SYSCALL_BASE + 0xF0000) +diff --git a/sandbox/linux/system_headers/linux_syscalls.h ./sandbox/linux/system_headers/linux_syscalls.h +index 2b78a0c..b6fedb5 100644 +--- a/sandbox/linux/system_headers/linux_syscalls.h ++++ ./sandbox/linux/system_headers/linux_syscalls.h +@@ -10,6 +10,7 @@ + #define SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SYSCALLS_H_ + + #include "build/build_config.h" ++#include + + #if defined(__x86_64__) + #include "sandbox/linux/system_headers/x86_64_linux_syscalls.h" +diff --git a/sandbox/linux/system_headers/mips64_linux_syscalls.h ./sandbox/linux/system_headers/mips64_linux_syscalls.h +index ec75815..5515270 100644 +--- a/sandbox/linux/system_headers/mips64_linux_syscalls.h ++++ ./sandbox/linux/system_headers/mips64_linux_syscalls.h +@@ -1271,4 +1271,8 @@ + #define __NR_memfd_create (__NR_Linux + 314) + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier (__NR_Linux 318) ++#endif ++ + #endif // SANDBOX_LINUX_SYSTEM_HEADERS_MIPS64_LINUX_SYSCALLS_H_ +diff --git a/sandbox/linux/system_headers/mips_linux_syscalls.h ./sandbox/linux/system_headers/mips_linux_syscalls.h +index ddbf97f..ad3d64b 100644 +--- a/sandbox/linux/system_headers/mips_linux_syscalls.h ++++ ./sandbox/linux/system_headers/mips_linux_syscalls.h +@@ -1433,4 +1433,8 @@ + #define __NR_memfd_create (__NR_Linux + 354) + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier (__NR_Linux 358) ++#endif ++ + #endif // SANDBOX_LINUX_SYSTEM_HEADERS_MIPS_LINUX_SYSCALLS_H_ +diff --git a/sandbox/linux/system_headers/x86_64_linux_syscalls.h ./sandbox/linux/system_headers/x86_64_linux_syscalls.h +index b0ae0a2..8b12029 100644 +--- a/sandbox/linux/system_headers/x86_64_linux_syscalls.h ++++ ./sandbox/linux/system_headers/x86_64_linux_syscalls.h +@@ -1350,5 +1350,9 @@ + #define __NR_rseq 334 + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier 324 ++#endif ++ + #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_64_LINUX_SYSCALLS_H_ + +diff --git a/services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc ./services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc +index a85c0ea..715aa1e 100644 +--- a/sandbox/policy/linux/bpf_renderer_policy_linux.cc ++++ ./sandbox/policy/linux/bpf_renderer_policy_linux.cc +@@ -93,11 +93,11 @@ + case __NR_sysinfo: + case __NR_times: + case __NR_uname: +- return Allow(); +- case __NR_sched_getaffinity: + case __NR_sched_getparam: + case __NR_sched_getscheduler: + case __NR_sched_setscheduler: ++ return Allow(); ++ case __NR_sched_getaffinity: + return RestrictSchedTarget(GetPolicyPid(), sysno); + case __NR_prlimit64: + // See crbug.com/662450 and setrlimit comment above. + diff --git a/electron/musl-stat.patch.chromium b/electron/musl-stat.patch.chromium new file mode 100644 index 0000000..5a6036a --- /dev/null +++ b/electron/musl-stat.patch.chromium @@ -0,0 +1,12 @@ +--- a/base/files/file.h.orig ++++ b/base/files/file.h +@@ -19,7 +19,8 @@ + #include "build/build_config.h" + + #if BUILDFLAG(IS_BSD) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_NACL) || \ +- BUILDFLAG(IS_FUCHSIA) || (BUILDFLAG(IS_ANDROID) && __ANDROID_API__ < 21) ++ BUILDFLAG(IS_FUCHSIA) || (BUILDFLAG(IS_ANDROID) && __ANDROID_API__ < 21) || \ ++ (defined(OS_LINUX) && !defined(__GLIBC__)) + struct stat; + namespace base { + typedef struct stat stat_wrapper_t; diff --git a/electron/musl-tid-caching.patch.chromium b/electron/musl-tid-caching.patch.chromium new file mode 100644 index 0000000..bb83038 --- /dev/null +++ b/electron/musl-tid-caching.patch.chromium @@ -0,0 +1,81 @@ +--- ./sandbox/linux/services/namespace_sandbox.cc.orig ++++ ./sandbox/linux/services/namespace_sandbox.cc +@@ -209,6 +209,70 @@ + return base::LaunchProcess(argv, launch_options_copy); + } + ++#if defined(__aarch64__) ++#define TLS_ABOVE_TP ++#endif ++ ++struct musl_pthread ++{ ++ /* Part 1 -- these fields may be external or ++ * internal (accessed via asm) ABI. Do not change. */ ++ struct pthread *self; ++#ifndef TLS_ABOVE_TP ++ uintptr_t *dtv; ++#endif ++ struct pthread *prev, *next; /* non-ABI */ ++ uintptr_t sysinfo; ++#ifndef TLS_ABOVE_TP ++#ifdef CANARY_PAD ++ uintptr_t canary_pad; ++#endif ++ uintptr_t canary; ++#endif ++ ++/* Part 2 -- implementation details, non-ABI. */ ++ int tid; ++ int errno_val; ++ volatile int detach_state; ++ volatile int cancel; ++ volatile unsigned char canceldisable, cancelasync; ++ unsigned char tsd_used:1; ++ unsigned char dlerror_flag:1; ++ unsigned char *map_base; ++ size_t map_size; ++ void *stack; ++ size_t stack_size; ++ size_t guard_size; ++ void *result; ++ struct __ptcb *cancelbuf; ++ void **tsd; ++ struct { ++ volatile void *volatile head; ++ long off; ++ volatile void *volatile pending; ++ } robust_list; ++ int h_errno_val; ++ volatile int timer_id; ++ locale_t locale; ++ volatile int killlock[1]; ++ char *dlerror_buf; ++ void *stdio_locks; ++ ++ /* Part 3 -- the positions of these fields relative to ++ * the end of the structure is external and internal ABI. */ ++#ifdef TLS_ABOVE_TP ++ uintptr_t canary; ++ uintptr_t *dtv; ++#endif ++}; ++ ++void MaybeUpdateMuslTidCache() ++{ ++ pid_t real_tid = sys_gettid(); ++ pid_t* cached_tid_location = &reinterpret_cast(pthread_self())->tid; ++ *cached_tid_location = real_tid; ++} ++ + // static + pid_t NamespaceSandbox::ForkInNewPidNamespace(bool drop_capabilities_in_child) { + const pid_t pid = +@@ -226,6 +290,7 @@ + #if defined(LIBC_GLIBC) + MaybeUpdateGlibcTidCache(); + #endif ++ MaybeUpdateMuslTidCache(); + return 0; + } + diff --git a/electron/musl-v8-monotonic-pthread-cont_timedwait.patch.chromium b/electron/musl-v8-monotonic-pthread-cont_timedwait.patch.chromium new file mode 100644 index 0000000..768027d --- /dev/null +++ b/electron/musl-v8-monotonic-pthread-cont_timedwait.patch.chromium @@ -0,0 +1,22 @@ +Use monotonic clock for pthread_cond_timedwait with musl too. + +--- ./v8/src/base/platform/condition-variable.cc ++++ ./v8/src/base/platform/condition-variable.cc +@@ -16,7 +16,7 @@ + + ConditionVariable::ConditionVariable() { + #if (V8_OS_FREEBSD || V8_OS_NETBSD || V8_OS_OPENBSD || \ +- (V8_OS_LINUX && V8_LIBC_GLIBC)) ++ V8_OS_LINUX) + // On Free/Net/OpenBSD and Linux with glibc we can change the time + // source for pthread_cond_timedwait() to use the monotonic clock. + pthread_condattr_t attr; +@@ -92,7 +92,7 @@ + &native_handle_, &mutex->native_handle(), &ts); + #else + #if (V8_OS_FREEBSD || V8_OS_NETBSD || V8_OS_OPENBSD || \ +- (V8_OS_LINUX && V8_LIBC_GLIBC)) ++ V8_OS_LINUX) + // On Free/Net/OpenBSD and Linux with glibc we can change the time + // source for pthread_cond_timedwait() to use the monotonic clock. + result = clock_gettime(CLOCK_MONOTONIC, &ts); diff --git a/electron/nasm.patch.chromium b/electron/nasm.patch.chromium new file mode 100644 index 0000000..ff22a6f --- /dev/null +++ b/electron/nasm.patch.chromium @@ -0,0 +1,11 @@ +--- ./third_party/nasm/config/config-linux.h ++++ ./third_party/nasm/config/config-linux.h +@@ -117,7 +117,7 @@ + #define HAVE_ACCESS 1 + + /* Define to 1 if you have the `canonicalize_file_name' function. */ +-#define HAVE_CANONICALIZE_FILE_NAME 1 ++// #define HAVE_CANONICALIZE_FILE_NAME 1 + + /* Define to 1 if you have the `cpu_to_le16' intrinsic function. */ + /* #undef HAVE_CPU_TO_LE16 */ diff --git a/electron/no-execinfo.patch.chromium b/electron/no-execinfo.patch.chromium new file mode 100644 index 0000000..8cb2f79 --- /dev/null +++ b/electron/no-execinfo.patch.chromium @@ -0,0 +1,75 @@ +--- ./base/debug/stack_trace_posix.cc ++++ ./base/debug/stack_trace_posix.cc +@@ -27,7 +27,7 @@ + #if !defined(USE_SYMBOLIZE) + #include + #endif +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + #include + #endif + +@@ -89,7 +89,7 @@ + // Note: code in this function is NOT async-signal safe (std::string uses + // malloc internally). + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + std::string::size_type search_from = 0; + while (search_from < text->size()) { + // Look for the start of a mangled symbol, from search_from. +@@ -136,7 +136,7 @@ + virtual ~BacktraceOutputHandler() = default; + }; + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + void OutputPointer(void* pointer, BacktraceOutputHandler* handler) { + // This should be more than enough to store a 64-bit number in hex: + // 16 hex digits + 1 for null-terminator. +@@ -839,7 +839,7 @@ + // If we do not have unwind tables, then try tracing using frame pointers. + return base::debug::TraceStackFramePointers(const_cast(trace), + count, 0); +-#elif !defined(__UCLIBC__) && !defined(_AIX) ++#elif defined(__GLIBC__) && !defined(_AIX) + // Though the backtrace API man page does not list any possible negative + // return values, we take no chance. + return base::saturated_cast(backtrace(trace, count)); +@@ -852,13 +852,13 @@ + // NOTE: This code MUST be async-signal safe (it's used by in-process + // stack dumping signal handler). NO malloc or stdio is allowed here. + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + PrintBacktraceOutputHandler handler; + ProcessBacktrace(trace_, count_, prefix_string, &handler); + #endif + } + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + void StackTrace::OutputToStreamWithPrefix(std::ostream* os, + const char* prefix_string) const { + StreamBacktraceOutputHandler handler(os); +--- ./v8/src/codegen/external-reference-table.cc.orig ++++ ./v8/src/codegen/external-reference-table.cc +@@ -11,7 +11,9 @@ + + #if defined(DEBUG) && defined(V8_OS_LINUX) && !defined(V8_OS_ANDROID) + #define SYMBOLIZE_FUNCTION ++#if defined(__GLIBC__) + #include ++#endif + + #include + +@@ -96,7 +98,7 @@ + } + + const char* ExternalReferenceTable::ResolveSymbol(void* address) { +-#ifdef SYMBOLIZE_FUNCTION ++#if defined(SYMBOLIZE_FUNCTION) && defined(__GLIBC__) + char** names = backtrace_symbols(&address, 1); + const char* name = names[0]; + // The array of names is malloc'ed. However, each name string is static diff --git a/electron/no-getcontext.patch.chromium b/electron/no-getcontext.patch.chromium new file mode 100644 index 0000000..71c1e91 --- /dev/null +++ b/electron/no-getcontext.patch.chromium @@ -0,0 +1,26 @@ +--- ./third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc ++++ ./third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc +@@ -490,7 +490,9 @@ + siginfo.si_code = SI_USER; + siginfo.si_pid = getpid(); + ucontext_t context; ++#if defined(__GLIBC__) + getcontext(&context); ++#endif + return HandleSignal(sig, &siginfo, &context); + } + +@@ -675,9 +677,13 @@ + sys_prctl(PR_SET_DUMPABLE, 1, 0, 0, 0); + + CrashContext context; ++#if defined(__GLIBC__) + int getcontext_result = getcontext(&context.context); + if (getcontext_result) + return false; ++#else ++ return false; ++#endif + + #if defined(__i386__) + // In CPUFillFromUContext in minidumpwriter.cc the stack pointer is retrieved diff --git a/electron/no-mallinfo.patch.chromium b/electron/no-mallinfo.patch.chromium new file mode 100644 index 0000000..613169d --- /dev/null +++ b/electron/no-mallinfo.patch.chromium @@ -0,0 +1,99 @@ +--- a/base/trace_event/malloc_dump_provider.cc ++++ b/base/trace_event/malloc_dump_provider.cc +@@ -185,7 +185,6 @@ + #define MALLINFO2_FOUND_IN_LIBC + struct mallinfo2 info = mallinfo2(); + #endif +-#endif // defined(__GLIBC__) && defined(__GLIBC_PREREQ) + #if !defined(MALLINFO2_FOUND_IN_LIBC) + struct mallinfo info = mallinfo(); + #endif +@@ -205,6 +204,7 @@ + sys_alloc_dump->AddScalar(MemoryAllocatorDump::kNameSize, + MemoryAllocatorDump::kUnitsBytes, info.uordblks); + } ++#endif // defined(__GLIBC__) && defined(__GLIBC_PREREQ) + } + #endif + +@@ -339,7 +340,7 @@ + &allocated_objects_count); + #elif BUILDFLAG(IS_FUCHSIA) + // TODO(fuchsia): Port, see https://crbug.com/706592. +-#else ++#elif defined(__GLIBC__) + ReportMallinfoStats(/*pmd=*/nullptr, &total_virtual_size, &resident_size, + &allocated_objects_size, &allocated_objects_count); + #endif +--- ./base/process/process_metrics_posix.cc.orig ++++ ./base/process/process_metrics_posix.cc +@@ -105,7 +105,7 @@ + + #endif // !BUILDFLAG(IS_FUCHSIA) + +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) ++#if (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) + namespace { + + size_t GetMallocUsageMallinfo() { +@@ -123,7 +123,7 @@ + } + + } // namespace +-#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || ++#endif // (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS) || + // BUILDFLAG(IS_ANDROID) + + size_t ProcessMetrics::GetMallocUsage() { +@@ -131,9 +131,9 @@ + malloc_statistics_t stats = {0}; + malloc_zone_statistics(nullptr, &stats); + return stats.size_in_use; +-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) ++#elif (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) + return GetMallocUsageMallinfo(); +-#elif BUILDFLAG(IS_FUCHSIA) ++#else + // TODO(fuchsia): Not currently exposed. https://crbug.com/735087. + return 0; + #endif +--- ./third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc.orig ++++ ./third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc +@@ -35,7 +35,7 @@ + + MemoryUsage GetMemoryUsage() { + MemoryUsage result; +-#ifdef __linux__ ++#if defined(__linux__) && defined(__GLIBC__) + rusage res; + if (getrusage(RUSAGE_SELF, &res) == 0) { + result.max_rss_kb = res.ru_maxrss; +--- ./third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Process.inc ++++ ./third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Process.inc.orig +@@ -86,11 +86,11 @@ + } + + size_t Process::GetMallocUsage() { +-#if defined(HAVE_MALLINFO2) ++#if defined(HAVE_MALLINFO2) && defined(__GLIBC__) + struct mallinfo2 mi; + mi = ::mallinfo2(); + return mi.uordblks; +-#elif defined(HAVE_MALLINFO) ++#elif defined(HAVE_MALLINFO) && defined(__GLIBC__) + struct mallinfo mi; + mi = ::mallinfo(); + return mi.uordblks; + +--- ./third_party/swiftshader/third_party/llvm-10.0/configs/linux/include/llvm/Config/config.h.orig 2019-09-30 13:03:42.556880537 -0400 ++++ ./third_party/swiftshader/third_party/llvm-10.0/configs/linux/include/llvm/Config/config.h 2019-09-30 13:07:27.989821227 -0400 +@@ -122,7 +122,9 @@ + /* #undef HAVE_MALLCTL */ + + /* Define to 1 if you have the `mallinfo' function. */ ++#if defined(__GLIBC__) + #define HAVE_MALLINFO 1 ++#endif + + /* Define to 1 if you have the header file. */ + #define HAVE_MALLOC_H 1 diff --git a/electron/python-jinja-3.10.patch.electron b/electron/python-jinja-3.10.patch.electron new file mode 100644 index 0000000..d4571f1 --- /dev/null +++ b/electron/python-jinja-3.10.patch.electron @@ -0,0 +1,22 @@ +--- a/third_party/electron_node/tools/inspector_protocol/jinja2/runtime.py ++++ b/third_party/electron_node/tools/inspector_protocol/jinja2/runtime.py +@@ -315,7 +315,7 @@ class Context(with_metaclass(ContextMeta + + # register the context as mapping if possible + try: +- from collections import Mapping ++ from collections.abc import Mapping + Mapping.register(Context) + except ImportError: + pass +--- a/third_party/electron_node/tools/inspector_protocol/jinja2/sandbox.py ++++ b/third_party/electron_node/tools/inspector_protocol/jinja2/sandbox.py +@@ -14,7 +14,7 @@ + """ + import types + import operator +-from collections import Mapping ++from collections.abc import Mapping + from jinja2.environment import Environment + from jinja2.exceptions import SecurityError + from jinja2._compat import string_types, PY2 diff --git a/electron/quiche-arena-size.patch.chromium b/electron/quiche-arena-size.patch.chromium new file mode 100644 index 0000000..ed82104 --- /dev/null +++ b/electron/quiche-arena-size.patch.chromium @@ -0,0 +1,11 @@ +--- ./net/third_party/quiche/src/quiche/quic/core/quic_one_block_arena.h ++++ ./net/third_party/quiche/src/quiche/quic/core/quic_one_block_arena.h +@@ -69,7 +69,7 @@ + + // QuicConnections currently use around 1KB of polymorphic types which would + // ordinarily be on the heap. Instead, store them inline in an arena. +-using QuicConnectionArena = QuicOneBlockArena<1152>; ++using QuicConnectionArena = QuicOneBlockArena<1504>; + + } // namespace quic + diff --git a/electron/remove-no-opaque-pointers-flag.patch.chromium b/electron/remove-no-opaque-pointers-flag.patch.chromium new file mode 100644 index 0000000..f73f9ce --- /dev/null +++ b/electron/remove-no-opaque-pointers-flag.patch.chromium @@ -0,0 +1,19 @@ +Patch-Source: https://github.com/archlinux/svntogit-packages/blob/f3225f99b900e11ac900725992ea883142d7309c/trunk/remove-no-opaque-pointers-flag.patch +--- chromium-102.0.5005.61/build/config/compiler/BUILD.gn.orig 2022-05-19 10:35:52.991415777 +0000 ++++ chromium-102.0.5005.61/build/config/compiler/BUILD.gn 2022-05-19 10:36:11.102017131 +0000 +@@ -1538,15 +1538,6 @@ config("default_warnings") { + cflags += [ "-Wno-deprecated-non-prototype" ] + } + +- if (!is_nacl && !(is_chromeos || +- default_toolchain == "//build/toolchain/cros:target")) { +- # TODO(https://crbug.com/1316298): Re-enable once test failure is figured out +- cflags += [ +- "-Xclang", +- "-no-opaque-pointers", +- ] +- } +- + if (is_fuchsia) { + # TODO(https://bugs.chromium.org/p/fuchsia/issues/detail?id=77383) + cflags += [ "-Wno-deprecated-copy" ] diff --git a/electron/remove-strip_binary.patch.chromium b/electron/remove-strip_binary.patch.chromium new file mode 100644 index 0000000..8b13c6a --- /dev/null +++ b/electron/remove-strip_binary.patch.chromium @@ -0,0 +1,32 @@ +--- a/chrome/test/chromedriver/BUILD.gn.orig ++++ b/chrome/test/chromedriver/BUILD.gn +@@ -308,11 +308,7 @@ + } + } + +-if (is_linux) { +- chromedriver_output = "chromedriver.unstripped" +-} else { +- chromedriver_output = "chromedriver" +-} ++chromedriver_output = "chromedriver" + + executable("$chromedriver_output") { + testonly = true +@@ -336,16 +332,6 @@ + } + } + +-if (is_linux) { +- strip_binary("chromedriver") { +- testonly = true +- binary_input = "$root_out_dir/$chromedriver_output" +- symbol_output = "$root_out_dir/chromedriver.debug" +- stripped_binary_output = "$root_out_dir/chromedriver" +- deps = [ ":$chromedriver_output" ] +- } +-} +- + python_library("chromedriver_py_tests") { + testonly = true + deps = [ diff --git a/electron/resolver.patch.chromium b/electron/resolver.patch.chromium new file mode 100644 index 0000000..8dca36a --- /dev/null +++ b/electron/resolver.patch.chromium @@ -0,0 +1,36 @@ +--- ./net/dns/host_resolver_manager.cc.orig ++++ ./net/dns/host_resolver_manager.cc +@@ -3014,8 +3014,7 @@ + NetworkChangeNotifier::AddConnectionTypeObserver(this); + if (system_dns_config_notifier_) + system_dns_config_notifier_->AddObserver(this); +-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_OPENBSD) && \ +- !BUILDFLAG(IS_ANDROID) ++#if defined(__GLIBC__) + EnsureDnsReloaderInit(); + #endif + +--- ./net/dns/dns_reloader.cc.orig ++++ ./net/dns/dns_reloader.cc +@@ -6,8 +6,7 @@ + + #include "build/build_config.h" + +-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_OPENBSD) && \ +- !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_FUCHSIA) ++#if defined(__GLIBC__) + + #include + +--- ./net/dns/host_resolver_proc.cc.orig ++++ ./net/dns/host_resolver_proc.cc +@@ -176,8 +176,7 @@ + base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, + base::BlockingType::WILL_BLOCK); + +-#if BUILDFLAG(IS_POSIX) && \ +- !(BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_ANDROID)) ++#if defined(__GLIBC__) + DnsReloaderMaybeReload(); + #endif + absl::optional ai; diff --git a/electron/revert-use-ffile-compilation-dir.patch.chromium b/electron/revert-use-ffile-compilation-dir.patch.chromium new file mode 100644 index 0000000..f0c110f --- /dev/null +++ b/electron/revert-use-ffile-compilation-dir.patch.chromium @@ -0,0 +1,48 @@ +diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn +index f442166..c325f72 100644 +--- a/build/config/compiler/BUILD.gn ++++ b/build/config/compiler/BUILD.gn +@@ -1248,19 +1248,12 @@ config("compiler_deterministic") { + # different build directory like "out/feature_a" and "out/feature_b" if + # we build same files with same compile flag. + # Other paths are already given in relative, no need to normalize them. +- if (is_nacl) { +- # TODO(https://crbug.com/1231236): Use -ffile-compilation-dir= here. +- cflags += [ +- "-Xclang", +- "-fdebug-compilation-dir", +- "-Xclang", +- ".", +- ] +- } else { +- # -ffile-compilation-dir is an alias for both -fdebug-compilation-dir= +- # and -fcoverage-compilation-dir=. +- cflags += [ "-ffile-compilation-dir=." ] +- } ++ cflags += [ ++ "-Xclang", ++ "-fdebug-compilation-dir", ++ "-Xclang", ++ ".", ++ ] + if (!is_win) { + # We don't use clang -cc1as on Windows (yet? https://crbug.com/762167) + asmflags = [ "-Wa,-fdebug-compilation-dir,." ] +diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni +index 008a386..89e7fdf 100644 +--- a/build/config/compiler/compiler.gni ++++ b/build/config/compiler/compiler.gni +@@ -238,8 +238,11 @@ declare_args() { + # deterministic builds to reduce compile times, so this is less relevant for + # official builders. + strip_absolute_paths_from_debug_symbols_default = +- is_android || is_fuchsia || is_nacl || (is_win && use_lld) || is_linux || +- is_chromeos || (is_apple && !enable_dsyms) ++ # TODO(crbug.com/1010267): remove '!use_clang_coverage', coverage build has ++ # dependency to absolute path of source files. ++ !use_clang_coverage && ++ (is_android || is_fuchsia || is_nacl || (is_win && use_lld) || is_linux || ++ is_chromeos || (is_apple && !enable_dsyms)) + + # If the platform uses stripped absolute paths by default, then we don't expose + # it as a configuration option. If this is causing problems, please file a bug. diff --git a/electron/roll-src-third_party-ffmpeg.patch.chromium b/electron/roll-src-third_party-ffmpeg.patch.chromium new file mode 100644 index 0000000..5ca8093 --- /dev/null +++ b/electron/roll-src-third_party-ffmpeg.patch.chromium @@ -0,0 +1,287 @@ +--- a/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.cc ++++ b/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.cc +@@ -74,7 +74,7 @@ + codec_context->sample_fmt = AV_SAMPLE_FMT_NONE; + } + +- codec_context->ch_layout.nb_channels = config.channel_count; ++ codec_context->channels = config.channel_count; + codec_context->sample_rate = config.samples_per_second; + + if (config.extra_data) { +@@ -124,8 +124,8 @@ + case cdm::kAudioFormatPlanarS16: + case cdm::kAudioFormatPlanarF32: { + const int decoded_size_per_channel = +- decoded_audio_size / av_frame.ch_layout.nb_channels; +- for (int i = 0; i < av_frame.ch_layout.nb_channels; ++i) { ++ decoded_audio_size / av_frame.channels; ++ for (int i = 0; i < av_frame.channels; ++i) { + memcpy(output_buffer, av_frame.extended_data[i], + decoded_size_per_channel); + output_buffer += decoded_size_per_channel; +@@ -185,14 +185,13 @@ + // Success! + decoding_loop_ = std::make_unique(codec_context_.get()); + samples_per_second_ = config.samples_per_second; +- bytes_per_frame_ = +- codec_context_->ch_layout.nb_channels * config.bits_per_channel / 8; ++ bytes_per_frame_ = codec_context_->channels * config.bits_per_channel / 8; + output_timestamp_helper_ = + std::make_unique(config.samples_per_second); + is_initialized_ = true; + + // Store initial values to guard against midstream configuration changes. +- channels_ = codec_context_->ch_layout.nb_channels; ++ channels_ = codec_context_->channels; + av_sample_format_ = codec_context_->sample_fmt; + + return true; +@@ -292,19 +291,17 @@ + for (auto& frame : audio_frames) { + int decoded_audio_size = 0; + if (frame->sample_rate != samples_per_second_ || +- frame->ch_layout.nb_channels != channels_ || +- frame->format != av_sample_format_) { ++ frame->channels != channels_ || frame->format != av_sample_format_) { + DLOG(ERROR) << "Unsupported midstream configuration change!" + << " Sample Rate: " << frame->sample_rate << " vs " +- << samples_per_second_ +- << ", Channels: " << frame->ch_layout.nb_channels << " vs " +- << channels_ << ", Sample Format: " << frame->format << " vs " +- << av_sample_format_; ++ << samples_per_second_ << ", Channels: " << frame->channels ++ << " vs " << channels_ << ", Sample Format: " << frame->format ++ << " vs " << av_sample_format_; + return cdm::kDecodeError; + } + + decoded_audio_size = av_samples_get_buffer_size( +- nullptr, codec_context_->ch_layout.nb_channels, frame->nb_samples, ++ nullptr, codec_context_->channels, frame->nb_samples, + codec_context_->sample_fmt, 1); + if (!decoded_audio_size) + continue; +@@ -323,9 +320,9 @@ + size_t* total_size, + std::vector>* audio_frames, + AVFrame* frame) { +- *total_size += av_samples_get_buffer_size( +- nullptr, codec_context_->ch_layout.nb_channels, frame->nb_samples, +- codec_context_->sample_fmt, 1); ++ *total_size += av_samples_get_buffer_size(nullptr, codec_context_->channels, ++ frame->nb_samples, ++ codec_context_->sample_fmt, 1); + audio_frames->emplace_back(av_frame_clone(frame)); + return true; + } +--- a/media/ffmpeg/ffmpeg_common.cc ++++ b/media/ffmpeg/ffmpeg_common.cc +@@ -345,11 +345,10 @@ + codec_context->sample_fmt, codec_context->codec_id); + + ChannelLayout channel_layout = +- codec_context->ch_layout.nb_channels > 8 ++ codec_context->channels > 8 + ? CHANNEL_LAYOUT_DISCRETE +- : ChannelLayoutToChromeChannelLayout( +- codec_context->ch_layout.u.mask, +- codec_context->ch_layout.nb_channels); ++ : ChannelLayoutToChromeChannelLayout(codec_context->channel_layout, ++ codec_context->channels); + + int sample_rate = codec_context->sample_rate; + switch (codec) { +@@ -402,7 +401,7 @@ + extra_data, encryption_scheme, seek_preroll, + codec_context->delay); + if (channel_layout == CHANNEL_LAYOUT_DISCRETE) +- config->SetChannelsForDiscrete(codec_context->ch_layout.nb_channels); ++ config->SetChannelsForDiscrete(codec_context->channels); + + #if BUILDFLAG(ENABLE_PLATFORM_AC3_EAC3_AUDIO) + // These are bitstream formats unknown to ffmpeg, so they don't have +@@ -471,7 +470,7 @@ + + // TODO(scherkus): should we set |channel_layout|? I'm not sure if FFmpeg uses + // said information to decode. +- codec_context->ch_layout.nb_channels = config.channels(); ++ codec_context->channels = config.channels(); + codec_context->sample_rate = config.samples_per_second(); + + if (config.extra_data().empty()) { +--- a/media/filters/audio_file_reader.cc ++++ b/media/filters/audio_file_reader.cc +@@ -113,15 +113,14 @@ + + // Verify the channel layout is supported by Chrome. Acts as a sanity check + // against invalid files. See http://crbug.com/171962 +- if (ChannelLayoutToChromeChannelLayout( +- codec_context_->ch_layout.u.mask, +- codec_context_->ch_layout.nb_channels) == ++ if (ChannelLayoutToChromeChannelLayout(codec_context_->channel_layout, ++ codec_context_->channels) == + CHANNEL_LAYOUT_UNSUPPORTED) { + return false; + } + + // Store initial values to guard against midstream configuration changes. +- channels_ = codec_context_->ch_layout.nb_channels; ++ channels_ = codec_context_->channels; + audio_codec_ = CodecIDToAudioCodec(codec_context_->codec_id); + sample_rate_ = codec_context_->sample_rate; + av_sample_format_ = codec_context_->sample_fmt; +@@ -224,7 +223,7 @@ + if (frames_read < 0) + return false; + +- const int channels = frame->ch_layout.nb_channels; ++ const int channels = frame->channels; + if (frame->sample_rate != sample_rate_ || channels != channels_ || + frame->format != av_sample_format_) { + DLOG(ERROR) << "Unsupported midstream configuration change!" +--- a/media/filters/audio_file_reader_unittest.cc ++++ b/media/filters/audio_file_reader_unittest.cc +@@ -121,11 +121,11 @@ + EXPECT_FALSE(reader_->Open()); + } + +- void RunTestFailingDecode(const char* fn, int expect_read = 0) { ++ void RunTestFailingDecode(const char* fn) { + Initialize(fn); + EXPECT_TRUE(reader_->Open()); + std::vector> decoded_audio_packets; +- EXPECT_EQ(reader_->Read(&decoded_audio_packets), expect_read); ++ EXPECT_EQ(reader_->Read(&decoded_audio_packets), 0); + } + + void RunTestPartialDecode(const char* fn) { +@@ -219,7 +219,7 @@ + } + + TEST_F(AudioFileReaderTest, MidStreamConfigChangesFail) { +- RunTestFailingDecode("midstream_config_change.mp3", 42624); ++ RunTestFailingDecode("midstream_config_change.mp3"); + } + #endif + +--- a/media/filters/audio_video_metadata_extractor.cc ++++ b/media/filters/audio_video_metadata_extractor.cc +@@ -113,15 +113,6 @@ + if (!stream) + continue; + +- void* display_matrix = +- av_stream_get_side_data(stream, AV_PKT_DATA_DISPLAYMATRIX, nullptr); +- if (display_matrix) { +- rotation_ = VideoTransformation::FromFFmpegDisplayMatrix( +- static_cast(display_matrix)) +- .rotation; +- info.tags["rotate"] = base::NumberToString(rotation_); +- } +- + // Extract dictionary from streams also. Needed for containers that attach + // metadata to contained streams instead the container itself, like OGG. + ExtractDictionary(stream->metadata, &info.tags); +@@ -264,6 +255,8 @@ + if (raw_tags->find(tag->key) == raw_tags->end()) + (*raw_tags)[tag->key] = tag->value; + ++ if (ExtractInt(tag, "rotate", &rotation_)) ++ continue; + if (ExtractString(tag, "album", &album_)) + continue; + if (ExtractString(tag, "artist", &artist_)) +--- a/media/filters/ffmpeg_aac_bitstream_converter.cc ++++ b/media/filters/ffmpeg_aac_bitstream_converter.cc +@@ -195,15 +195,14 @@ + if (!header_generated_ || codec_ != stream_codec_parameters_->codec_id || + audio_profile_ != stream_codec_parameters_->profile || + sample_rate_index_ != sample_rate_index || +- channel_configuration_ != +- stream_codec_parameters_->ch_layout.nb_channels || ++ channel_configuration_ != stream_codec_parameters_->channels || + frame_length_ != header_plus_packet_size) { + header_generated_ = + GenerateAdtsHeader(stream_codec_parameters_->codec_id, + 0, // layer + stream_codec_parameters_->profile, sample_rate_index, + 0, // private stream +- stream_codec_parameters_->ch_layout.nb_channels, ++ stream_codec_parameters_->channels, + 0, // originality + 0, // home + 0, // copyrighted_stream +@@ -215,7 +214,7 @@ + codec_ = stream_codec_parameters_->codec_id; + audio_profile_ = stream_codec_parameters_->profile; + sample_rate_index_ = sample_rate_index; +- channel_configuration_ = stream_codec_parameters_->ch_layout.nb_channels; ++ channel_configuration_ = stream_codec_parameters_->channels; + frame_length_ = header_plus_packet_size; + } + +--- a/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc ++++ b/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc +@@ -34,7 +34,7 @@ + memset(&test_parameters_, 0, sizeof(AVCodecParameters)); + test_parameters_.codec_id = AV_CODEC_ID_AAC; + test_parameters_.profile = FF_PROFILE_AAC_MAIN; +- test_parameters_.ch_layout.nb_channels = 2; ++ test_parameters_.channels = 2; + test_parameters_.extradata = extradata_header_; + test_parameters_.extradata_size = sizeof(extradata_header_); + } +--- a/media/filters/ffmpeg_audio_decoder.cc ++++ b/media/filters/ffmpeg_audio_decoder.cc +@@ -28,7 +28,7 @@ + + // Return the number of channels from the data in |frame|. + static inline int DetermineChannels(AVFrame* frame) { +- return frame->ch_layout.nb_channels; ++ return frame->channels; + } + + // Called by FFmpeg's allocation routine to allocate a buffer. Uses +@@ -231,7 +231,7 @@ + // Translate unsupported into discrete layouts for discrete configurations; + // ffmpeg does not have a labeled discrete configuration internally. + ChannelLayout channel_layout = ChannelLayoutToChromeChannelLayout( +- codec_context_->ch_layout.u.mask, codec_context_->ch_layout.nb_channels); ++ codec_context_->channel_layout, codec_context_->channels); + if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED && + config_.channel_layout() == CHANNEL_LAYOUT_DISCRETE) { + channel_layout = CHANNEL_LAYOUT_DISCRETE; +@@ -348,11 +348,11 @@ + // Success! + av_sample_format_ = codec_context_->sample_fmt; + +- if (codec_context_->ch_layout.nb_channels != config.channels()) { ++ if (codec_context_->channels != config.channels()) { + MEDIA_LOG(ERROR, media_log_) + << "Audio configuration specified " << config.channels() + << " channels, but FFmpeg thinks the file contains " +- << codec_context_->ch_layout.nb_channels << " channels"; ++ << codec_context_->channels << " channels"; + ReleaseFFmpegResources(); + state_ = DecoderState::kUninitialized; + return false; +@@ -403,7 +403,7 @@ + if (frame->nb_samples <= 0) + return AVERROR(EINVAL); + +- if (s->ch_layout.nb_channels != channels) { ++ if (s->channels != channels) { + DLOG(ERROR) << "AVCodecContext and AVFrame disagree on channel count."; + return AVERROR(EINVAL); + } +@@ -436,8 +436,7 @@ + ChannelLayout channel_layout = + config_.channel_layout() == CHANNEL_LAYOUT_DISCRETE + ? CHANNEL_LAYOUT_DISCRETE +- : ChannelLayoutToChromeChannelLayout(s->ch_layout.u.mask, +- s->ch_layout.nb_channels); ++ : ChannelLayoutToChromeChannelLayout(s->channel_layout, s->channels); + + if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) { + DLOG(ERROR) << "Unsupported channel layout."; diff --git a/electron/scoped-file.patch.chromium b/electron/scoped-file.patch.chromium new file mode 100644 index 0000000..34bf6eb --- /dev/null +++ b/electron/scoped-file.patch.chromium @@ -0,0 +1,31 @@ +--- ./base/files/scoped_file_linux.cc.orig ++++ ./base/files/scoped_file_linux.cc +@@ -7,6 +7,7 @@ + #include + #include + #include ++#include + + #include "base/compiler_specific.h" + #include "base/debug/stack_trace.h" +@@ -80,9 +81,18 @@ + + extern "C" { + +-int __close(int); +- + __attribute__((visibility("default"), noinline)) int close(int fd) { ++ static int (*__close)(int) = nullptr; ++ ++ if (__close == nullptr) { ++ __close = (int (*)(int))dlsym(RTLD_NEXT, "close"); ++ ++ if (__close == nullptr) { ++ RAW_LOG(ERROR, "musl close not found\n"); ++ IMMEDIATE_CRASH(); ++ } ++ } ++ + if (base::IsFDOwned(fd) && g_is_ownership_enforced) + CrashOnFdOwnershipViolation(); + return __close(fd); diff --git a/electron/system-node.patch.electron b/electron/system-node.patch.electron new file mode 100644 index 0000000..1dbffc2 --- /dev/null +++ b/electron/system-node.patch.electron @@ -0,0 +1,53 @@ +--- a/third_party/electron_node/BUILD.gn ++++ b/third_party/electron_node/BUILD.gn +@@ -42,6 +42,18 @@ + node_module_version = "" + } + ++if (is_linux) { ++ import("//build/config/linux/pkg_config.gni") ++ ++ pkg_config("cares") { ++ packages = [ "libcares" ] ++ } ++ ++ pkg_config("nghttp2") { ++ packages = [ "libnghttp2" ] ++ } ++} ++ + assert(!node_use_dtrace, "node_use_dtrace not supported in GN") + assert(!node_use_etw, "node_use_etw not supported in GN") + +@@ -182,11 +194,9 @@ + component("node_lib") { + deps = [ + ":node_js2c", +- "deps/cares", + "deps/histogram", + "deps/googletest:gtest", + "deps/llhttp", +- "deps/nghttp2", + "deps/uvwasi", + "//third_party/zlib", + "//third_party/brotli:dec", +@@ -202,6 +212,19 @@ + public_configs = [ ":node_lib_config" ] + include_dirs = [ "src" ] + libs = [] ++ if (is_linux) { ++ configs += [ ++ ":cares", ++ ":nghttp2", ++ ] ++ libs += [ "http_parser" ] ++ } else { ++ deps += [ ++ "deps/cares", ++ "deps/http_parser", ++ "deps/nghttp2", ++ ] ++ } + frameworks = [] + cflags_cc = [ + "-Wno-deprecated-declarations", diff --git a/electron/vector-const.patch.electron b/electron/vector-const.patch.electron new file mode 100644 index 0000000..9790b57 --- /dev/null +++ b/electron/vector-const.patch.electron @@ -0,0 +1,109 @@ +--- a/electron/patches/chromium/feat_add_data_parameter_to_processsingleton.patch ++++ b/electron/patches/chromium/feat_add_data_parameter_to_processsingleton.patch +@@ -32,7 +32,7 @@ + - const base::FilePath& current_directory)>; + + base::RepeatingCallback additional_data)>; +++ const std::vector additional_data)>; + + #if BUILDFLAG(IS_WIN) + ProcessSingleton(const std::string& program_name, +@@ -73,7 +73,7 @@ + // |reader| is for sending back ACK message. + void HandleMessage(const std::string& current_dir, + const std::vector& argv, +-+ const std::vector additional_data, +++ const std::vector additional_data, + SocketReader* reader); + + private: +@@ -84,7 +84,7 @@ + - const std::string& current_dir, const std::vector& argv, + + const std::string& current_dir, + + const std::vector& argv, +-+ const std::vector additional_data, +++ const std::vector additional_data, + SocketReader* reader) { + DCHECK(ui_task_runner_->BelongsToCurrentThread()); + DCHECK(reader); +@@ -114,7 +114,7 @@ + + base::StringToSizeT(tokens[0], &num_args); + + std::vector command_line(tokens.begin() + 1, tokens.begin() + 1 + num_args); + + +-+ std::vector additional_data; +++ std::vector additional_data; + + if (tokens.size() >= 3 + num_args) { + + size_t additional_data_size; + + base::StringToSizeT(tokens[1 + num_args], &additional_data_size); +@@ -123,7 +123,7 @@ + + std::string(1, kTokenDelimiter)); + + const uint8_t* additional_data_bits = + + reinterpret_cast(remaining_args.c_str()); +-+ additional_data = std::vector( +++ additional_data = std::vector( + + additional_data_bits, additional_data_bits + additional_data_size); + + } + + +@@ -189,7 +189,7 @@ + base::CommandLine* parsed_command_line, + - base::FilePath* current_directory) { + + base::FilePath* current_directory, +-+ std::vector* parsed_additional_data) { +++ std::vector* parsed_additional_data) { + // We should have enough room for the shortest command (min_message_size) + // and also be a multiple of wchar_t bytes. The shortest command + - // possible is L"START\0\0" (empty current directory and command line). +@@ -230,7 +230,7 @@ + + msg.substr(fourth_null + 1, fifth_null - fourth_null); + + const uint8_t* additional_data_bytes = + + reinterpret_cast(additional_data.c_str()); +-+ *parsed_additional_data = std::vector(additional_data_bytes, +++ *parsed_additional_data = std::vector(additional_data_bytes, + + additional_data_bytes + additional_data_length); + + + return true; +@@ -241,7 +241,7 @@ + base::CommandLine parsed_command_line(base::CommandLine::NO_PROGRAM); + base::FilePath current_directory; + - if (!ParseCommandLine(cds, &parsed_command_line, ¤t_directory)) { +-+ std::vector additional_data; +++ std::vector additional_data; + + if (!ParseCommandLine(cds, &parsed_command_line, ¤t_directory, &additional_data)) { + *result = TRUE; + return true; +--- a/electron/shell/browser/api/electron_api_app.cc ++++ b/electron/shell/browser/api/electron_api_app.cc +@@ -519,10 +519,10 @@ + const base::RepeatingCallback< + void(const base::CommandLine& command_line, + const base::FilePath& current_directory, +- const std::vector additional_data)>& callback, ++ const std::vector additional_data)>& callback, + const base::CommandLine& cmd, + const base::FilePath& cwd, +- const std::vector additional_data) { ++ const std::vector additional_data) { + // Make sure the callback is called after app gets ready. + if (Browser::Get()->is_ready()) { + callback.Run(cmd, cwd, std::move(additional_data)); +@@ -1082,7 +1082,7 @@ + + void App::OnSecondInstance(const base::CommandLine& cmd, + const base::FilePath& cwd, +- const std::vector additional_data) { ++ const std::vector additional_data) { + v8::Isolate* isolate = JavascriptEnvironment::GetIsolate(); + v8::Locker locker(isolate); + v8::HandleScope handle_scope(isolate); +--- a/electron/shell/browser/api/electron_api_app.h ++++ b/electron/shell/browser/api/electron_api_app.h +@@ -195,7 +195,7 @@ + std::string GetLocaleCountryCode(); + void OnSecondInstance(const base::CommandLine& cmd, + const base::FilePath& cwd, +- const std::vector additional_data); ++ const std::vector additional_data); + bool HasSingleInstanceLock() const; + bool RequestSingleInstanceLock(gin::Arguments* args); + void ReleaseSingleInstanceLock();