Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions core/dynamo.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,10 +853,6 @@ standalone_init(void)
standalone_library = true;
/* We have release-build stats now so this is not just DEBUG */
stats = &nonshared_stats;
#if defined(INTERNAL) && defined(DEADLOCK_AVOIDANCE)
/* avoid issues w/ GLOBAL_DCONTEXT instead of thread dcontext */
dynamo_options.deadlock_avoidance = false;
#endif
#ifdef UNIX
os_page_size_init((const char **)our_environ);
#endif
Expand All @@ -865,6 +861,10 @@ standalone_init(void)
if (!syscalls_init())
return NULL; /* typically b/c of unsupported OS version */
#endif
#ifdef DEBUG
nonshared_stats.logmask = LOG_ALL;
#endif

config_init();
options_init();
vmm_heap_init();
Expand All @@ -887,8 +887,6 @@ standalone_init(void)

# ifdef DEBUG
/* FIXME: share code w/ main init routine? */
nonshared_stats.logmask = LOG_ALL;
options_init();
if (stats->loglevel > 0) {
char initial_options[MAX_OPTIONS_STRING];
main_logfile = open_log_file(main_logfile_name(), NULL, 0);
Expand Down
19 changes: 13 additions & 6 deletions core/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,8 @@ char option_string[MAX_OPTIONS_STRING] = {0,};
# define ASSERT_OWN_OPTIONS_LOCK(b, l) ASSERT_OWN_WRITE_LOCK(b, l)
# define CORE_STATIC static
/* official options */
options_t dynamo_options = {
# include "optionsx.h"
};
options_t dynamo_options;

/* Temporary string, static to save stack space in synchronize_dynamic_options().
* FIXME case 8074: should protect this better as w/o DR dll randomization attacker
* can repeatedly try to clobber. Move to heap? Or shrink stack space elsewhere
Expand Down Expand Up @@ -2440,11 +2439,19 @@ options_init()
{
int ret = 0, retval;

/* .lspdata pages start out writable so no unprotect needed here */
write_lock(&options_lock);
/* Apart from when we start of, we might end up here due to post processing.
* When here due to post processing, dynamo_options would not be writable.
* So we make them writable first.
*/
options_make_writable();
ASSERT(sizeof(dynamo_options) == sizeof(options_t));
/* Set to default options. */
set_dynamo_options_defaults(&dynamo_options);
#if defined(INTERNAL) && defined(DEADLOCK_AVOIDANCE)
/* avoid issues w/ GLOBAL_DCONTEXT instead of thread dcontext */
dynamo_options.deadlock_avoidance = false;
#endif
/* get dynamo options */
adjust_defaults_for_page_size(&dynamo_options);
retval = get_parameter(PARAM_STR(DYNAMORIO_VAR_OPTIONS), option_string,
sizeof(option_string));
if (IS_GET_PARAMETER_SUCCESS(retval))
Expand Down