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

Issue 14954012: Restrict mmap(2) flags for x64. (Closed)

Created:
7 years, 7 months ago by Chris Evans
Modified:
7 years, 7 months ago
CC:
chromium-reviews, joi+watch-content_chromium.org, darin-cc_chromium.org, jam, jln+watch_chromium.org
Visibility:
Public.

Description

Restrict mmap(2) flags for x64. BUG=241220

Patch Set 1 #

Total comments: 5

Patch Set 2 : #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+28 lines, -6 lines) Patch
M content/common/sandbox_seccomp_bpf_linux.cc View 1 3 chunks +28 lines, -6 lines 1 comment Download

Messages

Total messages: 8 (0 generated)
Chris Evans
7 years, 7 months ago (2013-05-15 19:34:34 UTC) #1
jln (very slow on Chromium)
lgtm with quite a few nits. Unless there is a rush, try to have someone ...
7 years, 7 months ago (2013-05-15 20:01:05 UTC) #2
jln (very slow on Chromium)
https://codereview.chromium.org/14954012/diff/4001/content/common/sandbox_seccomp_bpf_linux.cc File content/common/sandbox_seccomp_bpf_linux.cc (right): https://codereview.chromium.org/14954012/diff/4001/content/common/sandbox_seccomp_bpf_linux.cc#newcode1266 content/common/sandbox_seccomp_bpf_linux.cc:1266: #if defined(__x86_64__) Arg, had missed one important nit: #ifdef ...
7 years, 7 months ago (2013-05-15 20:03:52 UTC) #3
jln (DO NOT USE THIS)
https://codereview.chromium.org/14954012/diff/1/content/common/sandbox_seccomp_bpf_linux.cc File content/common/sandbox_seccomp_bpf_linux.cc (right): https://codereview.chromium.org/14954012/diff/1/content/common/sandbox_seccomp_bpf_linux.cc#newcode1280 content/common/sandbox_seccomp_bpf_linux.cc:1280: if (IsBaselinePolicyAllowed(sysno)) { Another remark: The goal of putting ...
7 years, 7 months ago (2013-05-15 20:10:13 UTC) #4
Chris Evans
On 2013/05/15 20:10:13, jln wrote: > https://codereview.chromium.org/14954012/diff/1/content/common/sandbox_seccomp_bpf_linux.cc > File content/common/sandbox_seccomp_bpf_linux.cc (right): > > https://codereview.chromium.org/14954012/diff/1/content/common/sandbox_seccomp_bpf_linux.cc#newcode1280 > ...
7 years, 7 months ago (2013-05-15 22:47:35 UTC) #5
Chris Evans
On 2013/05/15 20:03:52, Julien Tinnes wrote: > https://codereview.chromium.org/14954012/diff/4001/content/common/sandbox_seccomp_bpf_linux.cc > File content/common/sandbox_seccomp_bpf_linux.cc (right): > > https://codereview.chromium.org/14954012/diff/4001/content/common/sandbox_seccomp_bpf_linux.cc#newcode1266 ...
7 years, 7 months ago (2013-05-15 22:48:01 UTC) #6
Chris Evans
On 2013/05/15 20:01:05, Julien Tinnes wrote: > lgtm with quite a few nits. Unless there ...
7 years, 7 months ago (2013-05-15 22:58:12 UTC) #7
Chris Evans
7 years, 7 months ago (2013-05-15 23:11:57 UTC) #8
On 2013/05/15 20:01:05, Julien Tinnes wrote:
> lgtm with quite a few nits. Unless there is a rush, try to have someone do a
> last-look after addressing the nits.
> 
> Also of course make sure you test on ARM (still no good test coverage there).
> 
> I'm wondering if we shouldn't roll this a little bit more cautiously by
putting
> the additional restriction in renderer at first (and leaving the baseline
policy
> as-is).
> 
> Moreover, the baseline policy's goal is to be a one-size-fits-all as much as
> possible, so even if you want to restrict other process types, it may be worth
> doing so in their respective policies. For instance, I think NaCl might need
> more flags and I would love the baseline to still apply there.
> 
>
https://codereview.chromium.org/14954012/diff/1/content/common/sandbox_seccom...
> File content/common/sandbox_seccomp_bpf_linux.cc (right):
> 
>
https://codereview.chromium.org/14954012/diff/1/content/common/sandbox_seccom...
> content/common/sandbox_seccomp_bpf_linux.cc:667: case __NR_mmap:
> Nit: if we keep it this way, let's move mmap and mmap2 down to keep
alphabetical
> ordering!
> 
>
https://codereview.chromium.org/14954012/diff/1/content/common/sandbox_seccom...
> content/common/sandbox_seccomp_bpf_linux.cc:1243: uint32_t mask = ~(MAP_SHARED
|
> MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK |
> want to rename that variable denied_mask to make things more clear?
> 
>
https://codereview.chromium.org/14954012/diff/1/content/common/sandbox_seccom...
> content/common/sandbox_seccomp_bpf_linux.cc:1245: return sandbox->Cond(3,
> ErrorCode::TP_32BIT, ErrorCode::OP_HAS_ANY_BITS,
> Nit:
> 
> I guess we should have provided a OP_HAS_NO_BITS helper, it's a bit confusing
> that we're inverting the order of what's allowed / denied in comparison to the
> other similar functions.
> 
> Can you try to make things a little be more clear by having denied_mask on the
> previous line and the two Trap and ERR_ALLOWED each on their own line ?
> 
>
https://codereview.chromium.org/14954012/diff/1/content/common/sandbox_seccom...
> content/common/sandbox_seccomp_bpf_linux.cc:1260: switch (sysno) {
> If you want to make this a switch, make sure you start the switch on top.
> 
> Then you'd need a default: case as per style guide requirements.
> 
> I wonder if it's worth it though, I found the if () return logic fairly
> readable. Your call.

Sorry, I've made an error, we'll continue on
https://codereview.chromium.org/15112008

Powered by Google App Engine
This is Rietveld 408576698