diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-05-11 00:58:05 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-05-11 00:58:05 (GMT) |
commit | 46bcc7f122245f22772fd3e38d16e6afa7bd5881 (patch) | |
tree | d3c2ba1a9999e373428954f24d0e60c1ea63b756 /src/arch | |
parent | 1bda6c517d30d873ff0d92a96380946ef944c9ae (diff) |
Provided a way to look for ROP gadgets in binary code.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@533 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/arm/v7/opdefs/pop_A88131.d | 4 | ||||
-rw-r--r-- | src/arch/arm/v7/opdefs/pop_A88132.d | 4 | ||||
-rw-r--r-- | src/arch/processor.h | 12 | ||||
-rw-r--r-- | src/arch/vmpa.c | 26 | ||||
-rw-r--r-- | src/arch/vmpa.h | 3 |
5 files changed, 43 insertions, 6 deletions
diff --git a/src/arch/arm/v7/opdefs/pop_A88131.d b/src/arch/arm/v7/opdefs/pop_A88131.d index ef5ab25..5229af9 100644 --- a/src/arch/arm/v7/opdefs/pop_A88131.d +++ b/src/arch/arm/v7/opdefs/pop_A88131.d @@ -39,7 +39,6 @@ //if BitCount(registers) < 1 then UNPREDICTABLE; //if registers<15> == '1' && InITBlock() && !LastInITBlock() then UNPREDICTABLE; - chk_call DefineAsReturn(1) } @@ -61,7 +60,6 @@ //if BitCount(registers) < 2 || (P == '1' && M == '1') then UNPREDICTABLE; //if registers<15> == '1' && InITBlock() && !LastInITBlock() then UNPREDICTABLE; - chk_call DefineAsReturn(1) } @@ -83,7 +81,7 @@ @rules { //if t == 13 || (t == 15 && InITBlock() && !LastInITBlock()) then UNPREDICTABLE; - chk_call DefineAsReturn(1) + if (Rt == '1111') ; chk_call DefineAsReturn(1) } diff --git a/src/arch/arm/v7/opdefs/pop_A88132.d b/src/arch/arm/v7/opdefs/pop_A88132.d index 89c51c9..1762b45 100644 --- a/src/arch/arm/v7/opdefs/pop_A88132.d +++ b/src/arch/arm/v7/opdefs/pop_A88132.d @@ -40,7 +40,7 @@ //if BitCount(register_list) < 2 then SEE LDM / LDMIA / LDMFD; //if registers<13> == '1' && ArchVersion() >= 7 then UNPREDICTABLE; - chk_call DefineAsReturn(1) + if (register_list & 0x8000) ; chk_call DefineAsReturn(1) } @@ -63,7 +63,7 @@ @rules { //if t == 13 then UNPREDICTABLE; - chk_call DefineAsReturn(1) + if (Rt == '1111') ; chk_call DefineAsReturn(1) } diff --git a/src/arch/processor.h b/src/arch/processor.h index d650266..a856942 100644 --- a/src/arch/processor.h +++ b/src/arch/processor.h @@ -74,7 +74,17 @@ MemoryDataSize g_arch_processor_get_instruction_size(const GArchProcessor *); GArchInstruction *g_arch_processor_decode_instruction(const GArchProcessor *, GProcContext *, const bin_t *, off_t *, off_t, vmpa_t, GBinFormat *) __attribute__ ((deprecated)); /* Désassemble une instruction dans un flux de données. */ -GArchInstruction *g_arch_processor_disassemble(const GArchProcessor *, GProcContext *, const bin_t *, vmpa2t *, phys_t); +GArchInstruction *g_arch_processor_disassemble(const GArchProcessor *, GProcContext *, const bin_t *, vmpa2t *, phys_t) __attribute__ ((deprecated)); + + + +#define g_arch_processor_disassemble_nextgen(_proc, _ctx, _cnt, _pos) \ + ({ \ + const bin_t *_bin_data; \ + off_t _bin_length; \ + _bin_data = g_binary_content_get(_cnt, &_bin_length); \ + g_arch_processor_disassemble(_proc, _ctx, _bin_data, _pos, _bin_length); \ + }) diff --git a/src/arch/vmpa.c b/src/arch/vmpa.c index ad4c078..b10b007 100644 --- a/src/arch/vmpa.c +++ b/src/arch/vmpa.c @@ -247,6 +247,32 @@ void advance_vmpa(vmpa2t *addr, phys_t qty) /****************************************************************************** * * +* Paramètres : addr = élément à modifier. * +* qty = quantité d'unités de décallage. * +* * +* Description : Décalle une position d'une certaine quantité. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void deminish_vmpa(vmpa2t *addr, phys_t qty) +{ + /* On choisit de ne pas vérifier les débordements */ + + if (addr->physical != VMPA_NO_PHYSICAL) + addr->physical -= qty; + + if (addr->virtual != VMPA_NO_VIRTUAL) + addr->virtual -= qty; + +} + + +/****************************************************************************** +* * * Paramètres : a = première élément à venir consulter. * * b = second élément à traiter en parallèle. * * * diff --git a/src/arch/vmpa.h b/src/arch/vmpa.h index 3e0d35c..4611ebf 100644 --- a/src/arch/vmpa.h +++ b/src/arch/vmpa.h @@ -111,6 +111,9 @@ int cmp_vmpa(const vmpa2t *, const vmpa2t *); /* Décalle une position d'une certaine quantité. */ void advance_vmpa(vmpa2t *, phys_t); +/* Décalle une position d'une certaine quantité. */ +void deminish_vmpa(vmpa2t *, phys_t); + /* Calcule au mieux la distance entre deux coordonnées. */ phys_t compute_vmpa_diff(const vmpa2t *, const vmpa2t *); |