New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 742738 link

Starred by 4 users

Issue metadata

Status: Archived
Owner: ----
Closed: Sep 24
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

seccomp_bpf sandbox can‘t support 64-bits LittleEndian targets(mips64el)to compile

Reported by wangqing...@loongson.cn, Jul 14 2017

Issue description

update chromium latest version from https://chromium.googlesource.com/chromium/src.git,and compiled on loongson3a platform(mips64el architecture),but occurs following errors:

[2046/27239] CXX obj/sandbox/linux/seccomp_bpf/policy_compiler.o
FAILED: obj/sandbox/linux/seccomp_bpf/policy_compiler.o
g++ -MMD -MF obj/sandbox/linux/seccomp_bpf/policy_compiler.o.d -DSANDBOX_IMPLEMENTATION -DV8_DEPRECATION_WARNINGS -DUSE_UDEV -DUSE_AURA=1 -DUSE_PANGO=1 -DUSE_CAIRO=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -DUSE_X11=1 -DNO_TCMALLOC -DDISABLE_NACL -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32 -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26 -I../.. -Igen -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -funwind-tables -fPIC -pipe -mips64r2 -Wa,-mips64r2 -pthread -Wall -Wno-unused-local-typedefs -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-unused-parameter -Os -fno-ident -fdata-sections -ffunction-sections -fomit-frame-pointer -g0 -fvisibility=hidden -std=gnu++11 -Wno-narrowing -fno-rtti -fno-exceptions -fvisibility-inlines-hidden -c ../../sandbox/linux/bpf_dsl/policy_compiler.cc -o obj/sandbox/linux/seccomp_bpf/policy_compiler.o
In file included from ../../sandbox/linux/bpf_dsl/policy_compiler.cc:20:0:
../../sandbox/linux/bpf_dsl/seccomp_macros.h:290:2: error:#error Unsupported target platform
#error Unsupported target platform
^
../../sandbox/linux/bpf_dsl/policy_compiler.cc: In member function‘sandbox::CodeGen::Node sandbox::bpf_dsl::PolicyCompiler::CheckArch(sandbox::CodeGen::Node)’:
../../sandbox/linux/bpf_dsl/policy_compiler.cc:147:33: error:‘SECCOMP_ARCH_IDX’ has not been declared in this scope
BPF_LD + BPF_W + BPF_ABS, SECCOMP_ARCH_IDX,
^
../../sandbox/linux/bpf_dsl/policy_compiler.cc:148:55: error:‘SECCOMP_ARCH’ has not been declared in this scope
gen_.MakeInstruction(BPF_JMP + BPF_JEQ + BPF_K, SECCOMP_ARCH, passed,
^
../../sandbox/linux/bpf_dsl/policy_compiler.cc: In member function‘sandbox::CodeGen::Node sandbox::bpf_dsl::PolicyCompiler::MaybeAddEscapeHatch(sandbox::CodeGen::Node)’:
../../sandbox/linux/bpf_dsl/policy_compiler.cc:175:33: error:‘SECCOMP_IP_LSB_IDX’ has not been declared in this scope
BPF_LD + BPF_W + BPF_ABS, SECCOMP_IP_LSB_IDX,
^
../../sandbox/linux/bpf_dsl/policy_compiler.cc:179:41: error:‘SECCOMP_IP_MSB_IDX’ has not been declared in this scope
BPF_LD + BPF_W + BPF_ABS, SECCOMP_IP_MSB_IDX,
^
../../sandbox/linux/bpf_dsl/policy_compiler.cc: In member function‘sandbox::CodeGen::Node sandbox::bpf_dsl::PolicyCompiler::DispatchSyscall()’:
../../sandbox/linux/bpf_dsl/policy_compiler.cc:197:33: error:‘SECCOMP_NR_IDX’has not been declared in this scope
BPF_LD + BPF_W + BPF_ABS, SECCOMP_NR_IDX, CheckSyscallNumber(jumptable));
^
../../sandbox/linux/bpf_dsl/policy_compiler.cc: In member function‘sandbox::CodeGen::Node sandbox::bpf_dsl::PolicyCompiler::MaskedEqualHalf(int, size_t, uint64_t, uint64_t, sandbox::bpf_dsl::PolicyCompiler::ArgHalf, sandbox::CodeGen::Node, sandbox::CodeGen::Node)’:
../../sandbox/linux/bpf_dsl/policy_compiler.cc:324:53: error:‘SECCOMP_ARG_MSB_IDX’ has not been declared in this scope
const uint32_t upper = SECCOMP_ARG_MSB_IDX(argno);
^
../../sandbox/linux/bpf_dsl/policy_compiler.cc:325:53: error:‘SECCOMP_ARG_LSB_IDX’ has not been declared in this scope
const uint32_t lower = SECCOMP_ARG_LSB_IDX(argno);
^
../../sandbox/linux/bpf_dsl/policy_compiler.cc:368:76: error:‘SECCOMP_ARG_MSB_IDX’ has not been declared in this scope
const uint32_t idx = (half == ArgHalf::UPPER) ? SECCOMP_ARG_MSB_IDX(argno)
^
../../sandbox/linux/bpf_dsl/policy_compiler.cc:369:76: error:‘SECCOMP_ARG_LSB_IDX’ has not been declared in this scope
: SECCOMP_ARG_LSB_IDX(argno);
 
Initial patch that Add support for chromium on mips64el with use seccomp_bpf has just been submitted for a review.

It can be viewed at:
https://chromium-review.googlesource.com/c/571385/
Components: Internals>Sandbox>SiteIsolation
Labels: TE-NeedsTriageHelp
The issue seems to be out of TE-scope. Hence, adding label TE-NeedsTriageHelp for further investigation.

Thanks...!!
Cc: rsesek@chromium.org jorgelo@chromium.org jln@chromium.org
Components: -Internals>Sandbox>SiteIsolation Internals>Sandbox
I guess we need to look at that CL.
Project Member

Comment 5 by bugdroid1@chromium.org, Sep 18 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/534d7ce2af699715acfc4fe516ef3c2ffee65bc5

commit 534d7ce2af699715acfc4fe516ef3c2ffee65bc5
Author: Wang Qing <wangqing-hf@loongson.cn>
Date: Mon Sep 18 23:35:59 2017

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.

R= machenbach@chromium.org, brettw@chromium.org
TBR=jorgelo

Bug:  742738 
Change-Id: I79c5d1800c0a198a70c1f19a818885b726cbcc4f
Reviewed-on: https://chromium-review.googlesource.com/571385
Reviewed-by: Chris Palmer <palmer@chromium.org>
Reviewed-by: Brett Wilson <brettw@chromium.org>
Commit-Queue: Chris Palmer <palmer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#502712}
[modify] https://crrev.com/534d7ce2af699715acfc4fe516ef3c2ffee65bc5/AUTHORS
[modify] https://crrev.com/534d7ce2af699715acfc4fe516ef3c2ffee65bc5/base/macros.h
[modify] https://crrev.com/534d7ce2af699715acfc4fe516ef3c2ffee65bc5/content/common/sandbox_linux/sandbox_seccomp_bpf_linux.cc
[modify] https://crrev.com/534d7ce2af699715acfc4fe516ef3c2ffee65bc5/sandbox/features.gni
[modify] https://crrev.com/534d7ce2af699715acfc4fe516ef3c2ffee65bc5/sandbox/linux/BUILD.gn
[modify] https://crrev.com/534d7ce2af699715acfc4fe516ef3c2ffee65bc5/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
[modify] https://crrev.com/534d7ce2af699715acfc4fe516ef3c2ffee65bc5/sandbox/linux/bpf_dsl/seccomp_macros.h
[modify] https://crrev.com/534d7ce2af699715acfc4fe516ef3c2ffee65bc5/sandbox/linux/bpf_dsl/syscall_set.cc
[modify] https://crrev.com/534d7ce2af699715acfc4fe516ef3c2ffee65bc5/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
[modify] https://crrev.com/534d7ce2af699715acfc4fe516ef3c2ffee65bc5/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
[modify] https://crrev.com/534d7ce2af699715acfc4fe516ef3c2ffee65bc5/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
[modify] https://crrev.com/534d7ce2af699715acfc4fe516ef3c2ffee65bc5/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
[modify] https://crrev.com/534d7ce2af699715acfc4fe516ef3c2ffee65bc5/sandbox/linux/seccomp-bpf/syscall.cc
[modify] https://crrev.com/534d7ce2af699715acfc4fe516ef3c2ffee65bc5/sandbox/linux/system_headers/linux_seccomp.h
[modify] https://crrev.com/534d7ce2af699715acfc4fe516ef3c2ffee65bc5/sandbox/linux/system_headers/linux_signal.h
[modify] https://crrev.com/534d7ce2af699715acfc4fe516ef3c2ffee65bc5/sandbox/linux/system_headers/linux_syscalls.h
[modify] https://crrev.com/534d7ce2af699715acfc4fe516ef3c2ffee65bc5/sandbox/linux/system_headers/linux_ucontext.h
[modify] https://crrev.com/534d7ce2af699715acfc4fe516ef3c2ffee65bc5/sandbox/linux/system_headers/mips64_linux_syscalls.h
[add] https://crrev.com/534d7ce2af699715acfc4fe516ef3c2ffee65bc5/sandbox/linux/system_headers/mips64_linux_ucontext.h
[modify] https://crrev.com/534d7ce2af699715acfc4fe516ef3c2ffee65bc5/sandbox/linux/system_headers/mips_linux_syscalls.h

Cc: wangqing...@loongson.cn
when built with clang, macros.h produces an error:

../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/base/base/important_file_writer.o.d -DV8_DEPRECATION_WARNINGS -DNO_TCMALLOC -DSAFE_BROWSING_DB_REMOTE -DCHROMIUM_BUILD -DFIELDTRIAL_TESTING_ENABLED -DCR_CLANG_REVISION=\"313222-1\" -D_FILE_OFFSET_BITS=64 -DANDROID -DHAVE_SYS_UIO_H -DANDROID_NDK_VERSION_ROLL=r12b_1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -DCOMPONENT_BUILD -D__GNU_SOURCE=1 -D__compiler_offsetof=__builtin_offsetof -Dnan=__builtin_nan -Dsnprintf=snprintf -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DBASE_IMPLEMENTATION -I../.. -Igen -Igen/base/base_jni_headers -Igen/base/base_jni_headers/base -Igen/android_runtime_jni_headers/base -I../../third_party/android_tools/ndk/sources/android/cpufeatures -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -funwind-tables -fPIC -pipe -fcolor-diagnostics -ffunction-sections -fno-short-enums -fintegrated-as --target=mips64el-linux-androideabi --target=mips64el-linux-android -march=mips64el -mcpu=mips64r6 -mmsa -mfp64 -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-covered-switch-default -Wno-unneeded-internal-declaration -Wno-inconsistent-missing-override -Wno-undefined-var-template -Wno-nonportable-include-path -Wno-address-of-packed-member -Wno-unused-lambda-capture -Wno-user-defined-warnings -Wno-enum-compare-switch -Wno-tautological-unsigned-zero-compare -fomit-frame-pointer -g2 -fvisibility=hidden -Xclang -load -Xclang ../../third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang check-auto-raw-pointer -Xclang -plugin-arg-find-bad-constructs -Xclang check-ipc -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wno-char-subscripts -Wexit-time-destructors -Wexit-time-destructors -O2 -fno-ident -fdata-sections -ffunction-sections -std=gnu++14 -fno-rtti -isystem../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include -isystem../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++abi/libcxxabi/include -isystem../../third_party/android_tools/ndk/sources/android/support/include --sysroot=../../third_party/android_tools/ndk/platforms/android-21/arch-mips64 -fno-exceptions -fvisibility-inlines-hidden -c ../../base/files/important_file_writer.cc -o obj/base/base/important_file_writer.o
In file included from ../../base/files/important_file_writer.cc:5:
In file included from ../../base/files/important_file_writer.h:11:
In file included from ../../base/callback.h:9:
In file included from ../../base/callback_internal.h:13:
../../base/macros.h:22:9: error: '__mips64__' macro redefined [-Werror,-Wmacro-redefined]
#define __mips64__
        ^
<built-in>:360:9: note: previous definition is here
#define __mips64__ 1
        ^
1 error generated.



I'm actually testing outside of chromium, for libyuv, but the build should be similar:

gn gen out/Release "--args=is_debug=false target_os=\"android\" target_cpu=\"mips64el\" mips_arch_variant=\"r6\" mips_use_msa=true is_component_build=true is_clang=true"
ninja -v -C out/Release libyuv_unittest

Could you add an ifdef around those macros?

OK。
Do I need to reset a new issue? 
Project Member

Comment 8 by bugdroid1@chromium.org, Sep 22 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2d4aa3a485ad0e7dc9b11605972def9e907ac64a

commit 2d4aa3a485ad0e7dc9b11605972def9e907ac64a
Author: Gordana Cmiljanovic <gordana.cmiljanovic@imgtec.com>
Date: Fri Sep 22 14:25:18 2017

Fix __mips64__ macro redefinition

This fixes macro redefinition introduced by:
https://chromium-review.googlesource.com/c/chromium/src/+/571385

Bug:  742738 ,  766913 
Change-Id: Ie2583e3069da939b73208c92ba7c574417ece1af
Reviewed-on: https://chromium-review.googlesource.com/673185
Reviewed-by: Chris Palmer <palmer@chromium.org>
Reviewed-by: Frank Barchard <fbarchard@google.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#503731}
[modify] https://crrev.com/2d4aa3a485ad0e7dc9b11605972def9e907ac64a/base/macros.h

Project Member

Comment 9 by bugdroid1@chromium.org, Sep 22 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/60c5e60549ac037c8fdb1075682180b22fe0c68c

commit 60c5e60549ac037c8fdb1075682180b22fe0c68c
Author: Gordana Cmiljanovic <gordana.cmiljanovic@imgtec.com>
Date: Fri Sep 22 17:12:27 2017

Support seccomp-bpf for mips64el in Android

In addition to:
https://chromium-review.googlesource.com/c/chromium/src/+/571385

Bug:  742738 
Change-Id: I7c2ed6bf2ff5b7a3b9ec2a06bc1cbfd560c1aa99
Reviewed-on: https://chromium-review.googlesource.com/676849
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#503775}
[modify] https://crrev.com/60c5e60549ac037c8fdb1075682180b22fe0c68c/sandbox/linux/seccomp-bpf-helpers/baseline_policy_android.cc

Project Member

Comment 10 by sheriffbot@chromium.org, Sep 24

Status: Archived (was: Unconfirmed)
Issue has not been modified or commented on in the last 365 days, please re-open or file a new bug if this is still an issue.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Sign in to add a comment