seccomp-tools 1.6.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 898cc2a23df6443f39054c4b9027a576fb929729f74fc804ae82ae3b11c6772e
4
- data.tar.gz: 0e07d2d1914ac7185135425d0e34f0dcb1b6100e977176d8bd9ce23f95a3f287
3
+ metadata.gz: dc7a6ded95dadf7826ae07868793839e0ffa417ed936ae8461ff5bb6b59ff135
4
+ data.tar.gz: 82a0f811819137309ea22d68fe21fec5d48aad7b96f142b981c57478146a47af
5
5
  SHA512:
6
- metadata.gz: ec604fca33e16dd6ca77e923e34629338245828abdf3c97e9974d205a2306aa9ae0f3bc074b90e056790a8de86ed6484ab17ce190524b30394f2fda2b5dd9432
7
- data.tar.gz: 399e5e77fa99de23f3ad5013c442fc29a800a261d04150ab0bd467744a9302601ca7c60e5570e4e65f423cf4c93e4eb4428ae3f33b97d6a64c223af13b342e47
6
+ metadata.gz: 4d630e759687a7641d8cdeb4012a433a4fedc67c2f3e322c4cfaf041428e1199a2c46dd5db50c36a00a79a5b203f648f90345ac4ad6654b0cba93344c6737158
7
+ data.tar.gz: 23a441eb5cf55d3eb18a91a20e4b23a242e7b9b381dab81457ab3b087d9c53847e2d47be161c11305f213e629a23403b806e1a8e31e89adbd90443d1f79ef301
@@ -71,14 +71,11 @@ module SeccompTools
71
71
 
72
72
  jt = resolve_symbol(idx, statement.data[1])
73
73
  jf = resolve_symbol(idx, statement.data[2])
74
- statement.data[1] = jt
75
- statement.data[2] = jf
74
+ statement.data[1] = [jt, statement.data[1]]
75
+ statement.data[2] = [jf, statement.data[2]]
76
76
  end
77
77
  end
78
78
 
79
- # The farthest distance of a relative jump in BPF.
80
- JUMP_DISTANCE_MAX = 255
81
-
82
79
  # @param [Integer] index
83
80
  # @param [SeccompTools::Asm::Token, :next] sym
84
81
  def resolve_symbol(index, sym)
@@ -89,7 +86,7 @@ module SeccompTools
89
86
 
90
87
  if @symbols[str].nil?
91
88
  # 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
89
+ return str.to_i if str == str.to_i.to_s
93
90
 
94
91
  raise SeccompTools::UndefinedLabelError,
95
92
  @scanner.format_error(sym, "Cannot find label '#{str}'")
@@ -100,10 +97,6 @@ module SeccompTools
100
97
  raise SeccompTools::BackwardJumpError,
101
98
  @scanner.format_error(sym, "Does not support backward jumping to '#{str}'")
102
99
  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
100
  end
108
101
  end
109
102
 
@@ -176,10 +169,21 @@ module SeccompTools
176
169
  emit(:ret, src, k: val.to_i)
177
170
  end
178
171
 
179
- def emit_cmp(cmp, jt, jf)
172
+ # The farthest distance of a relative jump in BPF.
173
+ JUMP_DISTANCE_MAX = 255
174
+
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
@@ -2,5 +2,5 @@
2
2
 
3
3
  module SeccompTools
4
4
  # Gem version.
5
- VERSION = '1.6.0'
5
+ VERSION = '1.6.1'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - david942j
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-19 00:00:00.000000000 Z
11
+ date: 2023-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake