Presentation is loading. Please wait.

Presentation is loading. Please wait.

4/28/2019 6:13 PM HW-889P Advanced driver code analysis techniques Tips and tricks to develop more secure & reliable drivers Dave Sielaff Principal Software.

Similar presentations


Presentation on theme: "4/28/2019 6:13 PM HW-889P Advanced driver code analysis techniques Tips and tricks to develop more secure & reliable drivers Dave Sielaff Principal Software."— Presentation transcript:

1 4/28/2019 6:13 PM HW-889P Advanced driver code analysis techniques Tips and tricks to develop more secure & reliable drivers Dave Sielaff Principal Software Development Engineer Microsoft Corporation © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

2 Motivation Customers want reliable products
Some bugs are tough to find by debugging Finding potential crashes earlier is always good

3 Agenda Introducing the Source Code Annotation Language (SAL)
Understanding Visual Studio Code Analysis warnings Adding SAL to existing driver Afterwards, you will have examples of how to Fix bugs using Code Analysis warnings Annotate parameters and shared variable access

4 Introducing SAL Microsoft Source Code Annotation Language
Describes important aspects of code intent Like using ASSERT on function declarations Readable by humans and tools Declaring locking behavior Finding potential race conditions, deadlocks Describing parameter behavior Finding potential null dereferences, uninitialized memory use

5 Describing locking behavior
Which functions acquire/release locks? _Acquires_lock_(lock) _Releases_lock_(lock) Does a function depend on a lock being held prior to call? _Requires_lock_held_(lock) Which variables are guarded by which lock? _Guarded_by_(lock)

6 Concurrency Annotation Usage
4/28/2019 6:13 PM demo Concurrency Annotation Usage © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

7 Basic SAL parameter concepts
Input Data is passed to called function, treated as read-only Input/Output Data is passed into function and potentially modified Output Caller only provides space for called function to write to Called function writes data into that space Output Pointers Like Output, where value returned by called function is pointer

8 Basic SAL parameter concepts (continued)
Required Pointer parameter that must be non-NULL Optional Pointer parameter that can be NULL

9 Basic SAL parameter table
Required Parameters Optional Parameters Input to called function _In_ _In_opt_ Input to called function, and Output to caller _Inout_ _Inout_opt_ Output to caller _Out_ _Out_opt_ Output of pointer to caller _Outptr_ _Outptr_opt_

10 Parameter Annotation Usage
4/28/2019 6:13 PM demo Parameter Annotation Usage © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

11 Recap

12 Using Code Analysis and SAL
Code Analysis can find valuable bugs right out of the box Adding SAL to your code makes Code Analysis even more effective Think of SAL as compile-time ASSERT system No need to annotate your code all at once Annotating incrementally gets you incremental value, immediately and over time as your code evolves

13 For more information RELATED SESSIONS DOCUMENTATION & ARTICLES
TOOL-100T: Improving software quality using Visual Studio 11 C++ Code Analysis Driver Development Tools Windows Hardware Dev Center Windows Dev Center Visual Studio Code Analysis and SAL

14 thank you Feedback and questions http://forums.dev.windows.com
Session feedback

15 4/28/2019 6:13 PM © 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. © 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

16


Download ppt "4/28/2019 6:13 PM HW-889P Advanced driver code analysis techniques Tips and tricks to develop more secure & reliable drivers Dave Sielaff Principal Software."

Similar presentations


Ads by Google