C for Linux

          Session 3

BY:
      Eng.Ahmed Teirelbar
        Software Engineer
        Shuja' Consulting
gdb Basics
    -g
●


    In execution
●


         run
    ●


         continue
    ●


         step
    ●



         ...
Pointer Concepts

    An array is a pointer to the first element
●


    Pointer subscript access
●


    Scope issues – B...
Pointers
    SEGV
●


    Memory overwrites – “but it worked before!!!”
●


    null termination issues
●


    Core dump
●
Debugging and Detection
    More gdb
●


        dumping memory
    ●


        Casting
    ●


        Watchpoints
    ●
...
Allocation and Memory
    The Heap data structure
●



    Back to the process picture
●



    Very brief overview of sys...
Memory Leaks
    What is it?
●


    Why do we care? what is the OOM killer?
●


    Detection
●


        Your own code, ...
Structures/Unions in Memory
    Alignment
●


        Sizeof struct, union, pointer
    ●



    Casting
●


    Traversal...
Functions & the Stack
    Overview
●


        Base offset/Frame pointer
    ●



        RET
    ●



        Local varia...
The Infamous Stack Overflow Attack

    Overview of Concept
●


    How it works?
●


        The vulnerability
    ●


  ...
Structures w/Functions:
                     Data Abstraction
    Higher level of operation
●


        Object and Interfa...
Data Abstraction Cont'd
    Data Hiding
●


        Extension of type
    ●



        Type-level behavioral changes (deco...
Upcoming SlideShare
Loading in...5
×

sysprog3 Part2

535

Published on

second part of the third session in phase I of system programming sessions in eglug

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
535
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
18
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

sysprog3 Part2

  1. 1. C for Linux Session 3 BY: Eng.Ahmed Teirelbar Software Engineer Shuja' Consulting
  2. 2. gdb Basics -g ● In execution ● run ● continue ● step ● breakpoint ● variables ● directives ● execute code ●
  3. 3. Pointer Concepts An array is a pointer to the first element ● Pointer subscript access ● Scope issues – Back to the stack picture ● NULL pointer ●
  4. 4. Pointers SEGV ● Memory overwrites – “but it worked before!!!” ● null termination issues ● Core dump ●
  5. 5. Debugging and Detection More gdb ● dumping memory ● Casting ● Watchpoints ● Detection ● Sanity checks ● Macros with sizeof ● Magic numbers in Structures ●
  6. 6. Allocation and Memory The Heap data structure ● Back to the process picture ● Very brief overview of system memory allocation ● brk() ● Granularity & page size ● Allocation algorithms ● Block data ● Alignment ● Swapping ●
  7. 7. Memory Leaks What is it? ● Why do we care? what is the OOM killer? ● Detection ● Your own code, macros ● top and /proc/meminfo ● Valgrind and profiling ● http://valgrind.org/ ● http://www.advancedlinuxprogramming.com/ (Appendix A.2) ●
  8. 8. Structures/Unions in Memory Alignment ● Sizeof struct, union, pointer ● Casting ● Traversals of pointers ●
  9. 9. Functions & the Stack Overview ● Base offset/Frame pointer ● RET ● Local variables ● objdump ● gdb & stack trace ● where ● up/down ● Huge for core dumps ● Recursion & your stack ●
  10. 10. The Infamous Stack Overflow Attack Overview of Concept ● How it works? ● The vulnerability ● Integrate the whole stack picture ● How you place the exploiting code –high level ● How do you protect against it? ● Heap overflow ●
  11. 11. Structures w/Functions: Data Abstraction Higher level of operation ● Object and Interface ● Modularity of a defined interface ● Easier implementation per piece ● Unit test ● Module-level behavioral Changes ●
  12. 12. Data Abstraction Cont'd Data Hiding ● Extension of type ● Type-level behavioral changes (decoupling) ● Can be taken too far – be sensible ●
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×