win: Add compile guard around partition_alloc::SuspendTagCheckingScope

This commit is contained in:
Nik Pavlov 2024-09-02 14:09:26 +00:00 committed by Marshall Greenblatt
parent 1b57edfc50
commit 88b5034cf8
2 changed files with 33 additions and 0 deletions

View File

@ -739,5 +739,10 @@ patches = [
# linux: Fix cannot allocate memory in static TLS block in dlopen libcef.so
# https://github.com/chromiumembedded/cef/issues/3616
'name': 'third_party_sentencepiece_3616'
},
{
# Windows: Add missing check in base/profiler/stack_copier.cc to fix
# compilation error of cef_sandbox.
'name': 'win_sandbox_stack_copier'
}
]

View File

@ -0,0 +1,28 @@
diff --git base/profiler/stack_copier.cc base/profiler/stack_copier.cc
index 6cc3a6acef3a5..2495f4fbdf518 100644
--- base/profiler/stack_copier.cc
+++ base/profiler/stack_copier.cc
@@ -14,7 +14,9 @@
#include "base/bits.h"
#include "base/compiler_specific.h"
#include "base/profiler/stack_buffer.h"
+#if PA_BUILDFLAG(USE_PARTITION_ALLOC)
#include "partition_alloc/tagging.h"
+#endif
namespace base {
@@ -76,11 +78,13 @@ const uint8_t* StackCopier::CopyStackContentsAndRewritePointers(
const uintptr_t* original_stack_top,
size_t platform_stack_alignment,
uintptr_t* stack_buffer_bottom) {
+ #if PA_BUILDFLAG(USE_PARTITION_ALLOC)
// Disable MTE during this function because this function indiscriminately
// reads stack frames, some of which belong to system libraries, not Chrome
// itself. With stack tagging, some bytes on the stack have MTE tags different
// from the stack pointer tag.
partition_alloc::SuspendTagCheckingScope suspend_tag_checking_scope;
+#endif
const uint8_t* byte_src = original_stack_bottom;
// The first address in the stack with pointer alignment. Pointer-aligned