backports/electron: upgrade to 26.1.0 #243

Closed
ayakael wants to merge 2 commits from electron/upgrade-25.3.2 into v3.18
12 changed files with 728 additions and 315 deletions

View file

@ -2,16 +2,15 @@
# Maintainer: Lauren N. Liberda <lauren@selfisekai.rocks> # Maintainer: Lauren N. Liberda <lauren@selfisekai.rocks>
pkgname=electron-tasje pkgname=electron-tasje
pkgver=0.5.7 pkgver=0.5.7
pkgrel=0 pkgrel=1
pkgdesc="Tiny replacement for electron-builder" pkgdesc="Tiny replacement for electron-builder"
url="https://codeberg.org/selfisekai/electron_tasje/" url="https://codeberg.org/selfisekai/electron_tasje/"
arch="aarch64 x86_64" # only useful on platforms with electron arch="aarch64 x86_64" # only useful on platforms with electron
license="Apache-2.0" license="Apache-2.0"
makedepends="cargo" makedepends="cargo cargo-auditable"
source="electron_tasje-$pkgver.tar.gz::https://codeberg.org/selfisekai/electron_tasje/archive/v$pkgver.tar.gz" source="electron_tasje-$pkgver.tar.gz::https://codeberg.org/selfisekai/electron_tasje/archive/v$pkgver.tar.gz"
builddir="$srcdir/electron_tasje" builddir="$srcdir/electron_tasje"
export CARGO_REGISTRIES_CRATES_IO_PROTOCOL="sparse"
prepare() { prepare() {
default_prepare default_prepare
@ -20,7 +19,7 @@ prepare() {
} }
build() { build() {
cargo build --frozen --release cargo auditable build --frozen --release
} }
check() { check() {

View file

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

View file

@ -1,219 +0,0 @@
needed for libstdc++11 + clang only
crbug: https://bugs.chromium.org/p/chromium/issues/detail?id=1189788
--
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<LeafPageDecoder>(&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<std::unique_ptr<InnerPageDecoder>> inner_decoders_;
// Decodes the leaf page containing records.
- std::unique_ptr<LeafPageDecoder> 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<uint8_t[]>(table->page_size())),
- table_(table) {
+ : page_data_(), table_(table) {
DCHECK(table != nullptr);
DCHECK(IsValidPageSize(table->page_size()));
}
@@ -57,8 +56,8 @@
std::numeric_limits<int64_t>::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<uint8_t*>(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 <array>
#include <cstdint>
#include <memory>
@@ -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<uint8_t[]> page_data_;
+ const std::array<uint8_t, kMaxPageSize> page_data_;
// Raw pointer usage is acceptable because this instance's owner is expected
// to ensure that the VirtualTable outlives this.
VirtualTable* const table_;

View file

@ -2,4 +2,4 @@
# the electron launcher. # the electron launcher.
# Options to pass to electron. # 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 # Prefer user defined ELECTRON_USER_FLAGS (from env) over system
# default ELECTRON_FLAGS (from /etc/electron/default.conf). # 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} exec "/usr/lib/electron/electron" "$@" ${ELECTRON_FLAGS}

View file

@ -1,7 +0,0 @@
--- a/buildtools/third_party/libc++/__config_site
+++ b/buildtools/third_party/libc++/__config_site
@@ -49,3 +49,4 @@
#define _LIBCPP_REMOVE_TRANSITIVE_INCLUDES
+#define _LIBCPP_HAS_MUSL_LIBC
#endif // _LIBCPP_CONFIG_SITE

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

@ -1,14 +0,0 @@
back in the day when net_unittests were ran, the block arena size was not big
enough for some reason. should look at this again
--
--- a/net/third_party/quiche/src/quiche/quic/core/quic_one_block_arena.h
+++ b/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<1280>;
+using QuicConnectionArena = QuicOneBlockArena<1504>;
} // namespace quic

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

@ -1,25 +0,0 @@
for some reason this breaks and the fd returned after close() after a few
cycles is still in the lock array.
so, just don't enforce or wrap anything.
note when testing this again: __close does not exist as a symbol in musl, so a
manual dlsym workaround has to be performed to use this codepath.
--- a/base/files/scoped_file_linux.cc
+++ b/base/files/scoped_file_linux.cc
@@ -77,15 +77,3 @@
}
} // namespace base
-
-extern "C" {
-
-int __close(int);
-
-__attribute__((visibility("default"), noinline)) int close(int fd) {
- if (base::IsFDOwned(fd) && g_is_ownership_enforced)
- CrashOnFdOwnershipViolation();
- return __close(fd);
-}
-
-} // extern "C"

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