| Index: sandbox/linux/seccomp-bpf/codegen.cc
|
| diff --git a/sandbox/linux/seccomp-bpf/codegen.cc b/sandbox/linux/seccomp-bpf/codegen.cc
|
| index aa47155fce7a7178c4ed1948ccf71dd0a5b98884..2273cafe7b3ec9e16b5198d3fdd2469c70a5418d 100644
|
| --- a/sandbox/linux/seccomp-bpf/codegen.cc
|
| +++ b/sandbox/linux/seccomp-bpf/codegen.cc
|
| @@ -181,9 +181,7 @@ Instruction* CodeGen::MakeInstruction(uint16_t code,
|
| if (BPF_CLASS(code) != BPF_JMP || BPF_OP(code) == BPF_JA) {
|
| SANDBOX_DIE("Expected a BPF_JMP instruction");
|
| }
|
| - if (!jt && !jf) {
|
| - // We allow callers to defer specifying exactly one of the branch
|
| - // targets. It must then be set later by calling "JoinInstructions".
|
| + if (!jt || !jf) {
|
| SANDBOX_DIE("Branches must jump to a valid instruction");
|
| }
|
| Instruction* insn = new Instruction(code, k, jt, jf);
|
| @@ -191,35 +189,6 @@ Instruction* CodeGen::MakeInstruction(uint16_t code,
|
| return insn;
|
| }
|
|
|
| -void CodeGen::JoinInstructions(Instruction* head, Instruction* tail) {
|
| - // Merge two instructions, or set the branch target for an "always" jump.
|
| - // This function should be called, if the caller didn't initially provide
|
| - // a value for "next" when creating the instruction.
|
| - if (BPF_CLASS(head->code) == BPF_JMP) {
|
| - if (BPF_OP(head->code) == BPF_JA) {
|
| - if (head->jt_ptr) {
|
| - SANDBOX_DIE("Cannot append instructions in the middle of a sequence");
|
| - }
|
| - head->jt_ptr = tail;
|
| - } else {
|
| - if (!head->jt_ptr && head->jf_ptr) {
|
| - head->jt_ptr = tail;
|
| - } else if (!head->jf_ptr && head->jt_ptr) {
|
| - head->jf_ptr = tail;
|
| - } else {
|
| - SANDBOX_DIE("Cannot append instructions after a jump");
|
| - }
|
| - }
|
| - } else if (BPF_CLASS(head->code) == BPF_RET) {
|
| - SANDBOX_DIE("Cannot append instructions after a return statement");
|
| - } else if (head->next) {
|
| - SANDBOX_DIE("Cannot append instructions in the middle of a sequence");
|
| - } else {
|
| - head->next = tail;
|
| - }
|
| - return;
|
| -}
|
| -
|
| void CodeGen::Traverse(Instruction* instruction,
|
| void (*fnc)(Instruction*, void*),
|
| void* aux) {
|
|
|