Skip to content

Commit

Permalink
remove klee_alias_function()
Browse files Browse the repository at this point in the history
this function can be used to modify the control flow of the program
on different paths, enabling self-modifying code.
  • Loading branch information
jbuening authored and ccadar committed May 30, 2019
1 parent abf6542 commit 4b93a3e
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 103 deletions.
2 changes: 0 additions & 2 deletions include/klee/ExecutionState.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,6 @@ class ExecutionState {
std::set<std::string> arrayNames;

std::string getFnAlias(std::string fn);
void addFnAlias(std::string old_fn, std::string new_fn);
void removeFnAlias(std::string fn);

// The objects handling the klee_open_merge calls this state ran through
std::vector<ref<MergeHandler> > openMergeStack;
Expand Down
8 changes: 0 additions & 8 deletions include/klee/klee.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,6 @@ extern "C" {
/* Enable/disable forking. */
void klee_set_forking(unsigned enable);

/* klee_alias_function("foo", "bar") will replace, at runtime (on
the current path and all paths spawned on the current path), all
calls to foo() by calls to bar(). foo() and bar() have to exist
and have identical types. Use klee_alias_function("foo", "foo")
to undo. Be aware that some special functions, such as exit(),
may not always work. */
void klee_alias_function(const char* fn_name, const char* new_fn_name);

/* Print stack trace. */
void klee_stack_trace(void);

Expand Down
8 changes: 0 additions & 8 deletions lib/Core/ExecutionState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,6 @@ std::string ExecutionState::getFnAlias(std::string fn) {
else return "";
}

void ExecutionState::addFnAlias(std::string old_fn, std::string new_fn) {
fnAliases[old_fn] = new_fn;
}

void ExecutionState::removeFnAlias(std::string fn) {
fnAliases.erase(fn);
}

/**/

llvm::raw_ostream &klee::operator<<(llvm::raw_ostream &os, const MemoryMap &mm) {
Expand Down
15 changes: 0 additions & 15 deletions lib/Core/SpecialFunctionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ static SpecialFunctionHandler::HandlerInfo handlerInfo[] = {
add("klee_stack_trace", handleStackTrace, false),
add("klee_warning", handleWarning, false),
add("klee_warning_once", handleWarningOnce, false),
add("klee_alias_function", handleAliasFunction, false),
add("malloc", handleMalloc, true),
add("memalign", handleMemalign, true),
add("realloc", handleRealloc, true),
Expand Down Expand Up @@ -299,20 +298,6 @@ void SpecialFunctionHandler::handleSilentExit(ExecutionState &state,
executor.terminateState(state);
}

void SpecialFunctionHandler::handleAliasFunction(ExecutionState &state,
KInstruction *target,
std::vector<ref<Expr> > &arguments) {
assert(arguments.size()==2 &&
"invalid number of arguments to klee_alias_function");
std::string old_fn = readStringAtAddress(state, arguments[0]);
std::string new_fn = readStringAtAddress(state, arguments[1]);
KLEE_DEBUG_WITH_TYPE("alias_handling", llvm::errs() << "Replacing " << old_fn
<< "() with " << new_fn << "()\n");
if (old_fn == new_fn)
state.removeFnAlias(old_fn);
else state.addFnAlias(old_fn, new_fn);
}

void SpecialFunctionHandler::handleAssert(ExecutionState &state,
KInstruction *target,
std::vector<ref<Expr> > &arguments) {
Expand Down
1 change: 0 additions & 1 deletion lib/Core/SpecialFunctionHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ namespace klee {
HANDLER(handleDeleteArray);
HANDLER(handleExit);
HANDLER(handleErrnoLocation);
HANDLER(handleAliasFunction);
HANDLER(handleFree);
HANDLER(handleGetErrno);
HANDLER(handleGetObjSize);
Expand Down
37 changes: 0 additions & 37 deletions test/Feature/AliasFunction.c

This file was deleted.

31 changes: 0 additions & 31 deletions test/Feature/AliasFunctionExit.c

This file was deleted.

1 change: 0 additions & 1 deletion tools/klee/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,6 @@ static const char *modelledExternals[] = {
"klee_silent_exit",
"klee_warning",
"klee_warning_once",
"klee_alias_function",
"klee_stack_trace",
"llvm.dbg.declare",
"llvm.dbg.value",
Expand Down

0 comments on commit 4b93a3e

Please sign in to comment.