Skip to content

Commit e367cac

Browse files
committed
sb: notes
1 parent 371c82c commit e367cac

9 files changed

Lines changed: 50 additions & 17 deletions
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[[operating system]]
2+
# Address Space Layout Randomization
3+
- Randomizing memory addresses so attackers can't reliably predict memory addresses they need to target to exploit it

β€Ždata/second-brain/CS Primer - Operating systems.mdβ€Ž

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,39 @@
2828
- System call transfers control into the OS while raising the hardware privilege level
2929
- User apps run in "user mode"
3030
- Hardware restricts what apps can do
31-
32-
## CPU Timing
31+
### Stack Overflow
32+
- Stack is a memory region allocated by the OS
33+
- Overflowing it, you try to write to memory _outside_ the region where you don't have permission
34+
- OS raises a segfault due to the illegal memory address
35+
- It doesn't know what the cause of the segfault is which is why you don't get an actual stack overflow error
36+
- Historically the heap was started at low addresses, stack at high addresses
37+
- The big gap in the middle maximized the space available before collision
38+
- Doesn't matter anymore thanks to enormous virtual address space
39+
- What contributes to the size of a stack frame?
40+
- Data
41+
- Return address
42+
- Rounding up to alignment boundaries
43+
- Usually 16 bytes on modern systems
44+
- Helps with performance
45+
- You can't map all the virtual address space to actual hardware
46+
- [[Address Space Layout Randomization]]
47+
- Programs can request an increase to their stack limit with `setrlimit`
48+
- You can raise your soft limit up to the hard limit but only root can raise hard limits
49+
- `getrlimit` to check limits
50+
- Threads get their own stack to avoid collissions
51+
- `vmmap`
52+
- Virtual size --> how much address space is reserved for the stack
53+
- Resident size --> how much physical RAM is being used
54+
- Demand paging
55+
- Declaring an array doesn't allocate physical RAM, you have to write to the memory
56+
- OS maps physical memory when you touch it
57+
## Byte write
58+
- File systems don't track individual bytes on disk
59+
- Space is allocated in fixed-size chunks (blocks)
60+
- Blocks are usually 4096 bytes (4 KiB)
61+
- Writing 1 byte still gets a 4 KiB block
62+
- Larger blocks === less bookkeeping overhead but more wasted space
63+
- `/dev/urandom` is an interface to the kernel's random number generator
64+
- File descriptor is a "handle" to an open file
65+
- More efficient for accessing a file (open once)
66+
- Keeps state (position tracking, etc.)

β€Ždata/second-brain/Comic Reading List.mdβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
- Exquisite Corpses #5
2525
- Falling in Love on the Path to Hell #10
2626
- Frieren vol 12
27+
- Harley and Ivy #1
2728
- Imperial #1
2829
- It Killed Everyone But Me #1
2930
- Kaya #11

β€Ždata/second-brain/Introduction to Ancient Greek History.mdβ€Ž

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
- Hoplite phalanx
111111
- "Shield roller" (rough etymology)
112112
- Core infantry in a solid block
113-
- Changed society because men started fighting together (no mo heroes) and started demanding equal politic rights
113+
- Changed society because men started fighting together (no more heroes) and started demanding equal politic rights
114114
- Heavy armour
115115
- Only citizens who can afford the equipment can fight
116116
- Shield design protects the man to the left, strong together
@@ -120,5 +120,4 @@
120120
- Fighting for their city
121121
- The honour code has moved from the individual to the whole (polis)
122122
- Colonization begins due to a need for new farmland
123-
- Colonization allowed Greeks to start learning/adopting more from other civilizations
124-
-
123+
- Colonization allowed Greeks to start learning/adopting more from other civilizations
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1+
[[Computer Science]]
12
# Call Stack
2-
33
- Used to keep track of function calls during program execution
4-
- Stores all the variables required for the function
4+
- Stores all the variables required for the function
55
- A [[stack]] [[data structure]]
66

7-
[[Computer Science]]
8-
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[[computer science]]
2+
# Data structure
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
[[philosopher]]
12
# Derek Parfit
2-
3+
- Specialized in personal identity, [[rationality]], and [[ethics]]

β€Ždata/second-brain/e-ubc.mdβ€Ž

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[[philosophy]]
2+
# Rationality

0 commit comments

Comments
Β (0)