Module: SeccompTools::Explain::Verdict
- Defined in:
- lib/seccomp-tools/explain/verdict.rb
Overview
Decodes the value a filter path returns into the action it stands for: the label a policy
shows (+ALLOW+, ERRNO(5), ...) and where that action sorts among the buckets.
Constant Summary collapse
- ORDER =
Buckets are printed in this order; unlisted actions sort last.
%i[ALLOW USER_NOTIF LOG TRACE TRAP ERRNO KILL KILL_PROCESS UNKNOWN].freeze
Class Method Summary collapse
-
.action_of(label) ⇒ Symbol
The bare action symbol of a label, recovered by stripping any
(data)/ + (annotation)+ suffix Verdict.label appended. -
.label(ret) ⇒ String
The label for the value
reta leaf returns, including theSECCOMP_RET_DATApart when it is meaningful for the action. -
.rank(label) ⇒ Array(Integer, String)
Where the bucket labeled
labelsorts: by its action's position in ORDER, then alphabetically.
Class Method Details
.action_of(label) ⇒ Symbol
The bare action symbol of a label, recovered by stripping any (data) / + (annotation)+
suffix label appended. Safe because no action name itself contains " (".
39 40 41 |
# File 'lib/seccomp-tools/explain/verdict.rb', line 39 def action_of(label) label.sub(/\s*\(.*/, '').to_sym end |
.label(ret) ⇒ String
The label for the value ret a leaf returns, including the SECCOMP_RET_DATA part when
it is meaningful for the action.
19 20 21 22 23 24 25 |
# File 'lib/seccomp-tools/explain/verdict.rb', line 19 def label(ret) return 'UNKNOWN' unless ret.imm? # An unrecognized action value loads fine; the kernel treats it as KILL_PROCESS # (KILL_THREAD before Linux 4.14). See seccomp(2). Const::BPF.action_label(ret.val) || format('KILL_PROCESS (unknown action 0x%x)', ret.val) end |