automatic technology for detecting fatal sw errors before testing
DESCRIPTION
Automatic Technology for Detecting Fatal SW Errors Before Testing. 이광근 교수 Programming Research Lab. Seoul National University 12/19/2006 @ Samsung-SNU Workshop. Content. Technology: Static Program Analysis Product: Sparrow 1.0 Research: Sparrow 1.0SE. Open Problem. 소프트웨어가 실행되기 전에 - PowerPoint PPT PresentationTRANSCRIPT
Automatic Technology for Detecting Fatal SW Errors Before
Testing
이광근 교수
Programming Research Lab.Seoul National University
12/19/2006 @ Samsung-SNU Workshop
Content
Technology: Static Program Analysis Product: Sparrow 1.0 Research: Sparrow 1.0SE
Open Problem 소프트웨어가 실행되기 전에 우리가 바라는대로 실행될 지를
no core dump/segmentation fault no buffer overrun no memory leak “x.s > 0 at line 321” “notNull(y) whenever x = 0” etc.
엄밀하게 미리 확인해주는 기술은 ?
Static Program Analysis
프로그램의 실행 내용을실행전에 자동으로안전하게 어림잡는
일반적인 기술
“static analysis” “ 정적분석” “프로그램분석”
“ 실행전” : 프로그램을 실행시키지 않고 “ 자동으로” : 프로그램이 프로그램을 분석 “ 안전하게” : 모든 가능성을 포섭 “ 어림잡는” : 실제 이외의 것들이 포함됨
어림잡지 않으면 불가능 “ 일반적” : 소스 언어와 분석가능한 성질이
무제한 C, C++, C#, Java, ML, UML, JVM, x86, bits, etc. buffer overrun? memory leak? x=y at line 2? notNull(x) whenever y.s=0?
테스트와 다른점
테스트는 SW 를 실행시킬 수 있을 때 까지 기다려야
테스트는 찾고자 하는 오류를 모두 찾을 수 없음
프로그램 분석기 (static program analyzer) 는 SW 를 실행시키지 않고 타겟 오류의 위치를
자동으로 찾아줌 SW 의 소스만 준비되면 됨
Limitation: 허위 경보 (false alarm) inevitable
repeat if E then x = x+1 else x = x-1 until B
rule of the game minimize false alarms no (few) undetected errors with a reasonable cost
Sparrow 1.0
SW 오류 검증 기술의 진화
1990s 2000s1980s
효용
및
성숙도
2010s
테스트기술
정적분석기
술coverity.compolyspace.com
Sparrow 1.0
Sparrow 1.0
타겟 소스언어 C, C++ ANSI, GNU, MS, ARM, etc.
타겟 오류 buffer overrun memory leak uninitialized access
Other Players coverity.com
Stanford U., 미국시장에서 활발 , ’05 국내 진출시도 polyspace.com
Ecole Polytech., 유럽시장에서 활발 , ’06 국내 진출시도 grammatech.com
U. of Wisconsin-Madison, 미국정부시장 기타 ( 분석기술 미흡 : “shallow” analysis)
fortify, klocwork, secure, seque, wily 기존의 runtime tools
상용 PurifyPlus, Parasoft Insure++, Trace32, WinDBG, …
공개 SW Valgrind …
BMT Results
Sparrow vs Prevent (coverity.com) buffer overrun 최대 30% 더 많이 오류 검출
Sparrow vs Prevent (coverity.com) memory leak 최대 200% 더 많이 오류 검출
errors
errors
Sparrow 성능 1/2
GNU SoftwareAlarm
sReal Errors LOC Time (sec)
tar-1.13 1 1 20,258 22
sed-4.0.8 0 0 6,053 82
gzip-1.2.4a 0 0 7,327 32
grep-2.5.1 0 0 9,297 66
tcl-8.4.14 19 215,674 ~ 4hrs
netsmp-5.4 58 344,005 ~ 4hrs
On a Linux 2.6 box with Pentium4 3.2GHz, 4GB RAM
Buffer Overrun
Sparrow 성능 2/2
GNU SoftwareAlarm
sReal Errors LOC Time (sec)
tar-1.13 0 0 20,258 23
bison-1.875 10 5 25,907 49
gzip-1.2.4a 0 0 7,327 6
grep-2.5.1 4 1 9,297 26
openSSH-4.3p2 27 12 77,329 373
httpd-2.2.2 2 0 316,436 565
On a Linux 2.6 box with Pentium4 3.2GHz, 4GB RAM
Memory Leaks
Sparrow beats Prevent for 1/4
deep call chain function pointers function argument loop induction variables C standard library – memcpy, memset, …
Buffer Overrun
11
36
20True
False
Sparrow beats Prevent for 1/5
arbitrary pointer aliasing alloc/free complex data structure linking argument pointers infinite loop recursion
Memory Leaks
12
16
7 3
2
True
False
Sparrow 1.0
Sparrow 1.0SE for Verified System SWs
maybe interesting to Samsung Electronics
SW Labs.
Our Position 1/2
Goal zero-false-alarm analyzer for key system sws “domain-specific” zero-false-alarm sound anal
yzer
Our Position 2/2
For a particular sw A Can safely specialize Sparrow 1.0 Precise enough not to generate false alarms
Will be effective for later versions of A zfa Sparrow 1.0SE for Apache zfa Sparrow 1.0SE for Flash-memory Linux zfa Sparrow 1.0SE for Flash-memory DB ...
Example: Work In Progress toward zfa Sparrow 1.0 SE for Apache httpd-2.
2.2 we runned Sparrow 1.0 for Apache httpd-2.2.
2 found 2 real bugs, w identified 6 classes of false alarms addressed one class of false alarms have removed 9 false alarms and so on...
Conclusion
Technology: Static Program Analysis Product: Sparrow 1.0 Research: Sparrow 1.0SE
Thank you.
About me 연구
static program analysis 연구 2003- 현재 : 부교수 , 서울대 컴퓨터공학부 1998-2003: 단장 , 프로그램분석시스템 연구단 , 과기부
창의 연구단 1995-2003: 조교수 / 부교수 , KAIST 1993-1995: 정규연구원 , SW Principles Research, Bell Lab
s., Murry Hill, USA 1993: PhD, CS, Univ. of Illinois at Urbana-Champaign
ropas.snu.ac.kr/~kwang
Real Bugs Foundsrclib/apr/file_io/unix/filepath.c158 if (addpath[0] == '/') {159 /* Ignore the given root path, strip off leading160 * '/'s to a single leading '/' from the addpath,161 * and leave addpath at the first non-'/' character.162 */163 keptlen = 0;164 while (addpath[0] == '/')165 ++addpath;166 path[0] = '/';167 pathlen = 1;168 }
What if the array addpath only has ‘/’