commit 3d064f23199cbbecacc2dc6573e6758a1407911a
Author: Leigh Scott <leigh123linux(a)gmail.com>
Date: Tue Mar 30 12:19:57 2021 +0100
Fix F34 glibc font render and gcc11 issues
chromium-browser-privacy.spec | 2 +
chromium-fstatfix.patch | 141 ++++++++++++++++++++++++++++++++++++++++++
chromium-gcc11.patch | 127 +++++++++++++++++++++++++++++++++++++
3 files changed, 270 insertions(+)
---
diff --git a/chromium-browser-privacy.spec b/chromium-browser-privacy.spec
index 55509d8..53e81aa 100644
--- a/chromium-browser-privacy.spec
+++ b/chromium-browser-privacy.spec
@@ -158,6 +158,8 @@ Patch402: chromium-enable-widevine.patch
Patch403: chromium-manpage.patch
Patch404: chromium-md5-based-build-id.patch
Patch405: chromium-names.patch
+Patch406: chromium-fstatfix.patch
+Patch407: chromium-gcc11.patch
%if %{freeworld}
Patch420: chromium-rpm-fusion-brand.patch
%endif
diff --git a/chromium-fstatfix.patch b/chromium-fstatfix.patch
new file mode 100644
index 0000000..26e8003
--- /dev/null
+++ b/chromium-fstatfix.patch
@@ -0,0 +1,141 @@
+diff -up
chromium-88.0.4324.96/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc.fstatfix
chromium-88.0.4324.96/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
+---
chromium-88.0.4324.96/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc.fstatfix 2021-01-25
10:11:45.427436398 -0500
++++ chromium-88.0.4324.96/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc 2021-01-25
10:12:51.337699003 -0500
+@@ -257,6 +257,18 @@ ResultExpr EvaluateSyscallImpl(int fs_de
+ return RestrictKillTarget(current_pid, sysno);
+ }
+
++#if defined(__NR_newfstatat)
++ if (sysno == __NR_newfstatat) {
++ return RewriteFstatatSIGSYS();
++ }
++#endif
++
++#if defined(__NR_fstatat64)
++ if (sysno == __NR_fstatat64) {
++ return RewriteFstatatSIGSYS();
++ }
++#endif
++
+ if (SyscallSets::IsFileSystem(sysno) ||
+ SyscallSets::IsCurrentDirectory(sysno)) {
+ return Error(fs_denied_errno);
+diff -up
chromium-88.0.4324.96/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc.fstatfix
chromium-88.0.4324.96/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
+---
chromium-88.0.4324.96/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc.fstatfix 2021-01-25
10:13:10.179774081 -0500
++++ chromium-88.0.4324.96/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc 2021-01-25
10:16:18.790525746 -0500
+@@ -6,6 +6,8 @@
+
+ #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h"
+
++#include <errno.h>
++#include <fcntl.h>
+ #include <stddef.h>
+ #include <stdint.h>
+ #include <string.h>
+@@ -355,6 +357,35 @@ intptr_t SIGSYSSchedHandler(const struct
+ return -ENOSYS;
+ }
+
++intptr_t SIGSYSFstatatHandler(const struct arch_seccomp_data& args,
++ void* aux) {
++ switch (args.nr) {
++#if defined(__NR_newfstatat)
++ case __NR_newfstatat:
++#endif
++#if defined(__NR_fstatat64)
++ case __NR_fstatat64:
++#endif
++#if defined(__NR_newfstatat) || defined(__NR_fstatat64)
++ if (*reinterpret_cast<const char *>(args.args[1]) == '\0'
++ && args.args[3] == static_cast<uint64_t>(AT_EMPTY_PATH)) {
++ return sandbox::sys_fstat64(static_cast<int>(args.args[0]),
++ reinterpret_cast<struct stat64
*>(args.args[2]));
++ } else {
++ errno = EACCES;
++ return -1;
++ }
++ break;
++#endif
++ }
++
++ CrashSIGSYS_Handler(args, aux);
++
++ // Should never be reached.
++ RAW_CHECK(false);
++ return -ENOSYS;
++}
++
+ bpf_dsl::ResultExpr CrashSIGSYS() {
+ return bpf_dsl::Trap(CrashSIGSYS_Handler, NULL);
+ }
+@@ -387,6 +418,10 @@ bpf_dsl::ResultExpr RewriteSchedSIGSYS()
+ return bpf_dsl::Trap(SIGSYSSchedHandler, NULL);
+ }
+
++bpf_dsl::ResultExpr RewriteFstatatSIGSYS() {
++ return bpf_dsl::Trap(SIGSYSFstatatHandler, NULL);
++}
++
+ void AllocateCrashKeys() {
+ #if !defined(OS_NACL_NONSFI)
+ if (seccomp_crash_key)
+diff -up
chromium-88.0.4324.96/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h.fstatfix
chromium-88.0.4324.96/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h
+---
chromium-88.0.4324.96/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h.fstatfix 2021-01-25
10:16:36.982598236 -0500
++++ chromium-88.0.4324.96/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h 2021-01-25
10:18:45.705111027 -0500
+@@ -62,6 +62,10 @@ SANDBOX_EXPORT intptr_t SIGSYSPtraceFail
+ // sched_setparam(), sched_setscheduler()
+ SANDBOX_EXPORT intptr_t SIGSYSSchedHandler(const arch_seccomp_data& args,
+ void* aux);
++// If the fstatat syscall is actually a disguised fstat, calls the regular fstat
++// syscall, otherwise, crashes in the same way as CrashSIGSYS_Handler.
++SANDBOX_EXPORT intptr_t SIGSYSFstatatHandler(const struct arch_seccomp_data& args,
++ void* aux);
+
+ // Variants of the above functions for use with bpf_dsl.
+ SANDBOX_EXPORT bpf_dsl::ResultExpr CrashSIGSYS();
+@@ -72,6 +76,7 @@ SANDBOX_EXPORT bpf_dsl::ResultExpr Crash
+ SANDBOX_EXPORT bpf_dsl::ResultExpr CrashSIGSYSFutex();
+ SANDBOX_EXPORT bpf_dsl::ResultExpr CrashSIGSYSPtrace();
+ SANDBOX_EXPORT bpf_dsl::ResultExpr RewriteSchedSIGSYS();
++SANDBOX_EXPORT bpf_dsl::ResultExpr RewriteFstatatSIGSYS();
+
+ // Allocates a crash key so that Seccomp information can be recorded.
+ void AllocateCrashKeys();
+diff -up chromium-88.0.4324.96/sandbox/linux/services/syscall_wrappers.cc.fstatfix
chromium-88.0.4324.96/sandbox/linux/services/syscall_wrappers.cc
+--- chromium-88.0.4324.96/sandbox/linux/services/syscall_wrappers.cc.fstatfix 2021-01-25
10:18:53.307141311 -0500
++++ chromium-88.0.4324.96/sandbox/linux/services/syscall_wrappers.cc 2021-01-25
10:19:46.982355293 -0500
+@@ -261,4 +261,13 @@ int sys_sigaction(int signum,
+
+ #endif // defined(MEMORY_SANITIZER)
+
++SANDBOX_EXPORT int sys_fstat64(int fd, struct stat64 *buf)
++{
++#if defined(__NR_fstat64)
++ return syscall(__NR_fstat64, fd, buf);
++#else
++ return syscall(__NR_fstat, fd, buf);
++#endif
++}
++
+ } // namespace sandbox
+diff -up chromium-88.0.4324.96/sandbox/linux/services/syscall_wrappers.h.fstatfix
chromium-88.0.4324.96/sandbox/linux/services/syscall_wrappers.h
+--- chromium-88.0.4324.96/sandbox/linux/services/syscall_wrappers.h.fstatfix 2021-01-25
10:19:53.115379741 -0500
++++ chromium-88.0.4324.96/sandbox/linux/services/syscall_wrappers.h 2021-01-25
10:20:45.485588421 -0500
+@@ -17,6 +17,7 @@ struct sock_fprog;
+ struct rlimit64;
+ struct cap_hdr;
+ struct cap_data;
++struct stat64;
+
+ namespace sandbox {
+
+@@ -84,6 +85,9 @@ SANDBOX_EXPORT int sys_sigaction(int sig
+ const struct sigaction* act,
+ struct sigaction* oldact);
+
++// Recent glibc rewrites fstat to fstatat.
++SANDBOX_EXPORT int sys_fstat64(int fd, struct stat64 *buf);
++
+ } // namespace sandbox
+
+ #endif // SANDBOX_LINUX_SERVICES_SYSCALL_WRAPPERS_H_
diff --git a/chromium-gcc11.patch b/chromium-gcc11.patch
new file mode 100644
index 0000000..75f2299
--- /dev/null
+++ b/chromium-gcc11.patch
@@ -0,0 +1,127 @@
+diff --git a/third_party/angle/src/libANGLE/HandleAllocator.cpp
b/third_party/angle/src/libANGLE/HandleAllocator.cpp
+index 013f1dfb2..3ce63c192 100644
+--- a/third_party/angle/src/libANGLE/HandleAllocator.cpp
++++ b/third_party/angle/src/libANGLE/HandleAllocator.cpp
+@@ -9,6 +9,7 @@
+
+ #include "libANGLE/HandleAllocator.h"
+
++#include <limits>
+ #include <algorithm>
+ #include <functional>
+
+diff --git a/third_party/perfetto/src/trace_processor/containers/string_pool.cc
b/third_party/perfetto/src/trace_processor/containers/string_pool.cc
+index fd651958f..1e8d0606c 100644
+--- a/third_party/perfetto/src/trace_processor/containers/string_pool.cc
++++ b/third_party/perfetto/src/trace_processor/containers/string_pool.cc
+@@ -14,9 +14,9 @@
+ * limitations under the License.
+ */
+
++#include <limits>
+ #include "src/trace_processor/containers/string_pool.h"
+
+-#include <limits>
+
+ #include "perfetto/base/logging.h"
+ #include "perfetto/ext/base/utils.h"
+diff --git a/third_party/perfetto/src/trace_processor/db/column.cc
b/third_party/perfetto/src/trace_processor/db/column.cc
+index 00496b335..0dccfeb8a 100644
+--- a/third_party/perfetto/src/trace_processor/db/column.cc
++++ b/third_party/perfetto/src/trace_processor/db/column.cc
+@@ -14,6 +14,7 @@
+ * limitations under the License.
+ */
+
++#include <limits>
+ #include "src/trace_processor/db/column.h"
+
+ #include "src/trace_processor/db/compare.h"
+diff --git a/third_party/perfetto/src/trace_processor/types/variadic.cc
b/third_party/perfetto/src/trace_processor/types/variadic.cc
+index 837bfeba9..cdd56817d 100644
+--- a/third_party/perfetto/src/trace_processor/types/variadic.cc
++++ b/third_party/perfetto/src/trace_processor/types/variadic.cc
+@@ -14,6 +14,7 @@
+ * limitations under the License.
+ */
+
++#include <limits>
+ #include "src/trace_processor/types/variadic.h"
+
+ namespace perfetto {
+diff --git a/ui/accessibility/platform/ax_platform_atk_hyperlink.cc
b/ui/accessibility/platform/ax_platform_atk_hyperlink.cc
+index be91def6b..73f202356 100644
+--- a/ui/accessibility/platform/ax_platform_atk_hyperlink.cc
++++ b/ui/accessibility/platform/ax_platform_atk_hyperlink.cc
+@@ -245,7 +245,7 @@ static void AXPlatformAtkHyperlinkInit(AXPlatformAtkHyperlink* self,
gpointer) {
+ }
+
+ GType ax_platform_atk_hyperlink_get_type() {
+- static volatile gsize type_volatile = 0;
++ static gsize type_volatile = 0;
+
+ AXPlatformNodeAuraLinux::EnsureGTypeInit();
+
+diff --git a/ui/accessibility/platform/ax_platform_node_auralinux.cc
b/ui/accessibility/platform/ax_platform_node_auralinux.cc
+index 04125c6fd..6c64e5d8e 100644
+--- a/ui/accessibility/platform/ax_platform_node_auralinux.cc
++++ b/ui/accessibility/platform/ax_platform_node_auralinux.cc
+@@ -2274,7 +2274,7 @@ void ClassInit(gpointer class_pointer, gpointer /* class_data */)
{
+ GType GetType() {
+ AXPlatformNodeAuraLinux::EnsureGTypeInit();
+
+- static volatile gsize type_volatile = 0;
++ static gsize type_volatile = 0;
+ if (g_once_init_enter(&type_volatile)) {
+ static const GTypeInfo type_info = {
+ sizeof(AXPlatformNodeAuraLinuxClass), // class_size
+diff --git a/ui/gtk/gtk_key_bindings_handler.cc b/ui/gtk/gtk_key_bindings_handler.cc
+index c663a2074..38a342484 100644
+--- a/ui/gtk/gtk_key_bindings_handler.cc
++++ b/ui/gtk/gtk_key_bindings_handler.cc
+@@ -141,7 +141,7 @@ void GtkKeyBindingsHandler::HandlerClassInit(HandlerClass* klass) {
+ }
+
+ GType GtkKeyBindingsHandler::HandlerGetType() {
+- static volatile gsize type_id_volatile = 0;
++ static gsize type_id_volatile = 0;
+ if (g_once_init_enter(&type_id_volatile)) {
+ GType type_id = g_type_register_static_simple(
+ GTK_TYPE_TEXT_VIEW, g_intern_static_string("GtkKeyBindingsHandler"),
+diff --git a/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc
b/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc
+index c0b5a805b..e6f921926 100644
+--- a/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc
++++ b/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc
+@@ -2,6 +2,7 @@
+ // Use of this source code is governed by a BSD-style license that can be
+ // found in the LICENSE file.
+
++#include <cstddef>
+ #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
+
+ #include "base/observer_list.h"
+diff --git a/components/bookmarks/browser/bookmark_expanded_state_tracker.cc
b/components/bookmarks/browser/bookmark_expanded_state_tracker.cc
+index 4ad2afa1f..5c4596e12 100644
+--- a/components/bookmarks/browser/bookmark_expanded_state_tracker.cc
++++ b/components/bookmarks/browser/bookmark_expanded_state_tracker.cc
+@@ -2,6 +2,7 @@
+ // Use of this source code is governed by a BSD-style license that can be
+ // found in the LICENSE file.
+
++#include <cstddef>
+ #include "components/bookmarks/browser/bookmark_expanded_state_tracker.h"
+
+ #include <stdint.h>
+diff --git a/components/bookmarks/browser/base_bookmark_model_observer.cc
b/components/bookmarks/browser/base_bookmark_model_observer.cc
+index 657a3c96b..ad641a082 100644
+--- a/components/bookmarks/browser/base_bookmark_model_observer.cc
++++ b/components/bookmarks/browser/base_bookmark_model_observer.cc
+@@ -2,6 +2,8 @@
+ // Use of this source code is governed by a BSD-style license that can be
+ // found in the LICENSE file.
+
++#include <cstddef>
++
+ #include "components/bookmarks/browser/base_bookmark_model_observer.h"
+
+ namespace bookmarks {