瀏覽代碼

fix crash on samsung note 9

Carmelo Messina 3 年之前
父節點
當前提交
ad6d7ff003
共有 2 個文件被更改,包括 40 次插入0 次删除
  1. 1 0
      build/bromite_patches_list.txt
  2. 39 0
      build/patches/Fix-Note9-startup-crash.patch

+ 1 - 0
build/bromite_patches_list.txt

@@ -181,3 +181,4 @@ Add-more-private-google-search-engine.patch
 Enable-StrictOriginIsolation-and-SitePerProcess-flags.patch
 Site-setting-for-javascript-jit.patch
 Allow-change-keep-navigation-history.patch
+Fix-Note9-startup-crash.patch

+ 39 - 0
build/patches/Fix-Note9-startup-crash.patch

@@ -0,0 +1,39 @@
+From: uazo <uazo@users.noreply.github.com>
+Date: Thu, 3 Feb 2022 19:48:49 +0000
+Subject: Fix Samsung Note 9 startup crash
+
+---
+ .../base/library_loader/LibraryLoader.java     | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+diff --git a/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java b/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java
+--- a/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java
++++ b/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java
+@@ -505,6 +505,24 @@ public class LibraryLoader {
+     // Note: This cannot be done in the build configuration, as otherwise chrome_public_apk cannot
+     // both be used as the basis to ship on L, and the default APK used by developers on 10+.
+     private boolean forceSystemLinker() {
++        // Check from Samsung Galaxy Note 9 (Android 8.1) - Model SM-N960F
++        // crashes on startup due to crazylinker not compatible with that device
++        // it doesn't support RELRO for that device. we lose relocation sharing
++        // but it starts up.
++        // see also https://groups.google.com/a/chromium.org/g/chromium-dev/c/iAb7QUiNPLw
++        //          https://bugs.chromium.org/p/chromium/issues/detail?id=980304
++        String manufacturer = Build.MANUFACTURER.toLowerCase(Locale.US);
++        if (manufacturer.equals("samsung")
++                && Build.MODEL != null
++                && Build.MODEL.equals("SM-N960F")) {
++            Log.i(TAG, "Configuration: force use System Linker (workaround)");
++            // Use system linker without loading crazylinker
++            // the attempt with the system linker also happens normally as fallback,
++            // but in this case we bypass the load of creazylinker because
++            // it messes up the memory causing meaningless crashes
++            // at base::MessagePumpForUI::MessagePumpForUI()
++            return true;
++        }
+         return mUseChromiumLinker && !mUseModernLinker
+                 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
+     }
+-- 
+2.20.1
+