CS208 Introduction to Computer Systems Monday, 27 Feb 2023 + Are you buffers overflowing? Any questions? + How might we thwart buffer overflow attacks? - [OS developers, compiler developers, instruction set designers] Suppose the OS places the program's instructions in a different place every time it executes. Then ctarget.phase1's contents need to change to...a random number? - [Application programmers] Check the bounds of the input buffer and don't allow overflow. (e.g., use strncpy instead of strcpy) - [OS, chip, instruction set designers] Make all return addresses read-only. Or.. Don't allow instructions stored in the stack to be executed - [Programming language designers] Don't allow out-of-range indexing of arrays. Java, Python, Rust,... Slower === + Next - One more programming assignment (threads) - Takehome final - handed out Mon, Mar 6 - due Wed, Mar 15 - predictable topics: floating point representation; threads; network programming ==== + Scheduler reminder - CPU interrupts - Atomic operations - Disabling/enabling interrupts "pre-emptive multi-tasking" + What does "lock shared memory" look like? process A wants to check and manipulate SharedThing A: if lock on SharedThing is locked <--- needs to be go to sleep <--- atomic else: lock the lock <--- this one too! use SharedThing unlock the lock <--- me too! also, this needs to wake up a sleeper continue about business + How does a pipe work? - What does a pipe consist of? - Reading, writing, races - How to fix? + Threads