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

Issue 576673003: Decouple CodeGen from ErrorCode (Closed)

Created:
6 years, 3 months ago by mdempsky
Modified:
6 years, 3 months ago
CC:
chromium-reviews, jln+watch_chromium.org, leecam
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Decouple CodeGen from ErrorCode CodeGen's only dependency on ErrorCode was one MakeInstruction() overload, which can be removed by making the caller responsible for converting the ErrorCode to a BPF_RET'able value. Fortunately, there are only two uses of this function: 1. SandboxBPF::RetExpression() which is easily fixed by simply calling ErrorCode::err() to get the ErrorCode's error value. 2. codegen_unittest.cc which is merely testing the BPF code generator, and so any return values will do: no need to be seccomp-bpf return values... so just replace them with simple integer values. (While here, change a few bare "BPF_RET" arguments to "BPF_RET + BPF_K" just to be consistent.) After this CL, CodeGen focuses solely on assembling programs for the abstract BPF machine, while higher-level abstractions (primarily SandboxBPF) are responsible for using it in a way that's semantically meaningful for seccomp-bpf. BUG=414363 Committed: https://crrev.com/a5f2064030a34e71157085175b7ae93242509173 Cr-Commit-Position: refs/heads/master@{#295192}

Patch Set 1 #

Total comments: 6

Patch Set 2 : Respond to rickyz@ feedback #

Patch Set 3 : Sync and fix comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+36 lines, -46 lines) Patch
M sandbox/linux/seccomp-bpf/codegen.h View 1 2 3 chunks +2 lines, -3 lines 0 comments Download
M sandbox/linux/seccomp-bpf/codegen.cc View 1 2 1 chunk +0 lines, -11 lines 0 comments Download
M sandbox/linux/seccomp-bpf/codegen_unittest.cc View 1 2 8 chunks +26 lines, -28 lines 0 comments Download
M sandbox/linux/seccomp-bpf/sandbox_bpf.cc View 1 2 1 chunk +8 lines, -4 lines 0 comments Download

Messages

Total messages: 13 (2 generated)
mdempsky
(Similar to https://codereview.chromium.org/572753002/, but decoupling CodeGen instead of Trap now.)
6 years, 3 months ago (2014-09-16 06:54:40 UTC) #2
rickyz (no longer on Chrome)
On 2014/09/16 06:54:40, mdempsky wrote: > (Similar to https://codereview.chromium.org/572753002/, but decoupling CodeGen > instead of ...
6 years, 3 months ago (2014-09-16 22:36:13 UTC) #3
rickyz (no longer on Chrome)
lgtm https://codereview.chromium.org/576673003/diff/1/sandbox/linux/seccomp-bpf/sandbox_bpf.cc File sandbox/linux/seccomp-bpf/sandbox_bpf.cc (right): https://codereview.chromium.org/576673003/diff/1/sandbox/linux/seccomp-bpf/sandbox_bpf.cc#newcode891 sandbox/linux/seccomp-bpf/sandbox_bpf.cc:891: return CondExpression(gen, err); nit: fix indent
6 years, 3 months ago (2014-09-16 22:36:46 UTC) #4
rickyz (no longer on Chrome)
lgtm
6 years, 3 months ago (2014-09-16 22:36:49 UTC) #5
mdempsky
https://codereview.chromium.org/576673003/diff/1/sandbox/linux/seccomp-bpf/sandbox_bpf.cc File sandbox/linux/seccomp-bpf/sandbox_bpf.cc (right): https://codereview.chromium.org/576673003/diff/1/sandbox/linux/seccomp-bpf/sandbox_bpf.cc#newcode891 sandbox/linux/seccomp-bpf/sandbox_bpf.cc:891: return CondExpression(gen, err); On 2014/09/16 22:36:46, rickyz wrote: > ...
6 years, 3 months ago (2014-09-16 22:41:31 UTC) #6
jln (very slow on Chromium)
lgtm https://codereview.chromium.org/576673003/diff/1/sandbox/linux/seccomp-bpf/sandbox_bpf.cc File sandbox/linux/seccomp-bpf/sandbox_bpf.cc (right): https://codereview.chromium.org/576673003/diff/1/sandbox/linux/seccomp-bpf/sandbox_bpf.cc#newcode896 sandbox/linux/seccomp-bpf/sandbox_bpf.cc:896: SANDBOX_DIE("ErrorCode is not suitable for returning from a ...
6 years, 3 months ago (2014-09-16 22:42:29 UTC) #7
rickyz (no longer on Chrome)
Sorry for the spam, still figuring out how to use this thing :-) https://codereview.chromium.org/576673003/diff/1/sandbox/linux/seccomp-bpf/codegen.h File ...
6 years, 3 months ago (2014-09-16 22:44:11 UTC) #8
mdempsky
https://codereview.chromium.org/576673003/diff/1/sandbox/linux/seccomp-bpf/codegen.h File sandbox/linux/seccomp-bpf/codegen.h (right): https://codereview.chromium.org/576673003/diff/1/sandbox/linux/seccomp-bpf/codegen.h#newcode46 sandbox/linux/seccomp-bpf/codegen.h:46: // gen.MakeInstruction(BPF_RET+BPF_K, ErrorCode(ErrorCode::ERR_ALLOWED))); On 2014/09/16 22:44:10, rickyz wrote: > ...
6 years, 3 months ago (2014-09-16 22:47:44 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patchset/576673003/40001
6 years, 3 months ago (2014-09-16 23:07:34 UTC) #11
commit-bot: I haz the power
Committed patchset #3 (id:40001) as 91dd7a2bf7b21749675770fcd97cbcc02253ca18
6 years, 3 months ago (2014-09-17 00:46:11 UTC) #12
commit-bot: I haz the power
6 years, 3 months ago (2014-09-17 00:47:02 UTC) #13
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/a5f2064030a34e71157085175b7ae93242509173
Cr-Commit-Position: refs/heads/master@{#295192}

Powered by Google App Engine
This is Rietveld 408576698