Skip to content

Commit fec2796

Browse files
committed
ablation_b fix
1 parent 82a982c commit fec2796

File tree

5 files changed

+9
-14
lines changed

5 files changed

+9
-14
lines changed

src/gadget/library/builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ fn default_blacklist() -> HashSet<OpCode> {
3838
// it from consideration
3939
OpCode::CPUI_BRANCH,
4040
OpCode::CPUI_CALL,
41+
OpCode::CPUI_CALLOTHER,
4142
// The following operations are not yet modeled by jingle, so let's save some trees
4243
// and not even try to model them for the time being
4344
OpCode::CPUI_CBRANCH,

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pub use crate::synthesis::pcode_theory::pcode_assignment::{
2-
assert_compatible_semantics, assert_concat, assert_state_constraints,
2+
assert_concat, assert_pointer_invariant, assert_state_constraints,
33
};
44

55
#[cfg(feature = "bin")]

src/synthesis/pcode_theory/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::error::CrackersError;
1212
use crate::error::CrackersError::TheoryTimeout;
1313
use crate::synthesis::builder::{StateConstraintGenerator, TransitionConstraintGenerator};
1414
use crate::synthesis::pcode_theory::pcode_assignment::{
15-
assert_compatible_semantics, assert_concat, assert_state_constraints,
15+
assert_concat, assert_pointer_invariant, assert_state_constraints,
1616
};
1717
use crate::synthesis::pcode_theory::theory_constraint::{
1818
gen_conflict_clauses, ConjunctiveConstraint, TheoryStage,
@@ -130,6 +130,10 @@ impl<'ctx> PcodeTheory<'ctx> {
130130
post_bool,
131131
TheoryStage::Postcondition,
132132
));
133+
for g in &gadgets{
134+
let b = assert_pointer_invariant(&self.j, g, &self.pointer_invariants)?;
135+
self.solver.assert(&b);
136+
}
133137
event!(Level::TRACE, "Evaluating chain:");
134138
for x in &gadgets {
135139
for i in &x.instructions {

src/synthesis/pcode_theory/pcode_assignment.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use jingle::modeling::{ModeledBlock, ModeledInstruction, ModelingContext, State};
1+
use jingle::modeling::{ModeledBlock, ModelingContext, State};
22
use jingle::JingleContext;
33
use std::sync::Arc;
44
use z3::ast::Bool;
@@ -73,21 +73,12 @@ pub fn assert_concat<'ctx, T: ModelingContext<'ctx>>(
7373
Ok(Bool::and(z3, &bools))
7474
}
7575

76-
pub fn assert_compatible_semantics<'ctx, S: ModelingContext<'ctx>>(
76+
pub fn assert_pointer_invariant<'ctx>(
7777
jingle: &JingleContext<'ctx>,
78-
spec: &S,
7978
item: &ModeledBlock<'ctx>,
8079
invariants: &[Arc<TransitionConstraintGenerator>],
8180
) -> Result<Bool<'ctx>, CrackersError> {
8281
let mut bools = vec![];
83-
// First, all outputs of the item under test must be assignable to the same values
84-
// as in our specification computation
85-
bools.push(item.upholds_postcondition(spec)?);
86-
// Secondly, if the specification has some control flow behavior, the item must be able
87-
// to have the same control flow behavior
88-
if let Some(b) = spec.branch_comparison(item)? {
89-
bools.push(b)
90-
}
9182
// Thirdly, every input and output address must pass our pointer constraints
9283
for invariant in invariants.iter() {
9384
let inv = invariant(jingle, item)?;

src/synthesis/pcode_theory/theory_constraint.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use crate::synthesis::Decision;
55

66
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
77
pub enum TheoryStage {
8-
CombinedSemantics,
98
Consistency,
109
Branch,
1110
Precondition,

0 commit comments

Comments
 (0)