SlideShare a Scribd company logo
Update on the C++ Core
Guidelines’ Lifetime Safety
analysis in Clang
Gábor Horváth
xazax.hun@gmail.com
1
Agenda
• Motivation
• Whirlwind tour of lifetime analysis
• See the following talks for details:
• https://youtu.be/80BZxujhY38?t=1096
• https://youtu.be/sjnp3P9x5jA
• Highlight some implementation details
• Evaluation
• Upstreaming
• Conclusions
2
Motivation
• Microsoft: 70 percent of security patches are fixing memory errors
• https://youtu.be/PjbGojjnBZQ
• C++ has many sources of errors:
• Manual memory management, temporary objects, Pointer-like objects, …
• Dynamic tools
• Few false positives, not every arch is supported, coverage is important
• Static tools
• Arch independent, the earlier a bug is found the cheaper the fix
• Works without good test coverage
3
Motivation #2
int *p;
{
int x;
p = &x;
}
*p = 5;
string_view sv;
{
string s{“CoreHard"};
sv = s;
}
sv[0] = ‘c’;
Many static tools warn for the left snippet but not for the right,
even though they are fundamentally similar.
4
Motivation #3
int *p = &getIntByValue();
std::string_view sv = "test"s;
5
A Tour of Herb’s Lifetime Analysis
• Intends to catch common errors (not a verification tool)
• Classify types into categories
• Owners: never dangle, implementation assumed to be correct
• Pointers: might dangle, tracking points-to sets
• Aggregates: handled member-wise
• Values: everything else
• Analysis is function local
• Two implementations
• We implemented it in a Clang fork
• Kyle Reed and Neil MacIntosh implemented the MSVC version
6
A Tour of Herb’s Lifetime Analysis #2
• Flow-sensitive analysis
• We only need annotations for misclassifications (rare)
• Maps each Pointer at each program point to a points-to set
• Elements of a points-to set:
• Null
• Invalid
• Static (lives longer than the pointer or we cannot reason about it)
• Local variable/parameter
• Aggregate member
• Owned memory of an Owner
7
A Tour of Herb’s Lifetime Analysis #3
• https://cppx.godbolt.org/z/IdGRsT
8
A Tour of Herb’s Lifetime Analysis #4
9
vector v1{…};
vector v2{…};
auto it = v1.begin();
if (cond)
it = v2.begin();
if (cond2)
v2.push_back(…);
*it = …; // warning
Implementation
10
Analysis Within
a Basic Block
• Basic blocks contain subexprs in an eval order, no AST traversal required
• End of full expression is not marked (apart from DeclStmt)
• When to invalidate Pointers to temporaries?
• Modified the CFG to include ExprWithCleanup AST nodes
• Clang Static Analyzer is another user
11
int x;
int *p = &x;
int *q = p;
2: x
3: &[B1.2]
4: int *p = &x;
5: p
6: [B1.5] (LValToRVal)
7: int *q = p;
2: {x}
3: {x}
4: pset(p)={x}
5: {p}
6: {x}
7: pset(q)={x}
Analysis Within
a Basic Block
• Basic blocks contain subexprs in an eval order, no AST traversal required
• End of full expression is not marked (apart from DeclStmt)
• When to invalidate Pointers to temporaries?
• Modified the CFG to include ExprWithCleanup AST nodes
• Clang Static Analyzer is another user
12
int x;
int *p = &x;
int *q = p;
2: x
3: &[B1.2]
4: int *p = &x;
5: p
6: [B1.5] (LValToRVal)
7: int *q = p;
2: {x}
3: {x}
4: pset(p)={x}
5: {p}
6: {x}
7: pset(q)={x}
Analysis Within
a Basic Block
• Basic blocks contain subexprs in an eval order, no AST traversal required
• End of full expression is not marked (apart from DeclStmt)
• When to invalidate Pointers to temporaries?
• Modified the CFG to include ExprWithCleanup AST nodes
• Clang Static Analyzer is another user
13
int x;
int *p = &x;
int *q = p;
2: x
3: &[B1.2]
4: int *p = &x;
5: p
6: [B1.5] (LValToRVal)
7: int *q = p;
2: {x}
3: {x}
4: pset(p)={x}
5: {p}
6: {x}
7: pset(q)={x}
Analysis Within
a Basic Block
• Basic blocks contain subexprs in an eval order, no AST traversal required
• End of full expression is not marked (apart from DeclStmt)
• When to invalidate Pointers to temporaries?
• Modified the CFG to include ExprWithCleanup AST nodes
• Clang Static Analyzer is another user
14
int x;
int *p = &x;
int *q = p;
2: x
3: &[B1.2]
4: int *p = &x;
5: p
6: [B1.5] (LValToRVal)
7: int *q = p;
2: {x}
3: {x}
4: pset(p)={x}
5: {p}
6: {x}
7: pset(q)={x}
Analysis Within
a Basic Block
• Basic blocks contain subexprs in an eval order, no AST traversal required
• End of full expression is not marked (apart from DeclStmt)
• When to invalidate Pointers to temporaries?
• Modified the CFG to include ExprWithCleanup AST nodes
• Clang Static Analyzer is another user
15
int x;
int *p = &x;
int *q = p;
2: x
3: &[B1.2]
4: int *p = &x;
5: p
6: [B1.5] (LValToRVal)
7: int *q = p;
2: {x}
3: {x}
4: pset(p)={x}
5: {p}
6: {x}
7: pset(q)={x}
Analysis Within
a Basic Block
• Basic blocks contain subexprs in an eval order, no AST traversal required
• End of full expression is not marked (apart from DeclStmt)
• When to invalidate Pointers to temporaries?
• Modified the CFG to include ExprWithCleanup AST nodes
• Clang Static Analyzer is another user
16
int x;
int *p = &x;
int *q = p;
2: x
3: &[B1.2]
4: int *p = &x;
5: p
6: [B1.5] (LValToRVal)
7: int *q = p;
2: {x}
3: {x}
4: pset(p)={x}
5: {p}
6: {x}
7: pset(q)={x}
Analysis Within
a Basic Block
• Basic blocks contain subexprs in an eval order, no AST traversal required
• End of full expression is not marked (apart from DeclStmt)
• When to invalidate Pointers to temporaries?
• Modified the CFG to include ExprWithCleanup AST nodes
• Clang Static Analyzer is another user
17
int x;
int *p = &x;
int *q = p;
2: x
3: &[B1.2]
4: int *p = &x;
5: p
6: [B1.5] (LValToRVal)
7: int *q = p;
2: {x}
3: {x}
4: pset(p)={x}
5: {p}
6: {x}
7: pset(q)={x}
Analysis Within
a Basic Block
• Basic blocks contain subexprs in an eval order, no AST traversal required
• End of full expression is not marked (apart from DeclStmt)
• When to invalidate Pointers to temporaries?
• Modified the CFG to include ExprWithCleanup AST nodes
• Clang Static Analyzer is another user
18
int x;
int *p = &x;
int *q = p;
2: x
3: &[B1.2]
4: int *p = &x;
5: p
6: [B1.5] (LValToRVal)
7: int *q = p;
2: {x}
3: {x}
4: pset(p)={x}
5: {p}
6: {x}
7: pset(q)={x}
Analysis Within
a Basic Block
• Basic blocks contain subexprs in an eval order, no AST traversal required
• End of full expression is not marked (apart from DeclStmt)
• When to invalidate Pointers to temporaries?
• Modified the CFG to include ExprWithCleanup AST nodes
• Clang Static Analyzer is another user
19
int x;
int *p = &x;
int *q = p;
2: x
3: &[B1.2]
4: int *p = &x;
5: p
6: [B1.5] (LValToRVal)
7: int *q = p;
2: {x}
3: {x}
4: pset(p)={x}
5: {p}
6: {x}
7: pset(q)={x}
Analysis on the CFG Level – Merging Points-to Sets
int* p;
// pset(p) = {(invalid)}
if (cond) {
p = &i;
// pset(p) = {i}
} else {
p = nullptr;
// pset(p) = {(null)}
}
// pset(p) = {i, (null)}
• Calculate points-to sets
within each basic block
• Merge incoming points-to
sets on basic block entry
• Fixed-point iteration
• Loops
20
Analysis on the CFG Level – Dealing with Forks
void f(int* a) {
// pset(a) = {(null), *a)
if (a) {
// pset(a) = {*a}
} else {
// pset(a) = {(null)}
}
// pset(a) = {(null), *a)
}
{0, *a}
0*a
a = 0a != 0
a != 0 a = 0
{0, *a}
21
Tracking Null Pointers – Logical operators
if (a && b) {
*a;
}
*a;
if (a) {
if (b) {
*a; // OK
}
}
*a; // warning
a
b
*a
*a
b = 0a = 0
a != 0
a != 0
b != 0
a != 0
b != 0
22
Tracking Null Pointers – The Role of noreturn
(a && b)? … : noreturn();
*a;
a
b
…
*a
b = 0
a = 0
a != 0
a != 0
b != 0
a != 0
b != 0
noreturn
23
Tracking Null Pointers – Merging Too Early
bool c = a && b;
c ? … : noreturn();
*a; // false positive
a
b
b = 0
a = 0
a != 0
a != 0
b != 0
c
… noreturn
*a
c = 0c != 0
24
Tracking Null Pointers – Challenges with Assertions
void f(int* a, int *b) {
assert(a && b);
*b;
}
a
b
b = 0
a = 0
a != 0
a != 0
b != 0
void f(int* a, int *b) {
(bool)(a && b)? … : noreturn();
*b; // false positive
}
cast
*b noreturn
25
Summary of Flow-Sensitive Lifetime Analysis
• The performance overhead of the prototype is less than 10% of
-fsyntax-only
• 3 sources of false positives:
• Infeasible paths
• Miscategorizations
• Function modelling
26
Lifetime analysis for the rest of us
27
Typical Lifetime Issues
reference_wrapper<int> data() {
int i = 3;
return {i};
}
28
return o->name().c_str();auto add(int a) {
return [&a](int b) {
return a + b;
};
} string_view sv = "test"s;
S& V = *get();
29
Goal: Enable a Subset of Lifetime Warnings with
No False Positives
Clang warnings exist for:
30
Let’s generalize them!
int *data() {
int i = 3;
return &i;
}
new initializer_list<int>{1, 2, 3};
struct Y {
int *p;
Y(int i) : p(&i) {}
};
Evaluation of the Statement Local Analysis
• No false positives or true positives for LLVM and Clang head
• Few FPs if we categorize every user defined type
• FPs could be fixed with annotating llvm::ValueHandleBase
• Sample of 22 lifetime related fixes
• Faulty commits passed the reviews
• 11 would have been caught before breaking the bots
• 1 false negative due to Path not being automatically categorized as owner
• 3 are missed due to assignments not being checked
• Less than 1% performance overhead
31
What is the Issue Here?
• Contextual information is required to catch the problem
32
StringRef Prefix = is_abs(dir)
? SysRoot : "";
• Faulty:
• Fixed: StringRef Prefix = is_abs(dir)
? StringRef(SysRoot) : "";
Other True Positive Findings
• cplusplus.InnerPointer check of the Clang Static Analyzer
found 3 true positives in Ceph, Facebook’s RocksDB, GPGME
• GSoC 2018 project by Réka Kovács
• Problems were reported and fixed promptly
• The true positives were all statement local problems
• The same true positives can also be found with our statement-local
analysis
• How many true positives would we expect from the original
warnings?
33
Plans for upstreaming
• Annotations
• Other analyses can start to adopt to type
• Generalize warnings
• On by default for STL and explicitly annotated types
• Type category inference is controversial
• Plans for a tool that inserts inferred annotations
• Add flow sensitive analysis
• First handle function calls conservatively
• Add further annotations
• Infer annotations for functions
• Implement use-after-move checks, add exception support
34
Conclusions
• Herb’s analysis is useful for new projects, not always applicable to old
• Type categories are useful for other analyses
• Generalizing Clang warnings
• Generalizing CSA checks
• Generalizing Tidy checks
• Generalized warnings has low performance impact, all sources of
false positives can be addressed
• Infeasible paths → statement local analysis
• Miscategorization → only trigger for STL and annotated types
• Function modelling → only rely on known functions
35
Thank you!
36
• Clang implementation
• https://github.com/mgehre/clang
• Lifetime paper
• https://herbsutter.com/2018/09/20/lifetime-profile-v1-0-posted/
• MSVC implementation
• https://devblogs.microsoft.com/cppblog/lifetime-profile-update-in-visual-
studio-2019-preview-2/

More Related Content

What's hot

Practical file
Practical filePractical file
Practical file
rajeevkr35
 
Vhdl lab manual
Vhdl lab manualVhdl lab manual
Vhdl lab manual
Mukul Mohal
 
Address/Thread/Memory Sanitizer
Address/Thread/Memory SanitizerAddress/Thread/Memory Sanitizer
Address/Thread/Memory Sanitizer
Platonov Sergey
 
What has to be paid attention when reviewing code of the library you develop
What has to be paid attention when reviewing code of the library you developWhat has to be paid attention when reviewing code of the library you develop
What has to be paid attention when reviewing code of the library you develop
Andrey Karpov
 
Runtime Code Generation and Data Management for Heterogeneous Computing in Java
Runtime Code Generation and Data Management for Heterogeneous Computing in JavaRuntime Code Generation and Data Management for Heterogeneous Computing in Java
Runtime Code Generation and Data Management for Heterogeneous Computing in Java
Juan Fumero
 
[Defcon Russia #29] Алексей Тюрин - Spring autobinding
[Defcon Russia #29] Алексей Тюрин - Spring autobinding[Defcon Russia #29] Алексей Тюрин - Spring autobinding
[Defcon Russia #29] Алексей Тюрин - Spring autobinding
DefconRussia
 
Georgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software securityGeorgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software security
DefconRussia
 
04 sequentialbasics 1
04 sequentialbasics 104 sequentialbasics 1
04 sequentialbasics 1
Poornima Prasad
 
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)Go Go Gadget! - An Intro to Return Oriented Programming (ROP)
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)
Miguel Arroyo
 
02 Java Language And OOP PART II
02 Java Language And OOP PART II02 Java Language And OOP PART II
02 Java Language And OOP PART II
Hari Christian
 
Дмитрий Демчук. Кроссплатформенный краш-репорт
Дмитрий Демчук. Кроссплатформенный краш-репортДмитрий Демчук. Кроссплатформенный краш-репорт
Дмитрий Демчук. Кроссплатформенный краш-репорт
Sergey Platonov
 
Weakpass - defcon russia 23
Weakpass - defcon russia 23Weakpass - defcon russia 23
Weakpass - defcon russia 23
DefconRussia
 
Конверсия управляемых языков в неуправляемые
Конверсия управляемых языков в неуправляемыеКонверсия управляемых языков в неуправляемые
Конверсия управляемых языков в неуправляемые
Platonov Sergey
 
[Defcon Russia #29] Борис Савков - Bare-metal programming на примере Raspber...
[Defcon Russia #29] Борис Савков -  Bare-metal programming на примере Raspber...[Defcon Russia #29] Борис Савков -  Bare-metal programming на примере Raspber...
[Defcon Russia #29] Борис Савков - Bare-metal programming на примере Raspber...
DefconRussia
 
Java Generics - by Example
Java Generics - by ExampleJava Generics - by Example
Java Generics - by Example
Ganesh Samarthyam
 
Static Code Analysis for Projects, Built on Unreal Engine
Static Code Analysis for Projects, Built on Unreal EngineStatic Code Analysis for Projects, Built on Unreal Engine
Static Code Analysis for Projects, Built on Unreal Engine
Andrey Karpov
 
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
Andrey Karpov
 
Kotlin meets Gadsu
Kotlin meets GadsuKotlin meets Gadsu
Kotlin meets Gadsu
Christoph Pickl
 
How Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protectionsHow Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protections
Jonathan Salwan
 
Fpga 04-verilog-programming
Fpga 04-verilog-programmingFpga 04-verilog-programming
Fpga 04-verilog-programming
Malik Tauqir Hasan
 

What's hot (20)

Practical file
Practical filePractical file
Practical file
 
Vhdl lab manual
Vhdl lab manualVhdl lab manual
Vhdl lab manual
 
Address/Thread/Memory Sanitizer
Address/Thread/Memory SanitizerAddress/Thread/Memory Sanitizer
Address/Thread/Memory Sanitizer
 
What has to be paid attention when reviewing code of the library you develop
What has to be paid attention when reviewing code of the library you developWhat has to be paid attention when reviewing code of the library you develop
What has to be paid attention when reviewing code of the library you develop
 
Runtime Code Generation and Data Management for Heterogeneous Computing in Java
Runtime Code Generation and Data Management for Heterogeneous Computing in JavaRuntime Code Generation and Data Management for Heterogeneous Computing in Java
Runtime Code Generation and Data Management for Heterogeneous Computing in Java
 
[Defcon Russia #29] Алексей Тюрин - Spring autobinding
[Defcon Russia #29] Алексей Тюрин - Spring autobinding[Defcon Russia #29] Алексей Тюрин - Spring autobinding
[Defcon Russia #29] Алексей Тюрин - Spring autobinding
 
Georgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software securityGeorgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software security
 
04 sequentialbasics 1
04 sequentialbasics 104 sequentialbasics 1
04 sequentialbasics 1
 
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)Go Go Gadget! - An Intro to Return Oriented Programming (ROP)
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)
 
02 Java Language And OOP PART II
02 Java Language And OOP PART II02 Java Language And OOP PART II
02 Java Language And OOP PART II
 
Дмитрий Демчук. Кроссплатформенный краш-репорт
Дмитрий Демчук. Кроссплатформенный краш-репортДмитрий Демчук. Кроссплатформенный краш-репорт
Дмитрий Демчук. Кроссплатформенный краш-репорт
 
Weakpass - defcon russia 23
Weakpass - defcon russia 23Weakpass - defcon russia 23
Weakpass - defcon russia 23
 
Конверсия управляемых языков в неуправляемые
Конверсия управляемых языков в неуправляемыеКонверсия управляемых языков в неуправляемые
Конверсия управляемых языков в неуправляемые
 
[Defcon Russia #29] Борис Савков - Bare-metal programming на примере Raspber...
[Defcon Russia #29] Борис Савков -  Bare-metal programming на примере Raspber...[Defcon Russia #29] Борис Савков -  Bare-metal programming на примере Raspber...
[Defcon Russia #29] Борис Савков - Bare-metal programming на примере Raspber...
 
Java Generics - by Example
Java Generics - by ExampleJava Generics - by Example
Java Generics - by Example
 
Static Code Analysis for Projects, Built on Unreal Engine
Static Code Analysis for Projects, Built on Unreal EngineStatic Code Analysis for Projects, Built on Unreal Engine
Static Code Analysis for Projects, Built on Unreal Engine
 
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
 
Kotlin meets Gadsu
Kotlin meets GadsuKotlin meets Gadsu
Kotlin meets Gadsu
 
How Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protectionsHow Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protections
 
Fpga 04-verilog-programming
Fpga 04-verilog-programmingFpga 04-verilog-programming
Fpga 04-verilog-programming
 

Similar to Update on C++ Core Guidelines Lifetime Analysis. Gábor Horváth. CoreHard Spring 2019

How Data Flow analysis works in a static code analyzer
How Data Flow analysis works in a static code analyzerHow Data Flow analysis works in a static code analyzer
How Data Flow analysis works in a static code analyzer
Andrey Karpov
 
Memory Management with Java and C++
Memory Management with Java and C++Memory Management with Java and C++
Memory Management with Java and C++
Mohammad Shaker
 
Appsec obfuscator reloaded
Appsec obfuscator reloadedAppsec obfuscator reloaded
Appsec obfuscator reloaded
Cyber Security Alliance
 
Getting started cpp full
Getting started cpp   fullGetting started cpp   full
Getting started cpp full
Võ Hòa
 
Tips and tricks for building high performance android apps using native code
Tips and tricks for building high performance android apps using native codeTips and tricks for building high performance android apps using native code
Tips and tricks for building high performance android apps using native code
Kenneth Geisshirt
 
Basic c++ 11/14 for python programmers
Basic c++ 11/14 for python programmersBasic c++ 11/14 for python programmers
Basic c++ 11/14 for python programmers
Jen Yee Hong
 
Value Objects, Full Throttle (to be updated for spring TC39 meetings)
Value Objects, Full Throttle (to be updated for spring TC39 meetings)Value Objects, Full Throttle (to be updated for spring TC39 meetings)
Value Objects, Full Throttle (to be updated for spring TC39 meetings)
Brendan Eich
 
Modern Linux Tracing Landscape
Modern Linux Tracing LandscapeModern Linux Tracing Landscape
Modern Linux Tracing Landscape
Sasha Goldshtein
 
C++ Advanced Features
C++ Advanced FeaturesC++ Advanced Features
C++ Advanced Features
Michael Redlich
 
C++ Advanced Features
C++ Advanced FeaturesC++ Advanced Features
C++ Advanced Features
Michael Redlich
 
PVS-Studio team experience: checking various open source projects, or mistake...
PVS-Studio team experience: checking various open source projects, or mistake...PVS-Studio team experience: checking various open source projects, or mistake...
PVS-Studio team experience: checking various open source projects, or mistake...
Andrey Karpov
 
07 control+structures
07 control+structures07 control+structures
07 control+structures
baran19901990
 
Nodejs性能分析优化和分布式设计探讨
Nodejs性能分析优化和分布式设计探讨Nodejs性能分析优化和分布式设计探讨
Nodejs性能分析优化和分布式设计探讨
flyinweb
 
Basic C++ 11/14 for Python Programmers
Basic C++ 11/14 for Python ProgrammersBasic C++ 11/14 for Python Programmers
Basic C++ 11/14 for Python Programmers
Appier
 
Libra : A Compatible Method for Defending Against Arbitrary Memory Overwrite
Libra : A Compatible Method for Defending Against Arbitrary Memory OverwriteLibra : A Compatible Method for Defending Against Arbitrary Memory Overwrite
Libra : A Compatible Method for Defending Against Arbitrary Memory Overwrite
Jeremy Haung
 
Dynamic Binary Analysis and Obfuscated Codes
Dynamic Binary Analysis and Obfuscated Codes Dynamic Binary Analysis and Obfuscated Codes
Dynamic Binary Analysis and Obfuscated Codes
Jonathan Salwan
 
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
Teddy Hsiung
 
Story of static code analyzer development
Story of static code analyzer developmentStory of static code analyzer development
Story of static code analyzer development
Andrey Karpov
 
Building source code level profiler for C++.pdf
Building source code level profiler for C++.pdfBuilding source code level profiler for C++.pdf
Building source code level profiler for C++.pdf
ssuser28de9e
 
LSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityLSFMM 2019 BPF Observability
LSFMM 2019 BPF Observability
Brendan Gregg
 

Similar to Update on C++ Core Guidelines Lifetime Analysis. Gábor Horváth. CoreHard Spring 2019 (20)

How Data Flow analysis works in a static code analyzer
How Data Flow analysis works in a static code analyzerHow Data Flow analysis works in a static code analyzer
How Data Flow analysis works in a static code analyzer
 
Memory Management with Java and C++
Memory Management with Java and C++Memory Management with Java and C++
Memory Management with Java and C++
 
Appsec obfuscator reloaded
Appsec obfuscator reloadedAppsec obfuscator reloaded
Appsec obfuscator reloaded
 
Getting started cpp full
Getting started cpp   fullGetting started cpp   full
Getting started cpp full
 
Tips and tricks for building high performance android apps using native code
Tips and tricks for building high performance android apps using native codeTips and tricks for building high performance android apps using native code
Tips and tricks for building high performance android apps using native code
 
Basic c++ 11/14 for python programmers
Basic c++ 11/14 for python programmersBasic c++ 11/14 for python programmers
Basic c++ 11/14 for python programmers
 
Value Objects, Full Throttle (to be updated for spring TC39 meetings)
Value Objects, Full Throttle (to be updated for spring TC39 meetings)Value Objects, Full Throttle (to be updated for spring TC39 meetings)
Value Objects, Full Throttle (to be updated for spring TC39 meetings)
 
Modern Linux Tracing Landscape
Modern Linux Tracing LandscapeModern Linux Tracing Landscape
Modern Linux Tracing Landscape
 
C++ Advanced Features
C++ Advanced FeaturesC++ Advanced Features
C++ Advanced Features
 
C++ Advanced Features
C++ Advanced FeaturesC++ Advanced Features
C++ Advanced Features
 
PVS-Studio team experience: checking various open source projects, or mistake...
PVS-Studio team experience: checking various open source projects, or mistake...PVS-Studio team experience: checking various open source projects, or mistake...
PVS-Studio team experience: checking various open source projects, or mistake...
 
07 control+structures
07 control+structures07 control+structures
07 control+structures
 
Nodejs性能分析优化和分布式设计探讨
Nodejs性能分析优化和分布式设计探讨Nodejs性能分析优化和分布式设计探讨
Nodejs性能分析优化和分布式设计探讨
 
Basic C++ 11/14 for Python Programmers
Basic C++ 11/14 for Python ProgrammersBasic C++ 11/14 for Python Programmers
Basic C++ 11/14 for Python Programmers
 
Libra : A Compatible Method for Defending Against Arbitrary Memory Overwrite
Libra : A Compatible Method for Defending Against Arbitrary Memory OverwriteLibra : A Compatible Method for Defending Against Arbitrary Memory Overwrite
Libra : A Compatible Method for Defending Against Arbitrary Memory Overwrite
 
Dynamic Binary Analysis and Obfuscated Codes
Dynamic Binary Analysis and Obfuscated Codes Dynamic Binary Analysis and Obfuscated Codes
Dynamic Binary Analysis and Obfuscated Codes
 
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
 
Story of static code analyzer development
Story of static code analyzer developmentStory of static code analyzer development
Story of static code analyzer development
 
Building source code level profiler for C++.pdf
Building source code level profiler for C++.pdfBuilding source code level profiler for C++.pdf
Building source code level profiler for C++.pdf
 
LSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityLSFMM 2019 BPF Observability
LSFMM 2019 BPF Observability
 

More from corehard_by

C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
corehard_by
 
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
corehard_by
 
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений ОхотниковC++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
corehard_by
 
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр ТитовC++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
corehard_by
 
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
corehard_by
 
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья ШишковC++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
corehard_by
 
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
corehard_by
 
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
corehard_by
 
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
corehard_by
 
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
corehard_by
 
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
corehard_by
 
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
corehard_by
 
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел ФилоновC++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов
corehard_by
 
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan ČukićC++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
corehard_by
 
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia KazakovaC++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
corehard_by
 
C++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
C++ CoreHard Autumn 2018. Полезный constexpr - Антон ПолухинC++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
C++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
corehard_by
 
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
corehard_by
 
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
corehard_by
 
Как помочь и как помешать компилятору. Андрей Олейников ➠ CoreHard Autumn 2019
Как помочь и как помешать компилятору. Андрей Олейников ➠  CoreHard Autumn 2019Как помочь и как помешать компилятору. Андрей Олейников ➠  CoreHard Autumn 2019
Как помочь и как помешать компилятору. Андрей Олейников ➠ CoreHard Autumn 2019
corehard_by
 
Автоматизируй это. Кирилл Тихонов ➠ CoreHard Autumn 2019
Автоматизируй это. Кирилл Тихонов ➠  CoreHard Autumn 2019Автоматизируй это. Кирилл Тихонов ➠  CoreHard Autumn 2019
Автоматизируй это. Кирилл Тихонов ➠ CoreHard Autumn 2019
corehard_by
 

More from corehard_by (20)

C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
 
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
 
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений ОхотниковC++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
 
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр ТитовC++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
 
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
 
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья ШишковC++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
 
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
 
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
 
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
 
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
 
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
 
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
 
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел ФилоновC++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов
 
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan ČukićC++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
 
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia KazakovaC++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
 
C++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
C++ CoreHard Autumn 2018. Полезный constexpr - Антон ПолухинC++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
C++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
 
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
 
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
 
Как помочь и как помешать компилятору. Андрей Олейников ➠ CoreHard Autumn 2019
Как помочь и как помешать компилятору. Андрей Олейников ➠  CoreHard Autumn 2019Как помочь и как помешать компилятору. Андрей Олейников ➠  CoreHard Autumn 2019
Как помочь и как помешать компилятору. Андрей Олейников ➠ CoreHard Autumn 2019
 
Автоматизируй это. Кирилл Тихонов ➠ CoreHard Autumn 2019
Автоматизируй это. Кирилл Тихонов ➠  CoreHard Autumn 2019Автоматизируй это. Кирилл Тихонов ➠  CoreHard Autumn 2019
Автоматизируй это. Кирилл Тихонов ➠ CoreHard Autumn 2019
 

Recently uploaded

Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
christinelarrosa
 
High performance Serverless Java on AWS- GoTo Amsterdam 2024
High performance Serverless Java on AWS- GoTo Amsterdam 2024High performance Serverless Java on AWS- GoTo Amsterdam 2024
High performance Serverless Java on AWS- GoTo Amsterdam 2024
Vadym Kazulkin
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Neo4j
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
Fwdays
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
saastr
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
Fwdays
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
DanBrown980551
 
A Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's ArchitectureA Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's Architecture
ScyllaDB
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
Christine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptxChristine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptx
christinelarrosa
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
 

Recently uploaded (20)

Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
 
High performance Serverless Java on AWS- GoTo Amsterdam 2024
High performance Serverless Java on AWS- GoTo Amsterdam 2024High performance Serverless Java on AWS- GoTo Amsterdam 2024
High performance Serverless Java on AWS- GoTo Amsterdam 2024
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
 
A Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's ArchitectureA Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's Architecture
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
Christine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptxChristine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptx
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
 

Update on C++ Core Guidelines Lifetime Analysis. Gábor Horváth. CoreHard Spring 2019

  • 1. Update on the C++ Core Guidelines’ Lifetime Safety analysis in Clang Gábor Horváth xazax.hun@gmail.com 1
  • 2. Agenda • Motivation • Whirlwind tour of lifetime analysis • See the following talks for details: • https://youtu.be/80BZxujhY38?t=1096 • https://youtu.be/sjnp3P9x5jA • Highlight some implementation details • Evaluation • Upstreaming • Conclusions 2
  • 3. Motivation • Microsoft: 70 percent of security patches are fixing memory errors • https://youtu.be/PjbGojjnBZQ • C++ has many sources of errors: • Manual memory management, temporary objects, Pointer-like objects, … • Dynamic tools • Few false positives, not every arch is supported, coverage is important • Static tools • Arch independent, the earlier a bug is found the cheaper the fix • Works without good test coverage 3
  • 4. Motivation #2 int *p; { int x; p = &x; } *p = 5; string_view sv; { string s{“CoreHard"}; sv = s; } sv[0] = ‘c’; Many static tools warn for the left snippet but not for the right, even though they are fundamentally similar. 4
  • 5. Motivation #3 int *p = &getIntByValue(); std::string_view sv = "test"s; 5
  • 6. A Tour of Herb’s Lifetime Analysis • Intends to catch common errors (not a verification tool) • Classify types into categories • Owners: never dangle, implementation assumed to be correct • Pointers: might dangle, tracking points-to sets • Aggregates: handled member-wise • Values: everything else • Analysis is function local • Two implementations • We implemented it in a Clang fork • Kyle Reed and Neil MacIntosh implemented the MSVC version 6
  • 7. A Tour of Herb’s Lifetime Analysis #2 • Flow-sensitive analysis • We only need annotations for misclassifications (rare) • Maps each Pointer at each program point to a points-to set • Elements of a points-to set: • Null • Invalid • Static (lives longer than the pointer or we cannot reason about it) • Local variable/parameter • Aggregate member • Owned memory of an Owner 7
  • 8. A Tour of Herb’s Lifetime Analysis #3 • https://cppx.godbolt.org/z/IdGRsT 8
  • 9. A Tour of Herb’s Lifetime Analysis #4 9 vector v1{…}; vector v2{…}; auto it = v1.begin(); if (cond) it = v2.begin(); if (cond2) v2.push_back(…); *it = …; // warning
  • 11. Analysis Within a Basic Block • Basic blocks contain subexprs in an eval order, no AST traversal required • End of full expression is not marked (apart from DeclStmt) • When to invalidate Pointers to temporaries? • Modified the CFG to include ExprWithCleanup AST nodes • Clang Static Analyzer is another user 11 int x; int *p = &x; int *q = p; 2: x 3: &[B1.2] 4: int *p = &x; 5: p 6: [B1.5] (LValToRVal) 7: int *q = p; 2: {x} 3: {x} 4: pset(p)={x} 5: {p} 6: {x} 7: pset(q)={x}
  • 12. Analysis Within a Basic Block • Basic blocks contain subexprs in an eval order, no AST traversal required • End of full expression is not marked (apart from DeclStmt) • When to invalidate Pointers to temporaries? • Modified the CFG to include ExprWithCleanup AST nodes • Clang Static Analyzer is another user 12 int x; int *p = &x; int *q = p; 2: x 3: &[B1.2] 4: int *p = &x; 5: p 6: [B1.5] (LValToRVal) 7: int *q = p; 2: {x} 3: {x} 4: pset(p)={x} 5: {p} 6: {x} 7: pset(q)={x}
  • 13. Analysis Within a Basic Block • Basic blocks contain subexprs in an eval order, no AST traversal required • End of full expression is not marked (apart from DeclStmt) • When to invalidate Pointers to temporaries? • Modified the CFG to include ExprWithCleanup AST nodes • Clang Static Analyzer is another user 13 int x; int *p = &x; int *q = p; 2: x 3: &[B1.2] 4: int *p = &x; 5: p 6: [B1.5] (LValToRVal) 7: int *q = p; 2: {x} 3: {x} 4: pset(p)={x} 5: {p} 6: {x} 7: pset(q)={x}
  • 14. Analysis Within a Basic Block • Basic blocks contain subexprs in an eval order, no AST traversal required • End of full expression is not marked (apart from DeclStmt) • When to invalidate Pointers to temporaries? • Modified the CFG to include ExprWithCleanup AST nodes • Clang Static Analyzer is another user 14 int x; int *p = &x; int *q = p; 2: x 3: &[B1.2] 4: int *p = &x; 5: p 6: [B1.5] (LValToRVal) 7: int *q = p; 2: {x} 3: {x} 4: pset(p)={x} 5: {p} 6: {x} 7: pset(q)={x}
  • 15. Analysis Within a Basic Block • Basic blocks contain subexprs in an eval order, no AST traversal required • End of full expression is not marked (apart from DeclStmt) • When to invalidate Pointers to temporaries? • Modified the CFG to include ExprWithCleanup AST nodes • Clang Static Analyzer is another user 15 int x; int *p = &x; int *q = p; 2: x 3: &[B1.2] 4: int *p = &x; 5: p 6: [B1.5] (LValToRVal) 7: int *q = p; 2: {x} 3: {x} 4: pset(p)={x} 5: {p} 6: {x} 7: pset(q)={x}
  • 16. Analysis Within a Basic Block • Basic blocks contain subexprs in an eval order, no AST traversal required • End of full expression is not marked (apart from DeclStmt) • When to invalidate Pointers to temporaries? • Modified the CFG to include ExprWithCleanup AST nodes • Clang Static Analyzer is another user 16 int x; int *p = &x; int *q = p; 2: x 3: &[B1.2] 4: int *p = &x; 5: p 6: [B1.5] (LValToRVal) 7: int *q = p; 2: {x} 3: {x} 4: pset(p)={x} 5: {p} 6: {x} 7: pset(q)={x}
  • 17. Analysis Within a Basic Block • Basic blocks contain subexprs in an eval order, no AST traversal required • End of full expression is not marked (apart from DeclStmt) • When to invalidate Pointers to temporaries? • Modified the CFG to include ExprWithCleanup AST nodes • Clang Static Analyzer is another user 17 int x; int *p = &x; int *q = p; 2: x 3: &[B1.2] 4: int *p = &x; 5: p 6: [B1.5] (LValToRVal) 7: int *q = p; 2: {x} 3: {x} 4: pset(p)={x} 5: {p} 6: {x} 7: pset(q)={x}
  • 18. Analysis Within a Basic Block • Basic blocks contain subexprs in an eval order, no AST traversal required • End of full expression is not marked (apart from DeclStmt) • When to invalidate Pointers to temporaries? • Modified the CFG to include ExprWithCleanup AST nodes • Clang Static Analyzer is another user 18 int x; int *p = &x; int *q = p; 2: x 3: &[B1.2] 4: int *p = &x; 5: p 6: [B1.5] (LValToRVal) 7: int *q = p; 2: {x} 3: {x} 4: pset(p)={x} 5: {p} 6: {x} 7: pset(q)={x}
  • 19. Analysis Within a Basic Block • Basic blocks contain subexprs in an eval order, no AST traversal required • End of full expression is not marked (apart from DeclStmt) • When to invalidate Pointers to temporaries? • Modified the CFG to include ExprWithCleanup AST nodes • Clang Static Analyzer is another user 19 int x; int *p = &x; int *q = p; 2: x 3: &[B1.2] 4: int *p = &x; 5: p 6: [B1.5] (LValToRVal) 7: int *q = p; 2: {x} 3: {x} 4: pset(p)={x} 5: {p} 6: {x} 7: pset(q)={x}
  • 20. Analysis on the CFG Level – Merging Points-to Sets int* p; // pset(p) = {(invalid)} if (cond) { p = &i; // pset(p) = {i} } else { p = nullptr; // pset(p) = {(null)} } // pset(p) = {i, (null)} • Calculate points-to sets within each basic block • Merge incoming points-to sets on basic block entry • Fixed-point iteration • Loops 20
  • 21. Analysis on the CFG Level – Dealing with Forks void f(int* a) { // pset(a) = {(null), *a) if (a) { // pset(a) = {*a} } else { // pset(a) = {(null)} } // pset(a) = {(null), *a) } {0, *a} 0*a a = 0a != 0 a != 0 a = 0 {0, *a} 21
  • 22. Tracking Null Pointers – Logical operators if (a && b) { *a; } *a; if (a) { if (b) { *a; // OK } } *a; // warning a b *a *a b = 0a = 0 a != 0 a != 0 b != 0 a != 0 b != 0 22
  • 23. Tracking Null Pointers – The Role of noreturn (a && b)? … : noreturn(); *a; a b … *a b = 0 a = 0 a != 0 a != 0 b != 0 a != 0 b != 0 noreturn 23
  • 24. Tracking Null Pointers – Merging Too Early bool c = a && b; c ? … : noreturn(); *a; // false positive a b b = 0 a = 0 a != 0 a != 0 b != 0 c … noreturn *a c = 0c != 0 24
  • 25. Tracking Null Pointers – Challenges with Assertions void f(int* a, int *b) { assert(a && b); *b; } a b b = 0 a = 0 a != 0 a != 0 b != 0 void f(int* a, int *b) { (bool)(a && b)? … : noreturn(); *b; // false positive } cast *b noreturn 25
  • 26. Summary of Flow-Sensitive Lifetime Analysis • The performance overhead of the prototype is less than 10% of -fsyntax-only • 3 sources of false positives: • Infeasible paths • Miscategorizations • Function modelling 26
  • 27. Lifetime analysis for the rest of us 27
  • 28. Typical Lifetime Issues reference_wrapper<int> data() { int i = 3; return {i}; } 28 return o->name().c_str();auto add(int a) { return [&a](int b) { return a + b; }; } string_view sv = "test"s; S& V = *get();
  • 29. 29
  • 30. Goal: Enable a Subset of Lifetime Warnings with No False Positives Clang warnings exist for: 30 Let’s generalize them! int *data() { int i = 3; return &i; } new initializer_list<int>{1, 2, 3}; struct Y { int *p; Y(int i) : p(&i) {} };
  • 31. Evaluation of the Statement Local Analysis • No false positives or true positives for LLVM and Clang head • Few FPs if we categorize every user defined type • FPs could be fixed with annotating llvm::ValueHandleBase • Sample of 22 lifetime related fixes • Faulty commits passed the reviews • 11 would have been caught before breaking the bots • 1 false negative due to Path not being automatically categorized as owner • 3 are missed due to assignments not being checked • Less than 1% performance overhead 31
  • 32. What is the Issue Here? • Contextual information is required to catch the problem 32 StringRef Prefix = is_abs(dir) ? SysRoot : ""; • Faulty: • Fixed: StringRef Prefix = is_abs(dir) ? StringRef(SysRoot) : "";
  • 33. Other True Positive Findings • cplusplus.InnerPointer check of the Clang Static Analyzer found 3 true positives in Ceph, Facebook’s RocksDB, GPGME • GSoC 2018 project by Réka Kovács • Problems were reported and fixed promptly • The true positives were all statement local problems • The same true positives can also be found with our statement-local analysis • How many true positives would we expect from the original warnings? 33
  • 34. Plans for upstreaming • Annotations • Other analyses can start to adopt to type • Generalize warnings • On by default for STL and explicitly annotated types • Type category inference is controversial • Plans for a tool that inserts inferred annotations • Add flow sensitive analysis • First handle function calls conservatively • Add further annotations • Infer annotations for functions • Implement use-after-move checks, add exception support 34
  • 35. Conclusions • Herb’s analysis is useful for new projects, not always applicable to old • Type categories are useful for other analyses • Generalizing Clang warnings • Generalizing CSA checks • Generalizing Tidy checks • Generalized warnings has low performance impact, all sources of false positives can be addressed • Infeasible paths → statement local analysis • Miscategorization → only trigger for STL and annotated types • Function modelling → only rely on known functions 35
  • 36. Thank you! 36 • Clang implementation • https://github.com/mgehre/clang • Lifetime paper • https://herbsutter.com/2018/09/20/lifetime-profile-v1-0-posted/ • MSVC implementation • https://devblogs.microsoft.com/cppblog/lifetime-profile-update-in-visual- studio-2019-preview-2/

Editor's Notes

  1. During development you catch more issues