Courses/Computer Science/CPSC 457.W2012/Lecture Notes/KernMem

From wiki.ucalgary.ca
< Courses‎ | Computer Science‎ | CPSC 457.W2012‎ | Lecture Notes
Revision as of 21:51, 27 March 2012 by Locasto (talk | contribs) (Notes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Kernel Memory Management

The term "memory" is an overloaded one, and concepts like virtual memory conflate the notion of disk storage and main memory; in turn, caching file content in memory can make these concepts even more of a muddle.

In this session, we will take a step back and consider how the Linux kernel handles different memory management tasks, including:

  • supporting virtual memory (caching memory pages, caching files in memory)
  • managing its own memory allocation needs
  • managing the data structures for memory pages on behalf of userlevel tasks

Notes

The slides for today.

The struct page structure for holding metadata about physical page frames (and metadata used by the SLUB allocator).

Code for demonstrating compiler-declared size of userland structures and how malloc operates by exploring the data "around" a returned pointer.

A program called break that invokes mmap to try to allocate a single byte.

Sample output for the break program (see what it actually does to the processes memory regions list).

Excellent article on kernel memory exploitation with an overview of the three allocators:

http://census-labs.com/news/2012/01/03/linux-kernel-heap-exploitation/

Links from above article on various related topics:

More on kernel exploitation:

Reading

  • ULK, Chapter 15 (optional)