-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Based on electron24 patches. - Fix rotten patches, Update sandbox patch to fix compilation errors - Fix sandbox patch (a7 register should be in clobber list) - Revert a problematic upstream workaround that is causing a crash in crash handler. - Upstream bug report: https://bugs.chromium.org/p/chromium/issues/detail?id=1472258 - Disable RVV of libyuv because the build of libyuv with RVV at this commit is broken on riscv.
- Loading branch information
1 parent
952dcf5
commit cff60d5
Showing
14 changed files
with
3,836 additions
and
0 deletions.
There are no files selected for viewing
93 changes: 93 additions & 0 deletions
93
electron25/REVERT-problematic-signal-handling-workaround.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
From 879826a42ea58df54dd78f90066fcde3bc752831 Mon Sep 17 00:00:00 2001 | ||
From: Peter McNeeley <[email protected]> | ||
Date: Thu, 09 Feb 2023 17:05:06 +0000 | ||
Subject: [PATCH] Workaround rare for missing default signal handling | ||
|
||
We have seen rare cases on AMD linux where the default signal handler | ||
either does not run or a thread (probably a AMD driver thread) prevents the termination of the gpu process. Here, we now we catch this case | ||
when the alarm fires and then call 'exit_group' to kill all threads of | ||
the process. This has resolved the zombie gpu process issues we have | ||
seen on our context lost test. | ||
|
||
Note that many different calls were tried to kill the process when it | ||
is in this state. Only 'exit_group' was found to cause termination. | ||
|
||
|
||
Bug: 1396451 | ||
Change-Id: I81af62fbf80a4cac95bb83118e0f1cea4cb36aea | ||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4166540 | ||
Commit-Queue: Peter McNeeley <[email protected]> | ||
Reviewed-by: Robert Kroeger <[email protected]> | ||
Reviewed-by: Kyle Charbonneau <[email protected]> | ||
Cr-Commit-Position: refs/heads/main@{#1103311} | ||
--- | ||
|
||
diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc | ||
index 6fc7785..0eaad5c 100644 | ||
--- a/base/debug/stack_trace_posix.cc | ||
+++ b/base/debug/stack_trace_posix.cc | ||
@@ -14,6 +14,7 @@ | ||
#include <string.h> | ||
#include <sys/param.h> | ||
#include <sys/stat.h> | ||
+#include <sys/syscall.h> | ||
#include <sys/types.h> | ||
#include <unistd.h> | ||
|
||
@@ -300,6 +301,27 @@ | ||
std::ignore = HANDLE_EINTR(write(STDERR_FILENO, output, strlen(output))); | ||
} | ||
|
||
+#if BUILDFLAG(IS_LINUX) | ||
+void AlarmSignalHandler(int signal, siginfo_t* info, void* void_context) { | ||
+ // We have seen rare cases on AMD linux where the default signal handler | ||
+ // either does not run or a thread (Probably an AMD driver thread) prevents | ||
+ // the termination of the gpu process. We catch this case when the alarm fires | ||
+ // and then call exit_group() to kill all threads of the process. This has | ||
+ // resolved the zombie gpu process issues we have seen on our context lost | ||
+ // test. | ||
+ // Note that many different calls were tried to kill the process when it is in | ||
+ // this state. Only 'exit_group' was found to cause termination and it is | ||
+ // speculated that only this works because only this exit kills all threads in | ||
+ // the process (not simply the current thread). | ||
+ // See: http://crbug.com/1396451. | ||
+ PrintToStderr( | ||
+ "Warning: Default signal handler failed to terminate process.\n"); | ||
+ PrintToStderr("Calling exit_group() directly to prevent timeout.\n"); | ||
+ // See: https://man7.org/linux/man-pages/man2/exit_group.2.html | ||
+ syscall(SYS_exit_group, EXIT_FAILURE); | ||
+} | ||
+#endif // BUILDFLAG(IS_LINUX) | ||
+ | ||
void StackDumpSignalHandler(int signal, siginfo_t* info, void* void_context) { | ||
// NOTE: This code MUST be async-signal safe. | ||
// NO malloc or stdio is allowed here. | ||
@@ -520,11 +542,27 @@ | ||
PrintToStderr( | ||
"Calling _exit(EXIT_FAILURE). Core file will not be generated.\n"); | ||
_exit(EXIT_FAILURE); | ||
-#endif // !BUILDFLAG(IS_LINUX) | ||
+#else // BUILDFLAG(IS_LINUX) | ||
|
||
// After leaving this handler control flow returns to the point where the | ||
// signal was raised, raising the current signal once again but executing the | ||
// default handler instead of this one. | ||
+ | ||
+ // Set an alarm to trigger in case the default handler does not terminate | ||
+ // the process. See 'AlarmSignalHandler' for more details. | ||
+ struct sigaction action; | ||
+ memset(&action, 0, sizeof(action)); | ||
+ action.sa_flags = static_cast<int>(SA_RESETHAND); | ||
+ action.sa_sigaction = &AlarmSignalHandler; | ||
+ sigemptyset(&action.sa_mask); | ||
+ sigaction(SIGALRM, &action, nullptr); | ||
+ // 'alarm' function is signal handler safe. | ||
+ // https://man7.org/linux/man-pages/man7/signal-safety.7.html | ||
+ // This delay is set to be long enough for the real signal handler to fire but | ||
+ // shorter than chrome's process watchdog timer. | ||
+ constexpr unsigned int kAlarmSignalDelaySeconds = 5; | ||
+ alarm(kAlarmSignalDelaySeconds); | ||
+#endif // !BUILDFLAG(IS_LINUX) | ||
} | ||
|
||
class PrintBacktraceOutputHandler : public BacktraceOutputHandler { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from importlib.util import spec_from_loader, module_from_spec | ||
from importlib.machinery import SourceFileLoader | ||
import sys | ||
import re | ||
|
||
spec = spec_from_loader("deps", SourceFileLoader("deps", sys.argv[2])) | ||
deps = module_from_spec(spec) | ||
|
||
# The DEPS file is not a standard python file | ||
# Let's apply some hacks to trick the interpreter. | ||
deps.Str = str | ||
deps.Var = str | ||
|
||
spec.loader.exec_module(deps) | ||
|
||
match sys.argv[1]: | ||
case 'infra': | ||
# Return the commit of infra repo | ||
infra_rev = deps.vars['luci_go'] | ||
print(infra_rev.split(':')[-1]) | ||
case 'luci_go': | ||
# Return the commit of luci repo | ||
luci_go_rev = deps.deps["infra/go/src/go.chromium.org/luci"] | ||
print(luci_go_rev.split('@')[-1]) | ||
case 'esbuild': | ||
esbuild_ver_full = deps.deps["src/third_party/devtools-frontend/src/third_party/esbuild"]["packages"][0]["version"] | ||
esbuild_ver = re.match("^(.+)\.chromium.*$", esbuild_ver_full.split("@")[-1])[1] | ||
print(esbuild_ver) | ||
case _: | ||
print("Unsupported arguments!", file=sys.stderr) | ||
sys.exit(-1) |
19 changes: 19 additions & 0 deletions
19
electron25/electron25-extensions-common-api-runtime.json-support-riscv64.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- extensions/common/api/runtime.json.orig 2023-07-11 07:42:27.856148697 -0400 | ||
+++ extensions/common/api/runtime.json 2023-07-11 07:43:54.566062017 -0400 | ||
@@ -92,14 +92,14 @@ | ||
{ | ||
"id": "PlatformArch", | ||
"type": "string", | ||
- "enum": ["arm", "arm64", "x86-32", "x86-64", "mips", "mips64"], | ||
+ "enum": ["arm", "arm64", "x86-32", "x86-64", "mips", "mips64", "riscv64"], | ||
"description": "The machine's processor architecture." | ||
}, | ||
{ | ||
"id": "PlatformNaclArch", | ||
"description": "The native client architecture. This may be different from arch on some platforms.", | ||
"type": "string", | ||
- "enum": ["arm", "x86-32", "x86-64", "mips", "mips64"] | ||
+ "enum": ["arm", "x86-32", "x86-64", "mips", "mips64", "riscv64"] | ||
}, | ||
{ | ||
"id": "PlatformInfo", |
12 changes: 12 additions & 0 deletions
12
electron25/electron25-gclient-ignore-prebuilt-platform-specific-deps.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- depot_tools/gclient.py.orig 2023-06-26 16:33:06.394443514 +0200 | ||
+++ depot_tools/gclient.py 2023-06-26 16:33:06.394443514 +0200 | ||
@@ -916,6 +916,9 @@ | ||
hooks_cwd = self.root.root_dir | ||
|
||
for dep in deps_to_add: | ||
+ if '${arch}' in dep.name or '${platform}' in dep.name: | ||
+ print("WARN: ignoring platform-specific dep:", dep.name) | ||
+ continue | ||
if dep.verify_validity(): | ||
self.add_dependency(dep) | ||
self._mark_as_parsed([ |
25 changes: 25 additions & 0 deletions
25
electron25/electron25-partition_alloc.gni-add-missing-riscv64-definition.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
From 056959571def043ca984a8dcb51d5e71cfbdf5e5 Mon Sep 17 00:00:00 2001 | ||
From: kxxt <[email protected]> | ||
Date: Wed, 9 Aug 2023 15:42:58 +0800 | ||
Subject: [PATCH] partition_alloc.gni: riscv64 support | ||
|
||
--- | ||
base/allocator/partition_allocator/partition_alloc.gni | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/base/allocator/partition_allocator/partition_alloc.gni b/base/allocator/partition_allocator/partition_alloc.gni | ||
index 3954743c8c70b..fc2ac45f777d3 100644 | ||
--- a/base/allocator/partition_allocator/partition_alloc.gni | ||
+++ b/base/allocator/partition_allocator/partition_alloc.gni | ||
@@ -15,7 +15,7 @@ if (is_nacl) { | ||
# NaCl targets don't use 64-bit pointers. | ||
has_64_bit_pointers = false | ||
} else if (current_cpu == "x64" || current_cpu == "arm64" || | ||
- current_cpu == "loong64") { | ||
+ current_cpu == "loong64" || current_cpu == "riscv64") { | ||
has_64_bit_pointers = true | ||
} else if (current_cpu == "x86" || current_cpu == "arm") { | ||
has_64_bit_pointers = false | ||
-- | ||
2.41.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Index: src/third_party/angle/gni/angle.gni | ||
=================================================================== | ||
--- src.orig/third_party/angle/gni/angle.gni | ||
+++ src/third_party/angle/gni/angle.gni | ||
@@ -91,7 +91,8 @@ declare_args() { | ||
|
||
if (current_cpu == "arm64" || current_cpu == "x64" || | ||
current_cpu == "mips64el" || current_cpu == "s390x" || | ||
- current_cpu == "ppc64" || current_cpu == "loong64") { | ||
+ current_cpu == "ppc64" || current_cpu == "loong64" || | ||
+ current_cpu == "riscv64") { | ||
angle_64bit_current_cpu = true | ||
} else if (current_cpu == "arm" || current_cpu == "x86" || | ||
current_cpu == "mipsel" || current_cpu == "s390" || | ||
Index: src/third_party/angle/src/common/platform.h | ||
=================================================================== | ||
--- src.orig/third_party/angle/src/common/platform.h | ||
+++ src/third_party/angle/src/common/platform.h | ||
@@ -102,7 +102,7 @@ | ||
#endif | ||
|
||
// Mips and arm devices need to include stddef for size_t. | ||
-#if defined(__mips__) || defined(__arm__) || defined(__aarch64__) | ||
+#if defined(__mips__) || defined(__arm__) || defined(__aarch64__) || defined(__riscv) | ||
# include <stddef.h> | ||
#endif | ||
|
Oops, something went wrong.