Protecting Memory Pages for Underflow Detection
?
?
W, K, P / S, J, N Jump to previous / next marker
t / T Toggle theatre / SUPERtheatre mode
z Toggle filter mode V Revert filter to original state
X, ShiftSpace Toggle category and focus previous
v Invert topics / media as per focus
Keyboard Navigation
Global Keys
[, < / ], > Jump to previous / next episodeW, K, P / S, J, N Jump to previous / next marker
t / T Toggle theatre / SUPERtheatre mode
z Toggle filter mode V Revert filter to original state
Menu toggling
q Quotes r References f Filter c CreditsIn-Menu Movement
a
w
s
s
d
h
j
k
l
←
↑
↓
↓
→
Quotes and References Menus
Enter Jump to timecodeQuotes, References and Credits Menus
o Open URL (in new tab)Filter Menu
x, Space Toggle category and focus nextX, ShiftSpace Toggle category and focus previous
v Invert topics / media as per focus
Credits Menu
Enter Open URL (in new tab)⏫
Previous: 'Selective Memory Restoration'
⏫
0:01Recap and set the stage for the day
0:01Recap and set the stage for the day
0:01Recap and set the stage for the day
1:16Blackboard: Buffer Overruns
1:16Blackboard: Buffer Overruns
1:16Blackboard: Buffer Overruns
2:47Blackboard: VirtualAlloc() and virtual memory mapping
2:47Blackboard: VirtualAlloc() and virtual memory mapping
2:47Blackboard: VirtualAlloc() and virtual memory mapping
6:23Blackboard: Playing with how this memory works
6:23Blackboard: Playing with how this memory works
6:23Blackboard: Playing with how this memory works
8:23Blackboard: Guard Page with VirtualProtect()
8:23Blackboard: Guard Page with VirtualProtect()
8:23Blackboard: Guard Page with VirtualProtect()
9:38Blackboard: Faulting at the smallest error
9:38Blackboard: Faulting at the smallest error
9:38Blackboard: Faulting at the smallest error
13:29handmade_platform.h: Add PlatformMemory_OverflowCheck and PlatformMemory_UnderflowCheck flags
13:29handmade_platform.h: Add PlatformMemory_OverflowCheck and PlatformMemory_UnderflowCheck flags
13:29handmade_platform.h: Add PlatformMemory_OverflowCheck and PlatformMemory_UnderflowCheck flags
14:51handmade_memory.h: Enable PushSize_() to perform bounds checking by passing every allocation down to the system every time
14:51handmade_memory.h: Enable PushSize_() to perform bounds checking by passing every allocation down to the system every time
14:51handmade_memory.h: Enable PushSize_() to perform bounds checking by passing every allocation down to the system every time
17:26Run the game and see nothing in particular happen
17:26Run the game and see nothing in particular happen
17:26Run the game and see nothing in particular happen
17:37handmade_memory.h: Make PushSize_() set the OverflowCheck flag on everything, run the game and grind to a halt
17:37handmade_memory.h: Make PushSize_() set the OverflowCheck flag on everything, run the game and grind to a halt
17:37handmade_memory.h: Make PushSize_() set the OverflowCheck flag on everything, run the game and grind to a halt
19:24"You're an operating system. Have some self-respect"α
19:24"You're an operating system. Have some self-respect"α
19:24"You're an operating system. Have some self-respect"α
19:51"It's 2016, and all you have to do to kill Windows is just allocate some memory"β
19:51"It's 2016, and all you have to do to kill Windows is just allocate some memory"β
19:51"It's 2016, and all you have to do to kill Windows is just allocate some memory"β
20:35Return with the determination to provide a way to free our memory
20:35Return with the determination to provide a way to free our memory
20:35Return with the determination to provide a way to free our memory
21:48handmade_memory.h: Change PushSize_() to ensure arenas only keep the exact size they need
21:48handmade_memory.h: Change PushSize_() to ensure arenas only keep the exact size they need
21:48handmade_memory.h: Change PushSize_() to ensure arenas only keep the exact size they need
23:44Run the game to give that a shot
23:44Run the game to give that a shot
23:44Run the game to give that a shot
24:32handmade_memory.h: Rename memory_block_footer to memory_block_chain
24:32handmade_memory.h: Rename memory_block_footer to memory_block_chain
24:32handmade_memory.h: Rename memory_block_footer to memory_block_chain
27:02Blackboard: Positioning that memprotect in order to catch underflows
27:02Blackboard: Positioning that memprotect in order to catch underflows
27:02Blackboard: Positioning that memprotect in order to catch underflows
27:26win32_handmade.cpp: Make PLATFORM_ALLOCATE_MEMORY() allocate one blank 4K page at the beginning
27:26win32_handmade.cpp: Make PLATFORM_ALLOCATE_MEMORY() allocate one blank 4K page at the beginning
27:26win32_handmade.cpp: Make PLATFORM_ALLOCATE_MEMORY() allocate one blank 4K page at the beginning
30:13handmade_memory.h: Consider unifying the arena and allocator's data structures
30:13handmade_memory.h: Consider unifying the arena and allocator's data structures
30:13handmade_memory.h: Consider unifying the arena and allocator's data structures
31:40win32_handmade.cpp: Make PLATFORM_ALLOCATE_MEMORY() allocate
31:40win32_handmade.cpp: Make PLATFORM_ALLOCATE_MEMORY() allocate
31:40win32_handmade.cpp: Make PLATFORM_ALLOCATE_MEMORY() allocate
32:34Run the game to see it run exactly the same
32:34Run the game to see it run exactly the same
32:34Run the game to see it run exactly the same
32:45win32_handmade.cpp: Make PLATFORM_ALLOCATE_MEMORY() call VirtualProtect()1,2
32:45win32_handmade.cpp: Make PLATFORM_ALLOCATE_MEMORY() call VirtualProtect()1,2
32:45win32_handmade.cpp: Make PLATFORM_ALLOCATE_MEMORY() call VirtualProtect()1,2
37:03Blackboard: What actually happens with the guard page
37:03Blackboard: What actually happens with the guard page
37:03Blackboard: What actually happens with the guard page
39:00win32_handmade.cpp: Pass PAGE_NOACCESS to that VirtualProtect() call
39:00win32_handmade.cpp: Pass PAGE_NOACCESS to that VirtualProtect() call
39:00win32_handmade.cpp: Pass PAGE_NOACCESS to that VirtualProtect() call
39:38win32_handmade.cpp: Verify that the guard pages are happening properly
39:38win32_handmade.cpp: Verify that the guard pages are happening properly
39:38win32_handmade.cpp: Verify that the guard pages are happening properly
40:11Run the game with the expectation to crash and investigate why we don't
40:11Run the game with the expectation to crash and investigate why we don't
40:11Run the game with the expectation to crash and investigate why we don't
40:38handmade_memory.h: Make PushSize_() set the UnderflowCheck flag, run the game and successfully crash
40:38handmade_memory.h: Make PushSize_() set the UnderflowCheck flag, run the game and successfully crash
40:38handmade_memory.h: Make PushSize_() set the UnderflowCheck flag, run the game and successfully crash
41:28win32_handmade.cpp: Enable PLATFORM_ALLOCATE_MEMORY() to perform underflow checking
41:28win32_handmade.cpp: Enable PLATFORM_ALLOCATE_MEMORY() to perform underflow checking
41:28win32_handmade.cpp: Enable PLATFORM_ALLOCATE_MEMORY() to perform underflow checking
47:02win32_handmade.cpp: Enable PLATFORM_DEALLOCATE_MEMORY() to handle the checking
47:02win32_handmade.cpp: Enable PLATFORM_DEALLOCATE_MEMORY() to handle the checking
47:02win32_handmade.cpp: Enable PLATFORM_DEALLOCATE_MEMORY() to handle the checking
51:06handmade_world.cpp: Make GetWorldChunk() write off the beginning of the buffer, run the game and see nothing being detected
51:06handmade_world.cpp: Make GetWorldChunk() write off the beginning of the buffer, run the game and see nothing being detected
51:06handmade_world.cpp: Make GetWorldChunk() write off the beginning of the buffer, run the game and see nothing being detected
51:57handmade_memory.cpp: Toggle on the underflow checking in PushSize_(), run the game and immediately catch that offending write
51:57handmade_memory.cpp: Toggle on the underflow checking in PushSize_(), run the game and immediately catch that offending write
51:57handmade_memory.cpp: Toggle on the underflow checking in PushSize_(), run the game and immediately catch that offending write
52:49handmade_world.cpp: Make GetWorldChunk() write off the end of the buffer, run the game and see nothing being detected
52:49handmade_world.cpp: Make GetWorldChunk() write off the end of the buffer, run the game and see nothing being detected
52:49handmade_world.cpp: Make GetWorldChunk() write off the end of the buffer, run the game and see nothing being detected
53:34handmade_memory.cpp: Determine to enable PushSize_() to perform overflow checking
53:34handmade_memory.cpp: Determine to enable PushSize_() to perform overflow checking
53:34handmade_memory.cpp: Determine to enable PushSize_() to perform overflow checking
55:16todo.txt: Update the TODO list
55:16todo.txt: Update the TODO list
55:16todo.txt: Update the TODO list
55:39Q&A
🗩
55:39Q&A
🗩
55:39Q&A
🗩
1:09:22Wrap it up
🗩
1:09:22Wrap it up
🗩
1:09:22Wrap it up
🗩
⏬
Next: 'Consolidating Memory Block Headers'
⏬