automatic technology for detecting fatal sw errors before testing

26
Automatic Technology for Detecting Fatal SW Errors Before Testing 이이이 이이 Programming Research Lab. Seoul National University 12/19/2006 @ Samsung-SNU Workshop

Upload: denise-hayes

Post on 03-Jan-2016

42 views

Category:

Documents


1 download

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 Presentation

TRANSCRIPT

Page 1: Automatic Technology  for Detecting Fatal SW Errors Before Testing

Automatic Technology for Detecting Fatal SW Errors Before

Testing

이광근 교수

Programming Research Lab.Seoul National University

12/19/2006 @ Samsung-SNU Workshop

Page 2: Automatic Technology  for Detecting Fatal SW Errors Before Testing

Content

Technology: Static Program Analysis Product: Sparrow 1.0 Research: Sparrow 1.0SE

Page 3: Automatic Technology  for Detecting Fatal SW Errors Before Testing

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.

엄밀하게 미리 확인해주는 기술은 ?

Page 4: Automatic Technology  for Detecting Fatal SW Errors Before Testing

Static Program Analysis

프로그램의 실행 내용을실행전에 자동으로안전하게 어림잡는

일반적인 기술

“static analysis” “ 정적분석” “프로그램분석”

Page 5: Automatic Technology  for Detecting Fatal SW Errors Before Testing

“ 실행전” : 프로그램을 실행시키지 않고 “ 자동으로” : 프로그램이 프로그램을 분석 “ 안전하게” : 모든 가능성을 포섭 “ 어림잡는” : 실제 이외의 것들이 포함됨

어림잡지 않으면 불가능 “ 일반적” : 소스 언어와 분석가능한 성질이

무제한 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?

Page 6: Automatic Technology  for Detecting Fatal SW Errors Before Testing

테스트와 다른점

테스트는 SW 를 실행시킬 수 있을 때 까지 기다려야

테스트는 찾고자 하는 오류를 모두 찾을 수 없음

프로그램 분석기 (static program analyzer) 는 SW 를 실행시키지 않고 타겟 오류의 위치를

자동으로 찾아줌 SW 의 소스만 준비되면 됨

Page 7: Automatic Technology  for Detecting Fatal SW Errors Before Testing

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

Page 8: Automatic Technology  for Detecting Fatal SW Errors Before Testing

Sparrow 1.0

Page 9: Automatic Technology  for Detecting Fatal SW Errors Before Testing

SW 오류 검증 기술의 진화

1990s 2000s1980s

효용

성숙도

2010s

테스트기술

정적분석기

술coverity.compolyspace.com

Sparrow 1.0

Page 10: Automatic Technology  for Detecting Fatal SW Errors Before Testing

Sparrow 1.0

타겟 소스언어 C, C++ ANSI, GNU, MS, ARM, etc.

타겟 오류 buffer overrun memory leak uninitialized access

Page 11: Automatic Technology  for Detecting Fatal SW Errors Before Testing

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 …

Page 12: Automatic Technology  for Detecting Fatal SW Errors Before Testing

BMT Results

Sparrow vs Prevent (coverity.com) buffer overrun 최대 30% 더 많이 오류 검출

Sparrow vs Prevent (coverity.com) memory leak 최대 200% 더 많이 오류 검출

errors

errors

Page 13: Automatic Technology  for Detecting Fatal SW Errors Before Testing
Page 14: Automatic Technology  for Detecting Fatal SW Errors Before Testing
Page 15: Automatic Technology  for Detecting Fatal SW Errors Before Testing

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

Page 16: Automatic Technology  for Detecting Fatal SW Errors Before Testing

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

Page 17: Automatic Technology  for Detecting Fatal SW Errors Before Testing

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

Page 18: Automatic Technology  for Detecting Fatal SW Errors Before Testing

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

Page 19: Automatic Technology  for Detecting Fatal SW Errors Before Testing

Sparrow 1.0

Page 20: Automatic Technology  for Detecting Fatal SW Errors Before Testing

Sparrow 1.0SE for Verified System SWs

maybe interesting to Samsung Electronics

SW Labs.

Page 21: Automatic Technology  for Detecting Fatal SW Errors Before Testing

Our Position 1/2

Goal zero-false-alarm analyzer for key system sws “domain-specific” zero-false-alarm sound anal

yzer

Page 22: Automatic Technology  for Detecting Fatal SW Errors Before Testing

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 ...

Page 23: Automatic Technology  for Detecting Fatal SW Errors Before Testing

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...

Page 24: Automatic Technology  for Detecting Fatal SW Errors Before Testing

Conclusion

Technology: Static Program Analysis Product: Sparrow 1.0 Research: Sparrow 1.0SE

Thank you.

Page 25: Automatic Technology  for Detecting Fatal SW Errors Before Testing

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

Page 26: Automatic Technology  for Detecting Fatal SW Errors Before Testing

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 ‘/’