Skip to content

Commit 112f328

Browse files
committed
chp 4: grammar fixes
1 parent f191239 commit 112f328

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/chp4/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ But after finishing the chapter, maybe you'll start viewing memory primarily thr
142142
* Develop a mental model of memory safety, type safety, and binary exploitation
143143
* Learn to debug Rust code using Mozilla `rr`[^RR] (an enhanced variant of `gdb`[^GDB])
144144
* Understand how attackers exploit heap memory corruption bugs, step-by-step
145-
* Write your first an introductory exploit or two, bypassing modern protections!
145+
* Write an introductory exploit or two, bypassing modern protections!
146146
* Understand how Rust actually provides memory safety, including current limitations
147147
* Understand how modern, language-agnostic exploit mitigations work (and how they can fail)
148148

src/chp4/assure_stack_1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Lets visualize how a code snippet uses the stack, to make the push/pop discussio
7575

7676
* We're interested in how this program uses stack memory at runtime, adding the attribute `#[inline(never)]` to ensure the compiler allocates a stack frame each time either `recursive_count_down` or `square` is called.
7777

78-
* "Inlining" is an opportunistic compiler optimization can avoids function call overhead, including stack frame allocation and caller-register preservation [^Inlining]. It's not always applicable and as programmer we don't directly decide where it is. So forgoing it is a realistic case to prepare for.
78+
* "Inlining" is an opportunistic compiler optimization that avoids function call overhead, including stack frame allocation and caller-register preservation [^Inlining]. It's not always applicable and as programmer we don't directly decide where it is. So forgoing it is a realistic case to prepare for.
7979

8080
If run with `cargo run -- 2`, this program outputs:
8181

src/chp4/attack_1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Be it C, C++, or `unsafe` Rust.
8080

8181
For a more concrete discussion of memory and type safety, we'll examine three C snippets and visualize the violations therein. Note:
8282

83-
* None of the three snippets are, to the best our knowledge, *exploitable*. These small programs break safety, but not in manner unfortunate enough to enable a break of data-code isolation.
83+
* None of the three snippets are, to the best our knowledge, *exploitable*. These small programs break safety, but not in amanner unfortunate enough to enable a break of data-code isolation.
8484

8585
This distinction is intensional.
8686
We're starting by learning to identify bugs, even if innocuous.

src/chp4/sw_stack_1.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Both topics are the subjects of entire technical books, so we'll visually diagra
6969
</p>
7070

7171
Main memory, a physical machine's Random Access Memory (RAM), supports all non-trivial runtime computation.
72-
The bit-patterns it stores and operates on representations two distinct items:
72+
The bit-patterns it stores and operates on represent two distinct items:
7373

7474
* **Data** - Variable-length sequences of bytes representing any information: hardcoded strings, colors codes, numbers, entire image and video files, etc. Each byte can be addressed individually, even if word-aligned accesses are often preferable for performance.
7575

@@ -114,7 +114,7 @@ Fortunately, we don't have to consider or understand such minutia when programmi
114114
The jobs of various registers are, by contrast, important for a working mental model.
115115
In addition to the IP, the two special purpose registers worth noting are:
116116

117-
* The **Stack Pointer (`SP`)** register - the address denoting the bottom of the current stack frame. A stack frame is akin to function's in-RAM "notepad" for computing and saving *function-local* results.
117+
* The **Stack Pointer (`SP`)** register - the address denoting the bottom of the current stack frame. A stack frame is akin to a function's in-RAM "notepad" for computing and saving *function-local* results.
118118

119119
* In the statement `let x = 3 + 6;`, `x` will be computed using registers, then the value `9` will be stored on the stack[^RegisterAlloc]. This allows the CPU to re-use its small, fixed set of `GP*` registers for new computations when multiple functions are called in a program.
120120

@@ -185,7 +185,7 @@ It's important you commit it to memory, pun intended.
185185
> The kernel runs in "ring 0", the most privileged mode available.
186186
> It can read/write from/to any processes's memory, directly access hardware, and control special CPU features.
187187
>
188-
> Rings 2 and 3 are almost never used in practice[^RingProt].
188+
> Rings 1 and 2 are almost never used in practice[^RingProt].
189189
> These modes were intended for device drivers, special programs that allow a kernel to communicate with vendor-specific hardware.
190190
> In reality most device drivers are loaded directly into the kernel, running alongside it in ring 0 (creating a major OS attack surface[^MSKernBlocklist]).
191191
>

0 commit comments

Comments
 (0)