Class: SeccompTools::Instruction::RET

Inherits:
Base
  • Object
show all
Defined in:
lib/seccomp-tools/instruction/ret.rb

Overview

Instruction ret, terminates the filter with an action such as ALLOW or KILL.

The action comes from either the accumulator register A or the immediate k.

Constant Summary

Constants included from Const::BPF

Const::BPF::ACTION, Const::BPF::COMMAND, Const::BPF::JMP, Const::BPF::MISCOP, Const::BPF::MODE, Const::BPF::OP, Const::BPF::PR_SET_SECCOMP, Const::BPF::SECCOMP_MODE_FILTER, Const::BPF::SECCOMP_MODE_STRICT, Const::BPF::SECCOMP_RET_ACTION_FULL, Const::BPF::SECCOMP_RET_DATA, Const::BPF::SECCOMP_SET_MODE_FILTER, Const::BPF::SECCOMP_SET_MODE_STRICT, Const::BPF::SIZEOF_SECCOMP_DATA, Const::BPF::SRC

Instance Method Summary collapse

Methods inherited from Base

#initialize, #invalid

Methods included from Const::BPF

action_label

Constructor Details

This class inherits a constructor from SeccompTools::Instruction::Base

Instance Method Details

#branchArray

See Base#branch.

Accepts and ignores any arguments, the state is irrelevant here.

Returns:

  • (Array)

    Always an empty array, a filter stops executing at a return.



30
31
32
# File 'lib/seccomp-tools/instruction/ret.rb', line 30

def branch(*)
  []
end

#decompileString

Decompile instruction.

Returns:

  • (String)

    The return as assembly, e.g. "return ERRNO(1)".



14
15
16
# File 'lib/seccomp-tools/instruction/ret.rb', line 14

def decompile
  "return #{ret_str}"
end

#symbolize[:ret, (:a, Integer)]

Returns:

  • ([:ret, (:a, Integer)])

    :a when the action is taken from the A register, otherwise the immediate action value.



21
22
23
# File 'lib/seccomp-tools/instruction/ret.rb', line 21

def symbolize
  [:ret, code & 0x18 == SRC[:a] ? :a : k]
end