Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1602)

Issue 196793023: Add seccomp sandbox for non-SFI NaCl (Closed)

Created:
6 years, 9 months ago by hamaji
Modified:
6 years, 8 months ago
CC:
chromium-reviews, hidehiko, kmixter1, dvyukov, Alexander Potapenko
Visibility:
Public.

Description

Add seccomp sandbox for non-SFI NaCl All syscalls except whitelisted ones will cause SIGSYS. We test the sandbox with BPF_TEST and BPF_TEST_DEATH, which appropriately fork the process so the main process of the test will never enable the sandbox. TEST=Our app works with this sandbox on i686 and ARM TEST=Build chrome and nacl_helper on i686, x86-64, and ARM TEST=./out/Release/components_unittests --gtest_filter='NaClNonSfi*' # on i686, x86-64, and ARM TEST=SFI NaCl apps still work TEST=trybots BUG=359285 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=264383

Patch Set 1 #

Total comments: 25

Patch Set 2 : #

Patch Set 3 : #

Total comments: 17

Patch Set 4 : #

Patch Set 5 : #

Patch Set 6 : #

Total comments: 9

Patch Set 7 : #

Patch Set 8 : #

Patch Set 9 : #

Patch Set 10 : #

Patch Set 11 : #

Patch Set 12 : #

Patch Set 13 : #

Total comments: 8

Patch Set 14 : #

Patch Set 15 : #

Total comments: 23

Patch Set 16 : #

Patch Set 17 : #

Total comments: 16

Patch Set 18 : allow shutdown and pwrite64 #

Patch Set 19 : #

Total comments: 2

Patch Set 20 : #

Patch Set 21 : remove one more unittest for shutdown #

Total comments: 57

Patch Set 22 : #

Patch Set 23 : #

Total comments: 12

Patch Set 24 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1519 lines, -22 lines) Patch
M components/components_tests.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +10 lines, -0 lines 0 comments Download
M components/nacl.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 5 chunks +27 lines, -13 lines 0 comments Download
M components/nacl/loader/nacl_helper_linux.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +2 lines, -1 line 0 comments Download
M components/nacl/loader/nonsfi/DEPS View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
A components/nacl/loader/nonsfi/nonsfi_sandbox.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +39 lines, -0 lines 0 comments Download
A components/nacl/loader/nonsfi/nonsfi_sandbox.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +315 lines, -0 lines 0 comments Download
A components/nacl/loader/nonsfi/nonsfi_sandbox_sigsys_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +609 lines, -0 lines 0 comments Download
A components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +461 lines, -0 lines 0 comments Download
M sandbox/linux/sandbox_linux.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +16 lines, -0 lines 0 comments Download
M sandbox/linux/sandbox_linux_test_sources.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +1 line, -4 lines 0 comments Download
M sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +7 lines, -0 lines 0 comments Download
M sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 6 chunks +25 lines, -4 lines 0 comments Download
M sandbox/linux/seccomp-bpf/bpf_tests.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +6 lines, -0 lines 0 comments Download

Messages

Total messages: 38 (0 generated)
hamaji
Julien and Will: PTAL components/nacl/loader/nacl_sandbox_linux.cc Mark: PTAL others In this change, I'd like to focus ...
6 years, 9 months ago (2014-03-14 12:46:22 UTC) #1
hamaji
Julien and Will: PTAL components/nacl/loader/nacl_sandbox_linux.cc Mark: PTAL others In this change, I'd like to focus ...
6 years, 9 months ago (2014-03-14 12:46:23 UTC) #2
Mark Seaborn
I'm not an owner of these seccomp-bpf filters, so Julien might disagree with me about ...
6 years, 9 months ago (2014-03-18 23:53:57 UTC) #3
jln (very slow on Chromium)
We'll also need some testing. This is critical enough that we want a test that ...
6 years, 9 months ago (2014-03-20 00:54:52 UTC) #4
hamaji
As Mark has suggested, it would be better to add tests after Hidehiko finished his ...
6 years, 9 months ago (2014-03-24 15:56:37 UTC) #5
hamaji
A few more questions/comments. https://codereview.chromium.org/196793023/diff/40001/components/nacl/loader/nacl_sandbox_linux.cc File components/nacl/loader/nacl_sandbox_linux.cc (right): https://codereview.chromium.org/196793023/diff/40001/components/nacl/loader/nacl_sandbox_linux.cc#newcode227 components/nacl/loader/nacl_sandbox_linux.cc:227: case __NR_futex: Maybe better to ...
6 years, 9 months ago (2014-03-24 16:25:43 UTC) #6
Mark Seaborn
Julien and I went through this change together today. Can you split out some parts ...
6 years, 9 months ago (2014-03-28 01:38:24 UTC) #7
hamaji
https://codereview.chromium.org/196793023/diff/40001/components/nacl/browser/nacl_process_host.cc File components/nacl/browser/nacl_process_host.cc (right): https://codereview.chromium.org/196793023/diff/40001/components/nacl/browser/nacl_process_host.cc#newcode585 components/nacl/browser/nacl_process_host.cc:585: uses_nonsfi_mode_ ? On 2014/03/28 01:38:25, Mark Seaborn wrote: > ...
6 years, 9 months ago (2014-03-28 12:06:10 UTC) #8
Mark Seaborn
https://codereview.chromium.org/196793023/diff/1/components/nacl/loader/nacl_sandbox_linux.cc File components/nacl/loader/nacl_sandbox_linux.cc (right): https://codereview.chromium.org/196793023/diff/1/components/nacl/loader/nacl_sandbox_linux.cc#newcode246 components/nacl/loader/nacl_sandbox_linux.cc:246: // glibc internally calls brk in its memory allocation. ...
6 years, 9 months ago (2014-03-28 16:41:39 UTC) #9
hamaji
As a preparation (https://codereview.chromium.org/226033002/) is not landed yet, I didn't modify nacl_helper_linux.cc in this change. ...
6 years, 8 months ago (2014-04-07 21:17:59 UTC) #10
jln (very slow on Chromium)
https://codereview.chromium.org/196793023/diff/100001/components/nacl/loader/nonsfi/nonsfi_sandbox.cc File components/nacl/loader/nonsfi/nonsfi_sandbox.cc (right): https://codereview.chromium.org/196793023/diff/100001/components/nacl/loader/nonsfi/nonsfi_sandbox.cc#newcode214 components/nacl/loader/nonsfi/nonsfi_sandbox.cc:214: return ErrorCode(EPERM); Do you want to group all the ...
6 years, 8 months ago (2014-04-08 00:51:09 UTC) #11
hamaji
https://codereview.chromium.org/196793023/diff/100001/components/nacl/loader/nonsfi/nonsfi_sandbox.cc File components/nacl/loader/nonsfi/nonsfi_sandbox.cc (right): https://codereview.chromium.org/196793023/diff/100001/components/nacl/loader/nonsfi/nonsfi_sandbox.cc#newcode214 components/nacl/loader/nonsfi/nonsfi_sandbox.cc:214: return ErrorCode(EPERM); On 2014/04/08 00:51:10, jln wrote: > Do ...
6 years, 8 months ago (2014-04-09 21:09:09 UTC) #12
jln (very slow on Chromium)
This looks pretty much ready to me. Sorry about the little annoyance in the unit ...
6 years, 8 months ago (2014-04-10 21:00:02 UTC) #13
hamaji
https://codereview.chromium.org/196793023/diff/240001/components/nacl/loader/nonsfi/nonsfi_sandbox.cc File components/nacl/loader/nonsfi/nonsfi_sandbox.cc (right): https://codereview.chromium.org/196793023/diff/240001/components/nacl/loader/nonsfi/nonsfi_sandbox.cc#newcode55 components/nacl/loader/nonsfi/nonsfi_sandbox.cc:55: unsigned long denied_mask = ~(O_ACCMODE | O_NONBLOCK); On 2014/04/10 ...
6 years, 8 months ago (2014-04-11 01:25:57 UTC) #14
jln (very slow on Chromium)
I'm only at the beginning of looking at the tests and in a bit of ...
6 years, 8 months ago (2014-04-11 19:29:53 UTC) #15
jln (very slow on Chromium)
https://codereview.chromium.org/196793023/diff/280001/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc File components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc (right): https://codereview.chromium.org/196793023/diff/280001/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc#newcode198 components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc:198: DEATH_MESSAGE(kSeccompFailureMsg), Same remark as above: you need to split ...
6 years, 8 months ago (2014-04-11 20:19:46 UTC) #16
hamaji
https://codereview.chromium.org/196793023/diff/280001/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc File components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc (right): https://codereview.chromium.org/196793023/diff/280001/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc#newcode30 components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc:30: static const char kSeccompFailureMsg[] = "seccomp-bpf failure"; On 2014/04/11 ...
6 years, 8 months ago (2014-04-15 15:09:24 UTC) #17
jln (very slow on Chromium)
This looks pretty much ready to me, with a few nits. Mark, what do you ...
6 years, 8 months ago (2014-04-15 17:52:32 UTC) #18
hamaji
PPAPI tests hidehiko have added recently found we need two more syscalls, shutdown and pwrite64. ...
6 years, 8 months ago (2014-04-15 18:56:05 UTC) #19
jln (very slow on Chromium)
On 2014/04/15 18:56:05, hamaji wrote: > PPAPI tests hidehiko have added recently found we need ...
6 years, 8 months ago (2014-04-15 19:14:00 UTC) #20
hamaji
https://codereview.chromium.org/196793023/diff/320001/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc File components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc (right): https://codereview.chromium.org/196793023/diff/320001/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc#newcode35 components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc:35: On 2014/04/15 17:52:32, jln wrote: > All the BPF_TEST ...
6 years, 8 months ago (2014-04-15 19:31:58 UTC) #21
jln (very slow on Chromium)
lgtm (but let's wait for Mark's review) https://chromiumcodereview.appspot.com/196793023/diff/320001/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc File components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc (right): https://chromiumcodereview.appspot.com/196793023/diff/320001/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc#newcode79 components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc:79: DoClone(); > ...
6 years, 8 months ago (2014-04-15 20:19:51 UTC) #22
hamaji
+jochen for components/components_tests.gyp as it seems this change is almost ready. The background: we are ...
6 years, 8 months ago (2014-04-15 20:37:36 UTC) #23
Mark Seaborn
My only non-trivial comments are: * Some comments are labelled "[For future]": I'd like to ...
6 years, 8 months ago (2014-04-15 23:03:14 UTC) #24
jln (very slow on Chromium)
I agree about the copy-paste issue. Would it be ok with you to handle as ...
6 years, 8 months ago (2014-04-16 01:36:11 UTC) #25
jln (very slow on Chromium)
https://chromiumcodereview.appspot.com/196793023/diff/390001/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc File components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc (right): https://chromiumcodereview.appspot.com/196793023/diff/390001/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc#newcode56 components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc:56: seccomp_bpf_supported = ( Do you mind also adding ASSERT_TRUE(ThreadHelpers::IsSingleThreaded(-1)); ...
6 years, 8 months ago (2014-04-16 01:39:37 UTC) #26
hamaji
Julien, do you have an idea about the failure in this tsan builder? http://build.chromium.org/p/tryserver.chromium/builders/linux_tsan/builds/880 I ...
6 years, 8 months ago (2014-04-16 02:10:47 UTC) #27
hamaji
https://codereview.chromium.org/196793023/diff/390001/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc File components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc (right): https://codereview.chromium.org/196793023/diff/390001/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc#newcode55 components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc:55: #if !defined(THREAD_SANITIZER) On 2014/04/16 01:36:11, jln wrote: > On ...
6 years, 8 months ago (2014-04-16 02:17:59 UTC) #28
jln (very slow on Chromium)
I'm not sure what to do about TSANv1, I only ever ran sandbox_linux_unittests on TSANv2. ...
6 years, 8 months ago (2014-04-16 02:27:33 UTC) #29
dvyukov
On Wed, Apr 16, 2014 at 6:27 AM, <jln@chromium.org> wrote: > I'm not sure what ...
6 years, 8 months ago (2014-04-16 03:41:17 UTC) #30
jochen (gone - plz use gerrit)
components_tests.gypi lgtm
6 years, 8 months ago (2014-04-16 08:54:20 UTC) #31
Mark Seaborn
Please change the commit message (the "Description" field in Rietveld) to start with "Add seccomp ...
6 years, 8 months ago (2014-04-16 16:19:24 UTC) #32
hamaji
https://codereview.chromium.org/196793023/diff/430001/components/nacl/loader/nonsfi/nonsfi_sandbox.cc File components/nacl/loader/nonsfi/nonsfi_sandbox.cc (right): https://codereview.chromium.org/196793023/diff/430001/components/nacl/loader/nonsfi/nonsfi_sandbox.cc#newcode210 components/nacl/loader/nonsfi/nonsfi_sandbox.cc:210: // NaCl runtime exposes clock_gettime and clock_getres to untrusted ...
6 years, 8 months ago (2014-04-16 17:24:15 UTC) #33
hamaji
The CQ bit was checked by hamaji@chromium.org
6 years, 8 months ago (2014-04-17 00:08:17 UTC) #34
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/hamaji@chromium.org/196793023/450001
6 years, 8 months ago (2014-04-17 00:10:00 UTC) #35
commit-bot: I haz the power
Change committed as 264383
6 years, 8 months ago (2014-04-17 01:55:11 UTC) #36
jln (very slow on Chromium)
On 2014/04/17 01:55:11, I haz the power (commit-bot) wrote: > Change committed as 264383 Ohh, ...
6 years, 8 months ago (2014-04-17 02:13:47 UTC) #37
jln (very slow on Chromium)
6 years, 8 months ago (2014-04-17 02:14:39 UTC) #38
Message was sent while issue was closed.
A revert of this CL has been created in
https://codereview.chromium.org/240613003/ by jln@chromium.org.

The reason for reverting is: Broke ASAN on main WF.

/b/build/slave/Linux_ASan_LSan_Builder/build/src/third_party/binutils/Linux_x64/Release/bin/ld:
error:
obj/base/libsanitizer_options.a(obj/base/debug/sanitizer_options.sanitizer_options.o):
multiple definition of '__asan_default_options'
/b/build/slave/Linux_ASan_LSan_Builder/build/src/third_party/binutils/Linux_x64/Release/bin/ld:
obj/components/nacl/loader/nacl_helper.nacl_helper_linux.o: previous definition
here
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed..

Powered by Google App Engine
This is Rietveld 408576698