Skip to content

Commit 85774bd

Browse files
author
Tianyu Zhou
authored
Merge pull request #1 from RiS3-Lab/main
update
2 parents 888c468 + 7b53f60 commit 85774bd

3 files changed

Lines changed: 15 additions & 9 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ Shout out to their amazong contributions that made this possible.
6363
Q & A
6464
----
6565
Should you have any question, feel free to raise an issue in this repo or directly contact the author at liu.changm@northeastern.edu.
66-
It's intended that this project to be actively maintained for a period of time(mainly for readability improvement).
66+
It's intended that this project to be actively maintained for a period of time, mainly for readability improvement and performance fine-tuning.

pass/KSym/AnalysisDriver.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -493,22 +493,26 @@ Instruction* SAHandle::seed2sanitizedVar(CallInst *seed,enum UB_types UB_type) {
493493
return nullptr;
494494
}
495495
if(sanitized_stuct->getNumUses() == 1){
496-
// this only one use can only be the "insertValue" inst which is pointless
496+
// this only one use can only be the "extractInst" inst which is pointless
497497
errs()<<"Err: sanitized value not used\n";
498498
return nullptr;
499499
}
500500
if(sanitized_stuct->getNumUses() >= 2){
501501
auto u_it = sanitized_stuct->user_begin();
502502
for(; u_it != sanitized_stuct->user_end(); u_it++){
503503
Value * use_of_struct = *u_it;
504+
//errs()<<*use_of_struct<<'\n';
504505
ExtractValueInst * extract_inst = dyn_cast<ExtractValueInst>(use_of_struct);
505506
if(extract_inst != nullptr && use_of_struct != conVar){
506507
ub_value = extract_inst;
507508
break;
508509
}
509510
}
510511
}
511-
assert(ub_value != nullptr);
512+
if(ub_value == nullptr){
513+
// the sanitized value is never extracted from the struct
514+
return nullptr;
515+
}
512516
return ub_value;
513517
}
514518
else{
@@ -543,6 +547,7 @@ bool SAHandle::stillWrong(Instruction * sanitized_var,SEGraph*seg){
543547
int SAHandle::postBugAnalysis(TraceStatus* traceStatus,blist & old_blks ,Slice& old_slice){
544548
enum UB_types ub_type = seed2UBType(traceStatus->seed);
545549
Instruction * sanitized_value = seed2sanitizedVar(traceStatus->seed,ub_type);
550+
546551
if(ub_type != ub_notype){
547552
// this is a UB that needs to be post-bug analyzed
548553
if(sanitized_value == nullptr){
@@ -857,7 +862,7 @@ void SAHandle::run() {
857862
// also collect fetches, for later reporting purpose.
858863
collectSeed();
859864
collectFetch();
860-
865+
//errs()<<func<<'\n';
861866
while(seeds.size() > MAX_NUM_SEEDS_PER_FUNC){
862867
seeds.erase(seeds.begin());
863868
}

pass/KSym/Tool.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static void parseCheckPoint(string outFileName,vector<string>& ret){
119119
return;
120120
}
121121

122-
int MAX_NUM_TRACES_PER_SEED = 128;
122+
int MAX_NUM_TRACES_PER_SEED = 512;
123123
int MAX_NUM_SEEDS_PER_FUNC = 50;
124124
int MAX_NUM_CALLSITES_PER_CALLER=10;
125125
int MAX_NUM_CALLERS=10;
@@ -194,7 +194,7 @@ bool KSym::runOnModule(Module &m) {
194194
if(std::find(alreadyProcess.begin(),alreadyProcess.end(),funcName) != alreadyProcess.end()){
195195
continue;
196196
}*/
197-
string tarFunc("ch_gstatus");
197+
string tarFunc("sys_copyarea");
198198
//if(funcName != tarFunc ) {
199199
// continue;
200200
//}
@@ -297,16 +297,17 @@ bool KSym::runOnModule(Module &m) {
297297
errs()<<to_write;
298298
SAHandle* handleInter = new SAHandle(*cur_caller,&(calleeF->getFunc()),\
299299
mo,fw,user_paras,eachCallerFunc->second,&calleeF->interPTraces,taintSum,hop_count);
300-
handleInter->runInter();
300+
//
301301
/*
302+
handleInter->runInter();
302303
vector<string> new_processed_funcs(processed_funcs.begin(),processed_funcs.end());
303304
new_processed_funcs.push_back(caller_name);
304305
calleeList_next.push_back(make_pair(handleInter,new_processed_funcs));
305306
handleInter->mergeResult(summarized);
306307
*/
307308
std::future<void> fut = std::async(std::launch::async,&SAHandle::runInter,handleInter);
308-
std::chrono::system_clock::time_point one_hundred_seconds = std::chrono::system_clock::now() + std::chrono::seconds(100);
309-
if(fut.wait_until(one_hundred_seconds) == std::future_status::ready){
309+
std::chrono::system_clock::time_point timed_out_limit = std::chrono::system_clock::now() + std::chrono::seconds(200);
310+
if(fut.wait_until(timed_out_limit) == std::future_status::ready){
310311
vector<string> new_processed_funcs(processed_funcs.begin(),processed_funcs.end());
311312
new_processed_funcs.push_back(caller_name);
312313
calleeList_next.push_back(make_pair(handleInter,new_processed_funcs));

0 commit comments

Comments
 (0)