Skip to content
Snippets Groups Projects
Commit be2f8b24 authored by LN Liberda's avatar LN Liberda Committed by Patrycja Rosa
Browse files

testing/electron: upgrade to 27.0.0

parent b74d86d1
No related branches found
No related tags found
1 merge request!52703testing/electron: upgrade to 27.0.0
# Maintainer: lauren n. liberda <lauren@selfisekai.rocks>
pkgname=electron
pkgver=26.3.0
pkgrel=1
_chromium=116.0.5845.228
pkgver=27.0.0
_semver="${pkgver/_beta/-beta.}"
pkgrel=0
_chromium=118.0.5993.54
_depot_tools=b5509953468edd0906f2dc297886939abbd2bed5
_extra_patches=chromium-116-patchset-2
_extra_patches=118.0.5993.11
pkgdesc="Electron cross-platform desktop toolkit"
url="https://github.com/electron/electron"
arch="aarch64 x86_64" # same as chromium
......@@ -93,12 +94,12 @@ makedepends="
xcb-proto
yarn
zlib-dev
zstd
zstd-dev
"
subpackages="$pkgname-lang $pkgname-dev"
# the lower patches are specific to electron, the top ones are from the equivalent chromium version
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
source="https://s3.sakamoto.pl/lnl-aports-snapshots/electron-$_semver-$_chromium.tar.zst
https://gitlab.com/Matt.Jolly/chromium-patches/-/archive/$_extra_patches/chromium-patches-$_extra_patches.tar.gz
chromium-revert-drop-of-system-java.patch
chromium-use-alpine-target.patch
fix-missing-cstdint-include-musl.patch
......@@ -111,10 +112,10 @@ source="https://s3.sakamoto.pl/lnl-aports-snapshots/electron-$pkgver.tar.zst
musl-v8-monotonic-pthread-cont_timedwait.patch
no-execinfo.patch
no-mallinfo.patch
no-mte.patch
no-res-ninit-nclose.patch
no-sandbox-settls.patch
revert-llvm16-linker-flag.patch
tagging-ifuncs.patch
temp-failure-retry.patch
icon.patch
......@@ -128,6 +129,26 @@ source="https://s3.sakamoto.pl/lnl-aports-snapshots/electron-$pkgver.tar.zst
"
# tests are todo for some base checks
options="!check net suid"
builddir="$srcdir/electron-$_semver-$_chromium"
export PATH="$PATH:/usr/lib/qt5/bin"
# clang uses much less memory (and this doesn't support gcc)
export CC=clang
export CXX=clang++
# required to find the tools
export AR=llvm-ar
export NM=llvm-nm
export LD=clang++
# less log spam, reproducible
export CFLAGS="${CFLAGS/-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__="
# breaks chromium-based stuff
export CXXFLAGS="${CXXFLAGS/-D_GLIBCXX_ASSERTIONS=1}"
# creates a dist tarball that does not need to git clone everything at build time.
snapshot() {
......@@ -160,7 +181,7 @@ snapshot() {
echo "solutions = [
{
\"name\": \"src/electron\",
\"url\": \"file://$srcdir/electron@v$pkgver\",
\"url\": \"file://$srcdir/electron@v$_semver\",
\"deps_file\": \"DEPS\",
\"managed\": False,
\"custom_deps\": {
......@@ -201,15 +222,15 @@ snapshot() {
--output_name=src/chrome/android/profiles/afdo.prof \
--gs_url_base=chromeos-prebuilt/afdo-job/llvm
mv src $pkgname-$pkgver
mv src $pkgname-$_semver-$_chromium
# extra binaries are most likely things we don't want, so nuke them all
for elf in $(scanelf -RA -F "%F" $pkgname-$pkgver); do
for elf in $(scanelf -RA -F "%F" $pkgname-$_semver-$_chromium); do
rm -f "$elf"
done
msg "generating tarball.. (this takes a while)"
tar -cf $pkgname-$pkgver.tar \
tar -cf $pkgname-$_semver-$_chromium.tar \
--exclude="ChangeLog*" \
--exclude="testdata/*" \
--exclude="test_data/*" \
......@@ -217,9 +238,9 @@ snapshot() {
--exclude-backups \
--exclude-caches-all \
--exclude-vcs \
$pkgname-$pkgver
$pkgname-$_semver-$_chromium
zstd --auto-threads=logical --ultra --long -22 -T0 -vv $pkgname-$pkgver.tar
zstd --auto-threads=logical --ultra --long -22 -T"${ZSTD_LIMIT:-0}" -vv $pkgname-$_semver-$_chromium.tar
}
_extra_patch() {
......@@ -232,8 +253,10 @@ prepare() {
default_prepare
_extra_patch 116-object_paint_properties_sparse-include
_extra_patch 116-abseil-arm64
_extra_patch 118-SensorReadingField-include
_extra_patch 117-material-color-include
_extra_patch 118-system-freetype
_extra_patch 117-system-zstd
git init -q .
......@@ -251,7 +274,7 @@ prepare() {
git config commit.gpgsign false
git add LICENSE
git commit -m "init"
git tag "v$pkgver"
git tag "v$_semver"
git pack-refs
yarn install --frozen-lockfile --no-scripts
)
......@@ -261,8 +284,6 @@ prepare() {
./update_npm_deps
)
# re2 - 2023.06 port
# libavif - https://github.com/AOMediaCodec/libavif/commit/4d2776a3
# libaom - https://aomedia.googlesource.com/aom/+/706ee36dcc82%5E%21/
local use_system="
dav1d
......@@ -273,6 +294,7 @@ prepare() {
harfbuzz-ng
icu
jsoncpp
libavif
libdrm
libevent
libjpeg
......@@ -280,9 +302,11 @@ prepare() {
libxml
libxslt
opus
re2
snappy
woff2
zlib
zstd
"
for _lib in $use_system libjpeg_turbo; do
......@@ -332,25 +356,6 @@ _configure() {
cd "$builddir"
msg "Configuring build"
export PATH="$PATH:/usr/lib/qt5/bin"
# clang uses much less memory (and this doesn't support gcc)
export CC=clang
export CXX=clang++
# required to find the tools
export AR=llvm-ar
export NM=llvm-nm
export LD=clang++
# less log spam, reproducible
export CFLAGS="${CFLAGS/-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__="
# breaks chromium-based stuff
export CXXFLAGS="${CXXFLAGS/-D_GLIBCXX_ASSERTIONS=1}"
# shellcheck disable=2089
local gn_config="
clang_base_path=\"/usr\"
......@@ -374,7 +379,7 @@ _configure() {
angle_enable_gl_null=false
build_tflite_with_xnnpack=false
build_with_tflite_lib=false
build_with_tflite_lib=true
disable_fieldtrial_testing_config=true
enable_hangout_services_extension=true
enable_library_cdms=false
......@@ -397,7 +402,6 @@ _configure() {
rtc_use_pipewire=true
use_custom_libcxx=false
use_dawn=false
use_gnome_keyring=false
use_pulseaudio=true
use_sysroot=false
use_system_cares=true
......@@ -408,7 +412,6 @@ _configure() {
use_system_libffi=true
use_system_libjpeg=true
use_system_nghttp2=true
use_system_zlib=true
use_vaapi=true
"
......@@ -465,24 +468,24 @@ lang() {
}
sha512sums="
592241bcb3d2e7ec48dc2bca47f87fabe8119959e7797f39fa8a7c0deda724c56080d69fe253009fc8043cbaf972773d749ac73731572bf223c7a06e3b56e203 electron-26.3.0.tar.zst
bc81489d37186790ee1b423ada5d8275fe9c408d1be8635792f7d2984dfe847913b2c8847dd95caa2a7d388fc0914813ceb7f57b9ee2a4c417410f10f944e1a8 chromium-patches-chromium-116-patchset-2.tar.gz
ed67560e50c8bb094d83f856340942ad775f395011bb5c4ca1724526e7198f03c540a3493298d0e23e6eaf8b58752075c5478e813d872e9291cfdd9c998623dc electron-27.0.0-118.0.5993.54.tar.zst
194c3a7a0fa03a85df6fe52ece3d53d4d15b9d0cb440b56a2ccb1b5c0d3f6481b6f7287aa705c596ceea92d475677ddaf58926f3b31c03a3c20e80ad7e481ce7 chromium-patches-118.0.5993.11.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
8c458c76991131e54898e25346cd1798179726d6ea6ee7507f9474141f1d90155a750f2c208a513dd6846b429b38a26da9fbcae61e4888163c0d34ec79de4166 libstdc++13.patch
49851d42ce8ccd533d01d1bb2477930802b0bcebab8dd52f2da292088378c6ed9b74146e7dad55edfe096281fc84b2c55abaf832744fd4553a97c38ed891df3a libstdc++13.patch
0e991842e23a4b9133898125eeb39e45e3f86f886eef5d2f0d9a72ee143a3e124b3b4f60be94edd57ce4185bcd69704edb51f76d08fdb6207f5559a08dd41ab0 mman.patch
50c274a420bb8a7f14fcb56e40920dac8f708792a4520789b4987facea459bef88113d5a2b60fa8c57bee6e92bff3617d6b73fa305c8c44614c638971cffd440 musl-sandbox.patch
e7163ac5810ac85366cef2447412287c856e3d67c6b77f219a6e5a418b1965b98e449c409424ad0704a5bded9355dd0aec3dc4585918ce5a2ab36c079707afe2 musl-tid-caching.patch
92eb002718026611f5542362ad69b67f0a398ff71b3fca5c05d55cb5c6f9f29334e5e127bb4860cfaa3fba0f0d4c901e2b98808217e7dc02e254a64a5c9521aa musl-v8-monotonic-pthread-cont_timedwait.patch
8cc774e8d84e434960222c0497ad8193ae35c0732f98d3282d5fd4b4930f914809eec97832c199517ca89ca6b9d1d011db5ce533c40c68ce5fa464609d131a23 no-execinfo.patch
b5479874d125ee95a311295f227f8881a83023ec34fded7a6160b3ae32ea3ba0f2b833a9fb264c57f3d22746b6d8b00bdc8eb2ff86c43c412d6d3b55ae15b16b no-mallinfo.patch
8a52ff52201a5e20344f5497ee2ffef0520f7b2d934be92227e49c3f2c12a94c33650eefc88a0e451a6b81d44ce197db421aaec7388e6bb1cb525a43628779d3 no-mte.patch
e4c4e5bc6f828f9c883dd418c0ba01887949c29c311f76206a1ec29f620b0c0ba0452949dc2778a9c46ea066405857536964a36436a68eecf7da7952736333cf no-res-ninit-nclose.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
......
......@@ -51,16 +51,6 @@ missing libstdc++13 includes
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 @@
......
M115 needs ifuncs for this
--
--- a/base/allocator/partition_allocator/partition_alloc_config.h
+++ b/base/allocator/partition_allocator/partition_alloc_config.h
@@ -155,7 +155,7 @@
#define PA_CONFIG_HAS_MEMORY_TAGGING() \
(defined(ARCH_CPU_ARM64) && defined(__clang__) && \
!defined(ADDRESS_SANITIZER) && \
- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID)))
+ ((BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_ANDROID)))
#if PA_CONFIG(HAS_MEMORY_TAGGING)
static_assert(sizeof(void*) == 8);
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment