katch high coverage tes2ng of so6ware patches
play

KATCH: High-Coverage Tes2ng of So6ware Patches Paul - PowerPoint PPT Presentation

KATCH: High-Coverage Tes2ng of So6ware Patches Paul Marinescu and Cris2an Cadar Imperial College London Intro Manual tes2ng is hard Supplement it


  1. KATCH: ¡High-­‑Coverage ¡Tes2ng ¡of ¡ So6ware ¡Patches ¡ Paul ¡Marinescu ¡and ¡Cris2an ¡Cadar ¡ Imperial ¡College ¡London ¡

  2. Intro ¡ • Manual ¡tes2ng ¡is ¡hard ¡ • Supplement ¡it ¡with ¡automa2c ¡tes2ng ¡ • We ¡focus ¡on ¡tes2ng ¡so6ware ¡changes ¡ ¡ 2 ¡

  3. Manual ¡Patch ¡Coverage ¡ Covered ¡by ¡test ¡suite ¡ Not ¡covered ¡ 100% ¡ 90% ¡ 80% ¡ 70% ¡ 60% ¡ 50% ¡ 40% ¡ 30% ¡ 20% ¡ 10% ¡ 0% ¡ findu2ls ¡ diffu2ls ¡ binu2ls ¡ 3 ¡

  4. 4 ¡

  5. Example: ¡Tes2ng ¡diffu2ls ¡ $ ls diffutils config.sh build.sh regression-test.sh $ cat config.sh REPO="git://git.savannah.gnu.org/diffutils.git" DIFFTARGETS="src lib" PROGRAMS="src/diff src/diff3 src/sdiff src/cmp" LIBS="-lrt" $ katch diffutils 0 100 5 ¡

  6. High-­‑Level ¡Idea ¡ • Synthesize ¡inputs ¡which ¡execute ¡the ¡patch ¡ code ¡ • Given ¡a ¡program ¡loca2on ¡(e.g. ¡file ¡name, ¡line ¡ number), ¡synthesize ¡an ¡input ¡which ¡executes ¡ that ¡loca2on ¡ 6 ¡

  7. High-­‑Level ¡Approach ¡ • Concrete/Symbolic ¡execu2on ¡mix ¡+ ¡heuris2cs ¡ • Seeded ¡with ¡exis2ng ¡inputs ¡from ¡the ¡ regression ¡test ¡suites ¡ 7 ¡

  8. System ¡Overview ¡ Informed ¡Path ¡ Regenera2on ¡ New ¡ Program, ¡ Symbolic ¡ Patch ¡ Input ¡ program ¡ Patch, ¡ Execu4on ¡ Preprocessing ¡ Selec4on ¡ Greedy ¡ inputs ¡ Test ¡suite ¡ Explora2on ¡ Defini2on ¡ Switching ¡ KATCH ¡ 8 ¡

  9. Patch ¡Preprocessing ¡ Index: src/mod_accesslog.c ========================================== --- src/mod_accesslog.c (revision 2659) +++ src/mod_accesslog.c (revision 2660) @@ -156,6 +156,13 @@ void log(char input) { int file = open(”access.log”, ...); + if (input >= ’ ␣ ’ && + input <= ’~’) { // printable characters write(file, &input, 1); + } else { + char escinput; TARGET ¡1 ¡ + escinput = escape(input); src/mod_accesslog.c:164 + write(file, &escinput, 1); + } close(file); } 9 ¡

  10. Input ¡Selec2on ¡ • Rank ¡exis2ng ¡inputs ¡based ¡on ¡how ¡‘easy’ ¡it ¡is ¡ to ¡change ¡them ¡to ¡execute ¡the ¡patch ¡ • Op2miza2on ¡ • Lightweight ¡ 10 ¡

  11. Input ¡Selec2on ¡ Input ¡ A ¡ – ¡distance ¡4 ¡ Input ¡ B ¡ – ¡distance ¡2 ¡ Example ¡control-­‑flow ¡graph ¡ 11 ¡

  12. Concrete/Symbolic ¡Execu2on ¡ • Itera2ve ¡refinement ¡of ¡the ¡ini2al ¡input ¡ • Get ¡‘closer’ ¡to ¡the ¡target ¡at ¡each ¡itera2on ¡ • Symbolic ¡execu2on ¡+ ¡path ¡selec2on ¡heuris2cs ¡ 12 ¡

  13. Greedy ¡Explora2on ¡Step ¡ lighfpd ¡r2660: ¡patch ¡ void log(char input) { int file = open(”access.log”, …); modifies ¡log() ¡to ¡escape ¡ if (input >= ’ ␣ ’ && sensi2ve ¡characters ¡ input <= ’~’) { // printable characters write(file, &input, 1); + } else { + char escinput = escape(input); + write(file, &escinput, 1); + } close(file); } 13 ¡

  14. Greedy ¡Explora2on ¡Step ¡ Available ¡input: ¡“t” ¡ void log(char input) { int file = open(”access.log”, …); (or ¡any ¡printable ¡char) ¡ if (input >= ’ ␣ ’ && input <= ’~’) { // printable characters 1. Greedy ¡step: ¡ write(file, &input, 1); choose ¡the ¡ + } else { symbolic ¡branch ¡ + char escinput = escape(input); + write(file, &escinput, 1); whose ¡unexplored ¡ + } side ¡is ¡closest ¡to ¡the ¡ close(file); patch. ¡ } 2. Explore ¡this ¡side! ¡ ¡ 14 ¡

  15. Informed ¡Path ¡Regenera2on ¡ void log(char input) { Available ¡input: ¡“GET” ¡ if (input >= ’ ␣ ’ && input <= ’~’) { Greedy ¡step ¡fails! ¡ . . . } else { + . . . 1. Backtrack ¡to ¡the ¡ } symbolic ¡branch ¡ } that ¡disallows ¡this ¡ if (0 == strcmp(request, “GET”) side ¡to ¡be ¡executed ¡ . . . 2. Explore ¡the ¡other ¡ for (char* p = request; *p; p++) side ¡of ¡that ¡branch ¡ log(*p); ¡ request[2] ¡≠ ¡‘T’ ¡ 15 ¡

  16. Defini2on ¡Switching ¡ Available ¡test: ¡opt ¡= ¡ ‘a’ ¡ enum escape_t escape; void log(char input) { Patch ¡guarded ¡by ¡concrete ¡ if (escape == ESCAPE_ALL) { branch ¡ + . . . } Backtracking ¡step ¡fails! ¡ } 1. Find ¡all ¡reaching ¡ opt = getopt_long(argc, argv, ...); defini2ons ¡for ¡the ¡ switch (opt) { variables ¡involved ¡and ¡try ¡ case ‘a’: escape = ESCAPE_SPACE; to ¡cover ¡another ¡one ¡ break; 2. Favors ¡defini2ons ¡that ¡ case ‘b’: escape = ESCAPE_ALL; can ¡be ¡sta2cally ¡shown ¡to ¡ . . . sa2sfy ¡target, ¡or ¡ log(. . .); unexecuted ¡defini2ons ¡ 16 ¡

  17. Evalua2on ¡ findu2ls ¡ diffu2ls ¡ binu2ls ¡ 120 ¡ 114 ¡executable ¡patches ¡ 1362 ¡targets ¡ Added/modified ¡executable ¡basic ¡blocks ¡ 100 ¡ 80 ¡ 60 ¡ 40 ¡ 20 ¡ 0 ¡ 2010 ¡ 2011 ¡ 2012 ¡ 2013 ¡ 17 ¡

  18. Coverage ¡Improvement ¡ Covered ¡by ¡test ¡suite ¡ Covered ¡by ¡KATCH ¡ Not ¡covered ¡ 100% ¡ 90% ¡ 80% ¡ 70% ¡ 60% ¡ 50% ¡ 40% ¡ 30% ¡ 20% ¡ 10% ¡ 0% ¡ findu2ls ¡ diffu2ls ¡ binu2ls ¡ 18 ¡

  19. Bugs ¡Found ¡ 4 ¡bugs ¡ 15 ¡Crash ¡Bugs ¡ 6 ¡bugs ¡in ¡patch ¡code ¡ 5 ¡bugs ¡close ¡to ¡patch ¡code ¡ unknown ¡ causal ¡rela2on ¡ 19 ¡

  20. Bugs ¡Found ¡ Already ¡fixed ¡in ¡ Reported ¡and ¡pending ¡ the ¡last ¡version ¡ 2 ¡ 12 ¡ 1 ¡ Reported ¡and ¡fixed ¡ 20 ¡

  21. Automa2c ¡Patch ¡Tes2ng ¡ Prac2cal ¡autonomous ¡tes2ng ¡system ¡ ¡ Coverage ¡improvement ¡and ¡bug ¡finding ¡ ¡ Short ¡ar2fact* ¡presenta2on ¡on ¡Friday ¡ hfp://srg.doc.ic.ac.uk/projects/katch/ ¡ *Successfully ¡evaluated ¡by ¡the ¡ESEC/FSE ¡ar2fact ¡evalua2on ¡commifee ¡ 21 ¡

  22. Selected ¡Related ¡Work ¡ • Directed ¡Test ¡Suite ¡Augmenta2on ¡(APSEC’09, ¡FSE’10) ¡ • Directed ¡Symbolic ¡Execu2on ¡(SAS’11) ¡ • Differen2al ¡Symbolic ¡Execu2on ¡(FSE’08) ¡ • Directed ¡Incremental ¡Sym ¡bolic ¡Execu2on ¡(PLDI’11) ¡ 22 ¡

  23. Heuris2c ¡Contribu2on ¡ Suite ¡ Greedy ¡ Greedy+IPR ¡ Greedy+DS ¡ KATCH ¡ findu2ls ¡ 74 ¡ 85 ¡ 78 ¡ 85 ¡ diffu2ls ¡ 25 ¡ 29 ¡ 49 ¡ 63 ¡ binu2ls ¡ 70 ¡ 121 ¡ 76 ¡ 135 ¡ Total ¡ 169 ¡ 235 ¡ 203 ¡ 283 ¡ IPR ¡= ¡Informed ¡Path ¡Regenera2on ¡ DS ¡ ¡= ¡Defini2on ¡Switching ¡ 23 ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend