chore: remove mips64el patches as they've largely been upstreamed (#18628)

This commit is contained in:
Jeremy Apthorp 2019-06-05 16:36:17 -07:00 коммит произвёл GitHub
Родитель a45afddb75
Коммит 4b9da4dd0e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
112 изменённых файлов: 10 добавлений и 73370 удалений

2
DEPS
Просмотреть файл

@ -104,7 +104,7 @@ hooks = [
'action': [ 'action': [
'python', 'python',
'src/electron/script/apply_all_patches.py', 'src/electron/script/apply_all_patches.py',
'src/electron/patches/common/config.json', 'src/electron/patches/config.json',
], ],
}, },
{ {

Просмотреть файл

@ -236,7 +236,7 @@ void CommonWebContentsDelegate::ResetManagedWebContents(bool async) {
// this is guaranteed in the sync mode by the order of declaration, // this is guaranteed in the sync mode by the order of declaration,
// in the async version we maintain a reference until the WebContents // in the async version we maintain a reference until the WebContents
// is destroyed. // is destroyed.
// //electron/patches/common/chromium/content_browser_main_loop.patch // //electron/patches/chromium/content_browser_main_loop.patch
// is required to get the right quit closure for the main message loop. // is required to get the right quit closure for the main message loop.
base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask( base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask(
FROM_HERE, FROM_HERE,

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -1,7 +0,0 @@
{
"src/electron/patches/common/chromium": "src",
"src/electron/patches/common/boringssl": "src/third_party/boringssl/src",
"src/electron/patches/common/v8": "src/v8"
}

7
patches/config.json Normal file
Просмотреть файл

@ -0,0 +1,7 @@
{
"src/electron/patches/chromium": "src",
"src/electron/patches/boringssl": "src/third_party/boringssl/src",
"src/electron/patches/v8": "src/v8"
}

Просмотреть файл

@ -1,38 +0,0 @@
repo: src
patches:
-
author: null
file: Add-support-for-using-seccomp_bpf-on-mips64el.patch
description: null
-
author: null
file: Set-kernal-page-size-to-16K-on-loongson-MIPS-archtec.patch
description: null
-
author: null
file: Add-mips64el-redhat-linux-to-gcc_toolchain-for-mips6.patch
description: null
-
author: null
file: Fix-mips-cross-toolchain-build-src-crypto-ec-p256-64.patch
description: null
-
author: null
file: Fix-error-about-relocation-truncated-to-fit-R_MIPS_C.patch
description: null
-
author: Cheng Zhao <zcbenz@gmail.com>
file: backport-sqlite-8a87f7e.patch
description: null
-
author: Cheng Zhao <zcbenz@gmail.com>
file: backport-sqlite-9851f2e.patch
description: null
-
author: Cheng Zhao <zcbenz@gmail.com>
file: backport-sqlite-3d8ec48.patch
description: null
-
author: Cheng Zhao <zcbenz@gmail.com>
file: support-old-nss.patch
description: null

Просмотреть файл

@ -1,32 +0,0 @@
From c225042994cebe5717013bde26bbad757fefaa17 Mon Sep 17 00:00:00 2001
From: Wang Qing <wangqing-hf@loongson.cn>
Date: Thu, 28 Sep 2017 14:24:17 +0800
Subject: [PATCH] Add mips64el-redhat-linux- to gcc_toolchain for mips64el
cross compile on x64.
---
build/toolchain/linux/BUILD.gn | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/build/toolchain/linux/BUILD.gn b/build/toolchain/linux/BUILD.gn
index bd37707..2fbc4d6e 100644
--- a/build/toolchain/linux/BUILD.gn
+++ b/build/toolchain/linux/BUILD.gn
@@ -172,12 +172,12 @@ gcc_toolchain("mipsel") {
}
gcc_toolchain("mips64el") {
- cc = "gcc"
- cxx = "g++"
- ar = "ar"
+ cc = "mips64el-loongson-linux-gcc"
+ cxx = "mips64el-loongson-linux-g++"
+ ar = "mips64el-loongson-linux-ar"
ld = cxx
- readelf = "readelf"
- nm = "nm"
+ readelf = "mips64el-loongson-linux-readelf"
+ nm = "mips64el-loongson-linux-nm"
toolchain_args = {
cc_wrapper = ""

Просмотреть файл

@ -1,908 +0,0 @@
From d49a019f05d0daead9859dbf21a9f159a8d13e54 Mon Sep 17 00:00:00 2001
From: Wang Qing <wangqing-hf@loongson.cn>
Date: Fri, 14 Jul 2017 16:21:21 +0800
Subject: [PATCH] Add support for using seccomp_bpf on mips64el.
Currently, seccomp_bpf is not supported on mips64el, and the build
configuration sets use_seccomp_bpf=false on mips64el. This CL adds
support for seccomp-bpf on mips64el, and resolves many compiler errors
when compiling on mips64el.
This patch merge into chromium master branch:
https://chromium.googlesource.com/chromium/src/+/534d7ce2af699715acfc4fe516ef3c2ffee65bc5
BUG: 742738
R= machenbach@chromium.org, brettw@chromium.org
---
base/macros.h | 10 +++
.../sandbox_linux/sandbox_seccomp_bpf_linux.cc | 4 +-
sandbox/features.gni | 5 +-
sandbox/linux/BUILD.gn | 1 +
sandbox/linux/bpf_dsl/linux_syscall_ranges.h | 9 ++-
sandbox/linux/bpf_dsl/seccomp_macros.h | 63 +++++++++++++++-
sandbox/linux/bpf_dsl/syscall_set.cc | 5 +-
.../linux/seccomp-bpf-helpers/baseline_policy.cc | 8 +-
.../linux/seccomp-bpf-helpers/sigsys_handlers.cc | 2 +-
sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc | 88 ++++++++++++----------
sandbox/linux/seccomp-bpf-helpers/syscall_sets.h | 13 ++--
sandbox/linux/seccomp-bpf/syscall.cc | 51 ++++++++++++-
sandbox/linux/system_headers/linux_seccomp.h | 3 +
sandbox/linux/system_headers/linux_signal.h | 9 ++-
sandbox/linux/system_headers/linux_syscalls.h | 4 +-
sandbox/linux/system_headers/linux_ucontext.h | 4 +-
.../linux/system_headers/mips64_linux_syscalls.h | 2 +-
.../linux/system_headers/mips64_linux_ucontext.h | 50 ++++++++++++
sandbox/linux/system_headers/mips_linux_syscalls.h | 2 +-
20 files changed, 267 insertions(+), 67 deletions(-)
create mode 100644 sandbox/linux/system_headers/mips64_linux_ucontext.h
diff --git a/base/macros.h b/base/macros.h
index 154d4b0..d88119a 100644
--- a/base/macros.h
+++ b/base/macros.h
@@ -12,6 +12,16 @@
#include <stddef.h> // For size_t.
+// Distinguish mips32.
+#if defined(__mips__) && (_MIPS_SIM == _ABIO32)
+#define __mips32__
+#endif
+
+// Distinguish mips64.
+#if defined(__mips__) && (_MIPS_SIM == _ABI64)
+#define __mips64__
+#endif
+
// Put this in the declarations for a class to be uncopyable.
#define DISALLOW_COPY(TypeName) \
TypeName(const TypeName&) = delete
diff --git a/content/common/sandbox_linux/sandbox_seccomp_bpf_linux.cc b/content/common/sandbox_linux/sandbox_seccomp_bpf_linux.cc
index 9b27f94..1ab05a7 100644
--- a/content/common/sandbox_linux/sandbox_seccomp_bpf_linux.cc
+++ b/content/common/sandbox_linux/sandbox_seccomp_bpf_linux.cc
@@ -47,9 +47,9 @@ using sandbox::bpf_dsl::ResultExpr;
// Make sure that seccomp-bpf does not get disabled by mistake. Also make sure
// that we think twice about this when adding a new architecture.
-#if !defined(ARCH_CPU_ARM64)
+#if !defined(ARCH_CPU_ARM64) && !defined(ARCH_CPU_MIPS64EL)
#error "Seccomp-bpf disabled on supported architecture!"
-#endif // !defined(ARCH_CPU_ARM64)
+#endif // !defined(ARCH_CPU_ARM64) && !defined(ARCH_CPU_MIPS64EL)
#endif //
diff --git a/sandbox/features.gni b/sandbox/features.gni
index aa18c04..89693c5 100644
--- a/sandbox/features.gni
+++ b/sandbox/features.gni
@@ -4,13 +4,14 @@
import("//build/config/nacl/config.gni")
-# The seccomp-bpf sandbox is only supported on five architectures
+# The seccomp-bpf sandbox is only supported on six architectures
# currently.
# Do not disable seccomp_bpf anywhere without talking to
# security@chromium.org!
use_seccomp_bpf =
(is_linux || is_android) &&
(current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm" ||
- current_cpu == "arm64" || current_cpu == "mipsel")
+ current_cpu == "arm64" || current_cpu == "mipsel" ||
+ current_cpu == "mips64el")
use_seccomp_bpf = use_seccomp_bpf || is_nacl_nonsfi
diff --git a/sandbox/linux/BUILD.gn b/sandbox/linux/BUILD.gn
index 421d8b0..4b321e2 100644
--- a/sandbox/linux/BUILD.gn
+++ b/sandbox/linux/BUILD.gn
@@ -431,6 +431,7 @@ source_set("sandbox_services_headers") {
"system_headers/linux_time.h",
"system_headers/linux_ucontext.h",
"system_headers/mips64_linux_syscalls.h",
+ "system_headers/mips64_linux_ucontext.h",
"system_headers/mips_linux_syscalls.h",
"system_headers/mips_linux_ucontext.h",
"system_headers/x86_32_linux_syscalls.h",
diff --git a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
index a747770..334a00b 100644
--- a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
+++ b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
@@ -33,16 +33,19 @@
#define MIN_GHOST_SYSCALL (MIN_PRIVATE_SYSCALL + 0xfff0u)
#define MAX_SYSCALL (MIN_GHOST_SYSCALL + 4u)
-#elif defined(__mips__) && (_MIPS_SIM == _ABIO32)
+#elif defined(__mips32__)
#include <asm/unistd.h> // for __NR_O32_Linux and __NR_Linux_syscalls
#define MIN_SYSCALL __NR_O32_Linux
#define MAX_PUBLIC_SYSCALL (MIN_SYSCALL + __NR_Linux_syscalls)
#define MAX_SYSCALL MAX_PUBLIC_SYSCALL
-#elif defined(__mips__) && (_MIPS_SIM == _ABI64)
+#elif defined(__mips64__)
-#error "Add support to header file"
+#include <asm/unistd.h> // for __NR_64_Linux and __NR_64_Linux_syscalls
+#define MIN_SYSCALL __NR_64_Linux
+#define MAX_PUBLIC_SYSCALL (MIN_SYSCALL + __NR_64_Linux_syscalls)
+#define MAX_SYSCALL MAX_PUBLIC_SYSCALL
#elif defined(__aarch64__)
diff --git a/sandbox/linux/bpf_dsl/seccomp_macros.h b/sandbox/linux/bpf_dsl/seccomp_macros.h
index af70f21..e4e8142 100644
--- a/sandbox/linux/bpf_dsl/seccomp_macros.h
+++ b/sandbox/linux/bpf_dsl/seccomp_macros.h
@@ -190,7 +190,7 @@ typedef user_regs regs_struct;
#define SECCOMP_PT_PARM5(_regs) (_regs).REG_r4
#define SECCOMP_PT_PARM6(_regs) (_regs).REG_r5
-#elif defined(__mips__) && (_MIPS_SIM == _MIPS_SIM_ABI32)
+#elif defined(__mips32__)
#define SECCOMP_ARCH AUDIT_ARCH_MIPSEL
#define SYSCALL_EIGHT_ARGS
// MIPS sigcontext_t is different from i386/x86_64 and ARM.
@@ -224,7 +224,7 @@ typedef user_regs regs_struct;
#define SECCOMP_ARG_LSB_IDX(nr) (offsetof(struct arch_seccomp_data, args) + \
8*(nr) + 0)
-// On Mips we don't have structures like user_regs or user_regs_struct in
+// On MIPS we don't have structures like user_regs or user_regs_struct in
// sys/user.h that we could use, so we just define regs_struct directly.
struct regs_struct {
unsigned long long regs[32];
@@ -244,6 +244,65 @@ struct regs_struct {
#define SECCOMP_PT_PARM3(_regs) (_regs).REG_a2
#define SECCOMP_PT_PARM4(_regs) (_regs).REG_a3
+#elif defined(__mips64__)
+#define SECCOMP_ARCH AUDIT_ARCH_MIPSEL64
+#define SYSCALL_EIGHT_ARGS
+// MIPS sigcontext_t is different from i386/x86_64 and ARM.
+// See </arch/mips/include/uapi/asm/sigcontext.h> in the Linux kernel.
+#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.gregs[_reg])
+// Based on MIPS n64 ABI syscall convention.
+// On MIPS, when an indirect syscall is being made (syscall(__NR_foo)),
+// the real identifier (__NR_foo) is not in v0, but in a0.
+#define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 2)
+#define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 2)
+#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.pc
+#define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 4)
+#define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 5)
+#define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 6)
+#define SECCOMP_PARM4(_ctx) SECCOMP_REG(_ctx, 7)
+#define SECCOMP_PARM5(_ctx) SECCOMP_REG(_ctx, 8)
+#define SECCOMP_PARM6(_ctx) SECCOMP_REG(_ctx, 9)
+#define SECCOMP_PARM7(_ctx) SECCOMP_REG(_ctx, 10)
+#define SECCOMP_PARM8(_ctx) SECCOMP_REG(_ctx, 11)
+#define SECCOMP_NR_IDX (offsetof(struct arch_seccomp_data, nr))
+#define SECCOMP_ARCH_IDX (offsetof(struct arch_seccomp_data, arch))
+#define SECCOMP_IP_MSB_IDX (offsetof(struct arch_seccomp_data, \
+ instruction_pointer) + 4)
+#define SECCOMP_IP_LSB_IDX (offsetof(struct arch_seccomp_data, \
+ instruction_pointer) + 0)
+#define SECCOMP_ARG_MSB_IDX(nr) (offsetof(struct arch_seccomp_data, args) + \
+ 8*(nr) + 4)
+#define SECCOMP_ARG_LSB_IDX(nr) (offsetof(struct arch_seccomp_data, args) + \
+ 8*(nr) + 0)
+
+// On MIPS we don't have structures like user_regs or user_regs_struct in
+// sys/user.h that we could use, so we just define regs_struct directly.
+struct regs_struct {
+ unsigned long long regs[32];
+};
+
+#define REG_a7 regs[11]
+#define REG_a6 regs[10]
+#define REG_a5 regs[9]
+#define REG_a4 regs[8]
+#define REG_a3 regs[7]
+#define REG_a2 regs[6]
+#define REG_a1 regs[5]
+#define REG_a0 regs[4]
+#define REG_v1 regs[3]
+#define REG_v0 regs[2]
+
+#define SECCOMP_PT_RESULT(_regs) (_regs).REG_v0
+#define SECCOMP_PT_SYSCALL(_regs) (_regs).REG_v0
+#define SECCOMP_PT_PARM1(_regs) (_regs).REG_a0
+#define SECCOMP_PT_PARM2(_regs) (_regs).REG_a1
+#define SECCOMP_PT_PARM3(_regs) (_regs).REG_a2
+#define SECCOMP_PT_PARM4(_regs) (_regs).REG_a3
+#define SECCOMP_PT_PARM5(_regs) (_regs).REG_a4
+#define SECCOMP_PT_PARM6(_regs) (_regs).REG_a5
+#define SECCOMP_PT_PARM7(_regs) (_regs).REG_a6
+#define SECCOMP_PT_PARM8(_regs) (_regs).REG_a7
+
#elif defined(__aarch64__)
struct regs_struct {
unsigned long long regs[31];
diff --git a/sandbox/linux/bpf_dsl/syscall_set.cc b/sandbox/linux/bpf_dsl/syscall_set.cc
index 3d61fa3..b975a2b 100644
--- a/sandbox/linux/bpf_dsl/syscall_set.cc
+++ b/sandbox/linux/bpf_dsl/syscall_set.cc
@@ -14,9 +14,12 @@ namespace sandbox {
namespace {
-#if defined(__mips__) && (_MIPS_SIM == _MIPS_SIM_ABI32)
+#if defined(__mips32__)
// This is true for Mips O32 ABI.
static_assert(MIN_SYSCALL == __NR_Linux, "min syscall number should be 4000");
+#elif defined(__mips64__)
+// This is true for MIPS N64 ABI.
+static_assert(MIN_SYSCALL == __NR_Linux, "min syscall number should be 5000");
#else
// This true for supported architectures (Intel and ARM EABI).
static_assert(MIN_SYSCALL == 0u,
diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
index 4889a9a..d06e765 100644
--- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
@@ -86,7 +86,7 @@ bool IsBaselinePolicyWatched(int sysno) {
SyscallSets::IsNuma(sysno) ||
SyscallSets::IsPrctl(sysno) ||
SyscallSets::IsProcessGroupOrSession(sysno) ||
-#if defined(__i386__) || defined(__mips__)
+#if defined(__i386__) || defined(__mips32__)
SyscallSets::IsSocketCall(sysno) ||
#endif
#if defined(__arm__)
@@ -147,7 +147,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
if (sysno == __NR_fcntl)
return RestrictFcntlCommands();
-#if defined(__i386__) || defined(__arm__) || defined(__mips__)
+#if defined(__i386__) || defined(__arm__) || defined(__mips32__)
if (sysno == __NR_fcntl64)
return RestrictFcntlCommands();
#endif
@@ -191,7 +191,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
return RestrictMmapFlags();
#endif
-#if defined(__i386__) || defined(__arm__) || defined(__mips__)
+#if defined(__i386__) || defined(__arm__) || defined(__mips32__)
if (sysno == __NR_mmap2)
return RestrictMmapFlags();
#endif
@@ -241,7 +241,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
return Error(EPERM);
}
-#if defined(__i386__) || defined(__mips__)
+#if defined(__i386__) || defined(__mips32__)
if (SyscallSets::IsSocketCall(sysno))
return RestrictSocketcallCommand();
#endif
diff --git a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
index e6c64de..68890d2 100644
--- a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
+++ b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
@@ -95,7 +95,7 @@ void PrintSyscallError(uint32_t sysno) {
sysno_base10[i] = '0' + mod;
}
-#if defined(__mips__) && (_MIPS_SIM == _MIPS_SIM_ABI32)
+#if defined(__mips32__)
static const char kSeccompErrorPrefix[] = __FILE__
":**CRASHING**:" SECCOMP_MESSAGE_COMMON_CONTENT " in syscall 4000 + ";
#else
diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
index 1d9f95c..9f1cdef 100644
--- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
@@ -28,7 +28,7 @@ bool SyscallSets::IsKill(int sysno) {
bool SyscallSets::IsAllowedGettime(int sysno) {
switch (sysno) {
case __NR_gettimeofday:
-#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__mips32__)
case __NR_time:
#endif
return true;
@@ -38,11 +38,11 @@ bool SyscallSets::IsAllowedGettime(int sysno) {
case __NR_clock_gettime:
case __NR_clock_nanosleep: // Could be allowed.
case __NR_clock_settime: // Privileged.
-#if defined(__i386__) || defined(__mips__)
+#if defined(__i386__) || defined(__mips32__)
case __NR_ftime: // Obsolete.
#endif
case __NR_settimeofday: // Privileged.
-#if defined(__i386__) || defined(__mips__)
+#if defined(__i386__) || defined(__mips32__)
case __NR_stime:
#endif
default:
@@ -97,7 +97,9 @@ bool SyscallSets::IsFileSystem(int sysno) {
case __NR_stat: // EPERM not a valid errno.
case __NR_symlink:
case __NR_unlink:
+#if !defined(__mips64__)
case __NR_uselib: // Neither EPERM, nor ENOENT are valid errno.
+#endif
case __NR_ustat: // Same as above. Deprecated.
case __NR_utimes:
#endif // !defined(__aarch64__)
@@ -108,7 +110,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
case __NR_fchownat: // Should be called chownat ?
#if defined(__x86_64__) || defined(__aarch64__)
case __NR_newfstatat: // fstatat(). EPERM not a valid errno.
-#elif defined(__i386__) || defined(__arm__) || defined(__mips__)
+#elif defined(__i386__) || defined(__arm__) || defined(__mips32__)
case __NR_fstatat64:
#endif
#if defined(__i386__) || defined(__arm__)
@@ -117,7 +119,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
case __NR_linkat:
case __NR_lookup_dcookie: // ENOENT not a valid errno.
-#if defined(__i386__) || defined(__arm__) || defined(__mips__)
+#if defined(__i386__) || defined(__arm__) || defined(__mips32__)
case __NR_lstat64:
#endif
case __NR_memfd_create:
@@ -131,16 +133,16 @@ bool SyscallSets::IsFileSystem(int sysno) {
case __NR_readlinkat:
case __NR_renameat:
case __NR_renameat2:
-#if defined(__i386__) || defined(__arm__) || defined(__mips__)
+#if defined(__i386__) || defined(__arm__) || defined(__mips32__)
case __NR_stat64:
#endif
case __NR_statfs: // EPERM not a valid errno.
-#if defined(__i386__) || defined(__arm__) || defined(__mips__)
+#if defined(__i386__) || defined(__arm__) || defined(__mips32__)
case __NR_statfs64:
#endif
case __NR_symlinkat:
case __NR_truncate:
-#if defined(__i386__) || defined(__arm__) || defined(__mips__)
+#if defined(__i386__) || defined(__arm__) || defined(__mips32__)
case __NR_truncate64:
#endif
case __NR_unlinkat:
@@ -157,7 +159,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
switch (sysno) {
case __NR_fstat:
-#if defined(__i386__) || defined(__arm__) || defined(__mips__)
+#if defined(__i386__) || defined(__arm__) || defined(__mips32__)
case __NR_fstat64:
#endif
return true;
@@ -174,7 +176,7 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
case __NR_fdatasync: // EPERM not a valid errno.
case __NR_flock: // EPERM not a valid errno.
case __NR_fstatfs: // Give information about the whole filesystem.
-#if defined(__i386__) || defined(__arm__) || defined(__mips__)
+#if defined(__i386__) || defined(__arm__) || defined(__mips32__)
case __NR_fstatfs64:
#endif
case __NR_fsync: // EPERM not a valid errno.
@@ -202,14 +204,14 @@ bool SyscallSets::IsDeniedFileSystemAccessViaFd(int sysno) {
#if defined(__i386__) || defined(__arm__)
case __NR_fchown32:
#endif
-#if defined(__i386__) || defined(__arm__) || defined(__mips__)
+#if defined(__i386__) || defined(__arm__) || defined(__mips32__)
case __NR_ftruncate64:
#endif
#if !defined(__aarch64__)
case __NR_getdents: // EPERM not a valid errno.
#endif
case __NR_getdents64: // EPERM not a valid errno.
-#if defined(__i386__) || defined(__mips__)
+#if defined(__i386__) || defined(__mips32__)
case __NR_readdir:
#endif
return true;
@@ -299,7 +301,7 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) {
case __NR_rt_sigaction:
case __NR_rt_sigprocmask:
case __NR_rt_sigreturn:
-#if defined(__i386__) || defined(__arm__) || defined(__mips__)
+#if defined(__i386__) || defined(__arm__) || defined(__mips32__)
case __NR_sigaction:
case __NR_sigprocmask:
case __NR_sigreturn:
@@ -315,11 +317,11 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) {
case __NR_signalfd:
#endif
case __NR_signalfd4:
-#if defined(__i386__) || defined(__arm__) || defined(__mips__)
+#if defined(__i386__) || defined(__arm__) || defined(__mips32__)
case __NR_sigpending:
case __NR_sigsuspend:
#endif
-#if defined(__i386__) || defined(__mips__)
+#if defined(__i386__) || defined(__mips32__)
case __NR_signal:
case __NR_sgetmask: // Obsolete.
case __NR_ssetmask:
@@ -343,7 +345,7 @@ bool SyscallSets::IsAllowedOperationOnFd(int sysno) {
#endif
return true;
case __NR_fcntl:
-#if defined(__i386__) || defined(__arm__) || defined(__mips__)
+#if defined(__i386__) || defined(__arm__) || defined(__mips32__)
case __NR_fcntl64:
#endif
default:
@@ -460,12 +462,14 @@ bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {
}
}
-#if defined(__i386__) || defined(__mips__)
+#if defined(__i386__) || defined(__mips32__)
// Big multiplexing system call for sockets.
bool SyscallSets::IsSocketCall(int sysno) {
switch (sysno) {
+#if !defined(__mips64__)
case __NR_socketcall:
return true;
+#endif
default:
return false;
}
@@ -500,10 +504,10 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
defined(__aarch64__)
case __NR_mmap:
#endif
-#if defined(__i386__) || defined(__arm__) || defined(__mips__)
+#if defined(__i386__) || defined(__arm__) || defined(__mips32__)
case __NR_mmap2:
#endif
-#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__mips32__)
case __NR_modify_ldt:
#endif
case __NR_mprotect:
@@ -524,7 +528,7 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
bool SyscallSets::IsAllowedGeneralIo(int sysno) {
switch (sysno) {
case __NR_lseek:
-#if defined(__i386__) || defined(__arm__) || defined(__mips__)
+#if defined(__i386__) || defined(__arm__) || defined(__mips32__)
case __NR__llseek:
#endif
#if !defined(__aarch64__)
@@ -534,7 +538,7 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
case __NR_pselect6:
case __NR_read:
case __NR_readv:
-#if defined(__arm__) || defined(__mips__)
+#if defined(__arm__) || defined(__mips32__)
case __NR_recv:
#endif
#if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
@@ -548,7 +552,7 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
#if defined(__i386__) || defined(__arm__) || defined(__mips__)
case __NR__newselect:
#endif
-#if defined(__arm__) || defined(__mips__)
+#if defined(__arm__) || defined(__mips32__)
case __NR_send:
#endif
#if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
@@ -566,7 +570,7 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
case __NR_pwritev:
case __NR_recvmmsg: // Could specify source.
case __NR_sendfile:
-#if defined(__i386__) || defined(__arm__) || defined(__mips__)
+#if defined(__i386__) || defined(__arm__) || defined(__mips32__)
case __NR_sendfile64:
#endif
case __NR_sendmmsg: // Could specify destination.
@@ -608,7 +612,7 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
case __NR_nanosleep:
return true;
case __NR_getpriority:
-#if defined(__i386__) || defined(__arm__) || defined(__mips__)
+#if defined(__i386__) || defined(__arm__) || defined(__mips32__)
case __NR_nice:
#endif
case __NR_setpriority:
@@ -619,7 +623,7 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
bool SyscallSets::IsAdminOperation(int sysno) {
switch (sysno) {
-#if defined(__i386__) || defined(__arm__) || defined(__mips__)
+#if defined(__i386__) || defined(__arm__) || defined(__mips32__)
case __NR_bdflush:
#endif
case __NR_kexec_load:
@@ -667,7 +671,7 @@ bool SyscallSets::IsFsControl(int sysno) {
case __NR_quotactl:
case __NR_swapoff:
case __NR_swapon:
-#if defined(__i386__) || defined(__mips__)
+#if defined(__i386__) || defined(__mips32__)
case __NR_umount:
#endif
case __NR_umount2:
@@ -718,7 +722,7 @@ bool SyscallSets::IsGlobalProcessEnvironment(int sysno) {
#if defined(__i386__) || defined(__arm__)
case __NR_ugetrlimit:
#endif
-#if defined(__i386__) || defined(__mips__)
+#if defined(__i386__) || defined(__mips32__)
case __NR_ulimit:
#endif
case __NR_getrusage:
@@ -799,10 +803,9 @@ bool SyscallSets::IsKeyManagement(int sysno) {
}
}
-#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
-bool SyscallSets::IsSystemVSemaphores(int sysno) {
- switch (sysno) {
- case __NR_semctl:
+#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \
+ defined(__mips64__)
+bool SyscallSets::IsSystemVSemaphores(int sysno) { switch (sysno) { case __NR_semctl:
case __NR_semget:
case __NR_semop:
case __NR_semtimedop:
@@ -813,7 +816,8 @@ bool SyscallSets::IsSystemVSemaphores(int sysno) {
}
#endif
-#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
+#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \
+ defined(__mips64__)
// These give a lot of ambient authority and bypass the setuid sandbox.
bool SyscallSets::IsSystemVSharedMemory(int sysno) {
switch (sysno) {
@@ -828,7 +832,8 @@ bool SyscallSets::IsSystemVSharedMemory(int sysno) {
}
#endif
-#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
+#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \
+ defined(__mips64__)
bool SyscallSets::IsSystemVMessageQueue(int sysno) {
switch (sysno) {
case __NR_msgctl:
@@ -842,12 +847,14 @@ bool SyscallSets::IsSystemVMessageQueue(int sysno) {
}
#endif
-#if defined(__i386__) || defined(__mips__)
+#if defined(__i386__) || defined(__mips32__)
// Big system V multiplexing system call.
bool SyscallSets::IsSystemVIpc(int sysno) {
switch (sysno) {
+#if !defined(__mips64__)
case __NR_ipc:
return true;
+#endif
default:
return false;
}
@@ -855,10 +862,11 @@ bool SyscallSets::IsSystemVIpc(int sysno) {
#endif
bool SyscallSets::IsAnySystemV(int sysno) {
-#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
+#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) \
+ || defined(__mips64__)
return IsSystemVMessageQueue(sysno) || IsSystemVSemaphores(sysno) ||
IsSystemVSharedMemory(sysno);
-#elif defined(__i386__) || defined(__mips__)
+#elif defined(__i386__) || defined(__mips32__)
return IsSystemVIpc(sysno);
#endif
}
@@ -973,13 +981,13 @@ bool SyscallSets::IsMisc(int sysno) {
#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
case __NR_afs_syscall:
#endif
-#if defined(__i386__) || defined(__mips__)
+#if defined(__i386__) || defined(__mips32__)
case __NR_break:
#endif
#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
case __NR_getpmsg:
#endif
-#if defined(__i386__) || defined(__mips__)
+#if defined(__i386__) || defined(__mips32__)
case __NR_gtty:
case __NR_idle:
case __NR_lock:
@@ -993,7 +1001,7 @@ bool SyscallSets::IsMisc(int sysno) {
#if defined(__x86_64__)
case __NR_security:
#endif
-#if defined(__i386__) || defined(__mips__)
+#if defined(__i386__) || defined(__mips32__)
case __NR_stty:
#endif
#if defined(__x86_64__)
@@ -1048,7 +1056,9 @@ bool SyscallSets::IsMipsPrivate(int sysno) {
bool SyscallSets::IsMipsMisc(int sysno) {
switch (sysno) {
case __NR_sysmips:
+#if !defined(__mips64__)
case __NR_unused150:
+#endif
return true;
default:
return false;
diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
index 5ba6335..c31d5e9 100644
--- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
@@ -42,7 +42,7 @@ class SANDBOX_EXPORT SyscallSets {
static bool IsAllowedGetOrModifySocket(int sysno);
static bool IsDeniedGetOrModifySocket(int sysno);
-#if defined(__i386__) || defined(__mips__)
+#if defined(__i386__) || defined(__mips32__)
// Big multiplexing system call for sockets.
static bool IsSocketCall(int sysno);
#endif
@@ -70,19 +70,22 @@ class SANDBOX_EXPORT SyscallSets {
// Asynchronous I/O API.
static bool IsAsyncIo(int sysno);
static bool IsKeyManagement(int sysno);
-#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
+#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \
+ defined(__mips64__)
static bool IsSystemVSemaphores(int sysno);
#endif
-#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
+#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \
+ defined(__mips64__)
// These give a lot of ambient authority and bypass the setuid sandbox.
static bool IsSystemVSharedMemory(int sysno);
#endif
-#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
+#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \
+ defined(__mips64__)
static bool IsSystemVMessageQueue(int sysno);
#endif
-#if defined(__i386__) || defined(__mips__)
+#if defined(__i386__) || defined(__mips32__)
// Big system V multiplexing system call.
static bool IsSystemVIpc(int sysno);
#endif
diff --git a/sandbox/linux/seccomp-bpf/syscall.cc b/sandbox/linux/seccomp-bpf/syscall.cc
index 4d55936..d6db70f 100644
--- a/sandbox/linux/seccomp-bpf/syscall.cc
+++ b/sandbox/linux/seccomp-bpf/syscall.cc
@@ -188,7 +188,7 @@ asm(// We need to be able to tell the kernel exactly where we made a
".fnend\n"
#endif
"9:.size SyscallAsm, 9b-SyscallAsm\n"
-#elif defined(__mips__)
+#elif defined(__mips32__)
".text\n"
".option pic2\n"
".align 4\n"
@@ -240,6 +240,53 @@ asm(// We need to be able to tell the kernel exactly where we made a
".set pop\n"
".end SyscallAsm\n"
".size SyscallAsm,.-SyscallAsm\n"
+#elif defined(__mips64__)
+ ".text\n"
+ ".option pic2\n"
+ ".global SyscallAsm\n"
+ ".type SyscallAsm, @function\n"
+ "SyscallAsm:.ent SyscallAsm\n"
+ ".frame $sp, 16, $ra\n"
+ ".set push\n"
+ ".set noreorder\n"
+ "daddiu $sp, $sp, -16\n"
+ ".cpsetup $25, 0, SyscallAsm\n"
+ "sd $ra, 8($sp)\n"
+ // Check if "v0" is negative. If so, do not attempt to make a
+ // system call. Instead, compute the return address that is visible
+ // to the kernel after we execute "syscall". This address can be
+ // used as a marker that BPF code inspects.
+ "bgez $v0, 1f\n"
+ " nop\n"
+ // This is equivalent to "la $v0, 2f".
+ // LA macro has to be avoided since LLVM-AS has issue with LA in PIC mode
+ // https://llvm.org/bugs/show_bug.cgi?id=27644
+ "ld $v0, %got(2f)($gp)\n"
+ "daddiu $v0, $v0, %lo(2f)\n"
+ "b 2f\n"
+ " nop\n"
+ // On MIPS N64 all eight arguments go to registers a0 - a7
+ // We can go ahead and directly copy the entries from the arguments array
+ // into the appropriate CPU registers.
+ "1:ld $a7, 56($a0)\n"
+ "ld $a6, 48($a0)\n"
+ "ld $a5, 40($a0)\n"
+ "ld $a4, 32($a0)\n"
+ "ld $a3, 24($a0)\n"
+ "ld $a2, 16($a0)\n"
+ "ld $a1, 8($a0)\n"
+ "ld $a0, 0($a0)\n"
+ // Enter the kernel
+ "syscall\n"
+ // This is our "magic" return address that the BPF filter sees.
+ // Restore the return address from the stack.
+ "2:ld $ra, 8($sp)\n"
+ ".cpreturn\n"
+ "jr $ra\n"
+ "daddiu $sp, $sp, 16\n"
+ ".set pop\n"
+ ".end SyscallAsm\n"
+ ".size SyscallAsm,.-SyscallAsm\n"
#elif defined(__aarch64__)
".text\n"
".align 2\n"
@@ -358,7 +405,7 @@ intptr_t Syscall::Call(int nr,
ret = inout;
}
#elif defined(__mips__)
- int err_status;
+ intptr_t err_status;
intptr_t ret = Syscall::SandboxSyscallRaw(nr, args, &err_status);
if (err_status) {
diff --git a/sandbox/linux/system_headers/linux_seccomp.h b/sandbox/linux/system_headers/linux_seccomp.h
index 3deb3d2..a60fe2a 100644
--- a/sandbox/linux/system_headers/linux_seccomp.h
+++ b/sandbox/linux/system_headers/linux_seccomp.h
@@ -48,6 +48,9 @@
#ifndef AUDIT_ARCH_MIPSEL
#define AUDIT_ARCH_MIPSEL (EM_MIPS|__AUDIT_ARCH_LE)
#endif
+#ifndef AUDIT_ARCH_MIPSEL64
+#define AUDIT_ARCH_MIPSEL64 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
+#endif
#ifndef AUDIT_ARCH_AARCH64
#define AUDIT_ARCH_AARCH64 (EM_AARCH64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
#endif
diff --git a/sandbox/linux/system_headers/linux_signal.h b/sandbox/linux/system_headers/linux_signal.h
index fb9a47b..5ac4fdb 100644
--- a/sandbox/linux/system_headers/linux_signal.h
+++ b/sandbox/linux/system_headers/linux_signal.h
@@ -116,13 +116,20 @@ typedef siginfo_t LinuxSigInfo;
#endif // !defined(__native_client_nonsfi__)
// struct sigset_t is different size in PNaCl from the Linux's.
-#if defined(__mips__)
+#if defined(__mips32__)
#if !defined(_NSIG_WORDS)
#define _NSIG_WORDS 4
#endif
struct LinuxSigSet {
unsigned long sig[_NSIG_WORDS];
};
+#elif defined(__mips64__)
+#if !defined(_NSIG_WORDS)
+#define _NSIG_WORDS 2
+#endif
+struct LinuxSigSet {
+ unsigned long sig[_NSIG_WORDS];
+};
#else
typedef uint64_t LinuxSigSet;
#endif
diff --git a/sandbox/linux/system_headers/linux_syscalls.h b/sandbox/linux/system_headers/linux_syscalls.h
index 2b441e4..761c08a 100644
--- a/sandbox/linux/system_headers/linux_syscalls.h
+++ b/sandbox/linux/system_headers/linux_syscalls.h
@@ -21,11 +21,11 @@
#include "sandbox/linux/system_headers/arm_linux_syscalls.h"
#endif
-#if defined(__mips__) && (_MIPS_SIM == _ABIO32)
+#if defined(__mips32__)
#include "sandbox/linux/system_headers/mips_linux_syscalls.h"
#endif
-#if defined(__mips__) && (_MIPS_SIM == _ABI64)
+#if defined(__mips64__)
#include "sandbox/linux/system_headers/mips64_linux_syscalls.h"
#endif
diff --git a/sandbox/linux/system_headers/linux_ucontext.h b/sandbox/linux/system_headers/linux_ucontext.h
index ea4d8a6..e97d727 100644
--- a/sandbox/linux/system_headers/linux_ucontext.h
+++ b/sandbox/linux/system_headers/linux_ucontext.h
@@ -13,8 +13,10 @@
#include "sandbox/linux/system_headers/i386_linux_ucontext.h"
#elif defined(__x86_64__)
#include "sandbox/linux/system_headers/x86_64_linux_ucontext.h"
-#elif defined(__mips__)
+#elif defined(__mips32__)
#include "sandbox/linux/system_headers/mips_linux_ucontext.h"
+#elif defined(__mips64__)
+#include "sandbox/linux/system_headers/mips64_linux_ucontext.h"
#elif defined(__aarch64__)
#include "sandbox/linux/system_headers/arm64_linux_ucontext.h"
#else
diff --git a/sandbox/linux/system_headers/mips64_linux_syscalls.h b/sandbox/linux/system_headers/mips64_linux_syscalls.h
index 90f3d1be..ec75815 100644
--- a/sandbox/linux/system_headers/mips64_linux_syscalls.h
+++ b/sandbox/linux/system_headers/mips64_linux_syscalls.h
@@ -6,7 +6,7 @@
#ifndef SANDBOX_LINUX_SYSTEM_HEADERS_MIPS64_LINUX_SYSCALLS_H_
#define SANDBOX_LINUX_SYSTEM_HEADERS_MIPS64_LINUX_SYSCALLS_H_
-#if !defined(__mips__) || (_MIPS_SIM != _ABI64)
+#if !defined(__mips__)
#error "Including header on wrong architecture"
#endif
diff --git a/sandbox/linux/system_headers/mips64_linux_ucontext.h b/sandbox/linux/system_headers/mips64_linux_ucontext.h
new file mode 100644
index 0000000..3d10479
--- /dev/null
+++ b/sandbox/linux/system_headers/mips64_linux_ucontext.h
@@ -0,0 +1,50 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SANDBOX_LINUX_SYSTEM_HEADERS_MIPS64_LINUX_UCONTEXT_H_
+#define SANDBOX_LINUX_SYSTEM_HEADERS_MIPS64_LINUX_UCONTEXT_H_
+
+#include <stdint.h>
+
+// This is mostly copied from breakpad (common/android/include/sys/ucontext.h),
+// except we do use sigset_t for uc_sigmask instead of a custom type.
+#if !defined(__BIONIC_HAVE_UCONTEXT_T)
+// Ensure that 'stack_t' is defined.
+#include <asm/signal.h>
+
+// We also need greg_t for the sandbox, include it in this header as well.
+typedef unsigned long greg_t;
+
+typedef struct {
+ uint64_t gregs[32];
+ uint64_t fpregs[32];
+ uint64_t mdhi;
+ uint64_t hi1;
+ uint64_t hi2;
+ uint64_t hi3;
+ uint64_t mdlo;
+ uint64_t lo1;
+ uint64_t lo2;
+ uint64_t lo3;
+ uint64_t pc;
+ uint32_t fpc_csr;
+ uint32_t used_math;
+ uint32_t dsp;
+ uint32_t reserved;
+} mcontext_t;
+
+typedef struct ucontext {
+ uint32_t uc_flags;
+ struct ucontext* uc_link;
+ stack_t uc_stack;
+ mcontext_t uc_mcontext;
+ sigset_t uc_sigmask;
+ // Other fields are not used by Google Breakpad. Don't define them.
+} ucontext_t;
+
+#else
+#include <sys/ucontext.h>
+#endif // __BIONIC_HAVE_UCONTEXT_T
+
+#endif // SANDBOX_LINUX_SYSTEM_HEADERS_MIPS64_LINUX_UCONTEXT_H_
diff --git a/sandbox/linux/system_headers/mips_linux_syscalls.h b/sandbox/linux/system_headers/mips_linux_syscalls.h
index 784d6b8..ddbf97f 100644
--- a/sandbox/linux/system_headers/mips_linux_syscalls.h
+++ b/sandbox/linux/system_headers/mips_linux_syscalls.h
@@ -6,7 +6,7 @@
#ifndef SANDBOX_LINUX_SYSTEM_HEADERS_MIPS_LINUX_SYSCALLS_H_
#define SANDBOX_LINUX_SYSTEM_HEADERS_MIPS_LINUX_SYSCALLS_H_
-#if !defined(__mips__) || (_MIPS_SIM != _ABIO32)
+#if !defined(__mips__)
#error "Including header on wrong architecture"
#endif

Просмотреть файл

@ -1,43 +0,0 @@
From 0c64df90e4ca25644ac5aa3f35ab4884f697165e Mon Sep 17 00:00:00 2001
From: Wang Qing <wangqing-hf@loongson.cn>
Date: Mon, 9 Oct 2017 16:53:22 +0800
Subject: [PATCH] Fix error about "relocation truncated to fit: R_MIPS_CALL16"
when cross-compiling shared_library with is_debug on x64.
---
content/common/BUILD.gn | 5 +++++
ppapi/proxy/BUILD.gn | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn
index fd5c0dc..e91e8348 100644
--- a/content/common/BUILD.gn
+++ b/content/common/BUILD.gn
@@ -15,6 +15,11 @@ if (is_mac) {
import("//build/config/mac/mac_sdk.gni")
}
+if (is_debug && current_cpu == "mips64el") {
+ cflags_cc = [ "-mxgot" ]
+ cflags_cc += [ "-mlong-calls" ]
+}
+
# For feature flags internal to content. See content/public/common:features
# for feature flags that clients of contents need to know about.
buildflag_header("features") {
diff --git a/ppapi/proxy/BUILD.gn b/ppapi/proxy/BUILD.gn
index b572778..a2630f20 100644
--- a/ppapi/proxy/BUILD.gn
+++ b/ppapi/proxy/BUILD.gn
@@ -8,6 +8,11 @@ config("proxy_implementation") {
defines = [ "PPAPI_PROXY_IMPLEMENTATION" ]
}
+if (is_debug && current_cpu == "mips64el") {
+ cflags_cc = [ "-mxgot" ]
+ cflags_cc += [ "-mlong-calls" ]
+}
+
component("proxy") {
output_name = "ppapi_proxy"

Просмотреть файл

@ -1,27 +0,0 @@
From 317dff3f396f5e0fc7010a76d7ccbcb708e515a3 Mon Sep 17 00:00:00 2001
From: Wang Qing <wangqing-hf@loongson.cn>
Date: Sat, 30 Sep 2017 09:30:05 +0800
Subject: [PATCH] Fix mips cross-toolchain build src/crypto/ec/p256-64.c with
-O2.
---
third_party/boringssl/BUILD.gn | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn
index abe39b2..a7bd880 100644
--- a/third_party/boringssl/BUILD.gn
+++ b/third_party/boringssl/BUILD.gn
@@ -32,6 +32,12 @@ config("internal_config") {
]
if (is_posix) {
cflags_c = [ "-std=c99" ]
+ # TODO(wangqing): Fix mips cross-toolchain build src/crypto/ec/p256-64.c
+ # with -O2.
+ if (current_cpu == "mips64el" && current_cpu != host_cpu) {
+ cflags_c += [ "-O1" ]
+ }
+
defines += [ "_XOPEN_SOURCE=700" ]
}
}

Просмотреть файл

@ -1,54 +0,0 @@
From 81bbd23ad0649bfd381eaeecbd58c2c43ba08122 Mon Sep 17 00:00:00 2001
From: Wang Qing <wangqing-hf@loongson.cn>
Date: Thu, 14 Sep 2017 20:51:10 +0800
Subject: [PATCH] Set kernal page size to 16K on loongson(MIPS) archtecture.
This patch is specail used for mips64.
---
base/allocator/partition_allocator/page_allocator.h | 7 +++++++
base/allocator/partition_allocator/partition_alloc.h | 5 +++++
2 files changed, 12 insertions(+)
diff --git a/base/allocator/partition_allocator/page_allocator.h b/base/allocator/partition_allocator/page_allocator.h
index f57beb7..0ef1705 100644
--- a/base/allocator/partition_allocator/page_allocator.h
+++ b/base/allocator/partition_allocator/page_allocator.h
@@ -17,6 +17,8 @@ namespace base {
#if defined(OS_WIN)
static const size_t kPageAllocationGranularityShift = 16; // 64KB
+#elif __mips__
+static const size_t kPageAllocationGranularityShift = 14; // 64KB
#else
static const size_t kPageAllocationGranularityShift = 12; // 4KB
#endif
@@ -29,7 +31,12 @@ static const size_t kPageAllocationGranularityBaseMask =
// All Blink-supported systems have 4096 sized system pages and can handle
// permissions and commit / decommit at this granularity.
+// But, on mips have 16384 sized system pages.
+#ifdef __mips__
+static const size_t kSystemPageSize = 16384;
+#else
static const size_t kSystemPageSize = 4096;
+#endif
static const size_t kSystemPageOffsetMask = kSystemPageSize - 1;
static const size_t kSystemPageBaseMask = ~kSystemPageOffsetMask;
diff --git a/base/allocator/partition_allocator/partition_alloc.h b/base/allocator/partition_allocator/partition_alloc.h
index c720a50..67c3598 100644
--- a/base/allocator/partition_allocator/partition_alloc.h
+++ b/base/allocator/partition_allocator/partition_alloc.h
@@ -94,7 +94,12 @@ static const size_t kBucketShift = (kAllocationGranularity == 8) ? 3 : 2;
// system page of the span. For our current max slot span size of 64k and other
// constant values, we pack _all_ PartitionAllocGeneric() sizes perfectly up
// against the end of a system page.
+// On mips have 16KB pagesize, So kPartitionPageSize is 64KB.
+#ifdef __mips__
+static const size_t kPartitionPageShift = 16; // 64KB
+#else
static const size_t kPartitionPageShift = 14; // 16KB
+#endif
static const size_t kPartitionPageSize = 1 << kPartitionPageShift;
static const size_t kPartitionPageOffsetMask = kPartitionPageSize - 1;
static const size_t kPartitionPageBaseMask = ~kPartitionPageOffsetMask;

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,308 +0,0 @@
commit 8715f5df5f531eb997dcc20c1427cabf5a3284ab
Author: Victor Costan <pwnall@chromium.org>
Date: Tue Jan 30 06:22:31 2018 +0000
sqlite: Refactor BUILD.gn.
This CL contains the following refactorings.
1) The preprocessor defines ("compile-time options" in the SQLite
documentation [1]) used to build the SQLite library bundled with Chromium
are extracted in a "chromium_sqlite3_compile_options" configuration.
2) The "chromium_sqlite3_compile_options" configuration is injected into
all the targets that depend on //third_party/sqlite (when using
Chromium's bundled SQLite library), so sqlite.h is parsed with the
same preprocessor defines used to compile the library. This will
become important when we start disabling the SQLite features we don't
use.
3) The SQLite shell is compiled with the same preprocessor defines and
disabled warnings as the SQLite library. The shell is only built on
Linux for the purpose of debugging SQLite issues, and does not ship
with Chrome.
4) The configuration used when we rely on the system's SQLite library
(so the SQLite bundled with Chromium is not built) is renamed from
"sqlite_config" to "system_sqlite_config".
[1] https://www.sqlite.org/compile.html
Bug: 807093
Change-Id: Ibf495ef3c4635a9b40c35e9998694293899d10d9
Reviewed-on: https://chromium-review.googlesource.com/892096
Reviewed-by: Chris Mumford <cmumford@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532792}
diff --git a/third_party/sqlite/BUILD.gn b/third_party/sqlite/BUILD.gn
index 795bd8b..c23f10a 100644
--- a/third_party/sqlite/BUILD.gn
+++ b/third_party/sqlite/BUILD.gn
@@ -11,6 +11,98 @@ declare_args() {
use_system_sqlite = is_ios
}
+# Compile-time options passed to SQLite.
+#
+# These options are used when building our own SQLite library, which happens
+# everywhere except on iOS. These compile-time options are exported via a
+# public_config to all targets using SQLite, because they're needed by the
+# sqlite.h header. To avoid name clashes (macro names are resolved using a
+# global namespace), this block should only contain preprocessor macros that
+# are unambiguously connected to SQLite.
+#
+# The vast majority of the macros here are documented at
+# https://www.sqlite.org/compile.html
+config("chromium_sqlite3_compile_options") {
+ defines = [
+ "SQLITE_ENABLE_FTS3",
+
+ # New unicode61 tokenizer with built-in tables.
+ "SQLITE_DISABLE_FTS3_UNICODE",
+
+ # Chromium currently does not enable fts4, disable extra code.
+ "SQLITE_DISABLE_FTS4_DEFERRED",
+ "SQLITE_ENABLE_ICU",
+ "SQLITE_ENABLE_MEMORY_MANAGEMENT",
+ "SQLITE_SECURE_DELETE",
+
+ # Custom flag to tweak pcache pools.
+ # TODO(shess): This shouldn't use faux-SQLite naming.
+ "SQLITE_SEPARATE_CACHE_POOLS",
+
+ # TODO(shess): SQLite adds mutexes to protect structures which cross
+ # threads. In theory Chromium should be able to turn this to "2" which
+ # should give a slight speed boost. "2" is safe as long as a single
+ # connection is not used by more than one thread at a time.
+ "SQLITE_THREADSAFE=1",
+
+ # SQLite can spawn threads to sort in parallel if configured
+ # appropriately. Chromium doesn't configure SQLite for that, and would
+ # prefer to control distribution to worker threads.
+ "SQLITE_MAX_WORKER_THREADS=0",
+
+ # Allow 256MB mmap footprint per connection. Should not be too open-ended
+ # as that could cause memory fragmentation. 50MB encompasses the 99th
+ # percentile of Chrome databases in the wild.
+ # TODO(shess): A 64-bit-specific value could be 1G or more.
+ # TODO(shess): Figure out if exceeding this is costly.
+ "SQLITE_MAX_MMAP_SIZE=268435456",
+
+ # Use a read-only memory map when mmap'ed I/O is enabled to prevent memory
+ # stompers from directly corrupting the database.
+ # TODO(shess): Upstream the ability to use this define.
+ "SQLITE_MMAP_READ_ONLY=1",
+
+ # By default SQLite pre-allocates 100 pages of pcache data, which will not
+ # be released until the handle is closed. This is contrary to Chromium's
+ # memory-usage goals.
+ "SQLITE_DEFAULT_PCACHE_INITSZ=0",
+
+ # NOTE(shess): Some defines can affect the amalgamation. Those should be
+ # added to google_generate_amalgamation.sh, and the amalgamation
+ # re-generated. Usually this involves disabling features which include
+ # keywords or syntax, for instance SQLITE_OMIT_VIRTUALTABLE omits the
+ # virtual table syntax entirely. Missing an item usually results in
+ # syntax working but execution failing. Review:
+ # src/src/parse.py
+ # src/tool/mkkeywordhash.c
+ ]
+
+ # Pull in config.h on Linux. This allows use of preprocessor macros which
+ # are not available to the build config.
+ if (is_linux) {
+ defines += [ "_HAVE_SQLITE_CONFIG_H" ]
+ }
+
+ if (using_sanitizer) {
+ # Limit max length of data blobs and queries for fuzzing builds by 128 MB.
+ defines += [
+ "SQLITE_MAX_LENGTH=128000000",
+ "SQLITE_MAX_SQL_LENGTH=128000000",
+ "SQLITE_PRINTF_PRECISION_LIMIT=1280000",
+ ]
+
+ # During fuzz testing, valid SQL queries generated by fuzzing engine may
+ # lead to large memory allocations. If that happens, fuzzer reports an
+ # out-of-memory error. However, such errors are not valid bugs.
+ # To avoid hitting those irrelevant OOMs, we limit max number of memory
+ # pages, so fuzzer will not crash when reaching the limit.
+ # Apply this for fuzzing builds only, not for all builds with sanitizers.
+ if (use_fuzzing_engine) {
+ defines += [ "SQLITE_MAX_PAGE_COUNT=16384" ]
+ }
+ }
+}
+
if (!use_system_sqlite) {
config("sqlite_warnings") {
cflags = []
@@ -46,59 +138,8 @@ if (!use_system_sqlite) {
]
cflags = []
- defines = [
- "SQLITE_ENABLE_FTS3",
-
- # New unicode61 tokenizer with built-in tables.
- "SQLITE_DISABLE_FTS3_UNICODE",
-
- # Chromium currently does not enable fts4, disable extra code.
- "SQLITE_DISABLE_FTS4_DEFERRED",
- "SQLITE_ENABLE_ICU",
- "SQLITE_ENABLE_MEMORY_MANAGEMENT",
- "SQLITE_SECURE_DELETE",
-
- # Custom flag to tweak pcache pools.
- # TODO(shess): This shouldn't use faux-SQLite naming.
- "SQLITE_SEPARATE_CACHE_POOLS",
-
- # TODO(shess): SQLite adds mutexes to protect structures which cross
- # threads. In theory Chromium should be able to turn this to "2" which
- # should give a slight speed boost. "2" is safe as long as a single
- # connection is not used by more than one thread at a time.
- "SQLITE_THREADSAFE=1",
-
- # SQLite can spawn threads to sort in parallel if configured
- # appropriately. Chromium doesn't configure SQLite for that, and would
- # prefer to control distribution to worker threads.
- "SQLITE_MAX_WORKER_THREADS=0",
-
- # Allow 256MB mmap footprint per connection. Should not be too open-ended
- # as that could cause memory fragmentation. 50MB encompasses the 99th
- # percentile of Chrome databases in the wild.
- # TODO(shess): A 64-bit-specific value could be 1G or more.
- # TODO(shess): Figure out if exceeding this is costly.
- "SQLITE_MAX_MMAP_SIZE=268435456",
-
- # Use a read-only memory map when mmap'ed I/O is enabled to prevent memory
- # stompers from directly corrupting the database.
- # TODO(shess): Upstream the ability to use this define.
- "SQLITE_MMAP_READ_ONLY=1",
-
- # By default SQLite pre-allocates 100 pages of pcache data, which will not
- # be released until the handle is closed. This is contrary to Chromium's
- # memory-usage goals.
- "SQLITE_DEFAULT_PCACHE_INITSZ=0",
-
- # NOTE(shess): Some defines can affect the amalgamation. Those should be
- # added to google_generate_amalgamation.sh, and the amalgamation
- # re-generated. Usually this involves disabling features which include
- # keywords or syntax, for instance SQLITE_OMIT_VIRTUALTABLE omits the
- # virtual table syntax entirely. Missing an item usually results in
- # syntax working but execution failing. Review:
- # src/src/parse.py
- # src/tool/mkkeywordhash.c
- ]
+ defines = []
+
if (is_component_build) {
if (is_win) {
defines += [ "SQLITE_API=__declspec(dllexport)" ]
@@ -106,6 +147,14 @@ if (!use_system_sqlite) {
defines += [ "SQLITE_API=__attribute__((visibility(\"default\")))" ]
}
}
+
+ if (is_linux || is_android) {
+ defines += [
+ # Linux provides fdatasync(), a faster equivalent of fsync().
+ "fdatasync=fdatasync",
+ ]
+ }
+
if (is_posix) {
defines += [
# Allow xSleep() call on Unix to use usleep() rather than sleep(), so it
@@ -118,42 +167,12 @@ if (!use_system_sqlite) {
"USE_PREAD=1",
]
}
- if (is_linux || is_android) {
- defines += [
- # Linux provides fdatasync(), a faster equivalent of fsync().
- "fdatasync=fdatasync",
- ]
- }
-
- # Pull in config.h on Linux. This allows use of preprocessor macros which
- # are not available to the build config.
- if (is_linux) {
- defines += [ "_HAVE_SQLITE_CONFIG_H" ]
- }
-
- if (using_sanitizer) {
- # Limit max length of data blobs and queries for fuzzing builds by 128 MB.
- defines += [
- "SQLITE_MAX_LENGTH=128000000",
- "SQLITE_MAX_SQL_LENGTH=128000000",
- "SQLITE_PRINTF_PRECISION_LIMIT=1280000",
- ]
-
- # During fuzz testing, valid SQL queries generated by fuzzing engine may
- # lead to large memory allocations. If that happens, fuzzer reports an
- # out-of-memory error. However, such errors are not valid bugs.
- # To avoid hitting those irrelevant OOMs, we limit max number of memory
- # pages, so fuzzer will not crash when reaching the limit.
- # Apply this for fuzzing builds only, not for all builds with sanitizers.
- if (use_libfuzzer || use_afl) {
- defines += [ "SQLITE_MAX_PAGE_COUNT=16384" ]
- }
- }
include_dirs = [ "amalgamation" ]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
+ ":chromium_sqlite3_compile_options",
"//build/config/compiler:no_chromium_code",
# Must be after no_chromium_code for warning flags to be ordered
@@ -195,7 +214,10 @@ if (!use_system_sqlite) {
public_deps = [
":chromium_sqlite3",
]
- public_configs = [ ":sqlite_export" ]
+ public_configs = [
+ ":chromium_sqlite3_compile_options",
+ ":sqlite_export",
+ ]
}
if (is_linux) {
@@ -216,6 +238,16 @@ if (!use_system_sqlite) {
"//build/config:exe_and_shlib_deps",
"//third_party/icu",
]
+
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [
+ ":chromium_sqlite3_compile_options",
+ "//build/config/compiler:no_chromium_code",
+
+ # Must be after no_chromium_code for warning flags to be ordered
+ # correctly.
+ ":sqlite_warnings",
+ ]
}
}
}
@@ -225,7 +257,7 @@ if (use_system_sqlite) {
# version shipped with Chromium. Export a "sqlite" target so the change
# can be localized to this file.
- config("sqlite_config") {
+ config("system_sqlite_config") {
defines = [ "USE_SYSTEM_SQLITE" ]
if (is_ios) {
libs = [ "sqlite3" ]
@@ -235,7 +267,7 @@ if (use_system_sqlite) {
}
source_set("sqlite") {
- public_configs = [ ":sqlite_config" ]
+ public_configs = [ ":system_sqlite_config" ]
if (is_ios) {
public_deps = [
":sqlite_recover",

Просмотреть файл

@ -1,46 +0,0 @@
diff --git a/crypto/nss_util.cc b/crypto/nss_util.cc
index a0e7f61fab0c..fac728a729fb 100644
--- a/crypto/nss_util.cc
+++ b/crypto/nss_util.cc
@@ -623,13 +623,16 @@ class NSSInitSingleton {
EnsureNSPRInit();
- // We *must* have NSS >= 3.26 at compile time.
- static_assert((NSS_VMAJOR == 3 && NSS_VMINOR >= 26) || (NSS_VMAJOR > 3),
- "nss version check failed");
+ // We *must* have NSS >= 3.14.3.
+ static_assert(
+ (NSS_VMAJOR == 3 && NSS_VMINOR == 14 && NSS_VPATCH >= 3) ||
+ (NSS_VMAJOR == 3 && NSS_VMINOR > 14) ||
+ (NSS_VMAJOR > 3),
+ "nss version check failed");
// Also check the run-time NSS version.
// NSS_VersionCheck is a >= check, not strict equality.
- if (!NSS_VersionCheck("3.26")) {
- LOG(FATAL) << "NSS_VersionCheck(\"3.26\") failed. NSS >= 3.26 is "
+ if (!NSS_VersionCheck("3.14.3")) {
+ LOG(FATAL) << "NSS_VersionCheck(\"3.14.3\") failed. NSS >= 3.14.3 is "
"required. Please upgrade to the latest NSS, and if you "
"still get this error, contact your distribution "
"maintainer.";
diff --git a/crypto/scoped_test_nss_db.cc b/crypto/scoped_test_nss_db.cc
index 03470c130371..b334109e0342 100644
--- a/crypto/scoped_test_nss_db.cc
+++ b/crypto/scoped_test_nss_db.cc
@@ -44,6 +44,15 @@ ScopedTestNSSDB::~ScopedTestNSSDB() {
CERT_DestroyCertList(cert_list);
}
+ // Don't close when NSS is < 3.15.1, because it would require an additional
+ // sleep for 1 second after closing the database, due to
+ // http://bugzil.la/875601.
+ if (!NSS_VersionCheck("3.15.1")) {
+ LOG(ERROR) << "NSS version is < 3.15.1, test DB will not be closed.";
+ temp_dir_.Take();
+ return;
+ }
+
// NSS is allowed to do IO on the current thread since dispatching
// to a dedicated thread would still have the affect of blocking
// the current thread, due to NSS's internal locking requirements

Просмотреть файл

@ -1,6 +0,0 @@
repo: src/third_party/ffmpeg
patches:
-
author: Cheng Zhao <zcbenz@gmail.com>
file: Fix-build_ffmpeg-with-cross-prefix-mips64el-redhat-l.patch
description: null

Просмотреть файл

@ -1,22 +0,0 @@
From dcd2071f20aa79f2eb1959cd5f040a0e4a0c058b Mon Sep 17 00:00:00 2001
From: Wang Qing <wangqing-hf@loongson.cn>
Date: Sat, 30 Sep 2017 10:21:25 +0800
Subject: [PATCH] Fix build_ffmpeg with cross-prefix mips64el-redhat-linux-.
---
chromium/scripts/build_ffmpeg.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/chromium/scripts/build_ffmpeg.py b/chromium/scripts/build_ffmpeg.py
index 0dbd9eb..79b5af2 100755
--- a/chromium/scripts/build_ffmpeg.py
+++ b/chromium/scripts/build_ffmpeg.py
@@ -516,7 +516,7 @@ def main(argv):
else:
configure_flags['Common'].extend([
'--enable-cross-compile',
- '--cross-prefix=mips64el-linux-gnuabi64-',
+ '--cross-prefix=mips64el-loongson-linux-',
'--target-os=linux',
'--arch=mips',
'--extra-cflags=-mips64r2',

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше