From 611c274b2ee9a564ff1716490df756e3a2b04423 Mon Sep 17 00:00:00 2001 From: wallds Date: Mon, 10 Jan 2022 18:16:56 +0800 Subject: [PATCH] Fix test_access --- VTIL-Architecture/routine/call_convention.hpp | 2 +- VTIL-Architecture/symex/variable.cpp | 30 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/VTIL-Architecture/routine/call_convention.hpp b/VTIL-Architecture/routine/call_convention.hpp index a9c5b18..ae30be0 100644 --- a/VTIL-Architecture/routine/call_convention.hpp +++ b/VTIL-Architecture/routine/call_convention.hpp @@ -202,7 +202,7 @@ namespace vtil { register_physical, X86_REG_EBP, 32 }, /*.shadow_space =*/ - 0x20, + 0x0, /*.purge_stack =*/ true, diff --git a/VTIL-Architecture/symex/variable.cpp b/VTIL-Architecture/symex/variable.cpp index 593fd00..7e8a357 100644 --- a/VTIL-Architecture/symex/variable.cpp +++ b/VTIL-Architecture/symex/variable.cpp @@ -380,23 +380,23 @@ namespace vtil::symbolic // If vmexit, declared trashed if below or at the shadow space: // - if ( cwrite ) + if ( cwrite && cc.purge_stack) { - if ( it->base == &ins::vexit ? it.block->owner->routine_convention.purge_stack : cc.purge_stack ) - { - // Determine the limit of the stack memory owned by this routine. - // - expression limit = - tracer->trace( { it, REG_SP } ) + - it.block->sp_offset + - cc.shadow_space; + // Determine the limit of the stack memory owned by this routine. + // + expression limit = + tracer->trace( { it, REG_SP } ) + + it.block->sp_offset + + ( it->base == &ins::vexit ? 0 : cc.shadow_space ); - // Calculate the displacement, if constant below 0, declare trashed. - // - access_details details; - fill_displacement( &details, mem.base, pointer{ std::move( limit ) }, tracer, xblock ); - if ( !details.is_unknown() && ( details.bit_offset + var.bit_count() ) <= 0 ) - result += { .bit_offset = 0, .bit_count = var.bit_count(), .read = false, .write = true }; + // Calculate the displacement, if constant below 0, declare trashed. + // + access_details details; + fill_displacement( &details, mem.base, pointer{ std::move( limit ) }, tracer, xblock ); + if ( !details.is_unknown() && ( details.bit_offset + var.bit_count() ) <= 0 ) + { + result += { .bit_offset = 0, .bit_count = var.bit_count(), .read = false, .write = true }; + return result; } }