Debugging Print And Imaging Drivers. Print driver team philosophy on driver quality There are tools to detect violations Wrongful development assumptions.

Slides:



Advertisements
Similar presentations
Advanced Troubleshooting with Debug Diagnostics on IIS 6
Advertisements

Testing And Tools For Print And Imaging Drivers
Chapter 17 vector and Free Store John Keyser’s Modifications of Slides By Bjarne Stroustrup
Module R2 CS450. Next Week R1 is due next Friday ▫Bring manuals in a binder - make sure to have a cover page with group number, module, and date. You.
Microsoft Windows XP SP2 Urs P. Küderli Strategic Security Advisor Microsoft Schweiz GmbH.
More on protocol implementation Packet parsing Memory management Data structures for lookup.
1 of 6 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
1 of 6 Parts of Your Notebook Below is a graphic overview of the different parts of a OneNote 2007 notebook. Microsoft ® OneNote ® 2007 notebooks are digital.
1 of 5 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
Information for Developers Windows XP Service Pack 2 Information for Developers.
JavaScript, Fourth Edition
Memory Layout C and Data Structures Baojian Hua
OllyDbg Debuger.
Printer Driver Setup and 64-bit Implications. Outline Development Understanding how to write a printer driver for 64-bit systems What’s different and.
Simple Buffer Overflow Example Dan Fleck CS469 Security Engineering Reference: Coming up: Buffer Overflows.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science 2006 Exterminator: Automatically Correcting Memory Errors Gene Novark, Emery Berger.
Capturing Wireless Frames With A NIC Last Update Copyright 2012 Kenneth M. Chipps Ph.D.
Print Verifier Ashwin Needamangala Senior Test Development Lead Documents and Printing Team
Lesson 46: Using Information From the Web copy and paste information from a Web site print a Web page download information from a Web site customize Web.
Lesson 46: Using Information From the Web copy and paste information from a Web site print a Web page download information from a Web site customize Web.
XPSDrv Best practices using Print Verifier
New Document Lifecycle Opportunities N. Gregg Brown Lead Program Manager Digital Documents microsoft.com Microsoft Corporation.
Driver Verifier Advancements In Windows 7 Daniel Mihai Principal Software Design Engineer Windows Engineering Tools.
Min Kwan Park Test Tech Lead Visual C# QA team. Fail fast To-Dos for fail fast Analyze issues Information for further action Q&A Agenda.
2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez - Norlander Support Escalation Engineer Microsoft Session.
Windows Debugging Demystified
Homework Reading Programming Assignments
Information for Developers Windows XP Service Pack 2 Information for Developers Tony Goodhew Product manager Developer Division Microsoft Corp
How to Download and Install a Sharp Print Driver on a Mac.
Storage Testing in DTM Eric St.John Software Design Engineer in Test Storageマイクロソフトディベロップメント株式会社部署名名前.
How to Add WMI Interfaces to SCSIPort and Storport Miniports
Welcome to the Power of 64-bit Computing …now available on your desktop! © 1998, 1999 Compaq Computer Corporation.
Advances in Windows Printing Daniel Emerson Program Manager Digital Documents Platform and Solutions Microsoft Corporation.
Computer Security and Penetration Testing
Instructor Notes GPU debugging is still immature, but being improved daily. You should definitely check to see the latest options available before giving.
Visual Studio 2005 Team System: Building Robust & Reliable Software Tejasvi Kumar Technology Specialist - VSTS Microsoft Corporation
Debugging in Java. Common Bugs Compilation or syntactical errors are the first that you will encounter and the easiest to debug They are usually the result.
SQL Server Crash Dump Analysis A brief tour with WinDbg and other ugly tools Pablo Álvarez Doval Debugging & Optimization Team Lead
Topic 2d High-Level languages and Systems Software
Dynamic memory allocation and Pointers Lecture 4.
Unit OS11: Performance Evaluation Lab Manual.
CSCI Rational Purify 1 Rational Purify Overview Michel Izygon - Jim Helm.
Windows Color System Overview Lavanya Vasudevan Program Manager Digital Documents Platform and Solutions microsoft.com Microsoft Corporation.
DEV330 Visual Studio.NET IDE Tips and Tricks Billy Hollis Author / consultant.
Disclaimer The Content, Demonstration, Source Code and Programs presented here is "AS IS" without any warranty or conditions.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 11 – gdb and Debugging.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 10 – C: the heap and manual memory management.
Windows ® 2000 Debugging André Vachon Development Lead Windows Debuggers Microsoft Corporation.
© 2004 Microsoft Corporation. All rights reserved. 1 Rules for Filters (both Legacy and Mini)
IE Developer Tools Jonathan Seitel Program Manager.
Announcements You will receive your scores back for Assignment 2 this week. You will have an opportunity to correct your code and resubmit it for partial.
COMP091 – Operating Systems 1 Memory Management. Memory Management Terms Physical address –Actual address as seen by memory unit Logical address –Address.
Application Migration Fritz Ohman Alphageek
Boris Jabes Program Manager Visual C++ Microsoft Corporation.
Rade Trimceski Program Manager Microsoft Corporation Mitesh Desai Software Design Engineer Microsoft Corporation.
Code improvement: Coverity static analysis Valgrind dynamic analysis GABRIELE COSMO CERN, EP/SFT.
Memory-Related Perils and Pitfalls in C
Content Coverity Static Analysis Use cases of Coverity Examples
YAHMD - Yet Another Heap Memory Debugger
Debugging Memory Issues
CSE 374 Programming Concepts & Tools
Protecting Memory What is there to protect in memory?
Protecting Memory What is there to protect in memory?
Valgrind Overview What is Valgrind?
Crash Dump Analysis - Santosh Kumar Singh.
Memory Management III: Perils and pitfalls Mar 13, 2001
Introduction to Static Analyzer
Forum on Application Compatibility for Windows “Longhorn”
Valgrind Overview What is Valgrind?
SPL – PS2 C++ Memory Handling.
Presentation transcript:

Debugging Print And Imaging Drivers

Print driver team philosophy on driver quality There are tools to detect violations Wrongful development assumptions Types of source code problems Basic debugging tips Debugging and fixing the major types of problems - demoOutline

Driver robustness is goal #1 No unhandled exceptions of any kind No handled C-exceptions (SEH) No resource corruptions No resource leaks Driver Quality

Best Practices for Developing Driver Code Three attack vectors for having more robust and generally better driver code: Static analysis tools (PREfast) Extended runtime checks during testing Microsoft test tools

The Role of Microsoft Test Tools Aligned with robustness requirements in Windows ‘Longhorn’ Logo program Designed to assist vendors in meeting Logo program criteria

System Debug Aids There are powerful ways to detect violations Application Verifier Heap problems Handle problems First chance exceptions Loader lock issues Spooler built-in support for identifying crashing drivers

Most Common WRONG Development Assumptions Overactive exception handling: “it’s safe to __try/__except(1)” “it’s safe to try/catch(…)”

Most Common WRONG Development Assumptions (con’t) “It’s not a big deal to touch freed resources (memory, handles, etc.)” “It’s not a big deal to read/write few bytes past the length of a buffer – the odds the next page to be unreadable are too small” “It’s OK to use IsBadReadPtr/IsBadWritePtr APIs”

Most Common WRONG Development Assumptions (con’t) “It’s OK to skip checking the return values of resource allocation functions (malloc, new, CreateEvent, etc.)” “It’s OK to popup UI directly from within spooler process”

Types of Source Code Problems Heap corruptions: 70% contributor to print-related Microsoft Product Support calls Buffer overruns Use-after-free Double free Uninitialized variables Handle corruptions Use-after-free, double free Resource leaks

DEVMODE Issues General design issues Opaque binary format DEVMODE always comes from not trusted source Drivers can be susceptible to DEVMODE contents

DEVMODE issue types Buffer sizes Non zero-terminated strings File names Index values or loop counters Not portable (64-bit ready) data structures DevmodeCorruptor test tool for catching such problems DEVMODE Issues (con’t)

Setup Choosing a user mode debugger Symbols setup Checks for correct symbols Test Debug wizard Gflags.exe tool Application Verifier options

Basic Tips Use Microsoft debugger package Get familiar with debugger.chm kb command lists the stack trace of the break lmvl m MyDriver dumps all the driver file information.lines toggles showing source code lines.frame lets you navigate stack frames dv /V lets you examine local variables for each frame.cxr lets you switch processor contexts

Basic Tips (con’t) !analyze –v displays general information about the debug break !heap is a invaluable debugger extension !heap –p –a is great for identifying heap corruptions !htrace is great for OS handle corruptions/misuse If exception takes place “near” address 0x0, it’s probably a null pointer dereferencing If on x86 an access violation takes place above the user mode accessible memory (usually 0x ), it’s very probably uninitialized variable problem

Tips for Stack Overruns ebp is often useful for manually reconstructing the stack, especially useful for debugging stack overruns If possible, always cross-check your conclusions Search the stack for patterns like: 0:000> ebp l6 0007e e14c < something “near” EBP, but slightly bigger 0007e118 77f2f8c6 GDI32!bCreateDCW+0xb6 < a return address in code 0007e11c 0007e e

Call to Action Make sure you use Microsoft print driver test tools Familiarize yourself with the debugging basics Use the latest debugger and debug engines Enrich your arsenal of debugging techniques Explore debugging 64-bit processes

Additional Resources Web resources Latest debugging tools can be found at Latest available symbols can be downloaded from px px Windows DDK can be found at WS-Devices Profile lt.aspx?pull=/library/en-us/dnglobspec/html/devprof.asp WHDC Printing home page: WHDC Still Imaging / WIA home page:

Additional Resources For developer print questions: microsoft.com For developer scan questions: microsoft.com For developer color questions: microsoft.com Community Sites MSDN Developer Community Chats: Windows Printer Driver Development windows_ aspx windows_ aspx Windows Drivers: Printer Drivers Windows Drivers Printing and Networking

© 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.