SlideShare ist ein Scribd-Unternehmen logo
1 von 15
Downloaden Sie, um offline zu lesen
Coccinelle
Program matching and transformation tool for C
(System) code.
Gilles Muller, Julia Lawall
EPI REGAL, INRIA/LIP6
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
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
A “simple” Bug in Linux
 The “!&” bug
if (!state->card->
ac97_status & CENTER_LFE_ON)
val &= ~DSP_BIND_CENTER_LFE;
Boolean
Integer
A “simple” Bug in Linux
 The “!&” bug
if (!state->card->
ac97_status & CENTER_LFE_ON)
val &= ~DSP_BIND_CENTER_LFE;
Boolean
Integer
Bug fix
if (!(state->card->
ac97_status & CENTER_LFE_ON))
val &= ~DSP_BIND_CENTER_LFE;
Boolean
Integer
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
A Simple SmPL Sample
@@
expression E;
constant C;
@@
!E & C
A Simple SmPL Sample
@@
expression E;
constant C;
@@
- !E & C
A Simple SmPL Sample
@@
expression E;
constant C;
@@
- !E & C
+ !(E & C)
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 !!!
Bugs in Linux 2.6
[ASPLOS 2010]
Coccinelle Impact
 1000 patches accepted in the Linux
kernel
 40 SP in kernel sources
 Many users… but we don’t know all of
them
Questions?
CocciCheck your code, it’s free….
http://coccinelle.lip6.fr
Why Coccinelle ?
A Coccinelle (ladybug) is a bug that eats
smaller bugs
Owf 2013 rii coccinelle muller speaker 1

Weitere ähnliche Inhalte

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Empfohlen

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Empfohlen (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Owf 2013 rii coccinelle muller speaker 1

  • 1. Coccinelle Program matching and transformation tool for C (System) code. Gilles Muller, Julia Lawall EPI REGAL, INRIA/LIP6
  • 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. 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. A “simple” Bug in Linux  The “!&” bug if (!state->card-> ac97_status & CENTER_LFE_ON) val &= ~DSP_BIND_CENTER_LFE; Boolean Integer
  • 5. A “simple” Bug in Linux  The “!&” bug if (!state->card-> ac97_status & CENTER_LFE_ON) val &= ~DSP_BIND_CENTER_LFE; Boolean Integer
  • 6. Bug fix if (!(state->card-> ac97_status & CENTER_LFE_ON)) val &= ~DSP_BIND_CENTER_LFE; Boolean Integer
  • 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. A Simple SmPL Sample @@ expression E; constant C; @@ !E & C
  • 9. A Simple SmPL Sample @@ expression E; constant C; @@ - !E & C
  • 10. A Simple SmPL Sample @@ expression E; constant C; @@ - !E & C + !(E & C)
  • 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. Bugs in Linux 2.6 [ASPLOS 2010]
  • 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. Questions? CocciCheck your code, it’s free…. http://coccinelle.lip6.fr Why Coccinelle ? A Coccinelle (ladybug) is a bug that eats smaller bugs