CS208, Monday 28 Feb 2022
Buffer overflow assignment
- What happens to rsp and the contents of the stack when "call" gets executed?
- Same question, but for ret
- Key idea for this assignment: use ret's behavior to mess with what gets executed and when
- Von Neumann architecture: instructions and data in the same place
- What is this hex2raw thing about?
- Will you need to understand machine language?
- Phases 2 and 3 depend on some common defenses (enabled by default) being disabled when compiling ctarget.
- Love this and want even more? Check out the "rtarget" portion of this assignment as assigned by Aaron Bauer last term
Paged virtual memory basics
- virtual pages
- page number, page starting address, and byte offset
- physical pages
- address translation
- loading instructions into the CPU
- accessing memory like "movq 0x08(%rsp), %rax"
- simple page table
- (notational digression: mega vs. mebi, bytes vs. Hertz, common sloppy usage, and people's desire not to sound goofy by saying "kibi" and "gibi" out loud)
Practice
- Pretend
- pages have size 4KiB
- we have 64-bit addresses
- we have 16GiB of physical memory
- What is the starting virtual address of page 6 (i.e. the 7th page)?
- Suppose virtual page 6 is stored at physical page 0xabcd3. What is the virtual address of the 9th byte on the page? What is the physical address of that same byte?
- In general, how do you translate between a virtual address and a physical address?
- How big would a page table have to be?
Page tables
- What does the Linux page table look like?
- Mu
Why bother?
- efficient use of resources
- load a page only when you need it
- fast context switching (i.e. scheduling a new process)
- ...
- security
- different processes access different pages
- mark pages read-only
- ...
- simplified compiling/linking/loading