Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package nodejs-electron for openSUSE:Factory checked in at 2023-10-17 20:24:39 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/nodejs-electron (Old) and /work/SRC/openSUSE:Factory/.nodejs-electron.new.20540 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "nodejs-electron" Tue Oct 17 20:24:39 2023 rev:83 rq:1118118 version:25.9.1 Changes: -------- --- /work/SRC/openSUSE:Factory/nodejs-electron/nodejs-electron.changes 2023-10-12 23:48:03.365815792 +0200 +++ /work/SRC/openSUSE:Factory/.nodejs-electron.new.20540/nodejs-electron.changes 2023-10-17 20:24:42.822684170 +0200 @@ -1,0 +2,20 @@ +Mon Oct 16 17:38:38 UTC 2023 - Bruno Pitrus <brunopit...@hotmail.com> + +- Add backported security patches: + * CVE-2023-38552 bsc#1216272 CVE-2023-38552-node-integrity-checks-according-to-policies.patch + * CVE-2023-39333 bsc#1216273 CVE-2023-39333-node-create_dynamic_module-code-injection.patch + * CVE-2023-45143 bsc#1216205 CVE-2023-45143-undici-cookie-leakage.patch +- Build against Wayland 21 also on Leap 15.4 now that it's available + * drop wayland-WL-SINCE-VERSION.patch + * drop wayland_data_drag_controller-WL_SURFACE_OFFSET_SINCE_VERSION.patch + +------------------------------------------------------------------- +Mon Oct 16 08:55:17 UTC 2023 - Bruno Pitrus <brunopit...@hotmail.com> + +- Use system simdutf on Fedora â¥38 + * system-simdutf.patch +- Use system vulkan-memory-allocator on Fedora 40/Rawhide + * vulkan_memory_allocator.gn + * vulkan_memory_allocator-upgrade.patch + +------------------------------------------------------------------- Old: ---- wayland-WL-SINCE-VERSION.patch wayland_data_drag_controller-WL_SURFACE_OFFSET_SINCE_VERSION.patch New: ---- CVE-2023-38552-node-integrity-checks-according-to-policies.patch CVE-2023-39333-node-create_dynamic_module-code-injection.patch CVE-2023-45143-undici-cookie-leakage.patch system-simdutf.patch vulkan_memory_allocator-upgrade.patch vulkan_memory_allocator.gn ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nodejs-electron.spec ++++++ --- /var/tmp/diff_new_pack.BzeDud/_old 2023-10-17 20:24:46.550814679 +0200 +++ /var/tmp/diff_new_pack.BzeDud/_new 2023-10-17 20:24:46.550814679 +0200 @@ -115,13 +115,11 @@ %bcond_without system_dav1d %bcond_without system_highway %bcond_without system_nvctrl -%bcond_without wayland_21 %else %bcond_with system_crc32c %bcond_with system_dav1d %bcond_with system_highway %bcond_with system_nvctrl -%bcond_with wayland_21 %endif @@ -164,6 +162,17 @@ %bcond_with system_histogram %endif +%if 0%{?fedora} >= 38 +%bcond_without system_simdutf +%else +%bcond_with system_simdutf +%endif + +%if 0%{?fedora} >= 40 +%bcond_without system_vma +%else +%bcond_with system_vma +%endif # Abseil is broken in Leap @@ -211,6 +220,7 @@ Source50: flatbuffers.gn Source51: libsecret.gn Source52: highway.gn +Source53: vulkan_memory_allocator.gn # Reverse upstream changes to be able to build against ffmpeg-4 @@ -219,9 +229,6 @@ # and against harfbuzz 4 Source415: harfbuzz-replace-chromium-scoped-type.patch Source416: harfbuzz-replace-HbScopedPointer.patch -# and against Wayland 1.19 -Source418: wayland-WL-SINCE-VERSION.patch -Source419: wayland_data_drag_controller-WL_SURFACE_OFFSET_SINCE_VERSION.patch #Reverse upstream changes to build against system libavif. @@ -285,6 +292,7 @@ Patch1074: no-zlib-headers.patch Patch1076: crashpad-use-system-abseil.patch Patch1077: system-wayland.patch +Patch1078: system-simdutf.patch # PATCHES to fix interaction with third-party software Patch2004: chromium-gcc11.patch @@ -320,6 +328,7 @@ Patch2036: avif_image_decoder-libavif-1-mode.patch Patch2037: abseil-remove-unused-targets.patch Patch2038: avif_image_decoder-repetitionCount-clli.patch +Patch2039: vulkan_memory_allocator-upgrade.patch # PATCHES that should be submitted upstream verbatim or near-verbatim Patch3016: chromium-98-EnumTable-crash.patch @@ -349,6 +358,10 @@ # https://github.com/electron/electron/pull/40032 Patch3211: build-without-extensions.patch Patch3212: swiftshader-llvm17.patch +Patch3213: CVE-2023-38552-node-integrity-checks-according-to-policies.patch +Patch3214: CVE-2023-39333-node-create_dynamic_module-code-injection.patch +Patch3215: CVE-2023-45143-undici-cookie-leakage.patch + %if %{with clang} @@ -438,17 +451,19 @@ BuildRequires: python3-ply BuildRequires: python3-PyYAML BuildRequires: python3-six +%if %{with system_simdutf} +BuildRequires: simdutf-devel >= 3 +%endif BuildRequires: snappy-devel %if 0%{?suse_version} BuildRequires: update-desktop-files %endif BuildRequires: util-linux BuildRequires: vulkan-headers -%if %{with wayland_21} -BuildRequires: wayland-devel >= 1.20 -%else -BuildRequires: wayland-devel +%if %{with system_vma} +BuildRequires: VulkanMemoryAllocator-devel >= 3 %endif +BuildRequires: wayland-devel >= 1.20 BuildRequires: zstd %if %{with system_abseil} BuildRequires: pkgconfig(absl_algorithm_container) @@ -685,16 +700,16 @@ patch -R -p1 < %PATCH2011 %endif +%if %{without system_vma} +patch -R -p1 < %PATCH2039 +%endif + %if %{without harfbuzz_5} patch -R -p1 < %SOURCE415 patch -R -p1 < %SOURCE416 %endif -%if %{without wayland_21} -patch -R -p1 < %SOURCE418 -patch -R -p1 < %SOURCE419 -%endif # This one depends on an ffmpeg nightly, reverting unconditionally. patch -R -p1 < %SOURCE401 @@ -984,6 +999,11 @@ ) %endif +%if %{with system_vma} +find third_party/vulkan_memory_allocator -type f ! -name "*.gn" -a ! -name "*.gni" -delete +gn_system_libraries+=( vulkan_memory_allocator ) +%endif + %if %{with system_vpx} find third_party/libvpx -type f ! -name "*.gn" -a ! -name "*.gni" -delete gn_system_libraries+=( libvpx ) @@ -1013,6 +1033,9 @@ find third_party/electron_node/deps/histogram -type f ! -name "*.gn" -a ! -name "*.gni" -a ! -name "*.gyp" -a ! -name "*.gypi" -delete %endif +%if %{with system_simdutf} +find third_party/electron_node/deps/simdutf -type f ! -name "*.gn" -a ! -name "*.gni" -a ! -name "*.gyp" -a ! -name "*.gypi" -delete +%endif # Create the configuration for GN # Available options: out/Release/gn args --list out/Release/ @@ -1239,6 +1262,9 @@ %if %{with system_histogram} myconf_gn+=" use_system_histogram=true" %endif +%if %{with system_simdutf} +myconf_gn+=' use_system_simdutf=true' +%endif %if %{with clang} myconf_gn+=" is_clang=true clang_base_path=\"/usr\" clang_use_chrome_plugins=false" myconf_gn+=" use_lld=true" ++++++ CVE-2023-38552-node-integrity-checks-according-to-policies.patch ++++++ >From 1c538938ccadfd35fbc699d8e85102736cd5945c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= <tnies...@tnie.de> Date: Sun, 6 Aug 2023 12:56:02 +0000 Subject: [PATCH] policy: use tamper-proof integrity check function Using the JavaScript Hash class is unsafe because its internals can be tampered with. In particular, an application can cause Hash.prototype.digest() to return arbitrary values, thus allowing to circumvent the integrity verification that policies are supposed to guarantee. Add and use a new C++ binding internalVerifyIntegrity() that (hopefully) cannot be tampered with from JavaScript. PR-URL: https://github.com/nodejs-private/node-private/pull/462 Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/493 Reviewed-By: Rafael Gonzaga <rafael.n...@hotmail.com> CVE-ID: CVE-2023-38552 --- lib/internal/policy/manifest.js | 17 ++----- src/crypto/crypto_hash.cc | 50 +++++++++++++++++++ src/crypto/crypto_hash.h | 2 + .../crypto-hash-tampering/.gitattributes | 1 + .../policy/crypto-hash-tampering/main.js | 8 +++ .../policy/crypto-hash-tampering/policy.json | 15 ++++++ .../policy/crypto-hash-tampering/protected.js | 1 + .../test-policy-crypto-hash-tampering.js | 21 ++++++++ 8 files changed, 102 insertions(+), 13 deletions(-) create mode 100644 test/fixtures/policy/crypto-hash-tampering/.gitattributes create mode 100644 test/fixtures/policy/crypto-hash-tampering/main.js create mode 100644 test/fixtures/policy/crypto-hash-tampering/policy.json create mode 100644 test/fixtures/policy/crypto-hash-tampering/protected.js create mode 100644 test/parallel/test-policy-crypto-hash-tampering.js diff --git a/lib/internal/policy/manifest.js b/lib/internal/policy/manifest.js index 698971ee57f2b..d2afb10ec30e4 100644 --- a/third_party/electron_node/lib/internal/policy/manifest.js +++ b/third_party/electron_node/lib/internal/policy/manifest.js @@ -16,7 +16,6 @@ const { StringPrototypeEndsWith, StringPrototypeStartsWith, Symbol, - uncurryThis, } = primordials; const { ERR_MANIFEST_ASSERT_INTEGRITY, @@ -28,13 +27,8 @@ let debug = require('internal/util/debuglog').debuglog('policy', (fn) => { debug = fn; }); const SRI = require('internal/policy/sri'); -const crypto = require('crypto'); -const { Buffer } = require('buffer'); const { URL } = require('internal/url'); -const { createHash, timingSafeEqual } = crypto; -const HashUpdate = uncurryThis(crypto.Hash.prototype.update); -const HashDigest = uncurryThis(crypto.Hash.prototype.digest); -const BufferToString = uncurryThis(Buffer.prototype.toString); +const { internalVerifyIntegrity } = internalBinding('crypto'); const kRelativeURLStringPattern = /^\.{0,2}\//; const { getOptionValue } = require('internal/options'); const shouldAbortOnUncaughtException = getOptionValue( @@ -588,16 +582,13 @@ class Manifest { // Avoid clobbered Symbol.iterator for (let i = 0; i < integrityEntries.length; i++) { const { algorithm, value: expected } = integrityEntries[i]; - const hash = createHash(algorithm); // TODO(tniessen): the content should not be passed as a string in the // first place, see https://github.com/nodejs/node/issues/39707 - HashUpdate(hash, content, 'utf8'); - const digest = HashDigest(hash, 'buffer'); - if (digest.length === expected.length && - timingSafeEqual(digest, expected)) { + const mismatchedIntegrity = internalVerifyIntegrity(algorithm, content, expected); + if (mismatchedIntegrity === undefined) { return true; } - realIntegrities.set(algorithm, BufferToString(digest, 'base64')); + realIntegrities.set(algorithm, mismatchedIntegrity); } } diff --git a/src/crypto/crypto_hash.cc b/src/crypto/crypto_hash.cc index 200603a85ef33..3cb39d795c732 100644 --- a/third_party/electron_node/src/crypto/crypto_hash.cc +++ b/third_party/electron_node/src/crypto/crypto_hash.cc @@ -69,6 +69,9 @@ void Hash::Initialize(Environment* env, Local<Object> target) { SetMethodNoSideEffect(context, target, "getHashes", GetHashes); HashJob::Initialize(env, target); + + SetMethodNoSideEffect( + context, target, "internalVerifyIntegrity", InternalVerifyIntegrity); } void Hash::RegisterExternalReferences(ExternalReferenceRegistry* registry) { @@ -78,6 +81,8 @@ void Hash::RegisterExternalReferences(ExternalReferenceRegistry* registry) { registry->Register(GetHashes); HashJob::RegisterExternalReferences(registry); + + registry->Register(InternalVerifyIntegrity); } void Hash::New(const FunctionCallbackInfo<Value>& args) { @@ -310,5 +315,50 @@ bool HashTraits::DeriveBits( return true; } +void InternalVerifyIntegrity(const v8::FunctionCallbackInfo<v8::Value>& args) { + Environment* env = Environment::GetCurrent(args); + + CHECK_EQ(args.Length(), 3); + + CHECK(args[0]->IsString()); + Utf8Value algorithm(env->isolate(), args[0]); + + CHECK(args[1]->IsString() || IsAnyByteSource(args[1])); + ByteSource content = ByteSource::FromStringOrBuffer(env, args[1]); + + CHECK(args[2]->IsArrayBufferView()); + ArrayBufferOrViewContents<unsigned char> expected(args[2]); + + const EVP_MD* md_type = EVP_get_digestbyname(*algorithm); + unsigned char digest[EVP_MAX_MD_SIZE]; + unsigned int digest_size; + if (md_type == nullptr || EVP_Digest(content.data(), + content.size(), + digest, + &digest_size, + md_type, + nullptr) != 1) { + return ThrowCryptoError( + env, ERR_get_error(), "Digest method not supported"); + } + + if (digest_size != expected.size() || + CRYPTO_memcmp(digest, expected.data(), digest_size) != 0) { + Local<Value> error; + MaybeLocal<Value> rc = + StringBytes::Encode(env->isolate(), + reinterpret_cast<const char*>(digest), + digest_size, + BASE64, + &error); + if (rc.IsEmpty()) { + CHECK(!error.IsEmpty()); + env->isolate()->ThrowException(error); + return; + } + args.GetReturnValue().Set(rc.FromMaybe(Local<Value>())); + } +} + } // namespace crypto } // namespace node diff --git a/src/crypto/crypto_hash.h b/src/crypto/crypto_hash.h index 96a9804420db6..2d17c3510ed21 100644 --- a/third_party/electron_node/src/crypto/crypto_hash.h +++ b/third_party/electron_node/src/crypto/crypto_hash.h @@ -82,6 +82,8 @@ struct HashTraits final { using HashJob = DeriveBitsJob<HashTraits>; +void InternalVerifyIntegrity(const v8::FunctionCallbackInfo<v8::Value>& args); + } // namespace crypto } // namespace node ++++++ CVE-2023-39333-node-create_dynamic_module-code-injection.patch ++++++ >From eaf9083cf1e43bd897ac8244dcc0f4e3500150ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= <tnies...@tnie.de> Date: Sun, 6 Aug 2023 10:41:33 +0000 Subject: [PATCH] module: fix code injection through export names createDynamicModule() properly escapes import names, but not export names. In WebAssembly, any string is a valid export name. Importing a WebAssembly module that uses a non-identifier export name leads to either a syntax error in createDynamicModule() or to code injection, that is, to the evaluation of almost arbitrary JavaScript code outside of the WebAssembly module. To address this issue, adopt the same mechanism in createExport() that createImport() already uses. Add tests for both exports and imports. PR-URL: https://github.com/nodejs-private/node-private/pull/461 Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/490 Reviewed-By: Rafael Gonzaga <rafael.n...@hotmail.com> CVE-ID: CVE-2023-39333 --- .../modules/esm/create_dynamic_module.js | 14 ++--- test/es-module/test-esm-wasm.mjs | 50 ++++++++++++++++++ .../export-name-code-injection.wasm | Bin 0 -> 98 bytes .../es-modules/export-name-code-injection.wat | 8 +++ .../es-modules/export-name-syntax-error.wasm | Bin 0 -> 37 bytes .../es-modules/export-name-syntax-error.wat | 6 +++ test/fixtures/es-modules/import-name.wasm | Bin 0 -> 237 bytes test/fixtures/es-modules/import-name.wat | 10 ++++ 8 files changed, 81 insertions(+), 7 deletions(-) create mode 100644 test/fixtures/es-modules/export-name-code-injection.wasm create mode 100644 test/fixtures/es-modules/export-name-code-injection.wat create mode 100644 test/fixtures/es-modules/export-name-syntax-error.wasm create mode 100644 test/fixtures/es-modules/export-name-syntax-error.wat create mode 100644 test/fixtures/es-modules/import-name.wasm create mode 100644 test/fixtures/es-modules/import-name.wat diff --git a/lib/internal/modules/esm/create_dynamic_module.js b/lib/internal/modules/esm/create_dynamic_module.js index f7c20083b6c91..c99da19d5c827 100644 --- a/third_party/electron_node/lib/internal/modules/esm/create_dynamic_module.js +++ b/third_party/electron_node/lib/internal/modules/esm/create_dynamic_module.js @@ -18,13 +18,13 @@ function createImport(impt, index) { import.meta.imports[${imptPath}] = $import_${index};`; } -function createExport(expt) { - const name = `${expt}`; - return `let $${name}; -export { $${name} as ${name} }; -import.meta.exports.${name} = { - get: () => $${name}, - set: (v) => $${name} = v, +function createExport(expt, index) { + const nameStringLit = JSONStringify(expt); + return `let $export_${index}; +export { $export_${index} as ${nameStringLit} }; +import.meta.exports[${nameStringLit}] = { + get: () => $export_${index}, + set: (v) => $export_${index} = v, };`; } ++++++ CVE-2023-45143-undici-cookie-leakage.patch ++++++ >From e041de359221ebeae04c469e8aff4145764e6d76 Mon Sep 17 00:00:00 2001 From: Khafra <maitken033380...@gmail.com> Date: Wed, 11 Oct 2023 14:56:38 -0400 Subject: [PATCH] Merge pull request from GHSA-wqq4-5wpv-mx2g * fix: delete 'cookie' and 'host' headers on cross-origin redirect * apply suggestion --- lib/fetch/index.js | 4 ++ test/fetch/redirect-cross-origin-header.js | 48 ++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 test/fetch/redirect-cross-origin-header.js diff --git a/lib/fetch/index.js b/lib/fetch/index.js index c89c9b7ffc..5323c30abc 100644 --- a/third_party/electron_node/deps/undici/src/lib/fetch/index.js +++ b/third_party/electron_node/deps/undici/src/lib/fetch/index.js @@ -1200,6 +1200,10 @@ async function httpRedirectFetch (fetchParams, response) { if (!sameOrigin(requestCurrentURL(request), locationURL)) { // https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name request.headersList.delete('authorization') + + // "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement. + request.headersList.delete('cookie') + request.headersList.delete('host') } // 14. If requestâs body is non-null, then set requestâs body to the first return --- src/third_party/electron_node/deps/undici/undici.js.orig 2023-10-12 11:05:39.514426000 +0200 +++ src/third_party/electron_node/deps/undici/undici.js 2023-10-16 19:37:43.239110900 +0200 @@ -11006,6 +11006,10 @@ var require_fetch = __commonJS({ } if (!sameOrigin(requestCurrentURL(request), locationURL)) { request.headersList.delete("authorization"); + + // "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement. + request.headersList.delete('cookie') + request.headersList.delete('host') } if (request.body != null) { assert(request.body.source); ++++++ create_tarball.sh ++++++ --- /var/tmp/diff_new_pack.BzeDud/_old 2023-10-17 20:24:46.726820841 +0200 +++ /var/tmp/diff_new_pack.BzeDud/_new 2023-10-17 20:24:46.734821121 +0200 @@ -168,7 +168,7 @@ net/third_party/nss #Derived code, not vendored dependency. net/third_party/quiche #Not available as a shared library yet. An old version is in Factory (google-quiche-source) net/third_party/uri_template #Derived code, not vendored dependency. - third_party/abseil-cpp #15.4 and fc36 too old. + third_party/abseil-cpp #Leap and fc36 too old. third_party/angle # ANGLE is an integral part of chrome and is not available as a shared library. third_party/angle/src/third_party/ceval #not in any distro third_party/angle/src/third_party/libXNVCtrl #Not in 15.4 @@ -286,15 +286,15 @@ third_party/swiftshader/third_party/astc-encoder #not in rawhide or factory. Debian has it (astc-encoder) third_party/swiftshader/third_party/llvm-subzero #heavily forked version of libLLVM for use in subzero third_party/swiftshader/third_party/marl #not on any distro - third_party/swiftshader/third_party/SPIRV-Headers #FC36 too old - third_party/swiftshader/third_party/SPIRV-Tools #FC36 too old + third_party/swiftshader/third_party/SPIRV-Headers #Leap too old + third_party/swiftshader/third_party/SPIRV-Tools #Leap too old third_party/swiftshader/third_party/subzero #integral part of swiftshader #third_party/tflite #Not used by electron, but chrome needs it. #third_party/tflite/src/third_party/eigen3 #third_party/tflite/src/third_party/fft2d - third_party/vulkan-deps/spirv-headers #FC36 too old - third_party/vulkan-deps/spirv-tools #FC36 too old - third_party/vulkan-deps/vulkan-headers #FC36 too old. CONSIDER UNBUNDLING when all distros have new enough vulkan sdk + third_party/vulkan-deps/spirv-headers #Leap too old + third_party/vulkan-deps/spirv-tools #Leap too old + third_party/vulkan-deps/vulkan-headers #Leap too old. CONSIDER UNBUNDLING when all distros have new enough vulkan sdk third_party/vulkan_memory_allocator #not in any distro third_party/webgpu-cts #Javascript code. Needed even if you're building chrome without webgpu third_party/webrtc #Integral part of chrome ++++++ replace_gn_files-system-libs.patch ++++++ --- /var/tmp/diff_new_pack.BzeDud/_old 2023-10-17 20:24:46.902827002 +0200 +++ /var/tmp/diff_new_pack.BzeDud/_new 2023-10-17 20:24:46.906827143 +0200 @@ -1,12 +1,13 @@ --- chromium-79.0.3945.29/build/linux/unbundle/replace_gn_files.py.system-dav1d 2019-11-09 14:30:17.297016975 +0100 +++ chromium-79.0.3945.29/build/linux/unbundle/replace_gn_files.py 2019-11-10 09:40:19.694662891 +0100 -@@ -40,6 +40,9 @@ import sys +@@ -40,6 +40,10 @@ import sys 'double-conversion': 'base/third_party/double_conversion/BUILD.gn', 'ffmpeg': 'third_party/ffmpeg/BUILD.gn', 'flac': 'third_party/flac/BUILD.gn', + 'flatbuffers': 'third_party/flatbuffers/BUILD.gn', + 'libsecret' : 'third_party/libsecret/BUILD.gn', + 'highway' : 'third_party/highway/BUILD.gn', ++ 'vulkan_memory_allocator' : 'third_party/vulkan_memory_allocator/BUILD.gn', 'fontconfig': 'third_party/fontconfig/BUILD.gn', 'freetype': 'build/config/freetype/freetype.gni', 'harfbuzz-ng': 'third_party/harfbuzz-ng/harfbuzz.gni', ++++++ system-simdutf.patch ++++++ --- src/third_party/electron_node/BUILD.gn.old 2023-10-12 09:14:14.490589900 +0000 +++ src/third_party/electron_node/BUILD.gn 2023-10-15 07:18:47.581489100 +0000 @@ -44,6 +44,7 @@ declare_args() { # Allows downstream packagers (eg. Linux distributions) to build Electron against system shared libraries. use_system_cares = false use_system_nghttp2 = false + use_system_simdutf = false use_system_llhttp = false use_system_histogram = false } @@ -211,7 +212,6 @@ component("node_lib") { ":node_js2c", "deps/googletest:gtest", "deps/base64", - "deps/simdutf", "deps/uvwasi", "//third_party/zlib", "//third_party/brotli:dec", @@ -248,6 +248,11 @@ component("node_lib") { } else { deps += [ "deps/histogram" ] } + if (use_system_simdutf) { + libs += [ "simdutf" ] + } else { + deps += [ "deps/simdutf" ] + } frameworks = [] cflags_cc = [ "-Wno-deprecated-declarations", ++++++ vulkan_memory_allocator-upgrade.patch ++++++ >From 5ed594bfc740a7dd614c0507ff1ac2de7adb0f6b Mon Sep 17 00:00:00 2001 From: Amirali Abdolrashidi <abdolrash...@google.com> Date: Wed, 11 Oct 2023 23:25:23 +0000 Subject: [PATCH] Reland "Reland "Update Chromium to use VMA 3.0"" This is a reland of commit 048603b3375064d2f34773bea1eb796882068848 Original change's description: > Reland "Update Chromium to use VMA 3.0" > > This is a reland of commit 39d7f0daabd13c913865b2a583d6da21d77a5f70 > > An uninitialized value was causing errors in MSAN tests. > * Initialized the value of the VmaVulkanFunctions in CreateAllocator() > to {}. > > Original change's description: > > Update Chromium to use VMA 3.0 > > > > Following the change in ANGLE to add support for VMA 3.0, we must > > also update the VMA version used in Chromium. Currently ANGLE supports > > both VMA 2.3 and 3.0, via setting ANGLE_VMA_VERSION which is defined > > based on the build files. In Chromium, since this parameter is not set, > > ANGLE defaults to using VMA 2.3, which results in conflict if only the > > VMA hash is changed. > > * ANGLE CL: https://crrev.com/c/4777337 > > > > * Updated the VMA hash in the dependencies to the 3.0 version. > > * Updated the usage of some functions and variables in gpu/vulkan/ to > > be in line with the new VMA changes. > > * Added angle_vma_version to the build files. It is set to allow ANGLE > > to use VMA 3.0. > > * This parameter is added temporarily. When ANGLE removes support for > > VMA 2.3, it can be removed. > > > > Bug: b/295208838 > > Change-Id: I7a0592291d8d0d9902942d39f83e338647753521 > > Reviewed-on: > > https://chromium-review.googlesource.com/c/chromium/src/+/4794544 > > Reviewed-by: Peng Huang <penghu...@chromium.org> > > Reviewed-by: Thomas Anderson <thomasander...@chromium.org> > > Commit-Queue: Amirali Abdolrashidi <abdolrash...@google.com> > > Cr-Commit-Position: refs/heads/main@{#1186061} > > Cq-Include-Trybots: luci.chromium.try:linux_chromium_msan_rel_ng > Bug: b/295208838 > Change-Id: I0e1b36cded6557a717bfb633eed783c1888d3607 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4803803 > Reviewed-by: Thomas Anderson <thomasander...@chromium.org> > Reviewed-by: Peng Huang <penghu...@chromium.org> > Commit-Queue: Amirali Abdolrashidi <abdolrash...@google.com> > Cr-Commit-Position: refs/heads/main@{#1188566} Bug: b/295208838 Change-Id: I6a987bae94b936afb9c158bb00ff7888a7db7c5e Cq-Include-Trybots: luci.chromium.try:linux_chromium_msan_rel_ng Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4911597 Reviewed-by: Thomas Anderson <thomasander...@chromium.org> Reviewed-by: Shahbaz Youssefi <syouss...@chromium.org> Commit-Queue: Peng Huang <penghu...@chromium.org> Cr-Commit-Position: refs/heads/main@{#1208563} --- DEPS | 2 +- build_overrides/angle.gni | 5 ++ .../init/gr_vk_memory_allocator_impl.cc | 4 +- gpu/vulkan/vma_wrapper.cc | 65 +++++++++++-------- third_party/vulkan_memory_allocator | 2 +- 5 files changed, 46 insertions(+), 32 deletions(-) diff --git a/build_overrides/angle.gni b/build_overrides/angle.gni index d1b56165ec4aaa8..c6f8dba7090263e 100644 --- a/build_overrides/angle.gni +++ b/build_overrides/angle.gni @@ -8,6 +8,11 @@ angle_root = "//third_party/angle" # True if ANGLE can access build/, testing/ and other Chrome folders. angle_has_build = true +# Declares the maximum supported VulkanMemoryAllocator version by the client +# in format AAABBBCCC, where AAA = major, BBB = minor, CCC = patch. +# The VulkanMemoryAllocator version may be found in its CHANGELOG.md. +angle_vma_version = 3000000 + # Overrides for ANGLE's dependencies angle_glslang_dir = "//third_party/vulkan-deps/glslang/src" angle_googletest_dir = "//third_party/googletest/src" diff --git a/gpu/vulkan/init/gr_vk_memory_allocator_impl.cc b/gpu/vulkan/init/gr_vk_memory_allocator_impl.cc index 695d169a15599af..9dd6ccb4789f801 100644 --- a/gpu/vulkan/init/gr_vk_memory_allocator_impl.cc +++ b/gpu/vulkan/init/gr_vk_memory_allocator_impl.cc @@ -203,8 +203,8 @@ class GrVkMemoryAllocatorImpl : public GrVkMemoryAllocator { vmaGetMemoryProperties(allocator_, &physical_device_memory_properties); for (uint32_t i = 0; i < physical_device_memory_properties->memoryHeapCount; ++i) { - total_allocated_memory += budget[i].blockBytes; - total_used_memory += budget[i].allocationBytes; + total_allocated_memory += budget[i].statistics.blockBytes; + total_used_memory += budget[i].statistics.allocationBytes; } DCHECK_LE(total_used_memory, total_allocated_memory); return {total_allocated_memory, total_used_memory}; diff --git a/gpu/vulkan/vma_wrapper.cc b/gpu/vulkan/vma_wrapper.cc index f185b251b4f310f..b1d05fb51746f9f 100644 --- a/gpu/vulkan/vma_wrapper.cc +++ b/gpu/vulkan/vma_wrapper.cc @@ -24,30 +24,39 @@ VkResult CreateAllocator(VkPhysicalDevice physical_device, const bool is_thread_safe, VmaAllocator* pAllocator) { auto* function_pointers = gpu::GetVulkanFunctionPointers(); - VmaVulkanFunctions functions = { - function_pointers->vkGetPhysicalDeviceProperties.get(), - function_pointers->vkGetPhysicalDeviceMemoryProperties.get(), - function_pointers->vkAllocateMemory.get(), - function_pointers->vkFreeMemory.get(), - function_pointers->vkMapMemory.get(), - function_pointers->vkUnmapMemory.get(), - function_pointers->vkFlushMappedMemoryRanges.get(), - function_pointers->vkInvalidateMappedMemoryRanges.get(), - function_pointers->vkBindBufferMemory.get(), - function_pointers->vkBindImageMemory.get(), - function_pointers->vkGetBufferMemoryRequirements.get(), - function_pointers->vkGetImageMemoryRequirements.get(), - function_pointers->vkCreateBuffer.get(), - function_pointers->vkDestroyBuffer.get(), - function_pointers->vkCreateImage.get(), - function_pointers->vkDestroyImage.get(), - function_pointers->vkCmdCopyBuffer.get(), - function_pointers->vkGetBufferMemoryRequirements2.get(), - function_pointers->vkGetImageMemoryRequirements2.get(), - function_pointers->vkBindBufferMemory2.get(), - function_pointers->vkBindImageMemory2.get(), - function_pointers->vkGetPhysicalDeviceMemoryProperties2.get(), - }; + VmaVulkanFunctions functions = {}; + functions.vkGetPhysicalDeviceProperties = + function_pointers->vkGetPhysicalDeviceProperties.get(); + functions.vkGetPhysicalDeviceMemoryProperties = + function_pointers->vkGetPhysicalDeviceMemoryProperties.get(); + functions.vkAllocateMemory = function_pointers->vkAllocateMemory.get(); + functions.vkFreeMemory = function_pointers->vkFreeMemory.get(); + functions.vkMapMemory = function_pointers->vkMapMemory.get(); + functions.vkUnmapMemory = function_pointers->vkUnmapMemory.get(); + functions.vkFlushMappedMemoryRanges = + function_pointers->vkFlushMappedMemoryRanges.get(); + functions.vkInvalidateMappedMemoryRanges = + function_pointers->vkInvalidateMappedMemoryRanges.get(); + functions.vkBindBufferMemory = function_pointers->vkBindBufferMemory.get(); + functions.vkBindImageMemory = function_pointers->vkBindImageMemory.get(); + functions.vkGetBufferMemoryRequirements = + function_pointers->vkGetBufferMemoryRequirements.get(); + functions.vkGetImageMemoryRequirements = + function_pointers->vkGetImageMemoryRequirements.get(); + functions.vkCreateBuffer = function_pointers->vkCreateBuffer.get(); + functions.vkDestroyBuffer = function_pointers->vkDestroyBuffer.get(); + functions.vkCreateImage = function_pointers->vkCreateImage.get(); + functions.vkDestroyImage = function_pointers->vkDestroyImage.get(); + functions.vkCmdCopyBuffer = function_pointers->vkCmdCopyBuffer.get(); + functions.vkGetBufferMemoryRequirements2KHR = + function_pointers->vkGetBufferMemoryRequirements2.get(); + functions.vkGetImageMemoryRequirements2KHR = + function_pointers->vkGetImageMemoryRequirements2.get(); + functions.vkBindBufferMemory2KHR = + function_pointers->vkBindBufferMemory2.get(); + functions.vkBindImageMemory2KHR = function_pointers->vkBindImageMemory2.get(); + functions.vkGetPhysicalDeviceMemoryProperties2KHR = + function_pointers->vkGetPhysicalDeviceMemoryProperties2.get(); static_assert(kVulkanRequiredApiVersion >= VK_API_VERSION_1_1, ""); VmaAllocatorCreateInfo allocator_info = { @@ -175,7 +184,7 @@ void GetPhysicalDeviceProperties( } void GetBudget(VmaAllocator allocator, VmaBudget* budget) { - vmaGetBudget(allocator, budget); + vmaGetHeapBudgets(allocator, budget); } std::pair<uint64_t, uint64_t> GetTotalAllocatedAndUsedMemory( @@ -183,14 +192,14 @@ std::pair<uint64_t, uint64_t> GetTotalAllocatedAndUsedMemory( // See GrVkMemoryAllocatorImpl::totalAllocatedAndUsedMemory() in skia for // reference. VmaBudget budget[VK_MAX_MEMORY_HEAPS]; - vmaGetBudget(allocator, budget); + GetBudget(allocator, budget); const VkPhysicalDeviceMemoryProperties* pPhysicalDeviceMemoryProperties; vmaGetMemoryProperties(allocator, &pPhysicalDeviceMemoryProperties); uint64_t total_allocated_memory = 0, total_used_memory = 0; for (uint32_t i = 0; i < pPhysicalDeviceMemoryProperties->memoryHeapCount; ++i) { - total_allocated_memory += budget[i].blockBytes; - total_used_memory += budget[i].allocationBytes; + total_allocated_memory += budget[i].statistics.blockBytes; + total_used_memory += budget[i].statistics.allocationBytes; } DCHECK_LE(total_used_memory, total_allocated_memory); ++++++ vulkan_memory_allocator.gn ++++++ config("vulkan_memory_allocator_config") { libs = ["VulkanMemoryAllocator"] } source_set("vulkan_memory_allocator") { public_configs = [ ":vulkan_memory_allocator_config" ] }