Intel Corporation · NASDAQ:INTC

Intel — Technical Presentation (May 2012)

22 slides from Intel's technical presentation, May 22, 2012

  1. Slide 1: Pointer Checker Feature in Intel C++ Composer

    Pointer Checker Feature in Intel® C++ Composer 2013: Catch Out-of-Bounds Memory Accesses easily! Intel Technical Presentation May 22, 2012 Kittur Ganesh, Technical Consulting Engineer, Intel® Software Software & Services Development Group Products Developer Products Division Copyright© 2012, Intel C

  2. Slide 2: Agenda

    Agenda • What is Pointer Checker? • Pointer Checker Enabling – At a glance • Pointer Checker Usage Model • Using Pointer Checker – Checking Bounds – Checking for Dangling Pointers – Checking Arrays – Intrinsics – Working with Enabled and Non-Enabled Modules – Checking Run Time Library (RTL) function

  3. Slide 3: What is Pointer Checker?

    What is Pointer Checker? • C/C++ pointers have well defined semantics that determine range of memory to access. – Compilers typically do not enforce p = malloc(size); • lower_bound(p) is (char *)p • upper_bound(p) is lower_bound(p) + size - 1 • Buffer Overflow/Overrun anomaly – Violation of memory s

  4. Slide 4: What is Pointer Checker?

    What is Pointer Checker? • A key feature of Intel® C++ Composer XE 2013 • Designed for use during application debugging and testing • Enabled via compile time switches. Pointer • User API allows control over what happens when a Checker violation is detected What is it? • Implemented mostly in a runt

  5. Slide 5: Pointer Checker – How it works?

    Pointer Checker – How it works? High Level Design • The compiler: – Creates bounds when a pointer is created via the “&” operator or array reference. – Copies bounds when a pointer is copied. – Stores bounds when a pointer is stored in memory. – Loads bounds when a pointer is loaded from memory. – P

  6. Slide 6: Pointer Checker Enabling - At a glance

    Pointer Checker Enabling - At a glance Getting started is easy… • Meet requirements: Supported Supported Supported Supported Languages Architecture Platforms Processor C, C++ IA-32, Intel® 64 Linux*, Windows* Intel® Pentium® 4 processor or later, or compatible non- Intel processor • Compile and buil

  7. Slide 7: Pointer Checker Enabling - At a glance: A sample program

    Pointer Checker Enabling - At a glance A sample program • Compile with Pointer Checker enabling option • Execute;Check for out-of-bounds errors (OOB) • Determine if OOB is true or false positive • Compile without Pointer Checker enabling switch: #include<stdio.h> % icc main.c;./a.out #include<chkp.h

  8. Slide 8: Pointer Checker – Usage Model

    Pointer Checker – Usage Model Model Description Header File Defines intrinsics and reporting functions (chkp.h) Compiler Options -check-pointers (/Qcheck-pointers) Enables pointer checker and adds associated libraries -check-pointers-dangling (/Q-check-pointers- Enables checking for dangling pointer

  9. Slide 9: Using Pointer Checker - Checking Bounds

    Using Pointer Checker - Checking Bounds Checks indirect accesses through pointers for accesses that are out of bounds • Check Bounds on Read/Write Operations -check-pointers=[none | write | rw] (Linux* OS) /Qcheck-pointers:[none | write | rw] (Windows* OS) %cat main.c • Compile without Pointer Check

  10. Slide 10: Using Pointer Checker - Checking For Dangling Pointers

    Using Pointer Checker - Checking For Dangling Pointers • Check for dangling pointers in stack and heap -check-pointers-dangling=[none | heap | stack | all] (Linux* OS) /Qcheck-pointers-dangling:[none | heap | stack | all] (Windows* OS) • When enabled: – Compiler uses a wrapper for the C runtime func

  11. Slide 11: Using Pointer Checker - Checking Arrays

    Using Pointer Checker - Checking Arrays • Pointer checker checks arrays in modules that actually define the arrays with bounds • For checking of bounds for arrays without dimensions: -[no-]check-pointers-undimensioned (Linux* OS) /Qcheck-pointers-undimensioned[-] (Windows* OS) %cat arr.c % icc -DREP

  12. Slide 12: Using Pointer Checker - Intrinsics

    Using Pointer Checker - Intrinsics • Defined in header file <chkp.h> • Ideal for: – Writing your own wrappers for Run-Time Library (RTL) functions – Working with enabled and non-enabled Modules – Checking and creating correct bounds for Custom Memory Allocators – &c For example (setting exact bounds

  13. Slide 13: Working with Enabled and Non-Enabled Modules

    Using Pointer Checker – Working with Enabled and Non-Enabled Modules • With non-enabled code writes or returns, false positives occur in enabled code, as bounds aren’t set correctly – Pointer Checker mitigates this for nearly all cases by checking the stored pointer against a copy of the pointer sto

  14. Slide 14: Using Pointer Checker – Checking RTL Functions

    Using Pointer Checker – Checking RTL Functions • Run-Time Library (RTL) routines dealing with pointers need to be encapsulated or replaced so returned pointers have proper descriptors, and usage of pointers within the RTL routine are checked correctly. • Pointer Checker provides checking on RTL func

  15. Slide 15: Finding and Reporting Out-of-Bounds Errors

    Using Pointer Checker – Finding and Reporting Out-of-Bounds Errors • Reporting controlled through: o __chkp_report_option_t enumeration o __chkp_report_control() library function Enum Value Action __CHKP_REPORT_NONE Do nothing. __CHKP_REPORT_BPT Execute a breakpoint interrupt. __CHKP_REPORT_LOG Log

  16. Slide 16: Using Pointer Checker – Guidelines

    Using Pointer Checker – Guidelines • Use Debug Configuration when using Pointer Checker for testing and debugging, so symbols are visible for better trace-back functionality. Use –rdynamic linker option when compiling on Linux*. • Compile to make bounds error occur near bad pointer generation. Compi

  17. Slide 17: Pointer Checker - Performance Overhead

    Pointer Checker - Performance Overhead • Runtime cost is high, about 2X to 5X execution time effect. • Code size increase from 20% to a very large increase (>100% plus), depending on the application. • Pointer Checker is seen as a debug tool. • Deployed applications are expected to have Pointer Chec

  18. Slide 18: Summary

    Summary • Pointer Checker is a key feature of Intel® C++ Composer XE 2013. • Pointer Checker is designed for use during application debugging and testing. • Point Checker provides full checking of all memory accesses through pointers. • A Pointer Checker enabled application will catch any out-of-bou

  19. Slide 19: Software & Services Group Developer Products Division

    Software & Services Group Developer Products Division Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 19

  20. Slide 20: Optimization Notice

    Optimization Notice Optimization Notice Intel’s compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does no

  21. Slide 21: Legal Disclaimer

    Legal Disclaimer INFORMATION IN THIS DOCUMENT IS PROVIDED “AS IS”. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO THIS IN

  22. Slide 22: Resources & Links

    Resources & Links • Intel® Compilers product website: http://www.intel.com/software/products/compilers • Active User Forum: http://software.intel.com/en-us/forums/ • Software Development Products Knowledge Base http://software.intel.com/en-us/articles/tools/ • To evaluate Intel® Software Development

Intel — Technical Presentation (May 2012) on 6ix