bpf_dsl: support arbitrary (arg & mask) == val expressions
commit2761abc6db37817c1d8df352903d3748bc3048cc
authorMatthew Dempsky <mdempsky@chromium.org>
Thu, 4 Sep 2014 21:54:04 +0000 (4 14:54 -0700)
committerMatthew Dempsky <mdempsky@chromium.org>
Thu, 4 Sep 2014 21:56:52 +0000 (4 21:56 +0000)
tree25d223f9de079953eeddba6c222b5aa6859abcfe
parentc03c03be05d34c626b68ab77bbd5be69acb73642
bpf_dsl: support arbitrary (arg & mask) == val expressions

Rework the seccomp_bpf compiler internals to work in terms of a single
general masked-equality condition instead of the variety of limited
condition operators previously supported.  All of the peephole
optimizations previously applied continue to be supported so similar
instructions should be emitted, but the handling of upper/lower words
is more cleanly structured now.

The old sandbox->Cond() interface continues to be supported for now so
that the old seccomp_bpf_unittests continue to give us assurances that
the new code generator is still correct.  Meanwhile, we provide a new
lower-level sandbox->CondMaskedEqual() method that bpf_dsl can now use.

BUG=408845
R=jln@chromium.org

Review URL: https://codereview.chromium.org/530133003

Cr-Commit-Position: refs/heads/master@{#293347}
sandbox/linux/bpf_dsl/bpf_dsl.cc
sandbox/linux/bpf_dsl/bpf_dsl.h
sandbox/linux/bpf_dsl/bpf_dsl_unittest.cc
sandbox/linux/seccomp-bpf/errorcode.cc
sandbox/linux/seccomp-bpf/errorcode.h
sandbox/linux/seccomp-bpf/sandbox_bpf.cc
sandbox/linux/seccomp-bpf/sandbox_bpf.h
sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc
sandbox/linux/seccomp-bpf/verifier.cc