Owf 2013 rii coccinelle muller speaker 1

699 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
699
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Owf 2013 rii coccinelle muller speaker 1

  1. 1. Coccinelle Program matching and transformation tool for C (System) code. Gilles Muller, Julia Lawall EPI REGAL, INRIA/LIP6
  2. 2. The problem: Dealing with Systems Code  It’s huge  It’s configuration polymorph  It’s often written in C  It evolves continuously  It’s (unfortunately) buggy
  3. 3. A “simple” Bug in Linux  The “!&” bug if (!state->card-> ac97_status & CENTER_LFE_ON) val &= ~DSP_BIND_CENTER_LFE; In sound/oss/ali5455.c until Linux 2.6.18
  4. 4. A “simple” Bug in Linux  The “!&” bug if (!state->card-> ac97_status & CENTER_LFE_ON) val &= ~DSP_BIND_CENTER_LFE; Boolean Integer
  5. 5. A “simple” Bug in Linux  The “!&” bug if (!state->card-> ac97_status & CENTER_LFE_ON) val &= ~DSP_BIND_CENTER_LFE; Boolean Integer
  6. 6. Bug fix if (!(state->card-> ac97_status & CENTER_LFE_ON)) val &= ~DSP_BIND_CENTER_LFE; Boolean Integer
  7. 7. The Coccinelle tool  Program matching and transformation for unpreprocessed C code.  Fits with the existing habits of Systems (Linux) programmers.  Semantic Patch Language (SmPL):  Based on the syntax of patches,  Declarative approach to transformation  High level search that abstracts away from irrelevant details  A single small semantic patch can modify hundreds of files, at thousands of code sites
  8. 8. A Simple SmPL Sample @@ expression E; constant C; @@ !E & C
  9. 9. A Simple SmPL Sample @@ expression E; constant C; @@ - !E & C
  10. 10. A Simple SmPL Sample @@ expression E; constant C; @@ - !E & C + !(E & C)
  11. 11. A Simple SmPL Sample @@ expression E; constant C; @@ - !E & C + !(E & C) 96 instances in Linux from 2.6.13 (August 2005) to v2.6.28 (December 2008) Warning, this is not always a bug !!!
  12. 12. Bugs in Linux 2.6 [ASPLOS 2010]
  13. 13. Coccinelle Impact  1000 patches accepted in the Linux kernel  40 SP in kernel sources  Many users… but we don’t know all of them
  14. 14. Questions? CocciCheck your code, it’s free…. http://coccinelle.lip6.fr Why Coccinelle ? A Coccinelle (ladybug) is a bug that eats smaller bugs

×