@@ -282,49 +282,51 @@ void ebpf_verifier_clear_thread_local_state() {
282
282
}
283
283
284
284
bool ebpf_check_constraints_at_label (std::ostream& os, const std::string& label_string,
285
- const std::set<std::string>& constraints) try {
286
- label_t label = label_t (label_string);
287
- if (!saved_pre_invariants.has_value ()) {
288
- os << " No pre-invariants available\n " ;
289
- return false ;
290
- }
291
- if (saved_pre_invariants.value ().find (label) == saved_pre_invariants.value ().end ()) {
292
- os << " No pre-invariants available for label " << label << " \n " ;
293
- return false ;
294
- }
295
- ebpf_domain_t from_inv (saved_pre_invariants.value ().at (label));
296
- auto concrete_domain = ebpf_domain_t::from_constraints (constraints, false );
285
+ const std::set<std::string>& constraints) {
286
+ try {
287
+ label_t label = label_t (label_string);
288
+ if (!saved_pre_invariants.has_value ()) {
289
+ os << " No pre-invariants available\n " ;
290
+ return false ;
291
+ }
292
+ if (saved_pre_invariants.value ().find (label) == saved_pre_invariants.value ().end ()) {
293
+ os << " No pre-invariants available for label " << label << " \n " ;
294
+ return false ;
295
+ }
296
+ ebpf_domain_t from_inv (saved_pre_invariants.value ().at (label));
297
+ auto concrete_domain = ebpf_domain_t::from_constraints (constraints, false );
298
+
299
+ if (concrete_domain.is_bottom ()) {
300
+ os << " The provided constraints are unsatisfiable (concrete domain is bottom)\n " ;
301
+ os << " Concrete constraints are self-contradictory\n " ;
302
+ os << concrete_domain << " \n " ;
303
+ return false ;
304
+ }
297
305
298
- if (concrete_domain.is_bottom ()) {
299
- os << " The provided constraints are unsatisfiable (concrete domain is bottom)\n " ;
300
- os << " Concrete constraints are self-contradictory\n " ;
301
- os << concrete_domain << " \n " ;
302
- return false ;
303
- }
306
+ if (from_inv.is_bottom ()) {
307
+ os << " The abstract state is unreachable\n " ;
308
+ os << from_inv << " \n " ;
309
+ return false ;
310
+ }
304
311
305
- if (from_inv.is_bottom ()) {
306
- os << " The abstract state is unreachable\n " ;
307
- os << from_inv << " \n " ;
308
- return false ;
309
- }
312
+ if ((from_inv & concrete_domain).is_bottom ()) {
313
+ os << " Concrete state does not match invariant\n " ;
310
314
311
- if ((from_inv & concrete_domain).is_bottom ()) {
312
- os << " Concrete state does not match invariant\n " ;
315
+ // Print the concrete state
316
+ os << " --- Concrete state ---\n " ;
317
+ os << concrete_domain << " \n " ;
313
318
314
- // Print the concrete state
315
- os << " --- Concrete state ---\n " ;
316
- os << concrete_domain << " \n " ;
319
+ os << " --- Abstract state ---\n " ;
320
+ os << from_inv << " \n " ;
317
321
318
- os << " --- Abstract state --- \n " ;
319
- os << from_inv << " \n " ;
322
+ return false ;
323
+ }
320
324
325
+ return true ;
326
+ } catch (std::exception& e) {
327
+ os << " Error occurred while checking constraints: " << e.what () << " \n " ;
321
328
return false ;
322
329
}
323
-
324
- return true ;
325
- } catch (std::exception& e) {
326
- os << " Error occurred while checking constraints: " << e.what () << " \n " ;
327
- return false ;
328
330
}
329
331
330
332
std::set<std::string> ebpf_get_invariants_at_label (const std::string& label)
0 commit comments