backports/electron: upgrade to 26.1.0

This commit is contained in:
Antoine Martin 2023-09-01 13:03:15 -04:00
parent 199a0231e9
commit 0db9ff5c2b
7 changed files with 725 additions and 46 deletions

View file

@ -1,9 +1,10 @@
# Maintainer: psykose <alice@ayaya.dev>
# Maintainer: lauren n. liberda <lauren@selfisekai.rocks>
pkgname=electron
pkgver=24.2.0
pkgver=26.1.0
pkgrel=0
_chromium=112.0.5615.165
_depot_tools=dbcecc90179a25159dc62f6ed00ae244360297e8
_chromium=116.0.5845.97
_depot_tools=b5509953468edd0906f2dc297886939abbd2bed5
_extra_patches=chromium-116-patchset-2
pkgdesc="Electron cross-platform desktop toolkit"
url="https://github.com/electron/electron"
arch="aarch64 x86_64" # same as chromium
@ -38,7 +39,7 @@ makedepends="
harfbuzz-dev
hunspell-dev
http-parser-dev
hwids-usb
hwdata-dev
java-jdk
jpeg-dev
jsoncpp-dev
@ -96,14 +97,14 @@ makedepends="
"
subpackages="$pkgname-lang $pkgname-dev"
# the lower patches are specific to electron, the top ones are from the equivalent chromium version
source="$pkgname-$pkgver-2.tar.zst::https://dev.alpinelinux.org/archive/electron/electron-$pkgver.tar.zst
chromium-VirtualCursor-standard-layout.patch
source="https://s3.sakamoto.pl/lnl-aports-snapshots/electron-$pkgver.tar.zst
chromium-patches-$_extra_patches.tar.gz::https://github.com/stha09/chromium-patches/archive/refs/tags/$_extra_patches.tar.gz
chromium-revert-drop-of-system-java.patch
chromium-use-alpine-target.patch
fix-missing-cstdint-include-musl.patch
gdbinit.patch
import-version.patch
libcxx-muslmode.patch
libstdc++13.patch
mman.patch
musl-sandbox.patch
musl-tid-caching.patch
@ -111,19 +112,20 @@ source="$pkgname-$pkgver-2.tar.zst::https://dev.alpinelinux.org/archive/electron
no-execinfo.patch
no-mallinfo.patch
no-res-ninit-nclose.patch
quiche-arena-size.patch
scoped-file-no-close.patch
no-sandbox-settls.patch
revert-llvm16-linker-flag.patch
tagging-ifuncs.patch
temp-failure-retry.patch
icon.patch
python-jinja-3.10.patch
vector-const.patch
webpack-hash.patch
default.conf
electron.desktop
electron-launcher.sh
"
# chromium sandbox is suid
# tests are todo for some base checks
options="!check net suid"
@ -135,17 +137,23 @@ snapshot() {
export CHROMIUM_BUILDTOOLS_PATH="$srcdir/src/buildtools"
mkdir -p "$srcdir"
cd "$srcdir"
git clone --branch=$_chromium --depth=1 \
https://chromium.googlesource.com/chromium/src.git
if ! [ -d src ]; then
git clone --branch=$_chromium --depth=1 \
https://chromium.googlesource.com/chromium/src.git
fi
git clone https://github.com/electron/electron.git
if ! [ -d electron ]; then
git clone https://github.com/electron/electron.git
fi
(
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
)
if ! [ -d depot_tools ]; then
(
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
)
fi
export PATH="$PATH:$srcdir/depot_tools"
@ -211,13 +219,23 @@ snapshot() {
--exclude-vcs \
$pkgname-$pkgver
zstd --ultra --long -22 -T0 -vv $pkgname-$pkgver.tar
zstd --auto-threads=logical --ultra --long -22 -T0 -vv $pkgname-$pkgver.tar
}
_extra_patch() {
msg chromium-"$1".patch
patch -Np1 < "$srcdir"/chromium-patches-"$_extra_patches"/chromium-"$1".patch
}
prepare() {
dos2unix third_party/vulkan_memory_allocator/include/vk_mem_alloc.h
default_prepare
git init .
_extra_patch 116-object_paint_properties_sparse-include
_extra_patch 116-abseil-arm64
git init -q .
# link to system tools
ln -sfv /usr/bin/clang-format buildtools/linux64/clang-format
@ -227,14 +245,14 @@ prepare() {
(
cd electron
git init .
git init -q .
git config user.email "example@example.com"
git config user.name "example"
git config commit.gpgsign false
git add LICENSE
git commit -m "init"
git tag "v$pkgver"
# jesus christ what the fuck is wrong with you?
touch .git/packed-refs
git pack-refs
yarn install --frozen-lockfile --no-scripts
)
@ -243,18 +261,10 @@ prepare() {
./update_npm_deps
)
# these are normally unbundled, but they can't be with custom_libcxx.
# we use custom_libcxx as there are a few libstdc++ incompatibilities
# that now cause segfaults with the wayland ozone platform since electron 22.
# obviously, this is a FIXME.
# ---
# jsoncpp
# re2
# woff2
# ---
# re2 - 2023.06 port
# libavif - https://github.com/AOMediaCodec/libavif/commit/4d2776a3
# libaom - https://aomedia.googlesource.com/aom/+/706ee36dcc82%5E%21/
local use_system="
brotli
dav1d
ffmpeg
flac
@ -262,7 +272,7 @@ prepare() {
freetype
harfbuzz-ng
icu
libaom
jsoncpp
libdrm
libevent
libjpeg
@ -271,6 +281,7 @@ prepare() {
libxslt
opus
snappy
woff2
zlib
"
@ -337,6 +348,9 @@ _configure() {
export CXXFLAGS="${CXXFLAGS/-g/} -O2 -Wno-unknown-warning-option -Wno-builtin-macro-redefined -Wno-deprecated-declarations"
export CPPFLAGS="${CPPFLAGS/-g/} -D__DATE__= -D__TIME__= -D__TIMESTAMP__="
# breaks chromium-based stuff
export CXXFLAGS="${CXXFLAGS/-D_GLIBCXX_ASSERTIONS=1}"
# shellcheck disable=2089
local gn_config="
clang_base_path=\"/usr\"
@ -345,11 +359,13 @@ _configure() {
import(\"//electron/build/args/release.gn\")
blink_enable_generated_code_formatting=false
chrome_pgo_phase=0
clang_use_chrome_plugins=false
fatal_linker_warnings=false
ffmpeg_branding=\"Chrome\"
icu_use_data_file=true
is_cfi=false
is_clang=true
is_component_ffmpeg=true
is_debug=false
is_official_build=true
@ -368,6 +384,7 @@ _configure() {
enable_reading_list=false
enable_remoting=false
enable_reporting=false
enable_rust=false
enable_screen_ai_service=false
enable_service_discovery=false
enable_stripping=false
@ -378,7 +395,7 @@ _configure() {
proprietary_codecs=true
rtc_link_pipewire=true
rtc_use_pipewire=true
use_custom_libcxx=true
use_custom_libcxx=false
use_dawn=false
use_gnome_keyring=false
use_pulseaudio=true
@ -448,14 +465,14 @@ lang() {
}
sha512sums="
208cbaa48cd929c242dce6d7e4291655a625b84f44f7d5d3ef6b40d55f7ab2269457496afa8fff73bc6c5aa01be6d26e4bdf63371a407f1f888061fbfc778a6d electron-24.2.0-2.tar.zst
f88adc643dacf7e7be1b9bb77ff2c172cd04de2a988d3cdca77313122ba3ea93e6781ee675f3d7daf337a2542c0cbf31ffb08413e9f85c287b3a5e950d7d8a31 chromium-VirtualCursor-standard-layout.patch
ddeb2b1ed6d0cf4d47cac2b9dce004811b9839be121ec06b6838563e71132b542464e117299d3f4dade336469407372f6f584590c23c0fa5337135c1357d6f47 electron-26.1.0.tar.zst
bc81489d37186790ee1b423ada5d8275fe9c408d1be8635792f7d2984dfe847913b2c8847dd95caa2a7d388fc0914813ceb7f57b9ee2a4c417410f10f944e1a8 chromium-patches-chromium-116-patchset-2.tar.gz
29bb685e03356a77df5fd347cdf55194cc8b3265c421cc76e54d64edefc329dbcb052deb26b22e8f587ce68456876c071de1b7d258dd0fcc6ee66c875ec4a020 chromium-revert-drop-of-system-java.patch
fa291e941076146d0edd5b96c088240a44a6e0aca3dfc744929655607182d2dc47e6c35ecb419f7c623fcf7f26dc3c4dd924dbf5ed10c3b986283f5ef2f72573 chromium-use-alpine-target.patch
9200f78bad70e95c648a5e8392d50642190600f655c6baa366ff6467ebad52d3b3f305dad58f3610da67136f4b723557653b174ec5c25be8d8737ee04d9ee09f fix-missing-cstdint-include-musl.patch
33ee60863cc438ef57ffef92ba4cf67a856a5ffc16138bce241bcf87e47b15154aa86918e793c26f7ec4dc62a445257ad5673ed7001daf22c4043cf6cc57da7f gdbinit.patch
8de65109ece27ea63bd469f2220c56b8c752ba0a50fdf390082a2d5ae74b8e010199126175569f6d5084270dd4e0571e68aec32c0bca8211a6699925b3a09124 import-version.patch
1bb1b31ee3057fb626a2d5eb44698946484e45017310d55026347f18f774453828802438ba14691d81edaad6c96c5df25c4aca772a30674a04feca3df11fccfb libcxx-muslmode.patch
8c458c76991131e54898e25346cd1798179726d6ea6ee7507f9474141f1d90155a750f2c208a513dd6846b429b38a26da9fbcae61e4888163c0d34ec79de4166 libstdc++13.patch
0e991842e23a4b9133898125eeb39e45e3f86f886eef5d2f0d9a72ee143a3e124b3b4f60be94edd57ce4185bcd69704edb51f76d08fdb6207f5559a08dd41ab0 mman.patch
50c274a420bb8a7f14fcb56e40920dac8f708792a4520789b4987facea459bef88113d5a2b60fa8c57bee6e92bff3617d6b73fa305c8c44614c638971cffd440 musl-sandbox.patch
e7163ac5810ac85366cef2447412287c856e3d67c6b77f219a6e5a418b1965b98e449c409424ad0704a5bded9355dd0aec3dc4585918ce5a2ab36c079707afe2 musl-tid-caching.patch
@ -463,13 +480,15 @@ e7163ac5810ac85366cef2447412287c856e3d67c6b77f219a6e5a418b1965b98e449c409424ad07
8cc774e8d84e434960222c0497ad8193ae35c0732f98d3282d5fd4b4930f914809eec97832c199517ca89ca6b9d1d011db5ce533c40c68ce5fa464609d131a23 no-execinfo.patch
b5479874d125ee95a311295f227f8881a83023ec34fded7a6160b3ae32ea3ba0f2b833a9fb264c57f3d22746b6d8b00bdc8eb2ff86c43c412d6d3b55ae15b16b no-mallinfo.patch
e4c4e5bc6f828f9c883dd418c0ba01887949c29c311f76206a1ec29f620b0c0ba0452949dc2778a9c46ea066405857536964a36436a68eecf7da7952736333cf no-res-ninit-nclose.patch
2bc334352cdf0e523003c882e1a29623896bf3f3543469b23a532cb5ff32a75e7f23dc94abfaed4a97e24d26bdc51b780728583f1e7e7860f00c49e4d91edfa9 quiche-arena-size.patch
8c33808ede31dd3b8eb951991e034751949756c4e6c2cd0e19823e95fddf5f9d94424bbd73ffe6dd965df2b0887fc5c42ab8a97c64b553d47662e90651b84f13 scoped-file-no-close.patch
6dc4d8dc92e685dace62265a1ddb3aebc558aed54d20ff6d36b030be0c48d7e84662326c31363612492574d9a03c62653cdc21a60995b97dee1d75cae86a9f9b no-sandbox-settls.patch
b7f45dfbb3ddd186514b0e45f0d6c170b2c46e4e09d633e8a86ec80ae31f386ed02ffa1a18db2c49e324653941b72f09ca71b2c7478e6ef04d3875ec1909554b revert-llvm16-linker-flag.patch
3cffb9ea335e4696260366175e79ececb648087bbb6b484ea65029c0298369aab29c30704eadae889a3c8e5112abf03f5a5e49a1574192c32e98cab8e9197026 tagging-ifuncs.patch
e48693e6b7aeebf69a5acbf80d9a35defe4c23835121dfeb58b051ac7c527e758a41004f4d193274fe1b01c0bfb1dbc77b09cb6a404a3fdee507a2918afb0edb temp-failure-retry.patch
905565c10f5e5600e7d4db965c892cc45009a258e9995da958974d838ace469e1db1019195307e8807860d5b55ba6bfeea478b1f39a9b99e82c619b2816a1a22 icon.patch
e05180199ee1d559e4e577cedd3e589844ecf40d98a86321bf1bea5607b02eeb5feb486deddae40e1005b644550331f6b8500177aa7e79bcb3750d3c1ceb76c3 python-jinja-3.10.patch
71571b15cf8bd6259b7fd22bea0e46b64890f3db776365de33fe539f26ce9ef99459e05c3dde9434c3657225bc67160abc915acd93033cb487c770c6a2a5975f vector-const.patch
2aa340854316f1284217c0ca17cbf44953684ad6c7da90815117df30928612eb9fb9ffb734b948dfc309cd25d1a67cd57f77aac2d052a3dd9aca07a3a58cbb30 webpack-hash.patch
08460b15037511a4e5469ceac6ae5dd4db4c8cb87c129aaaf40ba58b16c60b8a307ffdd85805efead235758abed09ec31db1ef4cf9159f7b9acdcee3031bc96c default.conf
738b0314e6fc9d73766d4d10709bc9063fea7de6a9da9b332fae5214d727d7e89ee669a3eca853ade69134404f57ba778cf1bada5a25042633720c5d71bb6889 default.conf
191559fc7aa1ea0353c6fb0cc321ee1d5803a0e44848c8be941cfab96277b0de6a59962d373e2a2a1686c8f9be2bcf2d2f33706759a339a959e297d3f7fda463 electron.desktop
03750694e5e0b66f084c6e43135e60be15abb059e23486346ee4352dcc236984f2f35467b47f2b2ad46c98c22091cc2b978de8e73680febadba169d960f13f9f electron-launcher.sh
ff1844036c8ae0a0a57a16211a816bc0ad550ccf6ea1cf718e228b8c95b9c4f5c9772d1a1a23638c0e140703a7b52874371e27a0d9d54a7b9468e5c384759be5 electron-launcher.sh
"

View file

@ -2,4 +2,4 @@
# the electron launcher.
# Options to pass to electron.
ELECTRON_FLAGS="--ozone-platform-hint=auto"
ELECTRON_FLAGS="--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations,WebRTCPipeWireCapturer"

View file

@ -9,6 +9,10 @@ done
# Prefer user defined ELECTRON_USER_FLAGS (from env) over system
# default ELECTRON_FLAGS (from /etc/electron/default.conf).
ELECTRON_FLAGS=${ELECTRON_USER_FLAGS:-"$ELECTRON_FLAGS"}
export ELECTRON_FLAGS="$ELECTRON_FLAGS ${ELECTRON_USER_FLAGS:-"$ELECTRON_USER_FLAGS"}"
if [ "$ELECTRON_RUN_AS_NODE" == "1" ] && [ "$ELECTRON_STILL_PASS_THE_DEFAULT_FLAGS" != "1" ]; then
exec "/usr/lib/electron/electron" "$@"
fi
exec "/usr/lib/electron/electron" "$@" ${ELECTRON_FLAGS}

View file

@ -0,0 +1,329 @@
missing libstdc++13 includes
--
--- a/third_party/ruy/src/ruy/profiler/instrumentation.h
+++ b/third_party/ruy/src/ruy/profiler/instrumentation.h
@@ -19,6 +19,7 @@
#ifdef RUY_PROFILER
#include <cstdio>
#include <mutex>
+#include <string>
#include <vector>
#endif
--- a/third_party/openscreen/src/platform/base/error.h
+++ b/third_party/openscreen/src/platform/base/error.h
@@ -6,6 +6,7 @@
#define PLATFORM_BASE_ERROR_H_
#include <cassert>
+#include <cstdint>
#include <ostream>
#include <string>
#include <utility>
--- a/third_party/vulkan_memory_allocator/include/vk_mem_alloc.h
+++ b/third_party/vulkan_memory_allocator/include/vk_mem_alloc.h
@@ -2389,6 +2389,7 @@
#undef VMA_IMPLEMENTATION
#include <cstdint>
+#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <utility>
--- a/third_party/vulkan-deps/vulkan-validation-layers/src/layers/external/vma/vk_mem_alloc.h
+++ b/third_party/vulkan-deps/vulkan-validation-layers/src/layers/external/vma/vk_mem_alloc.h
@@ -2389,6 +2389,7 @@
#undef VMA_IMPLEMENTATION
#include <cstdint>
+#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <utility>
--- a/ui/base/prediction/kalman_filter.h
+++ b/ui/base/prediction/kalman_filter.h
@@ -8,6 +8,8 @@
#include "base/component_export.h"
#include "ui/gfx/geometry/matrix3_f.h"
+#include <cstdint>
+
namespace ui {
// This Kalman filter is used to predict state in one axles.
--- a/base/strings/string_piece.h
+++ b/base/strings/string_piece.h
@@ -24,6 +24,7 @@
#include <stddef.h>
#include <algorithm>
+#include <cstdint>
#include <iosfwd>
#include <limits>
#include <string>
--- a/ui/events/types/scroll_types.h
+++ b/ui/events/types/scroll_types.h
@@ -5,6 +5,8 @@
#ifndef UI_EVENTS_TYPES_SCROLL_TYPES_H_
#define UI_EVENTS_TYPES_SCROLL_TYPES_H_
+#include <cstdint>
+
namespace ui {
enum class ScrollGranularity : uint8_t {
--- a/third_party/webrtc/rtc_base/system/file_wrapper.h
+++ b/third_party/webrtc/rtc_base/system/file_wrapper.h
@@ -14,6 +14,7 @@
#include <stddef.h>
#include <stdio.h>
+#include <cstdint>
#include <string>
#include "absl/strings/string_view.h"
--- a/third_party/pdfium/constants/annotation_flags.h
+++ b/third_party/pdfium/constants/annotation_flags.h
@@ -5,6 +5,8 @@
#ifndef CONSTANTS_ANNOTATION_FLAGS_H_
#define CONSTANTS_ANNOTATION_FLAGS_H_
+#include <cstdint>
+
namespace pdfium {
namespace annotation_flags {
--- a/third_party/s2cellid/src/s2/util/math/mathutil.h
+++ b/third_party/s2cellid/src/s2/util/math/mathutil.h
@@ -21,6 +21,7 @@
#ifndef S2_UTIL_MATH_MATHUTIL_H_
#define S2_UTIL_MATH_MATHUTIL_H_
+#include <cstdint>
#include <type_traits>
class MathUtil {
--- a/third_party/s2cellid/src/s2/s1angle.h
+++ b/third_party/s2cellid/src/s2/s1angle.h
@@ -24,6 +24,7 @@
#define S2_S1ANGLE_H_
#include <math.h>
+#include <cstdint>
#include <limits>
#include <ostream>
#include <type_traits>
--- a/third_party/maldoca/src/maldoca/ole/header.h
+++ b/third_party/maldoca/src/maldoca/ole/header.h
@@ -45,6 +45,8 @@
#include "absl/strings/string_view.h"
+#include <cstdint>
+
namespace maldoca {
class OLEHeader {
--- a/components/password_manager/core/browser/generation/password_generator.h
+++ b/components/password_manager/core/browser/generation/password_generator.h
@@ -5,6 +5,7 @@
#ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_GENERATION_PASSWORD_GENERATOR_H_
#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_GENERATION_PASSWORD_GENERATOR_H_
+#include <cstdint>
#include <string>
--- a/base/debug/profiler.h
+++ b/base/debug/profiler.h
@@ -7,6 +7,7 @@
#include <stddef.h>
+#include <cstdint>
#include <string>
#include "base/base_export.h"
--- a/components/dom_distiller/core/url_utils.h
+++ b/components/dom_distiller/core/url_utils.h
@@ -5,6 +5,7 @@
#ifndef COMPONENTS_DOM_DISTILLER_CORE_URL_UTILS_H_
#define COMPONENTS_DOM_DISTILLER_CORE_URL_UTILS_H_
+#include <cstdint>
#include <string>
#include "base/strings/string_piece_forward.h"
--- a/components/feature_engagement/internal/event_storage_validator.h
+++ b/components/feature_engagement/internal/event_storage_validator.h
@@ -5,6 +5,7 @@
#ifndef COMPONENTS_FEATURE_ENGAGEMENT_INTERNAL_EVENT_STORAGE_VALIDATOR_H_
#define COMPONENTS_FEATURE_ENGAGEMENT_INTERNAL_EVENT_STORAGE_VALIDATOR_H_
+#include <cstdint>
#include <string>
namespace feature_engagement {
--- a/chrome/test/chromedriver/chrome/web_view_impl.cc
+++ b/chrome/test/chromedriver/chrome/web_view_impl.cc
@@ -8,6 +8,7 @@
#include <algorithm>
#include <memory>
#include <queue>
+#include <string>
#include <utility>
#include <vector>
--- a/cc/trees/target_property.cc
+++ b/cc/trees/target_property.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <cstdint>
+
#include "cc/trees/target_property.h"
#include "ui/gfx/animation/keyframe/target_property.h"
--- a/gpu/config/gpu_feature_info.h
+++ b/gpu/config/gpu_feature_info.h
@@ -5,6 +5,7 @@
#ifndef GPU_CONFIG_GPU_FEATURE_INFO_H_
#define GPU_CONFIG_GPU_FEATURE_INFO_H_
+#include <cstdint>
#include <string>
#include <vector>
--- a/gpu/config/gpu_driver_bug_workarounds.h
+++ b/gpu/config/gpu_driver_bug_workarounds.h
@@ -5,6 +5,7 @@
#ifndef GPU_CONFIG_GPU_DRIVER_BUG_WORKAROUNDS_H_
#define GPU_CONFIG_GPU_DRIVER_BUG_WORKAROUNDS_H_
+#include <cstdint>
#include <vector>
#include "build/build_config.h"
--- a/third_party/blink/public/common/page_state/page_state.h
+++ b/third_party/blink/public/common/page_state/page_state.h
@@ -5,6 +5,7 @@
#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_PAGE_STATE_PAGE_STATE_H_
#define THIRD_PARTY_BLINK_PUBLIC_COMMON_PAGE_STATE_PAGE_STATE_H_
+#include <cstdint>
#include <string>
#include <vector>
--- a/pdf/document_attachment_info.h
+++ b/pdf/document_attachment_info.h
@@ -5,6 +5,7 @@
#ifndef PDF_DOCUMENT_ATTACHMENT_INFO_H_
#define PDF_DOCUMENT_ATTACHMENT_INFO_H_
+#include <cstdint>
#include <string>
--- a/components/payments/content/utility/fingerprint_parser.h
+++ b/components/payments/content/utility/fingerprint_parser.h
@@ -7,6 +7,7 @@
#include <stddef.h>
+#include <cstdint>
#include <string>
#include <vector>
--- a/media/base/video_transformation.h
+++ b/media/base/video_transformation.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_BASE_VIDEO_TRANSFORMATION_H_
#define MEDIA_BASE_VIDEO_TRANSFORMATION_H_
+#include <cstdint>
#include <string>
#include "base/numerics/math_constants.h"
--- a/components/omnibox/browser/on_device_head_model.h
+++ b/components/omnibox/browser/on_device_head_model.h
@@ -5,6 +5,7 @@
#ifndef COMPONENTS_OMNIBOX_BROWSER_ON_DEVICE_HEAD_MODEL_H_
#define COMPONENTS_OMNIBOX_BROWSER_ON_DEVICE_HEAD_MODEL_H_
+#include <cstdint>
#include <string>
#include <utility>
#include <vector>
--- a/components/autofill/core/browser/autofill_ablation_study.h
+++ b/components/autofill/core/browser/autofill_ablation_study.h
@@ -5,6 +5,7 @@
#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_ABLATION_STUDY_H_
#define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_ABLATION_STUDY_H_
+#include <cstdint>
#include <string>
class GURL;
--- a/components/autofill/core/browser/strike_databases/strike_database_base.h
+++ b/components/autofill/core/browser/strike_databases/strike_database_base.h
@@ -5,6 +5,7 @@
#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_STRIKE_DATABASES_STRIKE_DATABASE_BASE_H_
#define COMPONENTS_AUTOFILL_CORE_BROWSER_STRIKE_DATABASES_STRIKE_DATABASE_BASE_H_
+#include <cstdint>
#include <map>
#include <string>
#include <vector>
--- a/chrome/browser/privacy_budget/encountered_surface_tracker.h
+++ b/chrome/browser/privacy_budget/encountered_surface_tracker.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_PRIVACY_BUDGET_ENCOUNTERED_SURFACE_TRACKER_H_
#define CHROME_BROWSER_PRIVACY_BUDGET_ENCOUNTERED_SURFACE_TRACKER_H_
+#include <cstdint>
#include <map>
#include "base/containers/flat_set.h"
--- a/chrome/browser/resource_coordinator/decision_details.h
+++ b/chrome/browser/resource_coordinator/decision_details.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_RESOURCE_COORDINATOR_DECISION_DETAILS_H_
#define CHROME_BROWSER_RESOURCE_COORDINATOR_DECISION_DETAILS_H_
+#include <cstdint>
#include <string>
#include <vector>
--- a/net/third_party/quiche/src/quiche/quic/core/qpack/qpack_stream_sender_delegate.h
+++ b/net/third_party/quiche/src/quiche/quic/core/qpack/qpack_stream_sender_delegate.h
@@ -8,6 +8,8 @@
#include "absl/strings/string_view.h"
#include "quiche/quic/platform/api/quic_export.h"
+#include <cstdint>
+
namespace quic {
// This interface writes encoder/decoder data to peer.
--- a/third_party/perfetto/src/trace_processor/sqlite/query_constraints.h
+++ b/third_party/perfetto/src/trace_processor/sqlite/query_constraints.h
@@ -17,6 +17,7 @@
#ifndef SRC_TRACE_PROCESSOR_SQLITE_QUERY_CONSTRAINTS_H_
#define SRC_TRACE_PROCESSOR_SQLITE_QUERY_CONSTRAINTS_H_
+#include <cstdint>
#include <limits>
#include <vector>
--- a/third_party/perfetto/include/perfetto/base/export.h
+++ b/third_party/perfetto/include/perfetto/base/export.h
@@ -17,6 +17,8 @@
#ifndef INCLUDE_PERFETTO_BASE_EXPORT_H_
#define INCLUDE_PERFETTO_BASE_EXPORT_H_
+#include <cstdint>
+
#include "perfetto/base/build_config.h"
#include "perfetto/public/abi/export.h"

View file

@ -0,0 +1,14 @@
this optimisation of CLONE_SETTLS is not valid used like this, and future musl
clone(3) will EINVAL on this use
--
--- a/sandbox/linux/services/credentials.cc
+++ b/sandbox/linux/services/credentials.cc
@@ -89,7 +89,7 @@
int clone_flags = CLONE_FS | LINUX_SIGCHLD;
void* tls = nullptr;
-#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY)) && \
+#if 0 && (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY)) && \
!defined(MEMORY_SANITIZER)
// Use CLONE_VM | CLONE_VFORK as an optimization to avoid copying page tables.
// Since clone writes to the new child's TLS before returning, we must set a

View file

@ -0,0 +1,42 @@
From 54969766fd2029c506befc46e9ce14d67c7ed02a Mon Sep 17 00:00:00 2001
From: Arthur Eubanks <aeubanks@google.com>
Date: Tue, 25 Apr 2023 03:05:19 +0000
Subject: [PATCH] Reland [clang] Disable autoupgrading debug info in ThinLTO
builds
ThinLTO reads bitcode many times and attempts to upgrade the debug info every time. This is expensive since it calls the verifier. We don't need this given all LLVM bitcode producers are from the same version of LLVM.
For just the build step that runs ThinLTO and links official Chrome, measured 34T -> 32T instructions via perf stat.
Reland disables adding flag for ChromeOS since that toolchain is too old to have this flag.
Bug: 972449
Change-Id: I44552dd6c9dc71683c002d0c885e78b2a4341659
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4470209
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Arthur Eubanks <aeubanks@google.com>
Cr-Commit-Position: refs/heads/main@{#1135007}
---
build/config/compiler/BUILD.gn | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 1c13bc80f0f..53db095c1b1 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -685,7 +685,6 @@
"/lldltocache:" +
rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
"/lldltocachepolicy:$cache_policy",
- "-mllvm:-disable-auto-upgrade-debug-info",
]
} else {
ldflags += [ "-flto=thin" ]
@@ -732,7 +731,6 @@
# toolchain has this flag.
# We only use one version of LLVM within a build so there's no need to
# upgrade debug info, which can be expensive since it runs the verifier.
- ldflags += [ "-Wl,-mllvm,-disable-auto-upgrade-debug-info" ]
}
}

View file

@ -0,0 +1,271 @@
From 89e6aa2c5346999aa4019eac9b08d79afe990766 Mon Sep 17 00:00:00 2001
From: "lauren n. liberda" <lauren@selfisekai.rocks>
Date: Sun, 20 Aug 2023 04:44:25 +0200
Subject: [PATCH] Revert "Reland "Reland "mte: refactor the tagging functions
to use ifuncs"""
This reverts commit b2c4ff8d5d8cdbf2487363a5b8d68b6485706069.
---
.../partition_allocator/partition_root.cc | 4 ++
base/allocator/partition_allocator/tagging.cc | 56 ++++++-------------
base/allocator/partition_allocator/tagging.h | 43 +++++++++-----
.../partition_allocator/tagging_unittest.cc | 8 +++
4 files changed, 60 insertions(+), 51 deletions(-)
diff --git a/base/allocator/partition_allocator/partition_root.cc b/base/allocator/partition_allocator/partition_root.cc
index 3fc0b11fb7156..813afbf836098 100644
--- a/base/allocator/partition_allocator/partition_root.cc
+++ b/base/allocator/partition_allocator/partition_root.cc
@@ -868,6 +868,10 @@ void PartitionRoot::Init(PartitionOptions opts) {
return;
}
+ // Swaps out the active no-op tagging intrinsics with MTE-capable ones, if
+ // running on the right hardware.
+ ::partition_alloc::internal::InitializeMTESupportIfNeeded();
+
#if BUILDFLAG(HAS_64_BIT_POINTERS)
// Reserve address space for partition alloc.
internal::PartitionAddressSpace::Init();
diff --git a/base/allocator/partition_allocator/tagging.cc b/base/allocator/partition_allocator/tagging.cc
index 6f0d49dffc3c6..63368e870fe0c 100644
--- a/base/allocator/partition_allocator/tagging.cc
+++ b/base/allocator/partition_allocator/tagging.cc
@@ -12,9 +12,7 @@
#if PA_CONFIG(HAS_MEMORY_TAGGING)
#include <arm_acle.h>
-#include <asm/hwcap.h>
#include <sys/auxv.h>
-#include <sys/ifunc.h>
#include <sys/prctl.h>
#define PR_SET_TAGGED_ADDR_CTRL 55
#define PR_GET_TAGGED_ADDR_CTRL 56
@@ -121,6 +119,12 @@ namespace {
return ret;
}
+#if PA_CONFIG(HAS_MEMORY_TAGGING)
+static bool HasCPUMemoryTaggingExtension() {
+ return base::CPU::GetInstanceNoAllocation().has_mte();
+}
+#endif // PA_CONFIG(HAS_MEMORY_TAGGING)
+
#if PA_CONFIG(HAS_MEMORY_TAGGING)
void* TagRegionRandomlyForMTE(void* ptr, size_t sz, uint64_t mask) {
// Randomly tag a region (MTE-enabled systems only). The first 16-byte
@@ -162,6 +166,7 @@ void* RemaskVoidPtrForMTE(void* ptr) {
}
return nullptr;
}
+#endif
void* TagRegionIncrementNoOp(void* ptr, size_t sz) {
// Region parameters are checked even on non-MTE systems to check the
@@ -178,49 +183,24 @@ void* TagRegionRandomlyNoOp(void* ptr, size_t sz, uint64_t mask) {
void* RemaskVoidPtrNoOp(void* ptr) {
return ptr;
}
-#endif
} // namespace
+void InitializeMTESupportIfNeeded() {
#if PA_CONFIG(HAS_MEMORY_TAGGING)
-using RemaskPtrInternalFn = void*(void* ptr);
-using TagMemoryRangeIncrementInternalFn = void*(void* ptr, size_t size);
-
-using TagMemoryRangeRandomlyInternalFn = void*(void* ptr,
- size_t size,
- uint64_t mask);
-
-extern "C" TagMemoryRangeIncrementInternalFn(
- *ResolveTagMemoryRangeIncrement(uint64_t hwcap, struct __ifunc_arg_t* hw)) {
- if ((hwcap & _IFUNC_ARG_HWCAP) && (hw->_hwcap2 & HWCAP2_MTE)) {
- return TagRegionIncrementForMTE;
+ if (HasCPUMemoryTaggingExtension()) {
+ global_remask_void_ptr_fn = RemaskVoidPtrForMTE;
+ global_tag_memory_range_increment_fn = TagRegionIncrementForMTE;
+ global_tag_memory_range_randomly_fn = TagRegionRandomlyForMTE;
}
- return TagRegionIncrementNoOp;
-}
-
-extern "C" TagMemoryRangeRandomlyInternalFn(
- *ResolveTagMemoryRandomly(uint64_t hwcap, struct __ifunc_arg_t* hw)) {
- if ((hwcap & _IFUNC_ARG_HWCAP) && (hw->_hwcap2 & HWCAP2_MTE)) {
- return TagRegionRandomlyForMTE;
- }
- return TagRegionRandomlyNoOp;
-}
-
-extern "C" RemaskPtrInternalFn(
- *ResolveRemaskPointer(uint64_t hwcap, struct __ifunc_arg_t* hw)) {
- if ((hwcap & _IFUNC_ARG_HWCAP) && (hw->_hwcap2 & HWCAP2_MTE)) {
- return RemaskVoidPtrForMTE;
- }
- return RemaskVoidPtrNoOp;
+#endif
}
-void* TagMemoryRangeIncrementInternal(void* ptr, size_t size)
- __attribute__((ifunc("ResolveTagMemoryRangeIncrement")));
-void* TagMemoryRangeRandomlyInternal(void* ptr, size_t size, uint64_t mask)
- __attribute__((ifunc("ResolveTagMemoryRandomly")));
-void* RemaskPointerInternal(void* ptr)
- __attribute__((ifunc("ResolveRemaskPointer")));
-#endif // PA_CONFIG(HAS_MEMORY_TAGGING)
+RemaskPtrInternalFn* global_remask_void_ptr_fn = RemaskVoidPtrNoOp;
+TagMemoryRangeIncrementInternalFn* global_tag_memory_range_increment_fn =
+ TagRegionIncrementNoOp;
+TagMemoryRangeRandomlyInternalFn* global_tag_memory_range_randomly_fn =
+ TagRegionRandomlyNoOp;
TagViolationReportingMode GetMemoryTaggingModeForCurrentThread() {
#if PA_CONFIG(HAS_MEMORY_TAGGING)
diff --git a/base/allocator/partition_allocator/tagging.h b/base/allocator/partition_allocator/tagging.h
index 858c5c3f69fc5..476e84e849c12 100644
--- a/base/allocator/partition_allocator/tagging.h
+++ b/base/allocator/partition_allocator/tagging.h
@@ -56,16 +56,32 @@ void ChangeMemoryTaggingModeForAllThreadsPerProcess(TagViolationReportingMode);
PA_COMPONENT_EXPORT(PARTITION_ALLOC)
TagViolationReportingMode GetMemoryTaggingModeForCurrentThread();
-// These forward-defined functions do not really exist in tagging.cc, they're resolved
-// by the dynamic linker to MTE-capable versions on the right hardware.
-#if PA_CONFIG(HAS_MEMORY_TAGGING)
-PA_COMPONENT_EXPORT(PARTITION_ALLOC)
-void* TagMemoryRangeIncrementInternal(void* ptr, size_t size);
-PA_COMPONENT_EXPORT(PARTITION_ALLOC)
-void* TagMemoryRangeRandomlyInternal(void* ptr, size_t size, uint64_t mask);
-PA_COMPONENT_EXPORT(PARTITION_ALLOC)
-void* RemaskPointerInternal(void* ptr);
-#endif
+// Called by the partition allocator after initial startup, this detects MTE
+// support in the current CPU and replaces the active tagging intrinsics with
+// MTE versions if needed.
+PA_COMPONENT_EXPORT(PARTITION_ALLOC) void InitializeMTESupportIfNeeded();
+
+// These global function pointers hold the implementations of the tagging
+// intrinsics (TagMemoryRangeRandomly, TagMemoryRangeIncrement, RemaskPtr).
+// They are designed to be callable without taking a branch. They are initially
+// set to no-op functions in tagging.cc, but can be replaced with MTE-capable
+// ones through InitializeMTEIfNeeded(). This is conceptually similar to an
+// IFUNC, even though less secure. These function pointers were introduced to
+// support older Android releases. With the removal of support for Android M,
+// it became possible to use IFUNC instead.
+// TODO(bartekn): void* -> uintptr_t
+using RemaskPtrInternalFn = void*(void* ptr);
+using TagMemoryRangeIncrementInternalFn = void*(void* ptr, size_t size);
+
+using TagMemoryRangeRandomlyInternalFn = void*(void* ptr,
+ size_t size,
+ uint64_t mask);
+extern PA_COMPONENT_EXPORT(PARTITION_ALLOC)
+ TagMemoryRangeRandomlyInternalFn* global_tag_memory_range_randomly_fn;
+extern PA_COMPONENT_EXPORT(PARTITION_ALLOC)
+ TagMemoryRangeIncrementInternalFn* global_tag_memory_range_increment_fn;
+extern PA_COMPONENT_EXPORT(PARTITION_ALLOC)
+ RemaskPtrInternalFn* global_remask_void_ptr_fn;
// Increments the tag of the memory range ptr. Useful for provable revocations
// (e.g. free). Returns the pointer with the new tag. Ensures that the entire
@@ -75,7 +91,7 @@ void* RemaskPointerInternal(void* ptr);
template <typename T>
PA_ALWAYS_INLINE T* TagMemoryRangeIncrement(T* ptr, size_t size) {
#if PA_CONFIG(HAS_MEMORY_TAGGING)
- return reinterpret_cast<T*>(TagMemoryRangeIncrementInternal(ptr, size));
+ return reinterpret_cast<T*>(global_tag_memory_range_increment_fn(ptr, size));
#else
return ptr;
#endif
@@ -93,7 +109,8 @@ PA_ALWAYS_INLINE T* TagMemoryRangeRandomly(T* ptr,
size_t size,
uint64_t mask = 0u) {
#if PA_CONFIG(HAS_MEMORY_TAGGING)
- return reinterpret_cast<T*>(TagMemoryRangeRandomlyInternal(ptr, size, mask));
+ return reinterpret_cast<T*>(
+ global_tag_memory_range_randomly_fn(ptr, size, mask));
#else
return ptr;
#endif
@@ -108,7 +125,7 @@ PA_ALWAYS_INLINE void* TagMemoryRangeRandomly(uintptr_t ptr,
template <typename T>
PA_ALWAYS_INLINE T* TagPtr(T* ptr) {
#if PA_CONFIG(HAS_MEMORY_TAGGING)
- return reinterpret_cast<T*>(RemaskPointerInternal(ptr));
+ return reinterpret_cast<T*>(global_remask_void_ptr_fn(ptr));
#else
return ptr;
#endif
diff --git a/base/allocator/partition_allocator/tagging_unittest.cc b/base/allocator/partition_allocator/tagging_unittest.cc
index 5c25a46e62015..fab5db7212a34 100644
--- a/base/allocator/partition_allocator/tagging_unittest.cc
+++ b/base/allocator/partition_allocator/tagging_unittest.cc
@@ -16,6 +16,7 @@ namespace partition_alloc::internal {
// Check whether we can call the tagging intrinsics safely on all architectures.
TEST(PartitionAllocMemoryTaggingTest, TagMemoryRangeRandomlySafe) {
+ ::partition_alloc::internal::InitializeMTESupportIfNeeded();
uintptr_t buffer =
AllocPages(PageAllocationGranularity(), PageAllocationGranularity(),
PageAccessibilityConfiguration(
@@ -31,6 +32,7 @@ TEST(PartitionAllocMemoryTaggingTest, TagMemoryRangeRandomlySafe) {
}
TEST(PartitionAllocMemoryTaggingTest, TagMemoryRangeIncrementSafe) {
+ ::partition_alloc::internal::InitializeMTESupportIfNeeded();
base::CPU cpu;
uintptr_t buffer =
AllocPages(PageAllocationGranularity(), PageAllocationGranularity(),
@@ -52,6 +54,7 @@ TEST(PartitionAllocMemoryTaggingTest, TagMemoryRangeIncrementSafe) {
#if defined(ARCH_CPU_64_BITS)
// Size / alignment constraints are only enforced on 64-bit architectures.
TEST(PartitionAllocMemoryTaggingTest, TagMemoryRangeBadSz) {
+ ::partition_alloc::internal::InitializeMTESupportIfNeeded();
base::CPU cpu;
uintptr_t buffer =
AllocPages(PageAllocationGranularity(), PageAllocationGranularity(),
@@ -68,6 +71,7 @@ TEST(PartitionAllocMemoryTaggingTest, TagMemoryRangeBadSz) {
}
TEST(PartitionAllocMemoryTaggingTest, TagMemoryRangeRandomlyNoSz) {
+ ::partition_alloc::internal::InitializeMTESupportIfNeeded();
base::CPU cpu;
uintptr_t buffer =
AllocPages(PageAllocationGranularity(), PageAllocationGranularity(),
@@ -83,6 +87,7 @@ TEST(PartitionAllocMemoryTaggingTest, TagMemoryRangeRandomlyNoSz) {
}
TEST(PartitionAllocMemoryTaggingTest, TagMemoryRangeRandomlyBadAlign) {
+ ::partition_alloc::internal::InitializeMTESupportIfNeeded();
base::CPU cpu;
uintptr_t buffer =
AllocPages(PageAllocationGranularity(), PageAllocationGranularity(),
@@ -99,6 +104,7 @@ TEST(PartitionAllocMemoryTaggingTest, TagMemoryRangeRandomlyBadAlign) {
}
TEST(PartitionAllocMemoryTaggingTest, TagMemoryRangeIncrementBadSz) {
+ ::partition_alloc::internal::InitializeMTESupportIfNeeded();
base::CPU cpu;
uintptr_t buffer =
AllocPages(PageAllocationGranularity(), PageAllocationGranularity(),
@@ -114,6 +120,7 @@ TEST(PartitionAllocMemoryTaggingTest, TagMemoryRangeIncrementBadSz) {
}
TEST(PartitionAllocMemoryTaggingTest, TagMemoryRangeIncrementNoSz) {
+ ::partition_alloc::internal::InitializeMTESupportIfNeeded();
base::CPU cpu;
uintptr_t buffer =
AllocPages(PageAllocationGranularity(), PageAllocationGranularity(),
@@ -129,6 +136,7 @@ TEST(PartitionAllocMemoryTaggingTest, TagMemoryRangeIncrementNoSz) {
}
TEST(PartitionAllocMemoryTaggingTest, TagMemoryRangeIncrementBadAlign) {
+ ::partition_alloc::internal::InitializeMTESupportIfNeeded();
base::CPU cpu;
uintptr_t buffer =
AllocPages(PageAllocationGranularity(), PageAllocationGranularity(),
--
2.41.0