seccomp-tools 1.6.0 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 898cc2a23df6443f39054c4b9027a576fb929729f74fc804ae82ae3b11c6772e
4
- data.tar.gz: 0e07d2d1914ac7185135425d0e34f0dcb1b6100e977176d8bd9ce23f95a3f287
3
+ metadata.gz: e367e58696b5e8ff43054439401688981bcc960c0f80882384054245f21efbe4
4
+ data.tar.gz: 3af03e40f20244cf2bdbc82254a514d84c6792d87bd167305c4b0edd9a356f35
5
5
  SHA512:
6
- metadata.gz: ec604fca33e16dd6ca77e923e34629338245828abdf3c97e9974d205a2306aa9ae0f3bc074b90e056790a8de86ed6484ab17ce190524b30394f2fda2b5dd9432
7
- data.tar.gz: 399e5e77fa99de23f3ad5013c442fc29a800a261d04150ab0bd467744a9302601ca7c60e5570e4e65f423cf4c93e4eb4428ae3f33b97d6a64c223af13b342e47
6
+ metadata.gz: 5d8542e0a5330c40418947ed864a32fb9b125ed6b25aead0faadcb7743cae4c3b03a17a7dfaf41a90e0585e7ffb407e2af00cbc931e9e3c2334f0f176cf368c7
7
+ data.tar.gz: c08c293b669e59d253daec6351f4b43a4ae3d34fe9b25bc9663e5a3f21361f90b15d578cf0c4be1e468b50e8ceb7b3b6e36117eb7aa7bea66dd38fa1cc8680b5
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  [![Build Status](https://github.com/david942j/seccomp-tools/workflows/build/badge.svg)](https://github.com/david942j/seccomp-tools/actions)
2
- [![Code Climate](https://codeclimate.com/github/david942j/seccomp-tools/badges/gpa.svg)](https://codeclimate.com/github/david942j/seccomp-tools)
3
- [![Issue Count](https://codeclimate.com/github/david942j/seccomp-tools/badges/issue_count.svg)](https://codeclimate.com/github/david942j/seccomp-tools)
4
- [![Test Coverage](https://codeclimate.com/github/david942j/seccomp-tools/badges/coverage.svg)](https://codeclimate.com/github/david942j/seccomp-tools/coverage)
2
+ [![Maintainability](https://qlty.sh/gh/david942j/projects/seccomp-tools/maintainability.svg)](https://qlty.sh/gh/david942j/projects/seccomp-tools)
3
+ [![Code Coverage](https://qlty.sh/gh/david942j/projects/seccomp-tools/coverage.svg)](https://qlty.sh/gh/david942j/projects/seccomp-tools)
5
4
  [![Inline docs](https://inch-ci.org/github/david942j/seccomp-tools.svg?branch=master)](https://inch-ci.org/github/david942j/seccomp-tools)
6
5
  [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](https://www.rubydoc.info/github/david942j/seccomp-tools/)
7
6
  [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](http://choosealicense.com/licenses/mit/)
@@ -31,7 +30,7 @@ $ gem install seccomp-tools
31
30
 
32
31
  If you failed when compiling, try:
33
32
  ```
34
- sudo apt install gcc ruby-dev
33
+ sudo apt install gcc ruby-dev make
35
34
  ```
36
35
  and install seccomp-tools again.
37
36
 
@@ -348,6 +347,7 @@ $ seccomp-tools emu --help
348
347
  # Supported architectures are <aarch64|amd64|i386|s390x>.
349
348
  # Default: amd64
350
349
  # -q, --[no-]quiet Run quietly, only show emulation result.
350
+ # -i, --ip=VAL Set instruction pointer.
351
351
 
352
352
  $ seccomp-tools emu spec/data/libseccomp.bpf write 0x3
353
353
  # line CODE JT JF K
@@ -12,6 +12,9 @@ module SeccompTools
12
12
  #
13
13
  # Compile seccomp rules.
14
14
  class Compiler
15
+ # The farthest distance of a relative jump in BPF.
16
+ JUMP_DISTANCE_MAX = 255
17
+
15
18
  # Instantiate a {Compiler} object.
16
19
  #
17
20
  # @param [String] source
@@ -21,7 +24,7 @@ module SeccompTools
21
24
  # @param [Symbol] arch
22
25
  # Architecture.
23
26
  def initialize(source, filename, arch)
24
- @scanner = Scanner.new(source, arch, filename: filename)
27
+ @scanner = Scanner.new(source, arch, filename:)
25
28
  @arch = arch
26
29
  @symbols = {}
27
30
  end
@@ -71,14 +74,11 @@ module SeccompTools
71
74
 
72
75
  jt = resolve_symbol(idx, statement.data[1])
73
76
  jf = resolve_symbol(idx, statement.data[2])
74
- statement.data[1] = jt
75
- statement.data[2] = jf
77
+ statement.data[1] = [jt, statement.data[1]]
78
+ statement.data[2] = [jf, statement.data[2]]
76
79
  end
77
80
  end
78
81
 
79
- # The farthest distance of a relative jump in BPF.
80
- JUMP_DISTANCE_MAX = 255
81
-
82
82
  # @param [Integer] index
83
83
  # @param [SeccompTools::Asm::Token, :next] sym
84
84
  def resolve_symbol(index, sym)
@@ -89,7 +89,7 @@ module SeccompTools
89
89
 
90
90
  if @symbols[str].nil?
91
91
  # special case - goto <n> can be considered as $+1+<n>
92
- return str.to_i if str == str.to_i.to_s && str.to_i <= JUMP_DISTANCE_MAX
92
+ return str.to_i if str == str.to_i.to_s
93
93
 
94
94
  raise SeccompTools::UndefinedLabelError,
95
95
  @scanner.format_error(sym, "Cannot find label '#{str}'")
@@ -100,10 +100,6 @@ module SeccompTools
100
100
  raise SeccompTools::BackwardJumpError,
101
101
  @scanner.format_error(sym, "Does not support backward jumping to '#{str}'")
102
102
  end
103
- if dis > JUMP_DISTANCE_MAX
104
- raise SeccompTools::LongJumpError,
105
- @scanner.format_error(sym, "Does not support jumping farther than #{JUMP_DISTANCE_MAX}, got: #{dis}")
106
- end
107
103
  end
108
104
  end
109
105
 
@@ -122,7 +118,7 @@ module SeccompTools
122
118
  code |= Const::BPF::OP.fetch(a, 0)
123
119
  code |= Const::BPF::MISCOP.fetch(a, 0)
124
120
  end
125
- BPF.new({ code: code, k: k, jt: jt, jf: jf }, @arch, @line)
121
+ BPF.new({ code:, k:, jt:, jf: }, @arch, @line)
126
122
  end
127
123
 
128
124
  # A = -A
@@ -151,7 +147,7 @@ module SeccompTools
151
147
 
152
148
  def emit_alu(op, val)
153
149
  src, k = val.x? ? [:x, 0] : [:k, val.to_i]
154
- emit(:alu, convert_alu_op(op), src, k: k)
150
+ emit(:alu, convert_alu_op(op), src, k:)
155
151
  end
156
152
 
157
153
  def convert_alu_op(op)
@@ -176,14 +172,22 @@ module SeccompTools
176
172
  emit(:ret, src, k: val.to_i)
177
173
  end
178
174
 
179
- def emit_cmp(cmp, jt, jf)
175
+ def emit_cmp(cmp, jt_sym, jf_sym)
176
+ jt = jt_sym[0]
177
+ jf = jf_sym[0]
180
178
  jop, jt, jf = convert_jmp_op(cmp, jt, jf)
181
- return emit(:jmp, jop, 0, jt: 0, jf: 0, k: jt) if jop == :ja || jt == jf
179
+ return emit(:jmp, :none, 0, jt: 0, jf: 0, k: jt) if jop == :ja || jt == jf
182
180
 
181
+ [jt_sym, jf_sym].each do |dis, sym|
182
+ if dis > JUMP_DISTANCE_MAX
183
+ raise SeccompTools::LongJumpError,
184
+ @scanner.format_error(sym, "Does not support jumping farther than #{JUMP_DISTANCE_MAX}, got: #{dis}")
185
+ end
186
+ end
183
187
  val = cmp[1]
184
188
  src = val.x? ? :x : :k
185
189
  k = val.x? ? 0 : val.to_i
186
- emit(:jmp, jop, src, jt: jt, jf: jf, k: k)
190
+ emit(:jmp, jop, src, jt:, jf:, k:)
187
191
  end
188
192
 
189
193
  # == != >= <= > < &
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.4.16
4
- # from Racc grammar file "".
3
+ # This file is automatically generated by Racc 1.8.1
4
+ # from Racc grammar file "sasm.y".
5
5
  #
6
6
 
7
7
  require 'racc/parser.rb'
@@ -311,6 +311,7 @@ Racc_arg = [
311
311
  racc_shift_n,
312
312
  racc_reduce_n,
313
313
  racc_use_result_var ]
314
+ Ractor.make_shareable(Racc_arg) if defined?(Ractor)
314
315
 
315
316
  Racc_token_to_s_table = [
316
317
  "$end",
@@ -387,6 +388,7 @@ Racc_token_to_s_table = [
387
388
  "alu_op",
388
389
  "args",
389
390
  "number" ]
391
+ Ractor.make_shareable(Racc_token_to_s_table) if defined?(Ractor)
390
392
 
391
393
  Racc_debug_parser = false
392
394
 
@@ -18,25 +18,25 @@ module SeccompTools
18
18
  # Keywords with special meanings in our assembly. Keywords are all case-insensitive.
19
19
  KEYWORDS = %w[a x if else return mem args args_h data len sys_number arch instruction_pointer].freeze
20
20
  # Regexp for matching keywords.
21
- KEYWORD_MATCHER = /\A\b(#{KEYWORDS.join('|')})\b/i.freeze
21
+ KEYWORD_MATCHER = /\A\b(#{KEYWORDS.join('|')})\b/i
22
22
  # Action strings can be used in a return statement. Actions must be in upper case.
23
23
  # See {SeccompTools::Const::BPF::ACTION}.
24
24
  ACTIONS = Const::BPF::ACTION.keys.map(&:to_s)
25
25
  # Regexp for matching actions.
26
- ACTION_MATCHER = /\A\b(#{ACTIONS.join('|')})\b/.freeze
26
+ ACTION_MATCHER = /\A\b(#{ACTIONS.join('|')})\b/
27
27
  # Special constants for checking the current architecture. See {SeccompTools::Const::Audit::ARCH}. These constants
28
28
  # are case-insensitive.
29
29
  AUDIT_ARCHES = Const::Audit::ARCH.keys
30
30
  # Regexp for matching arch values.
31
- AUDIT_ARCH_MATCHER = /\A\b(#{AUDIT_ARCHES.join('|')})\b/i.freeze
31
+ AUDIT_ARCH_MATCHER = /\A\b(#{AUDIT_ARCHES.join('|')})\b/i
32
32
  # Comparisons.
33
33
  COMPARE = %w[== != >= <= > <].freeze
34
34
  # Regexp for matching comparisons.
35
- COMPARE_MATCHER = /\A(#{COMPARE.join('|')})/.freeze
35
+ COMPARE_MATCHER = /\A(#{COMPARE.join('|')})/
36
36
  # All valid arithmetic operators.
37
37
  ALU_OP = %w[+ - * / | ^ << >>].freeze
38
38
  # Regexp for matching ALU operators.
39
- ALU_OP_MATCHER = /\A(#{ALU_OP.map { |o| ::Regexp.escape(o) }.join('|')})/.freeze
39
+ ALU_OP_MATCHER = /\A(#{ALU_OP.map { |o| ::Regexp.escape(o) }.join('|')})/
40
40
  # Supported architectures
41
41
  ARCHES = SeccompTools::Syscall::ABI.keys.map(&:to_s)
42
42
 
@@ -149,14 +149,14 @@ module SeccompTools
149
149
  <<-EOS
150
150
  #{@filename}:#{tok.line + 1}:#{tok.col + 1} #{msg}
151
151
  #{line}
152
- #{' ' * calculate_spaces(@lines[tok.line][0...tok.col]) + '^' * tok.str.size}
152
+ #{(' ' * calculate_spaces(@lines[tok.line][0...tok.col])) + ('^' * tok.str.size)}
153
153
  EOS
154
154
  end
155
155
 
156
156
  private
157
157
 
158
158
  def calculate_spaces(str)
159
- str.size + str.count("\t") * (TAB_WIDTH - 1)
159
+ str.size + (str.count("\t") * (TAB_WIDTH - 1))
160
160
  end
161
161
  end
162
162
  end
@@ -108,8 +108,8 @@ module SeccompTools
108
108
  # @yieldparam [Context] ctx
109
109
  # Context after this instruction.
110
110
  # @return [void]
111
- def branch(context, &block)
112
- inst.branch(context).each(&block)
111
+ def branch(context, &)
112
+ inst.branch(context).each(&)
113
113
  end
114
114
 
115
115
  # Corresponding instruction object.
@@ -10,7 +10,7 @@ module SeccompTools
10
10
  # Summary of this command.
11
11
  SUMMARY = 'Seccomp bpf assembler.'
12
12
  # Usage of this command.
13
- USAGE = "asm - #{SUMMARY}\n\nUsage: seccomp-tools asm IN_FILE [options]"
13
+ USAGE = "asm - #{SUMMARY}\n\nUsage: seccomp-tools asm IN_FILE [options]".freeze
14
14
 
15
15
  def initialize(*)
16
16
  super
@@ -60,11 +60,9 @@ EOS
60
60
  # Just write message to stdout.
61
61
  # @param [String] msg
62
62
  # The message.
63
- # @return [false]
64
- # Always return +false+.
63
+ # @return [void]
65
64
  def show(msg)
66
65
  puts msg
67
- false
68
66
  end
69
67
 
70
68
  class << self
@@ -10,7 +10,7 @@ module SeccompTools
10
10
  # Summary of this command.
11
11
  SUMMARY = 'Disassemble seccomp bpf.'
12
12
  # Usage of this command.
13
- USAGE = "disasm - #{SUMMARY}\n\nUsage: seccomp-tools disasm BPF_FILE [options]"
13
+ USAGE = "disasm - #{SUMMARY}\n\nUsage: seccomp-tools disasm BPF_FILE [options]".freeze
14
14
 
15
15
  def initialize(*)
16
16
  super
@@ -15,7 +15,7 @@ module SeccompTools
15
15
  SUMMARY = 'Automatically dump seccomp bpf from execution file(s).'
16
16
  # Usage of this command.
17
17
  USAGE = "dump - #{SUMMARY}\nNOTE : This function is only available on Linux." \
18
- "\n\nUsage: seccomp-tools dump [exec] [options]"
18
+ "\n\nUsage: seccomp-tools dump [exec] [options]".freeze
19
19
 
20
20
  def initialize(*)
21
21
  super
@@ -72,7 +72,7 @@ module SeccompTools
72
72
  case option[:format]
73
73
  when :inspect then output { "\"#{bpf.bytes.map { |b| format('\\x%02X', b) }.join}\"\n" }
74
74
  when :raw then output { bpf }
75
- when :disasm then output { SeccompTools::Disasm.disasm(bpf, arch: arch) }
75
+ when :disasm then output { SeccompTools::Disasm.disasm(bpf, arch:) }
76
76
  end
77
77
  end
78
78
  if option[:pid].nil?
@@ -15,7 +15,7 @@ module SeccompTools
15
15
  # Summary of this command.
16
16
  SUMMARY = 'Emulate seccomp rules.'
17
17
  # Usage of this command.
18
- USAGE = "emu - #{SUMMARY}\n\nUsage: seccomp-tools emu [options] BPF_FILE [sys_nr [arg0 [arg1 ... arg5]]]"
18
+ USAGE = "emu - #{SUMMARY}\n\nUsage: seccomp-tools emu [options] BPF_FILE [sys_nr [arg0 [arg1 ... arg5]]]".freeze
19
19
 
20
20
  def initialize(*)
21
21
  super
@@ -33,6 +33,10 @@ module SeccompTools
33
33
  opt.on('-q', '--[no-]quiet', 'Run quietly, only show emulation result.') do |v|
34
34
  option[:verbose] = 0 if v
35
35
  end
36
+
37
+ opt.on('-i', '--ip=VAL', Integer, 'Set instruction pointer.') do |val|
38
+ option[:instruction_pointer] = val
39
+ end
36
40
  end
37
41
  end
38
42
 
@@ -50,9 +54,13 @@ module SeccompTools
50
54
  sys = evaluate_sys_nr(sys) if sys
51
55
  args.map! { |v| Integer(v) }
52
56
  trace = Set.new
53
- res = SeccompTools::Emulator.new(insts, sys_nr: sys, args: args, arch: option[:arch]).run do |ctx|
54
- trace << ctx[:pc]
55
- end
57
+ res = SeccompTools::Emulator.new(
58
+ insts,
59
+ sys_nr: sys,
60
+ args:,
61
+ instruction_pointer: option[:instruction_pointer] && Integer(option[:instruction_pointer]),
62
+ arch: option[:arch]
63
+ ).run
56
64
 
57
65
  if option[:verbose] >= 1
58
66
  disasm = SeccompTools::Disasm.disasm(raw, arch: option[:arch]).lines
@@ -338,4 +338,4 @@ X32_MODE_BIT = 0x40000000
338
338
  pkey_alloc: 330,
339
339
  pkey_free: 331,
340
340
  statx: 332
341
- }.tap { |h| h.keys.each { |k| h["x32_#{k}".to_sym] = h[k] | X32_MODE_BIT } } # rubocop:disable Style/HashEachMethods
341
+ }.tap { |h| h.keys.each { |k| h[:"x32_#{k}"] = h[k] | X32_MODE_BIT } }
@@ -36,7 +36,7 @@ module SeccompTools
36
36
  # Defines hash function.
37
37
  # @return [Integer]
38
38
  def hash
39
- @rel.hash ^ @val.hash
39
+ [@rel, @val].hash
40
40
  end
41
41
 
42
42
  # Defines +eql?+.
@@ -78,7 +78,7 @@ module SeccompTools
78
78
  values[reg] = if rel == :mem
79
79
  values[val]
80
80
  else
81
- Value.new(rel: rel, val: val)
81
+ Value.new(rel:, val:)
82
82
  end
83
83
  end
84
84
 
@@ -164,7 +164,7 @@ module SeccompTools
164
164
  # For +Set+ to get the hash value.
165
165
  # @return [Integer]
166
166
  def hash
167
- values.hash ^ known_data.hash
167
+ [values, known_data].hash
168
168
  end
169
169
  end
170
170
  end
@@ -30,7 +30,7 @@ module SeccompTools
30
30
  end
31
31
  end
32
32
  code.contexts = ctxs
33
- code.disasm(code: display_bpf, arg_infer: arg_infer)
33
+ code.disasm(code: display_bpf, arg_infer:)
34
34
  end.join("\n")
35
35
  if display_bpf
36
36
  <<-EOS
@@ -101,7 +101,7 @@ module SeccompTools
101
101
  child, status = Process.wait2
102
102
  cont = true
103
103
  # TODO: Test if clone / vfork works
104
- if [Ptrace::EVENT_CLONE, Ptrace::EVENT_FORK, Ptrace::EVENT_VFORK].include?(status >> 16)
104
+ if [Ptrace::EVENT_CLONE, Ptrace::EVENT_FORK, Ptrace::EVENT_VFORK].include?(status.to_i >> 16)
105
105
  # New child launched!
106
106
  # newpid = SeccompTools::Ptrace.geteventmsg(child)
107
107
  elsif status.stopped? && status.stopsig & 0x80 != 0
@@ -132,7 +132,7 @@ module SeccompTools
132
132
  def handle_child(*args)
133
133
  Ptrace.traceme_and_stop
134
134
  exec(*args)
135
- rescue # rubocop:disable Style/RescueStandardError # exec fail
135
+ rescue # rubocop:disable Style/RescueStandardError
136
136
  Logger.error("Failed to execute #{args.join(' ')}")
137
137
  exit(1)
138
138
  end
@@ -98,7 +98,7 @@ module SeccompTools
98
98
 
99
99
  def alu(op, src)
100
100
  if op == :neg
101
- set(:a, 2**32 - get(:a))
101
+ set(:a, (2**32) - get(:a))
102
102
  else
103
103
  src = get(:x) if src == :x
104
104
  set(:a, get(:a).__send__(op, src))
@@ -140,14 +140,14 @@ module SeccompTools
140
140
  end
141
141
 
142
142
  def data_of(index)
143
- raise IndexError, "Invalid index: #{index}" unless (index & 3).zero? && index.between?(0, 63)
143
+ raise IndexError, "Invalid index: #{index}" unless index.nobits?(3) && index.between?(0, 63)
144
144
 
145
145
  index /= 4
146
146
  case index
147
147
  when 0 then @sys_nr || undefined('sys_number')
148
148
  when 1 then @arch || undefined('arch')
149
- when 2 then @ip & 0xffffffff || undefined('instruction_pointer')
150
- when 3 then @ip >> 32 || undefined('instruction_pointer')
149
+ when 2 then (@ip & 0xffffffff) || undefined('instruction_pointer')
150
+ when 3 then (@ip >> 32) || undefined('instruction_pointer')
151
151
  else
152
152
  val = @args[(index - 4) / 2] || undefined("args[#{(index - 4) / 2}]")
153
153
  (val >> (index.even? ? 0 : 32)) & 0xffffffff
@@ -70,7 +70,7 @@ module SeccompTools
70
70
  when 8 then 'instruction_pointer'
71
71
  when 12 then 'instruction_pointer >> 32'
72
72
  else
73
- idx = Array.new(12) { |i| i * 4 + 16 }.index(k)
73
+ idx = Array.new(12) { |i| (i * 4) + 16 }.index(k)
74
74
  return 'INVALID' if idx.nil?
75
75
 
76
76
  args_name(idx)
@@ -31,7 +31,7 @@ module SeccompTools
31
31
  return 'A' if type == :a
32
32
 
33
33
  str = ACTION.invert[type & SECCOMP_RET_ACTION_FULL].to_s
34
- str << "(#{type & SECCOMP_RET_DATA})" if str == 'ERRNO'
34
+ str += "(#{type & SECCOMP_RET_DATA})" if str == 'ERRNO'
35
35
  str
36
36
  end
37
37
  end
@@ -24,7 +24,7 @@ module SeccompTools
24
24
  str.strip.empty? ? str : prep + str
25
25
  end
26
26
  color = severity.downcase.to_sym
27
- msg = +"[#{SeccompTools::Util.colorize(severity, t: color)}] #{message.join}"
27
+ msg = "[#{SeccompTools::Util.colorize(severity, t: color)}] #{message.join}"
28
28
  msg << "\n" unless msg.end_with?("\n")
29
29
  msg
30
30
  end
@@ -58,8 +58,8 @@ module SeccompTools
58
58
  def dump_bpf
59
59
  addr = args[2]
60
60
  len = Ptrace.peekdata(pid, addr, 0) & 0xffff # len is unsigned short
61
- filter = Ptrace.peekdata(pid, addr + bits / 8, 0) & ((1 << bits) - 1)
62
- Array.new(len) { |i| Ptrace.peekdata(pid, filter + i * 8, 0) }.pack('Q*')
61
+ filter = Ptrace.peekdata(pid, addr + (bits / 8), 0) & ((1 << bits) - 1)
62
+ Array.new(len) { |i| Ptrace.peekdata(pid, filter + (i * 8), 0) }.pack('Q*')
63
63
  end
64
64
 
65
65
  # @return [Symbol]
@@ -2,5 +2,5 @@
2
2
 
3
3
  module SeccompTools
4
4
  # Gem version.
5
- VERSION = '1.6.0'
5
+ VERSION = '1.6.2'
6
6
  end
metadata CHANGED
@@ -1,15 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seccomp-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - david942j
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-09-19 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: ostruct
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :development
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
13
26
  - !ruby/object:Gem::Dependency
14
27
  name: rake
15
28
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +107,20 @@ dependencies:
94
107
  - - "~>"
95
108
  - !ruby/object:Gem::Version
96
109
  version: '0.9'
110
+ - !ruby/object:Gem::Dependency
111
+ name: logger
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ type: :runtime
118
+ prerelease: false
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
97
124
  - !ruby/object:Gem::Dependency
98
125
  name: os
99
126
  requirement: !ruby/object:Gem::Requirement
@@ -114,6 +141,20 @@ dependencies:
114
141
  - - ">="
115
142
  - !ruby/object:Gem::Version
116
143
  version: 1.1.1
144
+ - !ruby/object:Gem::Dependency
145
+ name: racc
146
+ requirement: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - "~>"
149
+ - !ruby/object:Gem::Version
150
+ version: '1.8'
151
+ type: :runtime
152
+ prerelease: false
153
+ version_requirements: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - "~>"
156
+ - !ruby/object:Gem::Version
157
+ version: '1.8'
117
158
  description: |
118
159
  Provide useful tools to analyze seccomp rules.
119
160
  Visit https://github.com/david942j/seccomp-tools for more details.
@@ -125,6 +166,7 @@ extensions:
125
166
  - ext/ptrace/extconf.rb
126
167
  extra_rdoc_files: []
127
168
  files:
169
+ - LICENSE
128
170
  - README.md
129
171
  - bin/seccomp-tools
130
172
  - ext/ptrace/extconf.rb
@@ -174,7 +216,6 @@ files:
174
216
  - lib/seccomp-tools/templates/asm.s390x.asm
175
217
  - lib/seccomp-tools/util.rb
176
218
  - lib/seccomp-tools/version.rb
177
- homepage:
178
219
  licenses:
179
220
  - MIT
180
221
  metadata:
@@ -182,7 +223,7 @@ metadata:
182
223
  documentation_uri: https://www.rubydoc.info/github/david942j/seccomp-tools/master
183
224
  homepage_uri: https://github.com/david942j/seccomp-tools
184
225
  source_code_uri: https://github.com/david942j/seccomp-tools
185
- post_install_message:
226
+ rubygems_mfa_required: 'true'
186
227
  rdoc_options: []
187
228
  require_paths:
188
229
  - lib
@@ -190,15 +231,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
190
231
  requirements:
191
232
  - - ">="
192
233
  - !ruby/object:Gem::Version
193
- version: '2.6'
234
+ version: '3.1'
194
235
  required_rubygems_version: !ruby/object:Gem::Requirement
195
236
  requirements:
196
237
  - - ">="
197
238
  - !ruby/object:Gem::Version
198
239
  version: '0'
199
240
  requirements: []
200
- rubygems_version: 3.1.6
201
- signing_key:
241
+ rubygems_version: 3.6.9
202
242
  specification_version: 4
203
243
  summary: seccomp-tools
204
244
  test_files: []