specification less semantic bug detection
play

Specification-less Semantic Bug Detection Zhendong Su ETH Zurich - PowerPoint PPT Presentation

Specification-less Semantic Bug Detection Zhendong Su ETH Zurich What is the key mission of Computer Science? To help people turn creative ideas into working systems Software research is central to this mission A lot of progress to celebrate


  1. Approach Verify that Generate Randomly Query for the Pivot Select Generate the Pivot Row is Pivot Row Database Row contained

  2. Approach Verify that Generate Randomly Query for the Pivot Select Generate the Pivot Row is Pivot Row Database Row contained

  3. Approach How do we generate this query? Verify that Generate Randomly Query for the Pivot Select Generate the Pivot Row is Pivot Row Database Row contained

  4. How to generate queries? SELECT picture, description FROM animal_pictures WHERE Generate an expression that yields TRUE for the pivot row

  5. How to generate queries? Modify Use in Randomly Evaluate expression to WHERE Generate Expression yield TRUE clause Expression on Pivot Row

  6. Random exp. generation animal_pictures animal description picture We first generate a random expression https://www.sqlite.org/syntax/expr.html

  7. Random exp. generation animal = 'Cat' AND description LIKE '%cute%' AND = LIKE descri animal 'Cat' '%cute%' ption

  8. Random exp. generation animal = 'Cat' AND description LIKE '%cute%' AND Evaluate the tree based on the pivot row = LIKE descri animal 'Cat' '%cute%' ption

  9. Random exp. evaluation Constant nodes return their assigned literal AND values = LIKE 'Cat' '%cute%' descri animal 'Cat' '%cute%' ption

  10. Random exp. evaluation Column references return the values from the pivot row AND 'Cat = LIKE plants (cute!)' 'Cat' 'Cat' '%cute%' descri animal 'Cat' '%cute%' ption

  11. Random exp. evaluation Compound nodes compute their result AND based on their children TRUE TRUE 'Cat = LIKE plants (cute!)' 'Cat' 'Cat' '%cute%' descri animal 'Cat' '%cute%' ption

  12. Random exp. evaluation TRUE AND TRUE TRUE 'Cat = LIKE plants (cute!)' 'Cat' 'Cat' '%cute%' descri animal 'Cat' '%cute%' ption

  13. Query synthesis SELECT picture, description FROM animal_pictures WHERE animal = 'Cat' AND description LIKE '%cute%'

  14. Random exp. evaluation TRUE What about when the expression does not evaluate to TRUE ? AND TRUE TRUE 'Cat = LIKE plants (cute!)' 'Cat' 'Cat' '%cute%' descri animal 'Cat' '%cute%' ption

  15. Random exp. evaluation What about when the expression does not evaluate to TRUE ? FALSE animal = 'Dog' = 'Dog' 'Cat' animal 'Dog'

  16. Random exp. rectification switch (result) { case TRUE: result = randexpr; case FALSE: result = NOT randexpr; case NULL: result = randexpr ISNULL; }

  17. Random exp. rectification switch (result) { case TRUE: FALSE result = randexpr; animal = 'Dog' case FALSE: result = NOT randexpr; case NULL: result = randexpr ISNULL; }

  18. Random exp. rectification switch (result) { case TRUE: TRUE result = randexpr; NOT(animal = 'Dog') case FALSE: result = NOT randexpr; case NULL: result = randexpr ISNULL; }

  19. How to generate queries? SELECT picture, description FROM animal_pictures WHERE NOT(animal = 'Dog')

  20. Tested DBMS PostgreSQL We tested these (and other DBMS) in a period of 3-4 months

  21. DBMS

  22. DBMS

  23. DBMS

  24. Bugs overview Real Bugs DBMS Fixed Verified SQLite 65 0 MySQL 15 10 PostgreSQL 5 4 Sum 85 14 99 real bugs : code fixes or verified as bugs

  25. Bugs overview Real Bugs DBMS Fixed Verified SQLite 65 0 MySQL 15 10 PostgreSQL 5 4 Sum 85 14 The SQLite developers quickly responded to all our bug reports à we focused on this DBMS

  26. Bugs overview Real Bugs DBMS Fixed Verified SQLite 65 0 MySQL 15 10 PostgreSQL 5 4 Sum 85 14 All MySQL bug reports were verified quickly

  27. Bugs overview Real Bugs DBMS Fixed Verified SQLite 65 0 MySQL 15 10 PostgreSQL 5 4 Sum 85 14 MySQL’s trunk is unavailable , and it has a long release cycle

  28. Bugs overview Real Bugs DBMS Fixed Verified SQLite 65 0 MySQL 15 10 PostgreSQL 5 4 Sum 85 14 We found the fewest bugs in PostgreSQL and not all could be easily addressed

  29. Oracles Real Bugs DBMS Containment Error SEGFAULT SQLite 46 17 2 MySQL 14 10 1 PostgreSQL 1 7 1 Sum 61 34 4

  30. Oracles Real Bugs Containment Oracle DBMS Containment Error SEGFAULT SQLite 46 17 2 MySQL 14 10 1 PostgreSQL 1 7 1 Sum 61 34 4 Our Containment oracle allowed us to detect most errors

  31. Result: bug in SQLite3 Real Bugs Containment CREATE TABLE t0(c1 TEXT PRIMARY KEY) WITHOUT ROWID; Oracle CREATE INDEX i0 ON t0(c1 COLLATE NOCASE); INSERT INTO t0(c1) VALUES ('A'); INSERT INTO t0(c1) VALUES ('a'); An index is an auxiliary data structure that should not affect the query’s result

  32. Result: bug in SQLite3 Real Bugs Containment CREATE TABLE t0(c1 TEXT PRIMARY KEY) WITHOUT ROWID; Oracle CREATE INDEX i0 ON t0(c1 COLLATE NOCASE); c1 INSERT INTO t0(c1) VALUES ('A'); INSERT INTO t0(c1) VALUES ('a'); 'A' 'a'

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