From b2b43b80eb207fabc8eb5e08798f120f0dd5541e Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Fri, 27 Nov 2015 21:44:44 +0000 Subject: Protected other data access using locks. git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@611 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a --- ChangeLog | 13 +++++++++++++ src/analysis/disass/fetch.c | 3 ++- src/arch/context-int.h | 1 + src/arch/context.c | 38 ++++++++++---------------------------- src/arch/context.h | 5 +---- src/gtkext/gtkextstatusbar.c | 5 +++++ 6 files changed, 32 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index 308e126..fc012e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,18 @@ 15-11-27 Cyrille Bagard + * src/analysis/disass/fetch.c: + Disable old code. + + * src/arch/context.c: + * src/arch/context.h: + * src/arch/context-int.h: + Protect other data access using locks. Clean the code. + + * src/gtkext/gtkextstatusbar.c: + Disable most features of the status bar. + +15-11-27 Cyrille Bagard + * src/analysis/disass/area.c: * src/analysis/disass/area.h: * src/analysis/disass/disassembler.c: diff --git a/src/analysis/disass/fetch.c b/src/analysis/disass/fetch.c index bfc0598..5caf573 100644 --- a/src/analysis/disass/fetch.c +++ b/src/analysis/disass/fetch.c @@ -374,6 +374,7 @@ static void follow_execution_flow_v2(GProcContext *ctx, const GDelayedFetching * static void follow_execution_flow(const GLoadedBinary *binary, GProcContext *ctx, mem_area **areas, size_t *count, status_blob_info *info) { +#if 0 virt_t virt; /* Adresse de départ dépilée */ vmpa2t addr; /* Conversion en pleine adresse*/ GExeFormat *format; /* Format du fichier binaire */ @@ -406,7 +407,7 @@ static void follow_execution_flow(const GLoadedBinary *binary, GProcContext *ctx } - +#endif } static GDelayedFetching template; /* Patron des tâches à venir */ diff --git a/src/arch/context-int.h b/src/arch/context-int.h index 086a8ec..b7f7a20 100644 --- a/src/arch/context-int.h +++ b/src/arch/context-int.h @@ -49,6 +49,7 @@ struct _GProcContext vmpa2t *extra_symbols; /* Adresses de symboles */ size_t esyms_count; /* Nombres de nouveautés */ + GMutex es_access; /* Accès à cette même liste */ }; diff --git a/src/arch/context.c b/src/arch/context.c index 968a6ea..fe2e220 100644 --- a/src/arch/context.c +++ b/src/arch/context.c @@ -97,6 +97,7 @@ static void g_proc_context_init(GProcContext *ctx) ctx->extra_symbols = NULL; ctx->esyms_count = 0; + g_mutex_init(&ctx->es_access); } @@ -157,33 +158,6 @@ void g_proc_context_push_drop_point(GProcContext *ctx, virt_t addr) /****************************************************************************** * * -* Paramètres : ctx = contexte de désassemblage à consulter. * -* * -* Description : Indique si des points de départ restent à traiter ou non. * -* * -* Retour : true s'il existe encore au moins un point, false sinon. * -* * -* Remarques : - * -* * -******************************************************************************/ - -bool g_proc_context_has_drop_points(const GProcContext *ctx) -{ - bool result; /* Etat à retourner */ - - g_mutex_lock(&ctx->dp_access); - - result = (ctx->dp_count > 0); - - g_mutex_unlock(&ctx->dp_access); - - return result; - -} - - -/****************************************************************************** -* * * Paramètres : ctx = contexte de désassemblage à consulter. * * addr = adresse de mémoire virtuelle à rechercher. * * * @@ -195,7 +169,7 @@ bool g_proc_context_has_drop_points(const GProcContext *ctx) * * ******************************************************************************/ -bool g_proc_context_has_addr_as_drop_points(const GProcContext *ctx, virt_t addr) +bool g_proc_context_has_addr_as_drop_points(GProcContext *ctx, virt_t addr) { bool result; /* Bilan à retourner */ size_t i; /* Boucle de parcours */ @@ -270,10 +244,14 @@ bool g_proc_context_pop_drop_point(GProcContext *ctx, virt_t *virt) void g_proc_context_push_new_symbol_at(GProcContext *ctx, const vmpa2t *addr) { + g_mutex_lock(&ctx->es_access); + ctx->extra_symbols = (vmpa2t *)realloc(ctx->extra_symbols, ++ctx->esyms_count * sizeof(vmpa2t)); copy_vmpa(&ctx->extra_symbols[ctx->esyms_count - 1], addr); + g_mutex_unlock(&ctx->es_access); + } @@ -294,6 +272,8 @@ bool g_proc_context_pop_new_symbol_at(GProcContext *ctx, vmpa2t *addr) { bool result; /* Bilan à retourner */ + g_mutex_lock(&ctx->es_access); + result = (ctx->esyms_count > 0); if (result) @@ -302,6 +282,8 @@ bool g_proc_context_pop_new_symbol_at(GProcContext *ctx, vmpa2t *addr) copy_vmpa(addr, &ctx->extra_symbols[ctx->esyms_count]); } + g_mutex_unlock(&ctx->es_access); + return result; } diff --git a/src/arch/context.h b/src/arch/context.h index 973b7ae..36eb3e6 100644 --- a/src/arch/context.h +++ b/src/arch/context.h @@ -54,11 +54,8 @@ GType g_proc_context_get_type(void); /* Ajoute une adresse virtuelle comme point de départ de code. */ void g_proc_context_push_drop_point(GProcContext *, virt_t); -/* Indique si des points de départ restent à traiter ou non. */ -bool g_proc_context_has_drop_points(const GProcContext *); - /* Précise si une adresse donnée figure comme point de départ. */ -bool g_proc_context_has_addr_as_drop_points(const GProcContext *, virt_t); +bool g_proc_context_has_addr_as_drop_points(GProcContext *, virt_t); /* Fournit une adresse virtuelle comme point de départ de code. */ bool g_proc_context_pop_drop_point(GProcContext *, virt_t *); diff --git a/src/gtkext/gtkextstatusbar.c b/src/gtkext/gtkextstatusbar.c index 62d4950..e936866 100644 --- a/src/gtkext/gtkextstatusbar.c +++ b/src/gtkext/gtkextstatusbar.c @@ -537,6 +537,8 @@ status_blob_info *init_progessive_status(GtkExtStatusBar *bar, const char *messa { status_blob_info *result; /* Information à retourner */ + return NULL; + result = (status_blob_info *)calloc(1, sizeof(status_blob_info)); if (bar != NULL) @@ -568,6 +570,7 @@ status_blob_info *init_progessive_status(GtkExtStatusBar *bar, const char *messa void fini_progessive_status(status_blob_info *info) { + return; gtk_extended_status_bar_remove(info->bar, info->id); if (info->bar != NULL) @@ -592,6 +595,7 @@ void fini_progessive_status(status_blob_info *info) double get_current_progessive_status(const status_blob_info *info) { + return 0.0; return info->current; } @@ -612,6 +616,7 @@ double get_current_progessive_status(const status_blob_info *info) void inc_progessive_status(status_blob_info *info, double inc) { + return; assert((info->current + inc) < info->max); info->current += inc; -- cgit v0.11.2-87-g4458