diff options
Diffstat (limited to 'chromium/patches')
| -rw-r--r-- | chromium/patches/008-fstatat64.patch | 17 | ||||
| -rw-r--r-- | chromium/patches/016-musl-sandbox.patch | 113 | ||||
| -rw-r--r-- | chromium/patches/017-musl-tid-caching.patch | 85 | ||||
| -rw-r--r-- | chromium/patches/019-musl-no-execinfo.patch | 68 | ||||
| -rw-r--r-- | chromium/patches/020-musl-no-mallinfo.patch | 93 | ||||
| -rw-r--r-- | chromium/patches/021-musl-no-res-ninit.patch | 32 | ||||
| -rw-r--r-- | chromium/patches/022-no-sandbox-settls.patch | 16 | ||||
| -rw-r--r-- | chromium/patches/027-temp-failure-retry.patch | 22 | ||||
| -rw-r--r-- | chromium/patches/033-perfetto-get-thread-name.patch | 22 | ||||
| -rw-r--r-- | chromium/patches/035-breakpad-no-getcontext.patch | 27 | ||||
| -rw-r--r-- | chromium/patches/disable-dns_config_service.patch | 19 | ||||
| -rw-r--r-- | chromium/patches/llvm21-fixes.patch | 44 | ||||
| -rw-r--r-- | chromium/patches/noclanglibs.patch | 15 | ||||
| -rw-r--r-- | chromium/patches/sanitizer-no-death-callback.patch | 22 | ||||
| -rw-r--r-- | chromium/patches/terminal-fdset.patch | 10 |
15 files changed, 605 insertions, 0 deletions
diff --git a/chromium/patches/008-fstatat64.patch b/chromium/patches/008-fstatat64.patch new file mode 100644 index 0000000..1627ffa --- /dev/null +++ b/chromium/patches/008-fstatat64.patch | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | fstatat64 is macrod to fstatat in sys/stat.h in musl- but then that fstatat is | ||
| 2 | used in the _syscall4 macro mapping to __NR_$name, and __NR_fstatat is not | ||
| 3 | defined anywhere here, as it wants the 64 name. | ||
| 4 | |||
| 5 | so, just let it keep the name with an undef of the stat.h macro, then the macro | ||
| 6 | expansion below evaluates correctly. | ||
| 7 | --- a/third_party/lss/linux_syscall_support.h | ||
| 8 | +++ b/third_party/lss/linux_syscall_support.h | ||
| 9 | @@ -4947,7 +4947,8 @@ | ||
| 10 | # endif | ||
| 11 | #endif | ||
| 12 | #if defined(__NR_fstatat64) | ||
| 13 | + #undef fstatat64 | ||
| 14 | LSS_INLINE _syscall4(int, fstatat64, int, d, | ||
| 15 | const char *, p, | ||
| 16 | struct kernel_stat64 *, b, int, f) | ||
| 17 | #endif | ||
diff --git a/chromium/patches/016-musl-sandbox.patch b/chromium/patches/016-musl-sandbox.patch new file mode 100644 index 0000000..41abc50 --- /dev/null +++ b/chromium/patches/016-musl-sandbox.patch | |||
| @@ -0,0 +1,113 @@ | |||
| 1 | musl uses different syscalls from glibc for some functions, so the sandbox has | ||
| 2 | to account for that | ||
| 3 | -- | ||
| 4 | diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc ./sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc | ||
| 5 | index ff5a1c0..da56b9b 100644 | ||
| 6 | --- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc | ||
| 7 | +++ ./sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc | ||
| 8 | @@ -139,21 +139,11 @@ namespace sandbox { | ||
| 9 | // present (as in newer versions of posix_spawn). | ||
| 10 | ResultExpr RestrictCloneToThreadsAndEPERMFork() { | ||
| 11 | const Arg<unsigned long> flags(0); | ||
| 12 | - | ||
| 13 | - // TODO(mdempsky): Extend DSL to support (flags & ~mask1) == mask2. | ||
| 14 | - const uint64_t kAndroidCloneMask = CLONE_VM | CLONE_FS | CLONE_FILES | | ||
| 15 | - CLONE_SIGHAND | CLONE_THREAD | | ||
| 16 | - CLONE_SYSVSEM; | ||
| 17 | - const uint64_t kObsoleteAndroidCloneMask = kAndroidCloneMask | CLONE_DETACHED; | ||
| 18 | - | ||
| 19 | - const uint64_t kGlibcPthreadFlags = | ||
| 20 | - CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_THREAD | | ||
| 21 | - CLONE_SYSVSEM | CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID; | ||
| 22 | - const BoolExpr glibc_test = flags == kGlibcPthreadFlags; | ||
| 23 | - | ||
| 24 | - const BoolExpr android_test = | ||
| 25 | - AnyOf(flags == kAndroidCloneMask, flags == kObsoleteAndroidCloneMask, | ||
| 26 | - flags == kGlibcPthreadFlags); | ||
| 27 | + const int required = CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | | ||
| 28 | + CLONE_THREAD | CLONE_SYSVSEM; | ||
| 29 | + const int safe = CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID | | ||
| 30 | + CLONE_DETACHED; | ||
| 31 | + const BoolExpr thread_clone_ok = (flags&~safe)==required; | ||
| 32 | |||
| 33 | // The following two flags are the two important flags in any vfork-emulating | ||
| 34 | // clone call. EPERM any clone call that contains both of them. | ||
| 35 | @@ -163,7 +153,7 @@ ResultExpr RestrictCloneToThreadsAndEPERMFork() { | ||
| 36 | AnyOf((flags & (CLONE_VM | CLONE_THREAD)) == 0, | ||
| 37 | (flags & kImportantCloneVforkFlags) == kImportantCloneVforkFlags); | ||
| 38 | |||
| 39 | - return If(IsAndroid() ? android_test : glibc_test, Allow()) | ||
| 40 | + return If(thread_clone_ok, Allow()) | ||
| 41 | .ElseIf(is_fork_or_clone_vfork, Error(EPERM)) | ||
| 42 | .Else(CrashSIGSYSClone()); | ||
| 43 | } | ||
| 44 | diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc ./sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc | ||
| 45 | index d9d1882..0567557 100644 | ||
| 46 | --- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc | ||
| 47 | +++ ./sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc | ||
| 48 | @@ -392,6 +392,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) { | ||
| 49 | #if defined(__i386__) | ||
| 50 | case __NR_waitpid: | ||
| 51 | #endif | ||
| 52 | + case __NR_set_tid_address: | ||
| 53 | return true; | ||
| 54 | case __NR_clone: // Should be parameter-restricted. | ||
| 55 | case __NR_setns: // Privileged. | ||
| 56 | @@ -404,7 +405,6 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) { | ||
| 57 | #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) | ||
| 58 | case __NR_set_thread_area: | ||
| 59 | #endif | ||
| 60 | - case __NR_set_tid_address: | ||
| 61 | case __NR_unshare: | ||
| 62 | #if !defined(__mips__) && !defined(__aarch64__) | ||
| 63 | case __NR_vfork: | ||
| 64 | @@ -514,6 +514,8 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) { | ||
| 65 | case __NR_munlock: | ||
| 66 | case __NR_munmap: | ||
| 67 | case __NR_mseal: | ||
| 68 | + case __NR_mremap: | ||
| 69 | + case __NR_membarrier: | ||
| 70 | return true; | ||
| 71 | case __NR_madvise: | ||
| 72 | case __NR_mincore: | ||
| 73 | @@ -531,7 +533,6 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) { | ||
| 74 | case __NR_modify_ldt: | ||
| 75 | #endif | ||
| 76 | case __NR_mprotect: | ||
| 77 | - case __NR_mremap: | ||
| 78 | case __NR_msync: | ||
| 79 | case __NR_munlockall: | ||
| 80 | case __NR_readahead: | ||
| 81 | --- a/sandbox/policy/linux/bpf_renderer_policy_linux.cc | ||
| 82 | +++ b/sandbox/policy/linux/bpf_renderer_policy_linux.cc | ||
| 83 | @@ -94,6 +94,10 @@ | ||
| 84 | case __NR_pwrite64: | ||
| 85 | + case __NR_pwritev2: | ||
| 86 | case __NR_sched_get_priority_max: | ||
| 87 | case __NR_sched_get_priority_min: | ||
| 88 | + case __NR_sched_getparam: | ||
| 89 | + case __NR_sched_getscheduler: | ||
| 90 | + case __NR_sched_setscheduler: | ||
| 91 | case __NR_sysinfo: | ||
| 92 | case __NR_times: | ||
| 93 | case __NR_uname: | ||
| 94 | --- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc | ||
| 95 | +++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc | ||
| 96 | @@ -225,10 +225,15 @@ | ||
| 97 | if (sysno == __NR_getpriority || sysno ==__NR_setpriority) | ||
| 98 | return RestrictGetSetpriority(current_pid); | ||
| 99 | |||
| 100 | + // XXX: hacks for musl sandbox, calls needed? | ||
| 101 | + if (sysno == __NR_sched_getparam || sysno == __NR_sched_getscheduler || | ||
| 102 | + sysno == __NR_sched_setscheduler) { | ||
| 103 | + return Allow(); | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | // The scheduling syscalls are used in threading libraries and also heavily in | ||
| 107 | // abseil. See for example https://crbug.com/1370394. | ||
| 108 | - if (sysno == __NR_sched_getaffinity || sysno == __NR_sched_getparam || | ||
| 109 | - sysno == __NR_sched_getscheduler || sysno == __NR_sched_setscheduler) { | ||
| 110 | + if (sysno == __NR_sched_getaffinity) { | ||
| 111 | return RestrictSchedTarget(current_pid, sysno); | ||
| 112 | } | ||
| 113 | |||
diff --git a/chromium/patches/017-musl-tid-caching.patch b/chromium/patches/017-musl-tid-caching.patch new file mode 100644 index 0000000..498ce82 --- /dev/null +++ b/chromium/patches/017-musl-tid-caching.patch | |||
| @@ -0,0 +1,85 @@ | |||
| 1 | the sandbox caching of thread id's only works with glibc | ||
| 2 | see: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/32356 | ||
| 3 | see: https://gitlab.alpinelinux.org/alpine/aports/-/issues/13579 | ||
| 4 | -- | ||
| 5 | --- a/sandbox/linux/services/namespace_sandbox.cc | ||
| 6 | +++ b/sandbox/linux/services/namespace_sandbox.cc | ||
| 7 | @@ -209,6 +209,70 @@ | ||
| 8 | return base::LaunchProcess(argv, launch_options_copy); | ||
| 9 | } | ||
| 10 | |||
| 11 | +#if defined(__aarch64__) | ||
| 12 | +#define TLS_ABOVE_TP | ||
| 13 | +#endif | ||
| 14 | + | ||
| 15 | +struct musl_pthread | ||
| 16 | +{ | ||
| 17 | + /* Part 1 -- these fields may be external or | ||
| 18 | + * internal (accessed via asm) ABI. Do not change. */ | ||
| 19 | + struct pthread *self; | ||
| 20 | +#ifndef TLS_ABOVE_TP | ||
| 21 | + uintptr_t *dtv; | ||
| 22 | +#endif | ||
| 23 | + struct pthread *prev, *next; /* non-ABI */ | ||
| 24 | + uintptr_t sysinfo; | ||
| 25 | +#ifndef TLS_ABOVE_TP | ||
| 26 | +#ifdef CANARY_PAD | ||
| 27 | + uintptr_t canary_pad; | ||
| 28 | +#endif | ||
| 29 | + uintptr_t canary; | ||
| 30 | +#endif | ||
| 31 | + | ||
| 32 | +/* Part 2 -- implementation details, non-ABI. */ | ||
| 33 | + int tid; | ||
| 34 | + int errno_val; | ||
| 35 | + volatile int detach_state; | ||
| 36 | + volatile int cancel; | ||
| 37 | + volatile unsigned char canceldisable, cancelasync; | ||
| 38 | + unsigned char tsd_used:1; | ||
| 39 | + unsigned char dlerror_flag:1; | ||
| 40 | + unsigned char *map_base; | ||
| 41 | + size_t map_size; | ||
| 42 | + void *stack; | ||
| 43 | + size_t stack_size; | ||
| 44 | + size_t guard_size; | ||
| 45 | + void *result; | ||
| 46 | + struct __ptcb *cancelbuf; | ||
| 47 | + void **tsd; | ||
| 48 | + struct { | ||
| 49 | + volatile void *volatile head; | ||
| 50 | + long off; | ||
| 51 | + volatile void *volatile pending; | ||
| 52 | + } robust_list; | ||
| 53 | + int h_errno_val; | ||
| 54 | + volatile int timer_id; | ||
| 55 | + locale_t locale; | ||
| 56 | + volatile int killlock[1]; | ||
| 57 | + char *dlerror_buf; | ||
| 58 | + void *stdio_locks; | ||
| 59 | + | ||
| 60 | + /* Part 3 -- the positions of these fields relative to | ||
| 61 | + * the end of the structure is external and internal ABI. */ | ||
| 62 | +#ifdef TLS_ABOVE_TP | ||
| 63 | + uintptr_t canary; | ||
| 64 | + uintptr_t *dtv; | ||
| 65 | +#endif | ||
| 66 | +}; | ||
| 67 | + | ||
| 68 | +void MaybeUpdateMuslTidCache() | ||
| 69 | +{ | ||
| 70 | + pid_t real_tid = sys_gettid(); | ||
| 71 | + pid_t* cached_tid_location = &reinterpret_cast<struct musl_pthread*>(pthread_self())->tid; | ||
| 72 | + *cached_tid_location = real_tid; | ||
| 73 | +} | ||
| 74 | + | ||
| 75 | // static | ||
| 76 | pid_t NamespaceSandbox::ForkInNewPidNamespace(bool drop_capabilities_in_child) { | ||
| 77 | const pid_t pid = | ||
| 78 | @@ -226,6 +290,7 @@ | ||
| 79 | #if defined(LIBC_GLIBC) | ||
| 80 | MaybeUpdateGlibcTidCache(); | ||
| 81 | #endif | ||
| 82 | + MaybeUpdateMuslTidCache(); | ||
| 83 | return 0; | ||
| 84 | } | ||
| 85 | |||
diff --git a/chromium/patches/019-musl-no-execinfo.patch b/chromium/patches/019-musl-no-execinfo.patch new file mode 100644 index 0000000..7447919 --- /dev/null +++ b/chromium/patches/019-musl-no-execinfo.patch | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | musl does not have execinfo.h, and hence no implementation of | ||
| 2 | . backtrace() | ||
| 3 | . backtrace_symbols() | ||
| 4 | for discussion about this, see https://www.openwall.com/lists/musl/2021/07/16/1 | ||
| 5 | -- | ||
| 6 | --- a/v8/src/codegen/external-reference-table.cc | ||
| 7 | +++ b/v8/src/codegen/external-reference-table.cc | ||
| 8 | @@ -11,7 +11,9 @@ | ||
| 9 | |||
| 10 | #if defined(DEBUG) && defined(V8_OS_LINUX) && !defined(V8_OS_ANDROID) | ||
| 11 | #define SYMBOLIZE_FUNCTION | ||
| 12 | +#if defined(__GLIBC__) | ||
| 13 | #include <execinfo.h> | ||
| 14 | +#endif | ||
| 15 | |||
| 16 | #include <vector> | ||
| 17 | |||
| 18 | @@ -96,7 +98,7 @@ | ||
| 19 | } | ||
| 20 | |||
| 21 | const char* ExternalReferenceTable::ResolveSymbol(void* address) { | ||
| 22 | -#ifdef SYMBOLIZE_FUNCTION | ||
| 23 | +#if defined(SYMBOLIZE_FUNCTION) && defined(__GLIBC__) | ||
| 24 | char** names = backtrace_symbols(&address, 1); | ||
| 25 | const char* name = names[0]; | ||
| 26 | // The array of names is malloc'ed. However, each name string is static | ||
| 27 | --- a/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h | ||
| 28 | +++ b/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h | ||
| 29 | @@ -58,7 +58,7 @@ | ||
| 30 | #define HAVE_ERRNO_H 1 | ||
| 31 | |||
| 32 | /* Define to 1 if you have the <execinfo.h> header file. */ | ||
| 33 | -#define HAVE_EXECINFO_H 1 | ||
| 34 | +/* #define HAVE_EXECINFO_H 1 */ | ||
| 35 | |||
| 36 | /* Define to 1 if you have the <fcntl.h> header file. */ | ||
| 37 | #define HAVE_FCNTL_H 1 | ||
| 38 | --- a/base/debug/stack_trace.cc | ||
| 39 | +++ b/base/debug/stack_trace.cc | ||
| 40 | @@ -291,7 +291,9 @@ | ||
| 41 | } | ||
| 42 | |||
| 43 | void StackTrace::OutputToStream(std::ostream* os) const { | ||
| 44 | +#if defined(__GLIBC__) | ||
| 45 | OutputToStreamWithPrefix(os, {}); | ||
| 46 | +#endif | ||
| 47 | } | ||
| 48 | |||
| 49 | void StackTrace::OutputToStreamWithPrefix(std::ostream* os, | ||
| 50 | @@ -311,7 +313,7 @@ | ||
| 51 | |||
| 52 | std::string StackTrace::ToStringWithPrefix(cstring_view prefix_string) const { | ||
| 53 | std::stringstream stream; | ||
| 54 | -#if !defined(__UCLIBC__) && !defined(_AIX) | ||
| 55 | +#if defined(__GLIBC__) && !defined(_AIX) | ||
| 56 | OutputToStreamWithPrefix(&stream, prefix_string); | ||
| 57 | #endif | ||
| 58 | return stream.str(); | ||
| 59 | @@ -335,7 +335,7 @@ | ||
| 60 | } | ||
| 61 | |||
| 62 | std::ostream& operator<<(std::ostream& os, const StackTrace& s) { | ||
| 63 | -#if !defined(__UCLIBC__) && !defined(_AIX) | ||
| 64 | +#if defined(__GLIBC__) && !defined(_AIX) | ||
| 65 | s.OutputToStream(&os); | ||
| 66 | #else | ||
| 67 | os << "StackTrace::OutputToStream not implemented."; | ||
| 68 | |||
diff --git a/chromium/patches/020-musl-no-mallinfo.patch b/chromium/patches/020-musl-no-mallinfo.patch new file mode 100644 index 0000000..dc18ca5 --- /dev/null +++ b/chromium/patches/020-musl-no-mallinfo.patch | |||
| @@ -0,0 +1,93 @@ | |||
| 1 | musl does not implement mallinfo()/mallinfo2() | ||
| 2 | (or rather, malloc-ng, musl's allocator, doesn't) | ||
| 3 | |||
| 4 | for some reason only outside of x86_64 HAVE_MALLINFO gets weirdly set by something | ||
| 5 | -- | ||
| 6 | --- a/base/allocator/partition_allocator/src/partition_alloc/shim/allocator_shim_default_dispatch_to_partition_alloc.cc | ||
| 7 | +++ b/base/allocator/partition_allocator/src/partition_alloc/shim/allocator_shim_default_dispatch_to_partition_alloc.cc | ||
| 8 | @@ -646,7 +645,7 @@ SHIM_ALWAYS_EXPORT int mallopt(int cmd, int value) __THROW { | ||
| 9 | |||
| 10 | #endif // !PA_BUILDFLAG(IS_APPLE) && !PA_BUILDFLAG(IS_ANDROID) | ||
| 11 | |||
| 12 | -#if PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS) | ||
| 13 | +#if 0 | ||
| 14 | SHIM_ALWAYS_EXPORT struct mallinfo mallinfo(void) __THROW { | ||
| 15 | partition_alloc::SimplePartitionStatsDumper allocator_dumper; | ||
| 16 | Allocator()->DumpStats("malloc", true, &allocator_dumper); | ||
| 17 | --- a/base/process/process_metrics_posix.cc | ||
| 18 | +++ b/base/process/process_metrics_posix.cc | ||
| 19 | @@ -106,7 +107,8 @@ void IncreaseFdLimitTo(unsigned int max_descriptors) { | ||
| 20 | |||
| 21 | #endif // !BUILDFLAG(IS_FUCHSIA) | ||
| 22 | |||
| 23 | -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) | ||
| 24 | +#if (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS) || \ | ||
| 25 | + BUILDFLAG(IS_ANDROID) | ||
| 26 | namespace { | ||
| 27 | |||
| 28 | size_t GetMallocUsageMallinfo() { | ||
| 29 | @@ -132,7 +134,8 @@ size_t ProcessMetrics::GetMallocUsage() { | ||
| 30 | malloc_statistics_t stats = {0}; | ||
| 31 | malloc_zone_statistics(nullptr, &stats); | ||
| 32 | return stats.size_in_use; | ||
| 33 | -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) | ||
| 34 | +#elif (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS) || \ | ||
| 35 | + BUILDFLAG(IS_ANDROID) | ||
| 36 | return GetMallocUsageMallinfo(); | ||
| 37 | #elif BUILDFLAG(IS_FUCHSIA) | ||
| 38 | // TODO(fuchsia): Not currently exposed. https://crbug.com/735087. | ||
| 39 | diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc | ||
| 40 | index e37fc69c00..394f5dfdbb 100644 | ||
| 41 | --- a/base/trace_event/malloc_dump_provider.cc | ||
| 42 | +++ b/base/trace_event/malloc_dump_provider.cc | ||
| 43 | @@ -189,7 +188,6 @@ void ReportMallinfoStats(ProcessMemoryDump* pmd, | ||
| 44 | #define MALLINFO2_FOUND_IN_LIBC | ||
| 45 | struct mallinfo2 info = mallinfo2(); | ||
| 46 | #endif | ||
| 47 | -#endif // defined(__GLIBC__) && defined(__GLIBC_PREREQ) | ||
| 48 | #if !defined(MALLINFO2_FOUND_IN_LIBC) | ||
| 49 | struct mallinfo info = mallinfo(); | ||
| 50 | #endif | ||
| 51 | @@ -211,6 +209,7 @@ void ReportMallinfoStats(ProcessMemoryDump* pmd, | ||
| 52 | MemoryAllocatorDump::kUnitsBytes, | ||
| 53 | total_allocated_size); | ||
| 54 | } | ||
| 55 | +#endif // defined(__GLIBC__) && defined(__GLIBC_PREREQ) | ||
| 56 | } | ||
| 57 | #endif | ||
| 58 | |||
| 59 | @@ -368,7 +367,7 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args, | ||
| 60 | &allocated_objects_count); | ||
| 61 | #elif BUILDFLAG(IS_FUCHSIA) | ||
| 62 | // TODO(fuchsia): Port, see https://crbug.com/706592. | ||
| 63 | -#else | ||
| 64 | +#elif defined(__GLIBC__) | ||
| 65 | ReportMallinfoStats(/*pmd=*/nullptr, &total_virtual_size, &resident_size, | ||
| 66 | &allocated_objects_size, &allocated_objects_count); | ||
| 67 | #endif | ||
| 68 | --- a/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h | ||
| 69 | +++ b/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h | ||
| 70 | @@ -133,7 +133,6 @@ | ||
| 71 | /* #undef HAVE_MALLCTL */ | ||
| 72 | |||
| 73 | /* Define to 1 if you have the `mallinfo' function. */ | ||
| 74 | -#define HAVE_MALLINFO 1 | ||
| 75 | |||
| 76 | /* Some projects using SwiftShader bypass cmake (eg Chromium via gn) */ | ||
| 77 | /* so we need to check glibc version for the new API to be safe */ | ||
| 78 | --- a/third_party/swiftshader/third_party/llvm-10.0/llvm/lib/Support/Unix/Process.inc | ||
| 79 | +++ b/third_party/swiftshader/third_party/llvm-10.0/llvm/lib/Support/Unix/Process.inc | ||
| 80 | @@ -83,11 +83,11 @@ Expected<unsigned> Process::getPageSize() { | ||
| 81 | } | ||
| 82 | |||
| 83 | size_t Process::GetMallocUsage() { | ||
| 84 | -#if defined(HAVE_MALLINFO2) | ||
| 85 | +#if 0 | ||
| 86 | struct mallinfo2 mi; | ||
| 87 | mi = ::mallinfo2(); | ||
| 88 | return mi.uordblks; | ||
| 89 | -#elif defined(HAVE_MALLINFO) | ||
| 90 | +#elif 0 | ||
| 91 | struct mallinfo mi; | ||
| 92 | mi = ::mallinfo(); | ||
| 93 | return mi.uordblks; | ||
diff --git a/chromium/patches/021-musl-no-res-ninit.patch b/chromium/patches/021-musl-no-res-ninit.patch new file mode 100644 index 0000000..d74f6cd --- /dev/null +++ b/chromium/patches/021-musl-no-res-ninit.patch | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | similar to dns-resolver.patch, musl doesn't have res_ninit and so on | ||
| 2 | -- | ||
| 3 | --- a/net/dns/public/scoped_res_state.cc | ||
| 4 | +++ b/net/dns/public/scoped_res_state.cc | ||
| 5 | @@ -13,7 +13,7 @@ | ||
| 6 | namespace net { | ||
| 7 | |||
| 8 | ScopedResState::ScopedResState() { | ||
| 9 | -#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_FUCHSIA) | ||
| 10 | +#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_FUCHSIA) || defined(_GNU_SOURCE) | ||
| 11 | // Note: res_ninit in glibc always returns 0 and sets RES_INIT. | ||
| 12 | // res_init behaves the same way. | ||
| 13 | memset(&_res, 0, sizeof(_res)); | ||
| 14 | @@ -25,16 +25,8 @@ | ||
| 15 | } | ||
| 16 | |||
| 17 | ScopedResState::~ScopedResState() { | ||
| 18 | -#if !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA) | ||
| 19 | - | ||
| 20 | - // Prefer res_ndestroy where available. | ||
| 21 | -#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD) | ||
| 22 | - res_ndestroy(&res_); | ||
| 23 | -#else | ||
| 24 | - res_nclose(&res_); | ||
| 25 | -#endif // BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD) | ||
| 26 | - | ||
| 27 | -#endif // !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA) | ||
| 28 | + // musl res_init() doesn't actually do anything | ||
| 29 | + // no destruction is necessary as no memory has been allocated | ||
| 30 | } | ||
| 31 | |||
| 32 | bool ScopedResState::IsValid() const { | ||
diff --git a/chromium/patches/022-no-sandbox-settls.patch b/chromium/patches/022-no-sandbox-settls.patch new file mode 100644 index 0000000..f04e105 --- /dev/null +++ b/chromium/patches/022-no-sandbox-settls.patch | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | this optimisation of CLONE_SETTLS is not valid used like this, and musl | ||
| 2 | clone(3) will EINVAL on this use | ||
| 3 | -- | ||
| 4 | diff --git a/sandbox/linux/services/credentials.cc b/sandbox/linux/services/credentials.cc | ||
| 5 | index 7f925cc..993a9ee 100644 | ||
| 6 | --- a/sandbox/linux/services/credentials.cc | ||
| 7 | +++ b/sandbox/linux/services/credentials.cc | ||
| 8 | @@ -104,7 +104,7 @@ bool ChrootToSafeEmptyDir() { | ||
| 9 | // glibc performs syscalls by calling a function pointer in TLS, so we do not | ||
| 10 | // attempt this optimization. | ||
| 11 | // TODO(crbug.com/40196869) Broken in MSan builds after LLVM f1bb30a4956f. | ||
| 12 | - clone_flags |= CLONE_VM | CLONE_VFORK | CLONE_SETTLS; | ||
| 13 | + clone_flags |= CLONE_VM | CLONE_VFORK; | ||
| 14 | |||
| 15 | char tls_buf[PTHREAD_STACK_MIN_CONST] = {}; | ||
| 16 | tls = tls_buf; | ||
diff --git a/chromium/patches/027-temp-failure-retry.patch b/chromium/patches/027-temp-failure-retry.patch new file mode 100644 index 0000000..dc9ac6f --- /dev/null +++ b/chromium/patches/027-temp-failure-retry.patch | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | random glibc macro, not provided by musl. | ||
| 2 | https://www.gnu.org/software/libc/manual/html_node/Interrupted-Primitives.html | ||
| 3 | diff --git a/sandbox/linux/suid/process_util.h b/sandbox/linux/suid/process_util.h | ||
| 4 | index b0b92c1bcc..db6a122ea8 100644 | ||
| 5 | --- a/sandbox/linux/suid/process_util.h | ||
| 6 | +++ b/sandbox/linux/suid/process_util.h | ||
| 7 | @@ -12,6 +12,15 @@ | ||
| 8 | #include <stdint.h> | ||
| 9 | #include <sys/types.h> | ||
| 10 | |||
| 11 | +#define TEMP_FAILURE_RETRY(expression) \ | ||
| 12 | + (__extension__({ \ | ||
| 13 | + long int __result; \ | ||
| 14 | + do \ | ||
| 15 | + __result = (long int)(expression); \ | ||
| 16 | + while (__result == -1L && errno == EINTR); \ | ||
| 17 | + __result; \ | ||
| 18 | + })) | ||
| 19 | + | ||
| 20 | // This adjusts /proc/process/oom_score_adj so the Linux OOM killer | ||
| 21 | // will prefer certain process types over others. The range for the | ||
| 22 | // adjustment is [-1000, 1000], with [0, 1000] being user accessible. | ||
diff --git a/chromium/patches/033-perfetto-get-thread-name.patch b/chromium/patches/033-perfetto-get-thread-name.patch new file mode 100644 index 0000000..4014d1e --- /dev/null +++ b/chromium/patches/033-perfetto-get-thread-name.patch | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | --- a/third_party/perfetto/include/perfetto/ext/base/thread_utils.h | ||
| 2 | +++ b/third_party/perfetto/include/perfetto/ext/base/thread_utils.h | ||
| 3 | @@ -30,7 +30,8 @@ | ||
| 4 | #include <algorithm> | ||
| 5 | #endif | ||
| 6 | |||
| 7 | -#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) | ||
| 8 | +#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \ | ||
| 9 | + (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && !defined(__GLIBC__)) | ||
| 10 | #include <sys/prctl.h> | ||
| 11 | #endif | ||
| 12 | |||
| 13 | @@ -58,7 +59,8 @@ | ||
| 14 | |||
| 15 | inline bool GetThreadName(std::string& out_result) { | ||
| 16 | char buf[16] = {}; | ||
| 17 | -#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) | ||
| 18 | +#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \ | ||
| 19 | + (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && !defined(__GLIBC__)) | ||
| 20 | if (prctl(PR_GET_NAME, buf) != 0) | ||
| 21 | return false; | ||
| 22 | #else | ||
diff --git a/chromium/patches/035-breakpad-no-getcontext.patch b/chromium/patches/035-breakpad-no-getcontext.patch new file mode 100644 index 0000000..f9bc2e0 --- /dev/null +++ b/chromium/patches/035-breakpad-no-getcontext.patch | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | --- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc 2015-12-06 09:59:55.554536646 +0100 | ||
| 2 | +++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc 2015-12-06 10:01:16.818238035 +0100 | ||
| 3 | @@ -477,7 +477,9 @@ bool ExceptionHandler::SimulateSignalDel | ||
| 4 | siginfo.si_code = SI_USER; | ||
| 5 | siginfo.si_pid = getpid(); | ||
| 6 | ucontext_t context; | ||
| 7 | +#if defined(__GLIBC__) | ||
| 8 | getcontext(&context); | ||
| 9 | +#endif | ||
| 10 | return HandleSignal(sig, &siginfo, &context); | ||
| 11 | } | ||
| 12 | |||
| 13 | @@ -647,9 +649,14 @@ bool ExceptionHandler::WriteMinidump() { | ||
| 14 | sys_prctl(PR_SET_DUMPABLE, 1, 0, 0, 0); | ||
| 15 | |||
| 16 | CrashContext context; | ||
| 17 | + | ||
| 18 | +#if defined(__GLIBC__) | ||
| 19 | int getcontext_result = getcontext(&context.context); | ||
| 20 | if (getcontext_result) | ||
| 21 | return false; | ||
| 22 | +#else | ||
| 23 | + return false; | ||
| 24 | +#endif | ||
| 25 | |||
| 26 | #if defined(__i386__) | ||
| 27 | // In CPUFillFromUContext in minidumpwriter.cc the stack pointer is retrieved | ||
diff --git a/chromium/patches/disable-dns_config_service.patch b/chromium/patches/disable-dns_config_service.patch new file mode 100644 index 0000000..3c8e593 --- /dev/null +++ b/chromium/patches/disable-dns_config_service.patch | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | the linux one sometimes crashes, and this is optional/not required, so use the | ||
| 2 | stub fuschia one | ||
| 3 | https://gitlab.alpinelinux.org/alpine/aports/-/issues/15660 | ||
| 4 | -- | ||
| 5 | diff --git a/net/dns/BUILD.gn b/net/dns/BUILD.gn | ||
| 6 | index f36bf68..805d9a6 100644 | ||
| 7 | --- a/net/dns/BUILD.gn | ||
| 8 | +++ b/net/dns/BUILD.gn | ||
| 9 | @@ -130,8 +130,8 @@ source_set("dns") { | ||
| 10 | ] | ||
| 11 | } else if (is_linux) { | ||
| 12 | sources += [ | ||
| 13 | - "dns_config_service_linux.cc", | ||
| 14 | - "dns_config_service_linux.h", | ||
| 15 | + "dns_config_service_fuchsia.cc", | ||
| 16 | + "dns_config_service_fuchsia.h", | ||
| 17 | ] | ||
| 18 | } else if (is_posix) { | ||
| 19 | sources += [ | ||
diff --git a/chromium/patches/llvm21-fixes.patch b/chromium/patches/llvm21-fixes.patch new file mode 100644 index 0000000..01208af --- /dev/null +++ b/chromium/patches/llvm21-fixes.patch | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | diff --git a/components/autofill/core/browser/payments/full_card_request.cc b/components/autofill/core/browser/payments/full_card_request.cc | ||
| 2 | index 8b7319d..5a8ade3 100644 | ||
| 3 | --- a/components/autofill/core/browser/payments/full_card_request.cc | ||
| 4 | +++ b/components/autofill/core/browser/payments/full_card_request.cc | ||
| 5 | @@ -124,7 +124,7 @@ void FullCardRequest::GetFullCardImpl( | ||
| 6 | request_->card = std::move(card); | ||
| 7 | request_->last_committed_primary_main_frame_origin = | ||
| 8 | last_committed_primary_main_frame_origin; | ||
| 9 | - request_->context_token = std::move(context_token).value_or({}); | ||
| 10 | + request_->context_token = std::move(context_token).value_or(std::string{}); | ||
| 11 | request_->selected_challenge_option = std::move(selected_challenge_option); | ||
| 12 | |||
| 13 | should_unmask_card_ = request_->card.masked() || | ||
| 14 | diff --git a/ui/gfx/paint_vector_icon.cc b/ui/gfx/paint_vector_icon.cc | ||
| 15 | index eef47b4..710f070 100644 | ||
| 16 | --- a/ui/gfx/paint_vector_icon.cc | ||
| 17 | +++ b/ui/gfx/paint_vector_icon.cc | ||
| 18 | @@ -235,7 +235,7 @@ void PaintPath(Canvas* canvas, | ||
| 19 | break; | ||
| 20 | |||
| 21 | case H_LINE_TO: { | ||
| 22 | - const SkPoint last_point = path.getLastPt().value_or({0, 0}); | ||
| 23 | + const SkPoint last_point = path.getLastPt().value_or(SkPoint{0, 0}); | ||
| 24 | path.lineTo(arg(0), last_point.fY); | ||
| 25 | break; | ||
| 26 | } | ||
| 27 | @@ -245,7 +245,7 @@ void PaintPath(Canvas* canvas, | ||
| 28 | break; | ||
| 29 | |||
| 30 | case V_LINE_TO: { | ||
| 31 | - const SkPoint last_point = path.getLastPt().value_or({0, 0}); | ||
| 32 | + const SkPoint last_point = path.getLastPt().value_or(SkPoint{0, 0}); | ||
| 33 | path.lineTo(last_point.fX, arg(0)); | ||
| 34 | break; | ||
| 35 | } | ||
| 36 | @@ -273,7 +273,7 @@ void PaintPath(Canvas* canvas, | ||
| 37 | // details. | ||
| 38 | // Note that |x1| and |y1| will correspond to the sole control point if | ||
| 39 | // calculating a quadratic curve. | ||
| 40 | - const SkPoint last_point = path.getLastPt().value_or({0, 0}); | ||
| 41 | + const SkPoint last_point = path.getLastPt().value_or(SkPoint{0, 0}); | ||
| 42 | SkScalar delta_x = 0; | ||
| 43 | SkScalar delta_y = 0; | ||
| 44 | if (IsCommandTypeCurve(previous_command_type)) { | ||
diff --git a/chromium/patches/noclanglibs.patch b/chromium/patches/noclanglibs.patch new file mode 100644 index 0000000..4542171 --- /dev/null +++ b/chromium/patches/noclanglibs.patch | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | q66 doesn't want to pass clang_version for clanglib path since it's only used to | ||
| 2 | link the libclang_rt.builtins.a. but those are linked by default already so skip | ||
| 3 | it instead of computing the version | ||
| 4 | -- | ||
| 5 | --- a/build/config/clang/BUILD.gn | ||
| 6 | +++ b/build/config/clang/BUILD.gn | ||
| 7 | @@ -101,7 +101,7 @@ | ||
| 8 | } | ||
| 9 | |||
| 10 | template("clang_lib") { | ||
| 11 | - if (!defined(invoker.libname) || is_wasm) { | ||
| 12 | + if (true) { | ||
| 13 | not_needed(invoker, "*") | ||
| 14 | config(target_name) { | ||
| 15 | } | ||
diff --git a/chromium/patches/sanitizer-no-death-callback.patch b/chromium/patches/sanitizer-no-death-callback.patch new file mode 100644 index 0000000..b2c1e1f --- /dev/null +++ b/chromium/patches/sanitizer-no-death-callback.patch | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | undefined symbol in our build | ||
| 2 | |||
| 3 | --- a/v8/src/sandbox/testing.cc | ||
| 4 | +++ b/v8/src/sandbox/testing.cc | ||
| 5 | @@ -578,7 +578,7 @@ void UninstallCrashFilter() { | ||
| 6 | // We should also uninstall the sanitizer death callback as our crash filter | ||
| 7 | // may hand a crash over to sanitizers, which should then not enter our crash | ||
| 8 | // filtering logic a second time. | ||
| 9 | -#ifdef V8_USE_ANY_SANITIZER | ||
| 10 | +#if 0 | ||
| 11 | __sanitizer_set_death_callback(nullptr); | ||
| 12 | #endif // V8_USE_ANY_SANITIZER | ||
| 13 | } | ||
| 14 | @@ -782,7 +782,7 @@ void InstallCrashFilter() { | ||
| 15 | } | ||
| 16 | CHECK(success); | ||
| 17 | |||
| 18 | -#ifdef V8_USE_ANY_SANITIZER | ||
| 19 | +#if 0 | ||
| 20 | // We install sanitizer specific crash handlers. These can only check for | ||
| 21 | // in-sandbox crashes on certain configurations. | ||
| 22 | // | ||
diff --git a/chromium/patches/terminal-fdset.patch b/chromium/patches/terminal-fdset.patch new file mode 100644 index 0000000..32c7421 --- /dev/null +++ b/chromium/patches/terminal-fdset.patch | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | --- a/third_party/dawn/src/tint/utils/system/terminal_posix.cc | ||
| 2 | +++ b/third_party/dawn/src/tint/utils/system/terminal_posix.cc | ||
| 3 | @@ -37,6 +37,7 @@ | ||
| 4 | #include <optional> | ||
| 5 | #include <string_view> | ||
| 6 | #include <utility> | ||
| 7 | +#include <sys/select.h> | ||
| 8 | |||
| 9 | #include "src/tint/utils/containers/vector.h" | ||
| 10 | #include "src/tint/utils/macros/compiler.h" | ||