diff options
| -rw-r--r-- | chromium/.footprint | 32 | ||||
| -rw-r--r-- | chromium/.signature | 9 | ||||
| -rw-r--r-- | chromium/MAKEPKG | 228 | ||||
| -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 |
18 files changed, 874 insertions, 0 deletions
diff --git a/chromium/.footprint b/chromium/.footprint new file mode 100644 index 0000000..c7202b9 --- /dev/null +++ b/chromium/.footprint | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | drwxr-xr-x root/root usr/ | ||
| 2 | drwxr-xr-x root/root usr/bin/ | ||
| 3 | -rwxr-xr-x root/root usr/bin/chromium | ||
| 4 | drwxr-xr-x root/root usr/lib/ | ||
| 5 | drwxr-xr-x root/root usr/lib/chromium/ | ||
| 6 | -rwxr-xr-x root/root usr/lib/chromium/chrome | ||
| 7 | -rw-r--r-- root/root usr/lib/chromium/chrome_100_percent.pak | ||
| 8 | -rw-r--r-- root/root usr/lib/chromium/chrome_200_percent.pak | ||
| 9 | -rwxr-xr-x root/root usr/lib/chromium/chrome_crashpad_handler | ||
| 10 | -rw-r--r-- root/root usr/lib/chromium/headless_command_resources.pak | ||
| 11 | -rw-r--r-- root/root usr/lib/chromium/icudtl.dat | ||
| 12 | -rw-r--r-- root/root usr/lib/chromium/libEGL.so | ||
| 13 | -rw-r--r-- root/root usr/lib/chromium/libGLESv2.so | ||
| 14 | -rw-r--r-- root/root usr/lib/chromium/libVkICD_mock_icd.so | ||
| 15 | -rw-r--r-- root/root usr/lib/chromium/libVkLayer_khronos_validation.so | ||
| 16 | -rw-r--r-- root/root usr/lib/chromium/libvk_swiftshader.so | ||
| 17 | -rw-r--r-- root/root usr/lib/chromium/libvulkan.so.1 | ||
| 18 | -rw-r--r-- root/root usr/lib/chromium/resources.pak | ||
| 19 | -rw-r--r-- root/root usr/lib/chromium/snapshot_blob.bin | ||
| 20 | -rw-r--r-- root/root usr/lib/chromium/v8_context_snapshot.bin | ||
| 21 | -rw-r--r-- root/root usr/lib/chromium/vk_swiftshader_icd.json | ||
| 22 | -rwxr-xr-x root/root usr/lib/chromium/xdg-mime | ||
| 23 | -rwxr-xr-x root/root usr/lib/chromium/xdg-settings | ||
| 24 | drwxr-xr-x root/root usr/lib/chromium/locales/ | ||
| 25 | -rw-r--r-- root/root usr/lib/chromium/locales/el.pak | ||
| 26 | -rw-r--r-- root/root usr/lib/chromium/locales/el_FEMININE.pak | ||
| 27 | -rw-r--r-- root/root usr/lib/chromium/locales/el_MASCULINE.pak | ||
| 28 | -rw-r--r-- root/root usr/lib/chromium/locales/el_NEUTER.pak | ||
| 29 | -rw-r--r-- root/root usr/lib/chromium/locales/en-US.pak | ||
| 30 | -rw-r--r-- root/root usr/lib/chromium/locales/en-US_FEMININE.pak | ||
| 31 | -rw-r--r-- root/root usr/lib/chromium/locales/en-US_MASCULINE.pak | ||
| 32 | -rw-r--r-- root/root usr/lib/chromium/locales/en-US_NEUTER.pak | ||
diff --git a/chromium/.signature b/chromium/.signature new file mode 100644 index 0000000..064f303 --- /dev/null +++ b/chromium/.signature | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | untrusted comment: verify with zorz.pub | ||
| 2 | RWTZ9IduCSQ/mCt+MgmxBCIacoMiOpx/pJrUjF2156FsIgXHCpa5qubj+P0qLEMcjEuigwxGpU7wggR655yIeh8pB027Dd2/OQI= | ||
| 3 | |||
| 4 | SHA256 (MAKEPKG) = 2c8217075139a73fd4a4333c38f7a6a37b8145192cd4e9664efdc608b54e79e1 | ||
| 5 | SHA256 (.footprint) = bc40549f131fb1b986f7944ffd59685b8a2d183a21de2cf12403c5e1dda76df4 | ||
| 6 | SHA256 (chromium-145.0.7632.159-linux.tar.xz) = ea7350702cb827c94b786fc1fa51c24c0401e782c9c08dd7ca25a676da4a8f8c | ||
| 7 | SHA256 (wasm-node-4.53.3.tgz) = 04b101456db24503a6facaade777f4bfb58909195208d4dbbf7dc4217bf71289 | ||
| 8 | SHA256 (145.4.tar.gz) = bd7bd0984d048d6844195f4aa18b24a0f56603814c243ed32190746d8ba8d7c5 | ||
| 9 | SHA256 (chromium-patches-145.tar.gz) = 96d6562120964b0c9e1a2bedf4335e0bf20f5e7d67a443bb26c651b0167a6a6b | ||
diff --git a/chromium/MAKEPKG b/chromium/MAKEPKG new file mode 100644 index 0000000..4674fe9 --- /dev/null +++ b/chromium/MAKEPKG | |||
| @@ -0,0 +1,228 @@ | |||
| 1 | #!/bin/mkpkg | ||
| 2 | # description: Open-source web browser | ||
| 3 | # url: https://www.chromium.org/ | ||
| 4 | # | ||
| 5 | # Patches: | ||
| 6 | # copium — musl basics (Alpine/selfisekai) | ||
| 7 | # gentoo — system toolchain support (Matt Jolly) | ||
| 8 | # patches/ — musl deep fixes (Chimera cports + flux) | ||
| 9 | |||
| 10 | name=chromium | ||
| 11 | version=146.0.7680.164 | ||
| 12 | release=1 | ||
| 13 | _copium=146.4 | ||
| 14 | _gentoo=146-1 | ||
| 15 | depends=(gtk3 nss nspr harfbuzz icu libpng libjpeg-turbo libwebp | ||
| 16 | zlib libxml2 fontconfig freetype libffi libxkbcommon alsa-lib | ||
| 17 | wayland mesa libdrm dbus) | ||
| 18 | makedeps=(gn ninja rust rust-bindgen python3 nodejs flatbuffers gperf | ||
| 19 | bsd-headers gcc-compat) | ||
| 20 | source=(https://github.com/chromium-linux-tarballs/chromium-tarballs/releases/download/$version/chromium-$version-linux.tar.xz | ||
| 21 | https://registry.npmjs.org/@rollup/wasm-node/-/wasm-node-4.53.3.tgz | ||
| 22 | https://codeberg.org/selfisekai/copium/archive/$_copium.tar.gz | ||
| 23 | https://gitlab.com/Matt.Jolly/chromium-patches/-/archive/$_gentoo/chromium-patches-$_gentoo.tar.gz) | ||
| 24 | |||
| 25 | patch() { | ||
| 26 | cd chromium-$version | ||
| 27 | |||
| 28 | # Replace bundled rollup with wasm-node (pure WASM — no native binary needed on musl) | ||
| 29 | rm -rf third_party/devtools-frontend/src/node_modules/rollup | ||
| 30 | cp -a "$SRC"/package \ | ||
| 31 | third_party/devtools-frontend/src/node_modules/rollup | ||
| 32 | |||
| 33 | # Copium patches (musl basics) | ||
| 34 | for p in "$SRC"/copium/cr*.patch; do | ||
| 35 | case "$p" in *rust-pre1.8*|*rust-pre1.90*|*no-unrar*) continue ;; esac | ||
| 36 | patch -Np1 -i "$p" | ||
| 37 | done | ||
| 38 | |||
| 39 | # Gentoo patches (system toolchain) | ||
| 40 | patch -Np1 -i "$SRC"/chromium-patches-$_gentoo/chromium-145-compiler.patch | ||
| 41 | patch -Np1 -i "$SRC"/chromium-patches-$_gentoo/chromium-144-bindgen-custom-toolchain.patch | ||
| 42 | patch -Np1 -i "$SRC"/chromium-patches-$_gentoo/chromium-117-material-color-include.patch | ||
| 43 | patch -Np1 -i "$SRC"/chromium-patches-$_gentoo/chromium-145-revert-rustfmt.patch || true | ||
| 44 | |||
| 45 | # flux musl patches | ||
| 46 | for p in \ | ||
| 47 | 008-fstatat64 \ | ||
| 48 | 016-musl-sandbox \ | ||
| 49 | 017-musl-tid-caching \ | ||
| 50 | 019-musl-no-execinfo \ | ||
| 51 | 020-musl-no-mallinfo \ | ||
| 52 | 021-musl-no-res-ninit \ | ||
| 53 | 022-no-sandbox-settls \ | ||
| 54 | 027-temp-failure-retry \ | ||
| 55 | 033-perfetto-get-thread-name \ | ||
| 56 | 035-breakpad-no-getcontext \ | ||
| 57 | disable-dns_config_service \ | ||
| 58 | noclanglibs \ | ||
| 59 | sanitizer-no-death-callback \ | ||
| 60 | terminal-fdset \ | ||
| 61 | llvm21-fixes \ | ||
| 62 | ; do | ||
| 63 | patch -Np1 -i "$PKGMK_SOURCE_DIR"/patches/$p.patch | ||
| 64 | done | ||
| 65 | |||
| 66 | # Rust target triple | ||
| 67 | sed -i 's/unknown-linux-gnu/unknown-linux-musl/g' build/config/rust.gni | ||
| 68 | echo 'x86_64-unknown-linux-musl' >> build/rust/known-target-triples.txt | ||
| 69 | |||
| 70 | # Enable nightly Rust features | ||
| 71 | sed -i '1a import os; os.environ["RUSTC_BOOTSTRAP"] = "1"' \ | ||
| 72 | build/rust/gni_impl/rustc_wrapper.py | ||
| 73 | |||
| 74 | # Strip -Werror | ||
| 75 | sed -i 's/-Werror//g' build/config/compiler/BUILD.gn | ||
| 76 | |||
| 77 | # musl: libc++ rune table | ||
| 78 | sed -i '1i #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE' \ | ||
| 79 | third_party/libc++/src/include/__config | ||
| 80 | |||
| 81 | # musl: guard glibc-only stack trace helper | ||
| 82 | sed -i 's/OutputToStreamWithPrefixImpl(os, prefix_string);/#if defined(__GLIBC__)\n OutputToStreamWithPrefixImpl(os, prefix_string);\n#endif/' \ | ||
| 83 | base/debug/stack_trace.cc | ||
| 84 | |||
| 85 | # Fix dbus::Bus incomplete type | ||
| 86 | sed -i '/chrome_browser_main_linux.h/a #include "dbus/bus.h"' \ | ||
| 87 | chrome/browser/chrome_browser_main_linux.cc | ||
| 88 | } | ||
| 89 | |||
| 90 | sha256sums=( | ||
| 91 | "ea7350702cb827c94b786fc1fa51c24c0401e782c9c08dd7ca25a676da4a8f8c" | ||
| 92 | "04b101456db24503a6facaade777f4bfb58909195208d4dbbf7dc4217bf71289" | ||
| 93 | "bd7bd0984d048d6844195f4aa18b24a0f56603814c243ed32190746d8ba8d7c5" | ||
| 94 | "96d6562120964b0c9e1a2bedf4335e0bf20f5e7d67a443bb26c651b0167a6a6b" | ||
| 95 | ) | ||
| 96 | |||
| 97 | build() { | ||
| 98 | cd chromium-$version | ||
| 99 | |||
| 100 | export CC=clang CXX=clang++ AR=llvm-ar NM=llvm-nm RANLIB=llvm-ranlib LD=ld.lld | ||
| 101 | export CFLAGS="-O2 -pipe -Wno-unknown-warning-option -Wno-builtin-macro-redefined -Wno-deprecated-declarations" | ||
| 102 | export CXXFLAGS="$CFLAGS -Wno-invalid-constexpr" | ||
| 103 | export LDFLAGS="-fuse-ld=lld" | ||
| 104 | export RUSTC_BOOTSTRAP=1 | ||
| 105 | export DEPOT_TOOLS_UPDATE=0 | ||
| 106 | export VPYTHON_BYPASS="manually managed python not supported by chrome operations" | ||
| 107 | export PKG_CONFIG_PATH=/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig | ||
| 108 | export HOME="$PWD"/fake-home && mkdir -p "$HOME" | ||
| 109 | |||
| 110 | # System node + toolchain stubs | ||
| 111 | mkdir -p third_party/node/linux/node-linux-x64/bin | ||
| 112 | ln -sf /usr/bin/node third_party/node/linux/node-linux-x64/bin/node | ||
| 113 | mkdir -p third_party/llvm-build/Release+Asserts/bin | ||
| 114 | ln -sf /usr/bin/clang third_party/llvm-build/Release+Asserts/bin/ | ||
| 115 | ln -sf /usr/bin/clang++ third_party/llvm-build/Release+Asserts/bin/ | ||
| 116 | |||
| 117 | # Stub node version check | ||
| 118 | printf '#!/usr/bin/env python3\nimport sys; open(sys.argv[sys.argv.index("--out_file")+1], "w").write("ok")\n' \ | ||
| 119 | > third_party/node/check_version.py | ||
| 120 | |||
| 121 | mkdir -p out/Release | ||
| 122 | cat > out/Release/args.gn << EOF | ||
| 123 | is_clang = true | ||
| 124 | use_lld = true | ||
| 125 | is_debug = false | ||
| 126 | is_official_build = true | ||
| 127 | symbol_level = 0 | ||
| 128 | is_musl = true | ||
| 129 | custom_toolchain = "//build/toolchain/linux/unbundle:default" | ||
| 130 | host_toolchain = "//build/toolchain/linux/unbundle:default" | ||
| 131 | rust_sysroot_absolute = "$(rustc --print sysroot)" | ||
| 132 | rust_bindgen_root = "/usr" | ||
| 133 | bindgen_libclang_path = "/usr/lib" | ||
| 134 | clang_base_path = "/usr" | ||
| 135 | rustc_version = "0" | ||
| 136 | use_sysroot = false | ||
| 137 | treat_warnings_as_errors = false | ||
| 138 | fatal_linker_warnings = false | ||
| 139 | clang_use_chrome_plugins = false | ||
| 140 | use_custom_libcxx = true | ||
| 141 | use_safe_libstdcxx = false | ||
| 142 | chrome_pgo_phase = 0 | ||
| 143 | is_cfi = false | ||
| 144 | use_thin_lto = false | ||
| 145 | use_clang_modules = false | ||
| 146 | blink_enable_generated_code_formatting = false | ||
| 147 | use_system_harfbuzz = true | ||
| 148 | use_system_libffi = true | ||
| 149 | use_bundled_fontconfig = false | ||
| 150 | use_ozone = true | ||
| 151 | ozone_platform_wayland = true | ||
| 152 | ozone_platform_x11 = false | ||
| 153 | ozone_platform_headless = true | ||
| 154 | use_xkbcommon = true | ||
| 155 | use_alsa = true | ||
| 156 | use_pulseaudio = false | ||
| 157 | rtc_use_pipewire = false | ||
| 158 | use_vaapi = true | ||
| 159 | use_dbus = true | ||
| 160 | use_cups = false | ||
| 161 | use_kerberos = false | ||
| 162 | enable_widevine = false | ||
| 163 | enable_hangout_services_extension = false | ||
| 164 | enable_nocompile_tests = false | ||
| 165 | safe_browsing_use_unrar = false | ||
| 166 | proprietary_codecs = true | ||
| 167 | ffmpeg_branding = "Chrome" | ||
| 168 | enable_ml_internal = false | ||
| 169 | target_cpu = "x64" | ||
| 170 | EOF | ||
| 171 | |||
| 172 | gn gen out/Release || return 1 | ||
| 173 | |||
| 174 | # Remove bogus -I/include from generated ninja files | ||
| 175 | find out/Release -name '*.ninja' -exec sed -i 's| -I/include||g; s| -isystem/include||g' {} + | ||
| 176 | |||
| 177 | # System flatbuffers | ||
| 178 | ln -sf /usr/bin/flatc out/Release/flatc | ||
| 179 | |||
| 180 | ulimit -n 4096 | ||
| 181 | ninja -C out/Release -j8 chrome chrome_crashpad_handler || return 1 | ||
| 182 | |||
| 183 | # Install | ||
| 184 | d="$PKG/usr/lib/chromium" | ||
| 185 | install -d "$d" "$PKG/usr/bin" | ||
| 186 | |||
| 187 | install -m755 out/Release/chrome "$d/" | ||
| 188 | install -m755 out/Release/chrome_crashpad_handler "$d/" | ||
| 189 | |||
| 190 | # Data files | ||
| 191 | install -m644 out/Release/*.pak "$d/" | ||
| 192 | install -m644 out/Release/*.bin "$d/" 2>/dev/null || true | ||
| 193 | [ -f out/Release/icudtl.dat ] && install -m644 out/Release/icudtl.dat "$d/" | ||
| 194 | |||
| 195 | # Shared libraries (skip .TOC build artifacts) | ||
| 196 | for f in out/Release/*.so out/Release/*.so.*; do | ||
| 197 | [ -f "$f" ] && case "$f" in *.TOC) continue ;; esac && install -m644 "$f" "$d/" | ||
| 198 | done | ||
| 199 | |||
| 200 | # Vulkan SwiftShader ICD | ||
| 201 | [ -f out/Release/vk_swiftshader_icd.json ] && install -m644 out/Release/vk_swiftshader_icd.json "$d/" | ||
| 202 | |||
| 203 | # XDG helpers | ||
| 204 | for f in xdg-mime xdg-settings; do | ||
| 205 | [ -f out/Release/$f ] && install -m755 out/Release/$f "$d/" | ||
| 206 | done | ||
| 207 | |||
| 208 | # Locales — only en-US and el (Greek) | ||
| 209 | install -d "$d/locales" | ||
| 210 | for loc in en-US el; do | ||
| 211 | install -m644 out/Release/locales/${loc}.pak "$d/locales/" | ||
| 212 | for v in FEMININE MASCULINE NEUTER; do | ||
| 213 | [ -f out/Release/locales/${loc}_${v}.pak ] && \ | ||
| 214 | install -m644 out/Release/locales/${loc}_${v}.pak "$d/locales/" | ||
| 215 | done | ||
| 216 | done | ||
| 217 | |||
| 218 | # Wrapper | ||
| 219 | printf '#!/bin/sh\nexec /usr/lib/chromium/chrome --ozone-platform-hint=auto "$@"\n' > "$PKG/usr/bin/chromium" | ||
| 220 | chmod 755 "$PKG/usr/bin/chromium" | ||
| 221 | } | ||
| 222 | |||
| 223 | signify() { | ||
| 224 | untrusted comment: public key | ||
| 225 | RWTZ9IduCSQ/mL8337TEUinPwT92xFEUpD92hkS7IxcOnzTt9QdpohT3 | ||
| 226 | } | ||
| 227 | |||
| 228 | # vim: filetype=sh | ||
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" | ||