aboutsummaryrefslogtreecommitdiff
path: root/www/ungoogled-chromium/files/patch-base_allocator_partition__allocator_src_partition__alloc_starscan_stack_stack.cc
diff options
context:
space:
mode:
Diffstat (limited to 'www/ungoogled-chromium/files/patch-base_allocator_partition__allocator_src_partition__alloc_starscan_stack_stack.cc')
-rw-r--r--www/ungoogled-chromium/files/patch-base_allocator_partition__allocator_src_partition__alloc_starscan_stack_stack.cc50
1 files changed, 50 insertions, 0 deletions
diff --git a/www/ungoogled-chromium/files/patch-base_allocator_partition__allocator_src_partition__alloc_starscan_stack_stack.cc b/www/ungoogled-chromium/files/patch-base_allocator_partition__allocator_src_partition__alloc_starscan_stack_stack.cc
new file mode 100644
index 000000000000..17c7c31f634f
--- /dev/null
+++ b/www/ungoogled-chromium/files/patch-base_allocator_partition__allocator_src_partition__alloc_starscan_stack_stack.cc
@@ -0,0 +1,50 @@
+--- base/allocator/partition_allocator/src/partition_alloc/starscan/stack/stack.cc.orig 2023-12-23 12:33:28 UTC
++++ base/allocator/partition_allocator/src/partition_alloc/starscan/stack/stack.cc
+@@ -18,6 +18,10 @@
+ #include <pthread.h>
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#include <pthread_np.h>
++#endif
++
+ #if defined(LIBC_GLIBC)
+ extern "C" void* __libc_stack_end;
+ #endif
+@@ -48,6 +52,36 @@ void* GetStackTop() {
+
+ void* GetStackTop() {
+ return pthread_get_stackaddr_np(pthread_self());
++}
++
++#elif defined(OS_OPENBSD)
++
++void* GetStackTop() {
++ stack_t ss;
++ if (pthread_stackseg_np(pthread_self(), &ss) != 0)
++ return nullptr;
++ return reinterpret_cast<uint8_t*>(ss.ss_sp);
++}
++
++#elif defined(OS_FREEBSD)
++
++void* GetStackTop() {
++ pthread_attr_t attr;
++ int error = pthread_attr_init(&attr);
++ if (error) {
++ return nullptr;
++ }
++ error = pthread_attr_get_np(pthread_self(), &attr);
++ if (!error) {
++ void* base;
++ size_t size;
++ error = pthread_attr_getstack(&attr, &base, &size);
++ PA_CHECK(!error);
++ pthread_attr_destroy(&attr);
++ return reinterpret_cast<uint8_t*>(base) + size;
++ }
++ pthread_attr_destroy(&attr);
++ return nullptr;
+ }
+
+ #elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)